uros-db commented on code in PR #45383:
URL: https://github.com/apache/spark/pull/45383#discussion_r1515609105
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -509,18 +509,10 @@ abstract class StringPredicate extends BinaryExpression
return checkResult
}
// Additional check needed for collation compatibility
- val rightCollationId: Int =
right.dataType.asInstanceOf[StringType].collationId
- if (collationId != rightCollationId) {
- DataTypeMismatch(
- errorSubClass = "COLLATION_MISMATCH",
- messageParameters = Map(
- "collationNameLeft" ->
CollationFactory.fetchCollation(collationId).collationName,
- "collationNameRight" ->
CollationFactory.fetchCollation(rightCollationId).collationName
- )
- )
- } else {
- TypeCheckResult.TypeCheckSuccess
- }
+ val outputCollationId: Int = TypeCoercion
Review Comment:
I'd say `COLLATION_MISMATCH` first, `UNSUPPORTED_COLLATION.FOR_FUNCTION`
second. If the user specifies COLLATION_1 for `left` and COLLATION_2 for
`right`, how would we know which one to use when checking whether the functions
supports this type of collation? (in this case, suppose a function supports
COLLATION_1, but not COLLATION_2 - does the
`UNSUPPORTED_COLLATION.FOR_FUNCTION` pass or fail?)
Hence, I think we would first need to establish that COLLATION_1 and
COLLATION_2 are the same (no `COLLATION_MISMATCH `), before checking whether
the function supports the requested collation (no
`UNSUPPORTED_COLLATION.FOR_FUNCTION`)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]