LukaZdravic commented on code in PR #58827:
URL: https://github.com/apache/spark/pull/58827#discussion_r4063875645
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -2768,16 +2769,27 @@ object AsOfJoin {
def usesArrayOrderExpression(leftType: DataType, rightType: DataType):
Boolean =
(leftType, rightType) match {
case (ArrayType(leftElem, _), ArrayType(rightElem, _)) =>
- areArrayElementsCompatible(leftElem, rightElem)
+ // MATCH_CONDITION compares the two arrays with `>=`, which widens
array elements only
+ // through findTightestCommonType (no string promotion, no decimal
widening). Accept
+ // exactly what that comparison can compare: orderable elements that
are already
+ // structurally equal (BinaryComparison ignores struct field names
and nullability) or
+ // have a tightest common type. Otherwise the type check would pass
but the `>=` would
+ // fail to resolve.
+ isValidOperandType(leftElem) && isValidOperandType(rightElem) &&
+ (DataType.equalsStructurally(leftElem, rightElem,
ignoreNullability = true) ||
+ arrayElementCommonType(leftElem, rightElem).isDefined)
case _ => false
}
- private def areArrayElementsCompatible(leftElem: DataType, rightElem:
DataType): Boolean = {
- if (DataTypeUtils.sameType(leftElem, rightElem)) {
- RowOrdering.isOrderable(leftElem)
- } else {
- arePositionalStructsCompatible(leftElem, rightElem)
- }
+ /**
+ * The element type the `>=` comparison coerces two array operands to, if
any. Binary
Review Comment:
Thanks, fixed
--
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]