SQLSTATE Codes
Most error classes returned by Spark SQL are associated with a 5 character SQLSTATE.
A SQLSTATE is a SQL standard encoding for error conditions commonly used by JDBC, ODBC, and other client APIs.
A SQLSTATE consists of two portions: A two character class, and a three character subclass.
Each character must be a digit '0' to '9' or 'A' to 'Z'.
While many SQLSTATE values are prescribed by the SQL standard, others are common in the industry, specific to Spark.
For an ordered list of error classes see: Error Conditions in Spark SQL
Spark SQL uses the following SQLSTATE classes:
Class 0A: feature not supported
| SQLSTATE | Description and issuing error classes |
|---|---|
| 0A000 | feature not supported |
| INVALID_PANDAS_UDF_PLACEMENT, STAR_GROUP_BY_POS, UNSUPPORTED_ARROWTYPE, UNSUPPORTED_DATATYPE, UNSUPPORTED_DESERIALIZER, UNSUPPORTED_FEATURE, UNSUPPORTED_GENERATOR, UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY, UNSUPPORTED_TYPED_LITERAL |
Class 21: cardinality violation
| SQLSTATE | Description and issuing error classes |
|---|---|
| 21000 | cardinality violation |
| SCALAR_SUBQUERY_TOO_MANY_ROWS |
Class 22: data exception
Class 23: integrity constraint violation
| SQLSTATE | Description and issuing error classes |
|---|---|
| 23505 | A violation of the constraint imposed by a unique index or a unique constraint occurred. |
| DUPLICATED_MAP_KEY, DUPLICATE_KEY |
Class 2B: dependent privilege descriptors still exist
| SQLSTATE | Description and issuing error classes |
|---|---|
| 2BP01 | dependent_objects_still_exist |
| SCHEMA_NOT_EMPTY |
Class 38: external routine exception
| SQLSTATE | Description and issuing error classes |
|---|---|
| 38000 | external routine exception |
| FAILED_FUNCTION_CALL |
Class 39: external routine invocation exception
| SQLSTATE | Description and issuing error classes |
|---|---|
| 39000 | external routine invocation exception |
| FAILED_EXECUTE_UDF |
Class 42: syntax error or access rule violation
| SQLSTATE | Description and issuing error classes |
|---|---|
| 42000 | syntax error or access rule violation |
| AMBIGUOUS_REFERENCE_TO_FIELDS, INVALID_COLUMN_OR_FIELD_DATA_TYPE, INVALID_EXTRACT_BASE_FIELD_TYPE, INVALID_EXTRACT_FIELD_TYPE, INVALID_FIELD_NAME, INVALID_SET_SYNTAX, INVALID_SQL_SYNTAX, NON_PARTITION_COLUMN, NOT_NULL_CONSTRAINT_VIOLATION, NULLABLE_COLUMN_OR_FIELD, NULLABLE_ROW_ID_ATTRIBUTES | |
| 42601 | A character, token, or clause is invalid or missing. |
| IDENTIFIER_TOO_MANY_NAME_PARTS, INVALID_EXTRACT_FIELD, INVALID_FORMAT, PARSE_SYNTAX_ERROR, UNCLOSED_BRACKETED_COMMENT | |
| 42602 | A character that is invalid in a name has been detected. |
| INVALID_IDENTIFIER, INVALID_PROPERTY_KEY, INVALID_PROPERTY_VALUE | |
| 42604 | An invalid numeric or string constant has been detected. |
| EMPTY_JSON_FIELD_VALUE, INVALID_TYPED_LITERAL | |
| 42605 | The number of arguments specified for a scalar function is invalid. |
| WRONG_NUM_ARGS | |
| 42607 | An operand of an aggregate function or CONCAT operator is invalid. |
| NESTED_AGGREGATE_FUNCTION | |
| 42613 | Clauses are mutually exclusive. |
| INCOMPATIBLE_JOIN_TYPES, INVALID_LATERAL_JOIN_TYPE, NON_LAST_MATCHED_CLAUSE_OMIT_CONDITION, NON_LAST_NOT_MATCHED_BY_SOURCE_CLAUSE_OMIT_CONDITION, NON_LAST_NOT_MATCHED_BY_TARGET_CLAUSE_OMIT_CONDITION | |
| 42614 | A duplicate keyword or clause is invalid. |
| REPEATED_CLAUSE | |
| 42617 | The statement string is blank or empty. |
| PARSE_EMPTY_STATEMENT | |
| 42702 | A column reference is ambiguous, because of duplicate names. |
| AMBIGUOUS_COLUMN_OR_FIELD, AMBIGUOUS_LATERAL_COLUMN_ALIAS | |
| 42703 | An undefined column or parameter name was detected. |
| COLUMN_NOT_FOUND, UNRESOLVED_COLUMN, UNRESOLVED_FIELD, UNRESOLVED_MAP_KEY, UNRESOLVED_USING_COLUMN_FOR_JOIN | |
| 42704 | An undefined object or constraint name was detected. |
| AMBIGUOUS_REFERENCE, DEFAULT_DATABASE_NOT_EXISTS, FIELD_NOT_FOUND, INDEX_NOT_FOUND, SCHEMA_NOT_FOUND, UNRECOGNIZED_SQL_TYPE | |
| 42710 | A duplicate object or constraint name was detected. |
| CREATE_TABLE_COLUMN_OPTION_DUPLICATE, INDEX_ALREADY_EXISTS, LOCATION_ALREADY_EXISTS | |
| 42711 | A duplicate column name was detected in the object definition or ALTER TABLE statement. |
| COLUMN_ALREADY_EXISTS | |
| 42723 | A routine with the same signature already exists in the schema, module, or compound block where it is defined. |
| ROUTINE_ALREADY_EXISTS | |
| 42803 | A column reference in the SELECT or HAVING clause is invalid, because it is not a grouping column; or a column reference in the GROUP BY clause is invalid. |
| GROUPING_COLUMN_MISMATCH, GROUPING_ID_COLUMN_MISMATCH, MISSING_AGGREGATION, MISSING_GROUP_BY, UNRESOLVED_ALL_IN_GROUP_BY | |
| 42805 | An integer in the ORDER BY clause does not identify a column of the result table. |
| GROUP_BY_POS_OUT_OF_RANGE, ORDER_BY_POS_OUT_OF_RANGE | |
| 42809 | The identified object is not the type of object to which the statement applies. |
| FORBIDDEN_OPERATION | |
| 42818 | The operands of an operator or function are not compatible or comparable. |
| INCOMPARABLE_PIVOT_COLUMN | |
| 42823 | Multiple columns are returned from a subquery that only allows one column. |
| INVALID_SUBQUERY_EXPRESSION | |
| 42825 | The rows of UNION, INTERSECT, EXCEPT, or VALUES do not have compatible columns. |
| CANNOT_MERGE_INCOMPATIBLE_DATA_TYPE, INCOMPATIBLE_COLUMN_TYPE | |
| 42826 | The rows of UNION, INTERSECT, EXCEPT, or VALUES do not have the same number of columns. |
| NUM_COLUMNS_MISMATCH | |
| 42846 | Cast from source type to target type is not supported. |
| CANNOT_CAST_DATATYPE | |
| 42883 | No routine was found with a matching signature. |
| ROUTINE_NOT_FOUND, UNRESOLVED_ROUTINE | |
| 428C4 | The number of elements on each side of the predicate operator is not the same. |
| UNPIVOT_VALUE_SIZE_MISMATCH | |
| 428EK | The schema qualifier is not valid. |
| TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS | |
| 428FT | The partitioning clause specified on CREATE or ALTER is not valid. |
| PARTITIONS_ALREADY_EXIST, PARTITIONS_NOT_FOUND | |
| 42903 | Invalid use of an aggregate function or OLAP function. |
| GROUP_BY_AGGREGATE, GROUP_BY_POS_AGGREGATE, INVALID_WHERE_CONDITION | |
| 429BB | The data type of a column, parameter, or SQL variable is not supported. |
| CANNOT_RECOGNIZE_HIVE_TYPE | |
| 42K01 | data type not fully specified |
| DATATYPE_MISSING_SIZE, INCOMPLETE_TYPE_DEFINITION | |
| 42K02 | data source not found |
| DATA_SOURCE_NOT_FOUND | |
| 42K03 | File not found |
| PATH_NOT_FOUND, RENAME_SRC_PATH_NOT_FOUND | |
| 42K04 | Duplicate file |
| FAILED_RENAME_PATH, PATH_ALREADY_EXISTS | |
| 42K05 | Name is not valid |
| INVALID_EMPTY_LOCATION, REQUIRES_SINGLE_PART_NAMESPACE | |
| 42K06 | Invalid type for options |
| INVALID_OPTIONS | |
| 42K07 | Not a valid schema literal |
| INVALID_SCHEMA | |
| 42K08 | Not a constant |
| NON_LITERAL_PIVOT_VALUES | |
| 42K09 | Data type mismatch |
| DATATYPE_MISMATCH, PIVOT_VALUE_DATA_TYPE_MISMATCH, UNEXPECTED_INPUT_TYPE, UNPIVOT_VALUE_DATA_TYPE_MISMATCH | |
| 42K0A | Invalid UNPIVOT clause |
| UNPIVOT_REQUIRES_ATTRIBUTES, UNPIVOT_REQUIRES_VALUE_COLUMNS | |
| 42K0B | Legacy feature blocked |
| INCONSISTENT_BEHAVIOR_CROSS_VERSION | |
| 42KD9 | Cannot infer table schema. |
| UNABLE_TO_INFER_SCHEMA | |
| 42P01 | undefined_table |
| TABLE_OR_VIEW_NOT_FOUND, VIEW_NOT_FOUND | |
| 42P02 | undefined_parameter |
| UNBOUND_SQL_PARAMETER | |
| 42P06 | duplicate_schema |
| SCHEMA_ALREADY_EXISTS | |
| 42P07 | duplicate_table |
| TABLE_OR_VIEW_ALREADY_EXISTS, TEMP_TABLE_OR_VIEW_ALREADY_EXISTS, VIEW_ALREADY_EXISTS | |
| 42P20 | windowing_error |
| UNSUPPORTED_EXPR_FOR_WINDOW |
Class 46: java ddl 1
| SQLSTATE | Description and issuing error classes |
|---|---|
| 46110 | unsupported feature |
| CANNOT_MODIFY_CONFIG | |
| 46121 | invalid column name |
| INVALID_COLUMN_NAME_AS_PATH |
Class 53: insufficient resources
| SQLSTATE | Description and issuing error classes |
|---|---|
| 53200 | out_of_memory |
| UNABLE_TO_ACQUIRE_MEMORY |
Class 54: program limit exceeded
| SQLSTATE | Description and issuing error classes |
|---|---|
| 54000 | program limit exceeded |
| GROUPING_SIZE_LIMIT_EXCEEDED, TOO_MANY_ARRAY_ELEMENTS |
Class HY: CLI-specific condition
| SQLSTATE | Description and issuing error classes |
|---|---|
| HY008 | operation canceled |
| OPERATION_CANCELED |
Class XX: internal error
| SQLSTATE | Description and issuing error classes |
|---|---|
| XX000 | internal error |
| INTERNAL_ERROR |
.. include:: /shared/replacements.md