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

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #4457.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.
   -->
   
   `NullType` columns currently break Comet at the row-to-Arrow boundary. 
`Utils.toArrowType` throws `UnsupportedOperationException` for `NullType`, 
which surfaces in two places:
   
   1. `CometLocalTableScanExec` when a `LocalTableScan` contains a `NullType` 
column (the case in #4457, e.g. `SELECT max(col) FROM VALUES (NULL), (NULL) AS 
t(col)`).
   2. `CometShuffleExchangeExec` when a Spark `LocalTableScanExec` with a 
`NullType` column feeds a Comet shuffle.
   
   `NullType` is well-defined in Arrow (`ArrowType.Null`) and the Spark 
`ArrowWriter` already has a `NullWriter` case, so the right fix is to support 
it end-to-end rather than fall back. This PR is an alternative to #4458, which 
adds a `LocalTableScanExec`-only fallback and leaves the shuffle path broken.
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   - `Utils.toArrowType` maps `NullType` to `ArrowType.Null`.
   - `CometShuffleExchangeExec.supportedSerializableDataType` accepts 
`NullType` for both native and columnar shuffle.
   - Native shuffle row reader (`native/shuffle/src/spark_unsafe/row.rs`) 
handles `NullType`.
   
   ## How are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are 
they covered by existing tests)?
   -->
   
   New regression tests:
   
   - `CometExecSuite "CometLocalTableScanExec handles NullType nested in 
struct/array/map"` covers `NullType` nested under `StructType`, `ArrayType`, 
and `MapType` through `CometLocalTableScanExec`.
   - `CometColumnarShuffleSuite "columnar shuffle with NullType passthrough 
column"` covers JVM-input columnar shuffle with a `NullType` column. Replaces 
the older `"Fallback to Spark for unsupported input besides ordering"` test, 
which asserted the previous fallback behavior.
   - `CometNativeShuffleSuite "native shuffle with NullType passthrough 
column"` covers native shuffle with a Comet `LocalTableScan` source containing 
a `NullType` column. Gated on `spark.comet.exec.localTableScan.enabled=true` 
because native shuffle requires Comet input.
   


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