Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@
"The location name cannot be empty string, but `<location>` was given."
]
},
"INVALID_EXTRACT_FIELD" : {
"message" : [
"Cannot extract <field> from <expr>."
]
},
"INVALID_FIELD_NAME" : {
"message" : [
"Field name <fieldName> is invalid: <path> is not a struct."
Expand Down Expand Up @@ -2215,11 +2220,6 @@
"Invalid value for the '<argName>' parameter of function '<funcName>': <invalidValue>.<endingMsg>."
]
},
"_LEGACY_ERROR_TEMP_1102" : {
"message" : [
"Literals of type '<field>' are currently not supported for the <srcDataType> type."
]
},
"_LEGACY_ERROR_TEMP_1103" : {
"message" : [
"Unsupported component type <clz> in arrays."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1073,10 +1073,10 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {

def literalTypeUnsupportedForSourceTypeError(field: String, source: Expression): Throwable = {
new AnalysisException(
errorClass = "_LEGACY_ERROR_TEMP_1102",
errorClass = "INVALID_EXTRACT_FIELD",
messageParameters = Map(
"field" -> field,
"srcDataType" -> source.dataType.catalogString))
"field" -> toSQLId(field),
"expr" -> toSQLExpr(source)))
}

def arrayComponentTypeUnsupportedError(clz: Class[_]): Throwable = {
Expand Down
56 changes: 27 additions & 29 deletions sql/core/src/test/resources/sql-tests/results/extract.sql.out
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "string"
"expr" : "\"c\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -340,10 +340,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "interval year to month"
"expr" : "\"i\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -362,10 +362,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "interval day to second"
"expr" : "\"j\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -376,7 +376,6 @@ org.apache.spark.sql.AnalysisException
} ]
}


-- !query
select date_part('year', c), date_part('year', ntz), date_part('year', i) from t
-- !query schema
Expand Down Expand Up @@ -688,10 +687,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "string"
"expr" : "\"c\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand Down Expand Up @@ -964,10 +963,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "DAY",
"srcDataType" : "interval year to month"
"expr" : "\"INTERVAL '2-1' YEAR TO MONTH\"",
"field" : "`DAY`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -986,10 +985,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "DAY",
"srcDataType" : "interval year to month"
"expr" : "\"INTERVAL '2-1' YEAR TO MONTH\"",
"field" : "`DAY`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -1008,10 +1007,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "interval year to month"
"expr" : "\"INTERVAL '2-1' YEAR TO MONTH\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand Down Expand Up @@ -1134,10 +1133,10 @@ struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "MONTH",
"srcDataType" : "interval day to second"
"expr" : "\"INTERVAL '123 12:34:56.789123' DAY TO SECOND\"",
"field" : "`MONTH`"
},
"queryContext" : [ {
"objectType" : "",
Expand All @@ -1148,18 +1147,17 @@ org.apache.spark.sql.AnalysisException
} ]
}


-- !query
select date_part('not_supported', interval '123 12:34:56.789123123' DAY TO SECOND)
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
{
"errorClass" : "_LEGACY_ERROR_TEMP_1102",
"errorClass" : "INVALID_EXTRACT_FIELD",
"messageParameters" : {
"field" : "not_supported",
"srcDataType" : "interval day to second"
"expr" : "\"INTERVAL '123 12:34:56.789123' DAY TO SECOND\"",
"field" : "`not_supported`"
},
"queryContext" : [ {
"objectType" : "",
Expand Down