You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/08/23 01:20:18 UTC
[GitHub] [spark] dgd-contributor opened a new pull request #33805: [SPARK-36302][SQL] :Refactor thirteenth set of 20 query execution errors to use error classes
dgd-contributor opened a new pull request #33805:
URL: https://github.com/apache/spark/pull/33805
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->Adds error classes to some of the exceptions in QueryExecutionErrors.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->Improves auditing for developers and adds useful fields for users (error class and SQLSTATE).
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->Fills in missing error class and SQLSTATE fields.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->Existing tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] karenfeng commented on a change in pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
karenfeng commented on a change in pull request #33805:
URL: https://github.com/apache/spark/pull/33805#discussion_r717197730
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,4 +1,8 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
Review comment:
0A000 may be a better fit for these unsupported-type errors
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -14,13 +18,25 @@
"CANNOT_EVALUATE_EXPRESSION" : {
"message" : [ "Cannot evaluate expression: %s" ]
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE" : {
Review comment:
We can simplify this: `CANNOT_FETCH_TABLES_OF_DATABASE` -> `CANNOT_FETCH DATABASE_TABLES`
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -14,13 +18,25 @@
"CANNOT_EVALUATE_EXPRESSION" : {
"message" : [ "Cannot evaluate expression: %s" ]
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE" : {
+ "message" : [ "Unable to fetch tables of db %s" ],
+ "sqlState" : "42000"
Review comment:
This seems to be a catch-all type exception. I wouldn't group this as a syntax/semantic error (42000); maybe we can leave the SQLSTATE field empty.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -92,6 +131,17 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\" directory and you likely need to move it before restarting this query.", "Earlier version of Spark incorrectly escaped paths when writing out the \"_spark_metadata\" directory for structured streaming.", "While this was corrected in Spark 3.0, it appears that your query was started using an earlier version that incorrectly handled the \"_spark_metadata\" path.", "Correct \"_spark_metadata\" Directory: %s. Incorrect \"_spark_metadata\" Directory: %s", "Please move the data from the incorrect directory to the correct one, delete the incorrect directory, and then restart this query.", "If you believe you are receiving this message in error, you can disable it with the SQL conf %s." ]
+ },
+ "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND" : {
Review comment:
DEF -> DEFINITION
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -31,10 +47,18 @@
"CONCURRENT_QUERY" : {
"message" : [ "Another instance of this query was just started by a concurrent session." ]
},
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE" : {
Review comment:
CONVERT_HIVE_TABLE_TO_CATALOG_TABLE does not capture the error here; CANNOT_CONVERT_HIVE_TABLE_TO_CATALOG_TABLE would better encompass it
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -46,9 +70,20 @@
"message" : [ "Failed to rename %s to %s as destination already exists" ],
"sqlState" : "22023"
},
+ "FAILED_RENAME_TEMP_FILE" : {
Review comment:
TEMP -> TEMPORARY
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -31,10 +47,18 @@
"CONCURRENT_QUERY" : {
"message" : [ "Another instance of this query was just started by a concurrent session." ]
},
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE" : {
+ "message" : [ "%s, db: %s, table: %s" ],
+ "sqlState" : "0A000"
Review comment:
This isn't an unsupported operation issue; I'd leave this empty
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -149,6 +214,9 @@
"message" : [ "Unsupported data type %s" ],
"sqlState" : "0A000"
},
+ "UNSUPPORTED_HIVE_METASTORE_VERSION" : {
+ "message" : [ "Unsupported Hive Metastore version (%s). Please set %s with a valid version." ]
Review comment:
I think this is a 0A000 SQLSTATE.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -92,6 +131,17 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\" directory and you likely need to move it before restarting this query.", "Earlier version of Spark incorrectly escaped paths when writing out the \"_spark_metadata\" directory for structured streaming.", "While this was corrected in Spark 3.0, it appears that your query was started using an earlier version that incorrectly handled the \"_spark_metadata\" path.", "Correct \"_spark_metadata\" Directory: %s. Incorrect \"_spark_metadata\" Directory: %s", "Please move the data from the incorrect directory to the correct one, delete the incorrect directory, and then restart this query.", "If you believe you are receiving this message in error, you can disable it with the SQL conf %s." ]
+ },
+ "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND" : {
+ "message" : [ "%s when creating Hive client using classpath: %s", "Please make sure that jars for your version of hive and hadoop are included in the paths passed to %s." ],
+ "sqlState" : "42000"
Review comment:
I'm not sure if this is syntax/semantic error either. I'd remove this.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -118,10 +168,18 @@
"message" : [ "PARTITION clause cannot contain a non-partition column name: %s" ],
"sqlState" : "42000"
},
+ "PARTITION_COLUMN_NOT_FOUND_IN_SCHEMA" : {
Review comment:
Rename to match `MISSING_COLUMN`: `MISSING_PARTITION_COLUMN`
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -46,9 +70,20 @@
"message" : [ "Failed to rename %s to %s as destination already exists" ],
"sqlState" : "22023"
},
+ "FAILED_RENAME_TEMP_FILE" : {
+ "message" : [ "Failed to rename temp file %s to %s as rename returned false" ],
+ "sqlState" : "42000"
Review comment:
This isn't necessarily a syntax error. I don't have a good idea for which SQLSTATE this should be though. I'd leave this empty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] Peng-Lei commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
Peng-Lei commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-903483207
Please see [#PR](https://github.com/apache/spark/pull/33573). I try to define the new exception to mix SparkThrowable into a base Exception type. It can help us reduce conflicts in parallel development
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dgd-contributor commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
dgd-contributor commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-926389935
CC @karenfeng. Could you take another look when you have time ? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dgd-contributor commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
dgd-contributor commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-929023756
Thanks for your suggestion, @karenfeng, I have updated this PR. Please take another look when you have time, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dgd-contributor commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
dgd-contributor commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-933096547
Thanks for all your suggestions in recent our PRs, @karenfeng. dgd-contributes is a team, so it may be inconvenient for you when you help a member to resolve this problem and other members don't know anything about it. You can see the same problem in another PR so we are sorry about it. Now, a member of dgd team will work on all issues involved in refactoring query execution errors to use error classes. We will close all recent PR and a member will make PRs for those issues, so when you have time, please help us again.
If you get uncomfortable when helping us, we are sorry again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-903381086
Can one of the admins verify this patch?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] karenfeng commented on a change in pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
karenfeng commented on a change in pull request #33805:
URL: https://github.com/apache/spark/pull/33805#discussion_r719684804
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -46,9 +68,19 @@
"message" : [ "Failed to rename %s to %s as destination already exists" ],
"sqlState" : "22023"
},
+ "FAILED_RENAME_TEMPORARY_FILE" : {
+ "message" : [ "Failed to rename temp file %s to %s as rename returned false" ]
+ },
"FAILED_SET_ORIGINAL_PERMISSION_BACK" : {
"message" : [ "Failed to set original permission %s back to the created path: %s. Exception: %s" ]
},
+ "GET_PARTITION_METADATA_BY_FILTER" : {
Review comment:
The naming of this isn't obviously an error. Can we name this something like `CANNOT_GET_PARTITION_METADATA_BY_FILTER`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] karenfeng commented on a change in pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
karenfeng commented on a change in pull request #33805:
URL: https://github.com/apache/spark/pull/33805#discussion_r717197730
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,4 +1,8 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
Review comment:
0A000 may be a better fit for these unsupported-type errors
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -14,13 +18,25 @@
"CANNOT_EVALUATE_EXPRESSION" : {
"message" : [ "Cannot evaluate expression: %s" ]
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE" : {
Review comment:
We can simplify this: `CANNOT_FETCH_TABLES_OF_DATABASE` -> `CANNOT_FETCH DATABASE_TABLES`
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -14,13 +18,25 @@
"CANNOT_EVALUATE_EXPRESSION" : {
"message" : [ "Cannot evaluate expression: %s" ]
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE" : {
+ "message" : [ "Unable to fetch tables of db %s" ],
+ "sqlState" : "42000"
Review comment:
This seems to be a catch-all type exception. I wouldn't group this as a syntax/semantic error (42000); maybe we can leave the SQLSTATE field empty.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -92,6 +131,17 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\" directory and you likely need to move it before restarting this query.", "Earlier version of Spark incorrectly escaped paths when writing out the \"_spark_metadata\" directory for structured streaming.", "While this was corrected in Spark 3.0, it appears that your query was started using an earlier version that incorrectly handled the \"_spark_metadata\" path.", "Correct \"_spark_metadata\" Directory: %s. Incorrect \"_spark_metadata\" Directory: %s", "Please move the data from the incorrect directory to the correct one, delete the incorrect directory, and then restart this query.", "If you believe you are receiving this message in error, you can disable it with the SQL conf %s." ]
+ },
+ "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND" : {
Review comment:
DEF -> DEFINITION
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -31,10 +47,18 @@
"CONCURRENT_QUERY" : {
"message" : [ "Another instance of this query was just started by a concurrent session." ]
},
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE" : {
Review comment:
CONVERT_HIVE_TABLE_TO_CATALOG_TABLE does not capture the error here; CANNOT_CONVERT_HIVE_TABLE_TO_CATALOG_TABLE would better encompass it
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -46,9 +70,20 @@
"message" : [ "Failed to rename %s to %s as destination already exists" ],
"sqlState" : "22023"
},
+ "FAILED_RENAME_TEMP_FILE" : {
Review comment:
TEMP -> TEMPORARY
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -31,10 +47,18 @@
"CONCURRENT_QUERY" : {
"message" : [ "Another instance of this query was just started by a concurrent session." ]
},
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE" : {
+ "message" : [ "%s, db: %s, table: %s" ],
+ "sqlState" : "0A000"
Review comment:
This isn't an unsupported operation issue; I'd leave this empty
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -149,6 +214,9 @@
"message" : [ "Unsupported data type %s" ],
"sqlState" : "0A000"
},
+ "UNSUPPORTED_HIVE_METASTORE_VERSION" : {
+ "message" : [ "Unsupported Hive Metastore version (%s). Please set %s with a valid version." ]
Review comment:
I think this is a 0A000 SQLSTATE.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -92,6 +131,17 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\" directory and you likely need to move it before restarting this query.", "Earlier version of Spark incorrectly escaped paths when writing out the \"_spark_metadata\" directory for structured streaming.", "While this was corrected in Spark 3.0, it appears that your query was started using an earlier version that incorrectly handled the \"_spark_metadata\" path.", "Correct \"_spark_metadata\" Directory: %s. Incorrect \"_spark_metadata\" Directory: %s", "Please move the data from the incorrect directory to the correct one, delete the incorrect directory, and then restart this query.", "If you believe you are receiving this message in error, you can disable it with the SQL conf %s." ]
+ },
+ "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND" : {
+ "message" : [ "%s when creating Hive client using classpath: %s", "Please make sure that jars for your version of hive and hadoop are included in the paths passed to %s." ],
+ "sqlState" : "42000"
Review comment:
I'm not sure if this is syntax/semantic error either. I'd remove this.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -118,10 +168,18 @@
"message" : [ "PARTITION clause cannot contain a non-partition column name: %s" ],
"sqlState" : "42000"
},
+ "PARTITION_COLUMN_NOT_FOUND_IN_SCHEMA" : {
Review comment:
Rename to match `MISSING_COLUMN`: `MISSING_PARTITION_COLUMN`
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -46,9 +70,20 @@
"message" : [ "Failed to rename %s to %s as destination already exists" ],
"sqlState" : "22023"
},
+ "FAILED_RENAME_TEMP_FILE" : {
+ "message" : [ "Failed to rename temp file %s to %s as rename returned false" ],
+ "sqlState" : "42000"
Review comment:
This isn't necessarily a syntax error. I don't have a good idea for which SQLSTATE this should be though. I'd leave this empty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] karenfeng commented on a change in pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
karenfeng commented on a change in pull request #33805:
URL: https://github.com/apache/spark/pull/33805#discussion_r703900552
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,16 +1,50 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR" : {
Review comment:
Given that this is an error class, you can remove the `_ERROR` suffix to reduce redundancy and clutter.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,16 +1,50 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
+ },
"AMBIGUOUS_FIELD_NAME" : {
"message" : [ "Field name %s is ambiguous and has %s matching fields in the struct." ],
"sqlState" : "42000"
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE_ERROR" : {
+ "message" : [ "Unable to fetch tables of db %s" ]
+ },
+ "CANNOT_RECOGNIZE_HIVE_TYPE_ERROR" : {
+ "message" : [ "Cannot recognize hive type string: %s, column: %s" ],
+ "sqlState" : "0D000"
Review comment:
I'm not sure about 0D000; would 42000 be a better fit?
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,16 +1,50 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
+ },
"AMBIGUOUS_FIELD_NAME" : {
"message" : [ "Field name %s is ambiguous and has %s matching fields in the struct." ],
"sqlState" : "42000"
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE_ERROR" : {
+ "message" : [ "Unable to fetch tables of db %s" ]
+ },
+ "CANNOT_RECOGNIZE_HIVE_TYPE_ERROR" : {
+ "message" : [ "Cannot recognize hive type string: %s, column: %s" ],
+ "sqlState" : "0D000"
+ },
+ "CANNOT_SET_TIMEOUT_DURATION_ERROR" : {
+ "message" : [ "Cannot set timeout duration without enabling processing time timeout in [map|flatMap]GroupsWithState" ],
+ "sqlState" : "42000"
+ },
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE_ERROR" : {
+ "message" : [ "%s, db: %s, table: %s" ],
+ "sqlState" : "42000"
+ },
"DIVIDE_BY_ZERO" : {
"message" : [ "divide by zero" ],
"sqlState" : "22012"
},
+ "DROP_TABLE_WITH_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "DROP TABLE ... PURGE" ],
+ "sqlState" : "42000"
+ },
"DUPLICATE_KEY" : {
"message" : [ "Found duplicate keys '%s'" ],
"sqlState" : "23000"
},
+ "FAILED_RENAME_TEMP_FILE_ERROR" : {
+ "message" : [ "Failed to rename temp file %s to %s as rename returned false" ],
+ "sqlState" : "42000"
+ },
+ "GET_PARTITION_METADATA_BY_FILTER_ERROR" : {
+ "message" : [ "Caught Hive MetaException attempting to get partition metadata by filter\nfrom Hive. You can set the Spark configuration setting\n%s to true to work around\nthis problem, however this will result in degraded performance. Please\nreport a bug: https://issues.apache.org/jira/browse/SPARK" ]
Review comment:
I believe this error message is meant to be a single string without any newlines. Given how complex this is, however, we can turn this into an array of strings which will be joined with newlines for the user. In this case, it would look like:
```
"message" : [
"Caught Hive MetaException attempting to get partition metadata by filter from Hive.",
"You can set the Spark configuration setting %s to true to work around this problem, however this will result in degraded performance.",
"Please report a bug: https://issues.apache.org/jira/browse/SPARK" ]
```
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -52,17 +101,44 @@
"message" : [ "PARTITION clause cannot contain a non-partition column name: %s" ],
"sqlState" : "42000"
},
+ "PARTITION_COLUMN_NOT_FOUND_IN_SCHEMA_ERROR" : {
+ "message" : [ "Partition column %s not found in schema %s" ]
+ },
"PIVOT_VALUE_DATA_TYPE_MISMATCH" : {
"message" : [ "Invalid pivot value '%s': value data type %s does not match pivot column data type %s" ],
"sqlState" : "42000"
},
+ "RENAME_AS_EXISTS_PATH_ERROR" : {
+ "message" : [ "Failed to rename as %s already exists" ],
+ "sqlState" : "42000"
+ },
+ "RENAME_PATH_AS_EXISTS_PATH_ERROR" : {
+ "message" : [ "Failed to rename %s to %s as destination already exists" ],
+ "sqlState" : "42000"
+ },
+ "RENAME_SRC_PATH_NOT_FOUND_ERROR" : {
+ "message" : [ "Failed to rename as %s was not found" ],
+ "sqlState" : "42000"
+ },
"SECOND_FUNCTION_ARGUMENT_NOT_INTEGER" : {
"message" : [ "The second argument of '%s' function needs to be an integer." ],
"sqlState" : "22023"
},
+ "SERDE_INTERFACE_NOT_FOUND_ERROR" : {
+ "message" : [ "The SerDe interface removed since Hive 2.3(HIVE-15167). Please migrate your custom SerDes to Hive 2.3. See HIVE-15167 for more details." ],
+ "sqlState" : "42000"
Review comment:
This may be 0A000
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
##########
@@ -1283,126 +1283,145 @@ object QueryExecutionErrors {
}
def serDeInterfaceNotFoundError(e: NoClassDefFoundError): Throwable = {
- new ClassNotFoundException("The SerDe interface removed since Hive 2.3(HIVE-15167)." +
- " Please migrate your custom SerDes to Hive 2.3. See HIVE-15167 for more details.", e)
+ new SparkClassNotFoundException(
+ errorClass = "SERDE_INTERFACE_NOT_FOUND_ERROR",
+ messageParameters = Array.empty, e)
}
def convertHiveTableToCatalogTableError(
e: SparkException, dbName: String, tableName: String): Throwable = {
- new SparkException(s"${e.getMessage}, db: $dbName, table: $tableName", e)
+ new SparkException(
+ errorClass = "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE_ERROR",
+ messageParameters = Array(e.toString, dbName, tableName ), e)
}
def cannotRecognizeHiveTypeError(
e: ParseException, fieldType: String, fieldName: String): Throwable = {
new SparkException(
- s"Cannot recognize hive type string: $fieldType, column: $fieldName", e)
+ errorClass = "CANNOT_RECOGNIZE_HIVE_TYPE_ERROR",
+ messageParameters = Array(fieldType, fieldName), e)
}
def getTablesByTypeUnsupportedByHiveVersionError(): Throwable = {
- new UnsupportedOperationException("Hive 2.2 and lower versions don't support " +
- "getTablesByType. Please use Hive 2.3 or higher version.")
+ new SparkUnsupportedOperationException(
+ errorClass = "GET_TABLES_BY_TYPE_UNSUPPORTED_BY_HIVE_VERSION_ERROR",
+ messageParameters = Array.empty
+ )
}
def dropTableWithPurgeUnsupportedError(): Throwable = {
- new UnsupportedOperationException("DROP TABLE ... PURGE")
+ new SparkUnsupportedOperationException(
+ errorClass = "DROP_TABLE_WITH_PURGE_UNSUPPORTED_ERROR",
+ messageParameters = Array.empty
+ )
}
def alterTableWithDropPartitionAndPurgeUnsupportedError(): Throwable = {
- new UnsupportedOperationException("ALTER TABLE ... DROP PARTITION ... PURGE")
+ new SparkUnsupportedOperationException(
+ errorClass = "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR",
+ messageParameters = Array.empty
+ )
}
def invalidPartitionFilterError(): Throwable = {
- new UnsupportedOperationException(
- """Partition filter cannot have both `"` and `'` characters""")
+ new SparkUnsupportedOperationException(
+ errorClass = "INVALID_PARTITION_FILTER_ERROR",
+ messageParameters = Array.empty
+ )
}
def getPartitionMetadataByFilterError(e: InvocationTargetException): Throwable = {
- new RuntimeException(
- s"""
- |Caught Hive MetaException attempting to get partition metadata by filter
- |from Hive. You can set the Spark configuration setting
- |${SQLConf.HIVE_METASTORE_PARTITION_PRUNING_FALLBACK_ON_EXCEPTION} to true to work around
- |this problem, however this will result in degraded performance. Please
- |report a bug: https://issues.apache.org/jira/browse/SPARK
- """.stripMargin.replaceAll("\n", " "), e)
+ new SparkRuntimeException(
+ errorClass = "GET_PARTITION_METADATA_BY_FILTER_ERROR",
+ messageParameters = Array(
+ SQLConf.HIVE_METASTORE_PARTITION_PRUNING_FALLBACK_ON_EXCEPTION.toString),
+ e)
}
def unsupportedHiveMetastoreVersionError(version: String, key: String): Throwable = {
- new UnsupportedOperationException(s"Unsupported Hive Metastore version ($version). " +
- s"Please set $key with a valid version.")
+ new SparkUnsupportedOperationException(
+ errorClass = "UNSUPPORTED_HIVE_METASTORE_VERSION_ERROR",
+ messageParameters = Array(version, key)
+ )
}
def loadHiveClientCausesNoClassDefFoundError(
cnf: NoClassDefFoundError,
execJars: Seq[URL],
key: String,
e: InvocationTargetException): Throwable = {
- new ClassNotFoundException(
- s"""
- |$cnf when creating Hive client using classpath: ${execJars.mkString(", ")}\n
- |Please make sure that jars for your version of hive and hadoop are included in the
- |paths passed to $key.
- """.stripMargin.replaceAll("\n", " "), e)
+ new SparkClassNotFoundException(
+ errorClass = "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND_ERROR",
+ messageParameters = Array(cnf.toString, execJars.mkString(", "), key ), e)
}
def cannotFetchTablesOfDatabaseError(dbName: String, e: Exception): Throwable = {
- new SparkException(s"Unable to fetch tables of db $dbName", e)
+ new SparkException(
+ errorClass = "CANNOT_FETCH_TABLES_OF_DATABASE_ERROR",
+ messageParameters = Array(dbName), e)
}
def illegalLocationClauseForViewPartitionError(): Throwable = {
- new SparkException("LOCATION clause illegal for view partition")
+ new SparkException(
+ errorClass = "ILLEGAL_LOCATION_CLAUSE_FOR_VIEW_PARTITION_ERROR",
+ messageParameters = Array.empty, null
+ )
}
def renamePathAsExistsPathError(srcPath: Path, dstPath: Path): Throwable = {
- new FileAlreadyExistsException(
- s"Failed to rename $srcPath to $dstPath as destination already exists")
+ new SparkFileAlreadyExistsException(
+ errorClass = "RENAME_PATH_AS_EXISTS_PATH_ERROR",
+ messageParameters = Array(srcPath.toString, dstPath.toString))
}
def renameAsExistsPathError(dstPath: Path): Throwable = {
- new FileAlreadyExistsException(s"Failed to rename as $dstPath already exists")
+ new SparkFileAlreadyExistsException(
+ errorClass = "RENAME_PATH_AS_EXISTS_PATH_ERROR",
Review comment:
Do you meant to use the `RENAME_PATH_AS_EXISTS_PATH_ERROR` error class?
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,16 +1,50 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
+ },
"AMBIGUOUS_FIELD_NAME" : {
"message" : [ "Field name %s is ambiguous and has %s matching fields in the struct." ],
"sqlState" : "42000"
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE_ERROR" : {
+ "message" : [ "Unable to fetch tables of db %s" ]
+ },
+ "CANNOT_RECOGNIZE_HIVE_TYPE_ERROR" : {
+ "message" : [ "Cannot recognize hive type string: %s, column: %s" ],
+ "sqlState" : "0D000"
+ },
+ "CANNOT_SET_TIMEOUT_DURATION_ERROR" : {
+ "message" : [ "Cannot set timeout duration without enabling processing time timeout in [map|flatMap]GroupsWithState" ],
+ "sqlState" : "42000"
+ },
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE_ERROR" : {
+ "message" : [ "%s, db: %s, table: %s" ],
+ "sqlState" : "42000"
+ },
"DIVIDE_BY_ZERO" : {
"message" : [ "divide by zero" ],
"sqlState" : "22012"
},
+ "DROP_TABLE_WITH_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "DROP TABLE ... PURGE" ],
+ "sqlState" : "42000"
Review comment:
0A000 may fit better here
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -1,16 +1,50 @@
{
+ "ALTER_TABLE_WITH_DROP_PARTITION_AND_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "ALTER TABLE ... DROP PARTITION ... PURGE" ],
+ "sqlState" : "42000"
+ },
"AMBIGUOUS_FIELD_NAME" : {
"message" : [ "Field name %s is ambiguous and has %s matching fields in the struct." ],
"sqlState" : "42000"
},
+ "CANNOT_FETCH_TABLES_OF_DATABASE_ERROR" : {
+ "message" : [ "Unable to fetch tables of db %s" ]
+ },
+ "CANNOT_RECOGNIZE_HIVE_TYPE_ERROR" : {
+ "message" : [ "Cannot recognize hive type string: %s, column: %s" ],
+ "sqlState" : "0D000"
+ },
+ "CANNOT_SET_TIMEOUT_DURATION_ERROR" : {
+ "message" : [ "Cannot set timeout duration without enabling processing time timeout in [map|flatMap]GroupsWithState" ],
+ "sqlState" : "42000"
+ },
+ "CONVERT_HIVE_TABLE_TO_CATALOG_TABLE_ERROR" : {
+ "message" : [ "%s, db: %s, table: %s" ],
+ "sqlState" : "42000"
+ },
"DIVIDE_BY_ZERO" : {
"message" : [ "divide by zero" ],
"sqlState" : "22012"
},
+ "DROP_TABLE_WITH_PURGE_UNSUPPORTED_ERROR" : {
+ "message" : [ "DROP TABLE ... PURGE" ],
+ "sqlState" : "42000"
+ },
"DUPLICATE_KEY" : {
"message" : [ "Found duplicate keys '%s'" ],
"sqlState" : "23000"
},
+ "FAILED_RENAME_TEMP_FILE_ERROR" : {
+ "message" : [ "Failed to rename temp file %s to %s as rename returned false" ],
+ "sqlState" : "42000"
+ },
+ "GET_PARTITION_METADATA_BY_FILTER_ERROR" : {
+ "message" : [ "Caught Hive MetaException attempting to get partition metadata by filter\nfrom Hive. You can set the Spark configuration setting\n%s to true to work around\nthis problem, however this will result in degraded performance. Please\nreport a bug: https://issues.apache.org/jira/browse/SPARK" ]
+ },
+ "GET_TABLES_BY_TYPE_UNSUPPORTED_BY_HIVE_VERSION_ERROR" : {
+ "message" : [ "Hive 2.2 and lower versions don't support getTablesByType. Please use Hive 2.3 or higher version." ],
+ "sqlState" : "42000"
Review comment:
0A000 may be a better fit
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -36,6 +73,18 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER_ERROR" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS_ERROR" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\"\ndirectory and you likely need to move it before restarting this query.\n\nEarlier version of Spark incorrectly escaped paths when writing out the\n\"_spark_metadata\" directory for structured streaming. While this was corrected in\nSpark 3.0, it appears that your query was started using an earlier version that\nincorrectly handled the \"_spark_metadata\" path.\n\nCorrect \"_spark_metadata\" Directory: %s\nIncorrect \"_spark_metadata\" Directory: %s\n\nPlease move the data from the incorrect directory to the correct one, delete the\nincorrect directory, and then restart this query. If you believe you are receiving\nthis message in error, you can disable it with the SQL conf\n%s." ],
+ "sqlState" : "42000"
+ },
+ "LOAD_HIVE_CLIENT_CAUSES_NO_CLASS_DEF_FOUND_ERROR" : {
+ "message" : [ "%s when creating Hive client using classpath: %s\nPlease make sure that jars for your version of hive and hadoop are included in the\npaths passed to %s." ],
Review comment:
You can also split this one.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -36,6 +73,18 @@
"INVALID_JSON_SCHEMA_MAPTYPE" : {
"message" : [ "Input schema %s can only contain StringType as a key type for a MapType." ]
},
+ "INVALID_PARTITION_FILTER_ERROR" : {
+ "message" : [ "Partition filter cannot have both `\"` and `\\'` characters" ],
+ "sqlState" : "42000"
+ },
+ "LEGACY_METADATA_PATH_EXISTS_ERROR" : {
+ "message" : [ "Error: we detected a possible problem with the location of your \"_spark_metadata\"\ndirectory and you likely need to move it before restarting this query.\n\nEarlier version of Spark incorrectly escaped paths when writing out the\n\"_spark_metadata\" directory for structured streaming. While this was corrected in\nSpark 3.0, it appears that your query was started using an earlier version that\nincorrectly handled the \"_spark_metadata\" path.\n\nCorrect \"_spark_metadata\" Directory: %s\nIncorrect \"_spark_metadata\" Directory: %s\n\nPlease move the data from the incorrect directory to the correct one, delete the\nincorrect directory, and then restart this query. If you believe you are receiving\nthis message in error, you can disable it with the SQL conf\n%s." ],
Review comment:
You can split the message here into array elements, which will be re-joined with newlines later.
##########
File path: core/src/main/resources/error/error-classes.json
##########
@@ -52,17 +101,44 @@
"message" : [ "PARTITION clause cannot contain a non-partition column name: %s" ],
"sqlState" : "42000"
},
+ "PARTITION_COLUMN_NOT_FOUND_IN_SCHEMA_ERROR" : {
+ "message" : [ "Partition column %s not found in schema %s" ]
+ },
"PIVOT_VALUE_DATA_TYPE_MISMATCH" : {
"message" : [ "Invalid pivot value '%s': value data type %s does not match pivot column data type %s" ],
"sqlState" : "42000"
},
+ "RENAME_AS_EXISTS_PATH_ERROR" : {
Review comment:
This doesn't make much sense grammatically; maybe `RENAME_OVERWRITES_EXISTING_PATH`? We can also consolidate this with `RENAME_PATH_AS_EXISTS_PATH_ERROR`, and have everyone throw this error class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dgd-contributor commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
dgd-contributor commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-929023756
Thanks for your suggestion, @karenfeng, I have updated this PR. Please take another look when you have time, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dgd-contributor closed pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
dgd-contributor closed pull request #33805:
URL: https://github.com/apache/spark/pull/33805
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #33805: [SPARK-36302][SQL] Refactor thirteenth set of 20 query execution errors to use error classes
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #33805:
URL: https://github.com/apache/spark/pull/33805#issuecomment-903377957
cc @karenfeng FYI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org