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

   ## Which issue does this PR close?
   
   Backport of #6178 to `branch-1.2`. Closes #6172 on this branch.
   
   ## Rationale for this change
   
   The codegen dispatcher's map writer writes each key with no null check. A 
TRY cast whose key cast fails produces a null key, and the writer stores the 
key type's default instead, so the query returns wrong results (#6172, a 
critical bug). `branch-1.2` has the same dispatcher. See #6178 for the full 
analysis.
   
   ## What changes are included in this PR?
   
   Cherry-pick of 6a6d71c52f (`git cherry-pick -x`) with no conflicts and no 
adaptations. The diff against the source commit is identical apart from line 
numbers and blob hashes. `CometCast` and `CometBatchKernelCodegen` now refuse 
dispatch for a TRY cast whose map key cast can fail, and the query falls back 
to Spark.
   
   Other release branches: `branch-1.2` is the newest release branch, so there 
is no newer one to port to. Whether `branch-1.1` needs a backport is not part 
of this PR.
   
   ## How are these changes tested?
   
   On this branch, with JDK 17 and a native library built from `branch-1.2`: 
`CometCodegenSuite` and the 
`expressions/misc/codegen_dispatch_null_map_key.sql` file test pass (130 tests, 
0 failures). With `CometCast.scala` and `CometBatchKernelCodegen.scala` 
reverted to `branch-1.2`'s version, the SQL file test and two new 
`CometCodegenSuite` tests (`canHandle refuses a TRY cast whose map key cast can 
fail`, `a TRY cast over a foldable map with a failing key falls back`) fail, so 
the branch has the bug and the tests catch it. I ran the default Spark profile 
only.
   


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