1616// under the License.
1717
1818//! `SchemaAlignExec` reshapes its child's output so the per-column Arrow type and field-level
19- //! nullability match what Spark catalyst declared. Used between an inlined native subtree and
20- //! `ShuffleWriterExec` when the FFI deep-copy + `ScanExec` cast in `build_record_batch` are both
21- //! gone, so DataFusion / `datafusion-spark` return-type drift would otherwise be written into
22- //! shuffle blocks. See <https://github.com/apache/datafusion-comet/issues/4515> for the running
23- //! list of mismatched functions.
19+ //! nullability match what Spark catalyst declared, casting where necessary. Sits between a native
20+ //! subtree and `ShuffleWriterExec` so DataFusion / `datafusion-spark` return-type drift is caught
21+ //! before it reaches shuffle blocks. See
22+ //! <https://github.com/apache/datafusion-comet/issues/4515> for the running list of mismatched
23+ //! functions.
2424
2525use arrow:: array:: { ArrayRef , RecordBatch , RecordBatchOptions } ;
2626use arrow:: compute:: { cast_with_options, CastOptions } ;
@@ -53,6 +53,9 @@ fn warn_dedup() -> &'static Mutex<HashSet<String>> {
5353 SET . get_or_init ( || Mutex :: new ( HashSet :: new ( ) ) )
5454}
5555
56+ /// Casts each column of `child`'s output to the data_type Spark catalyst declared, widening
57+ /// nullability to `actual.nullable || expected.nullable`. See
58+ /// <https://github.com/apache/datafusion-comet/issues/4515>.
5659#[ derive( Debug ) ]
5760pub struct SchemaAlignExec {
5861 child : Arc < dyn ExecutionPlan > ,
@@ -74,8 +77,7 @@ impl SchemaAlignExec {
7477 /// Build a SchemaAlignExec that aligns `child`'s output to `expected`. Returns
7578 /// `Ok(child)` unchanged when no per-column reshape is needed; otherwise wraps `child`
7679 /// in a SchemaAlignExec whose target schema preserves `expected`'s data_type and metadata
77- /// but widens nullability to `actual.nullable || expected.nullable` (matching the
78- /// reconciliation rule used at the FFI boundary on `main`).
80+ /// but widens nullability to `actual.nullable || expected.nullable`.
7981 pub fn try_new_or_passthrough (
8082 child : Arc < dyn ExecutionPlan > ,
8183 expected : & SchemaRef ,
0 commit comments