-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-49334][SQL] str_to_map
should check whether the collation
values of all parameter types are the same
#47825
Changes from 2 commits
fed4a7e
1973bbc
e8be51b
a611128
899fd22
109af97
4d1ac6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -996,6 +996,30 @@ class CollationSQLExpressionsSuite | |
assert(sql(query).schema.fields.head.dataType.sameType(dataType)) | ||
} | ||
}) | ||
|
||
val tableName = "t_diff_collation" | ||
withTable(tableName) { | ||
sql(s"CREATE TABLE $tableName (" + | ||
s"text STRING COLLATE UTF8_BINARY, " + | ||
s"pairDelim STRING COLLATE UTF8_LCASE, " + | ||
s"keyValueDelim STRING COLLATE UTF8_BINARY) " + | ||
s"USING parquet") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, there is an ongoing effort to move such tests to please see: #47828 and https://issues.apache.org/jira/browse/SPARK-48779 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, I have moved the related tests to file |
||
checkError( | ||
exception = intercept[AnalysisException] { | ||
sql(s"SELECT str_to_map(text, pairDelim, keyValueDelim) from $tableName") | ||
}, | ||
errorClass = "DATATYPE_MISMATCH.DATA_DIFF_TYPES", | ||
sqlState = "42K09", | ||
parameters = Map( | ||
"functionName" -> "`str_to_map`", | ||
"dataType" -> "[\"STRING\", \"STRING COLLATE UTF8_LCASE\", \"STRING\"]", | ||
"sqlExpr" -> "\"str_to_map(text, pairDelim, keyValueDelim)\""), | ||
context = ExpectedContext( | ||
fragment = "str_to_map(text, pairDelim, keyValueDelim)", | ||
start = 7, | ||
stop = 48) | ||
) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we shouldn't use please see |
||
} | ||
|
||
test("Support RaiseError misc expression with collation") { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not how we usually enforce collation type coercion
please see
CollationTypeCasts.scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me take a closer look, thank you!