laxmanmamididd opened a new pull request, #7449:
URL: https://github.com/apache/datafusion-comet/pull/7449

   ## Which issue does this PR close?
   
   Backport of the array literal fix in #6666 to `branch-1.1`.
   
   ## Rationale for this change
   
   On `branch-1.1`, `CometLiteral` serializes array literals through 
`ArrayData.array`. A constant-folded array literal is an `UnsafeArrayData`, 
which has no backing object array, so planning throws:
   
   ```
   [UNSUPPORTED_CALL.WITHOUT_SUGGESTION] Cannot call the method "array" of the 
class "org.apache.spark.sql.catalyst.expressions.UnsafeArrayData"
   ```
   
   The query then fails instead of falling back. `sequence(1, 5)` is one way to 
produce such a literal. The only workaround on 1.1.0 is 
`spark.comet.expression.Literal.enabled=false`, which turns off native support 
for every literal.
   
   `main` fixed this in #6666. That PR bundles the fix with the OneRowRelation 
change, so this backport takes only the `literals.scala` lines.
   
   ## What changes are included in this PR?
   
   - `literals.scala`: read top-level and nested array literals with 
`toArray[Any](elementType)` instead of `.array`. These are the same two lines 
#6666 changed in this file.
   - `CometArrayExpressionSuite`: a regression test that projects flat and 
nested `sequence(...)` literals over a Parquet table and checks the plan runs 
in Comet. #6666 covers these literals in `one_row_relation.sql`, which needs 
its OneRowRelation change, so this test reads from a table instead.
   
   ## How are these changes tested?
   
   Run locally on `branch-1.1` with `-Pspark-4.0` on JDK 17:
   
   - Without the `literals.scala` change, the new test fails with the 
`UNSUPPORTED_CALL` error above.
   - With it, all 74 tests in `CometArrayExpressionSuite` pass.
   - `spotless:check` passes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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