Copilot commented on code in PR #58827:
URL: https://github.com/apache/spark/pull/58827#discussion_r4017296493


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -2768,18 +2768,13 @@ object AsOfJoin {
     def usesArrayOrderExpression(leftType: DataType, rightType: DataType): 
Boolean =
       (leftType, rightType) match {
         case (ArrayType(leftElem, _), ArrayType(rightElem, _)) =>
-          areArrayElementsCompatible(leftElem, rightElem)
+          // Array operands compare element-wise, so elements use the same 
rules as top-level
+          // operands: identical, coercible (INT vs BIGINT), or positional 
structs. This matches
+          // the comparison operator, which widens array element types the 
same way.
+          areOperandsCompatible(leftElem, rightElem)

Review Comment:
   This new acceptance is broader than the analyzer's binary-comparison 
coercion. `TypeCoercion.findWiderTypeForTwo(INT, STRING)` returns STRING, but 
the comparison coercion rules do not recurse string promotion through 
`ArrayType`; `asOfCondition` therefore remains `array<int> >= array<string>` 
and fails the `BinaryOperator` same-type check, while the order expression has 
been cast to `array<string>`. Either materialize/coerce the condition with the 
same widened array type or remove this advertised case; the current unit 
assertion does not prove that SQL analysis succeeds.
   
   This issue also appears in the following locations of the same file:
   - line 2998
   - line 2998
   - line 3003



-- 
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]

Reply via email to