shivadarshan-devadiga opened a new issue, #13671:
URL: https://github.com/apache/gluten/issues/13671

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   Since Spark 4.1 (SPARK-53535), 
`spark.sql.legacy.parquet.returnNullStructIfAllFieldsMissing` defaults to 
`false`. When all requested fields of a struct are missing from a Parquet file, 
Spark reads another field of the struct to tell whether the struct is null. 
Only structs that are null in the file come back as null.
   
   The Velox scan keeps the old behaviour unless the config is set explicitly, 
so it returns null for every such struct:
   
   - `GlutenConfig.getNativeSessionConf` passes the key to native only when it 
is set in the session. It is not in the list of configs whose Spark default is 
passed when unset.
   - `ConfigExtractor.cc` then falls back to `true`: 
`conf->get<bool>(kLegacyParquetReturnNullStructIfAllFieldsMissing, true)`.
   
   The tests enabled by #13398 (for #11914) all set the config explicitly, so 
they don't cover the default.
   
   Repro (`spark-sql`, ANSI off):
   
   ```sql
   INSERT OVERWRITE DIRECTORY '/tmp/ps' USING parquet
     SELECT if(id = 1, null, named_struct('a', id, 'b', id)) AS s FROM range(3);
   CREATE TEMPORARY VIEW t (s STRUCT<x: INT>) USING parquet OPTIONS (path 
'/tmp/ps');
   SELECT s, s IS NULL FROM t;
   ```
   
   Results with Spark 4.1.1 and 4.2.0, and the Gluten nightly bundles from 
2026-11-18 
(`gluten-velox-bundle-spark4.{1,2}_2.13-linux_aarch64-1.9.0-SNAPSHOT`). Both 
versions give the same rows:
   
   | Run | id 0 | id 1 | id 2 |
   |---|---|---|---|
   | Vanilla Spark, config unset | `{"x":null}` | `NULL` | `{"x":null}` |
   | Vanilla Spark, config `true` | `NULL` | `NULL` | `NULL` |
   | Gluten, config unset | `NULL` | `NULL` | `NULL` |
   | Gluten, config `false` | `{"x":null}` | `NULL` | `{"x":null}` |
   
   The scan is offloaded in the Gluten runs (`FileSourceScanExecTransformer`). 
Gluten matches Spark once the config is set to `false`, so the native reader 
supports the new behaviour. Only the default is wrong.
   
   Expected: with the config unset, Gluten follows Spark's default, which is 
`false` on Spark 4.1+. Spark 3.4–4.0 don't have the config and behave as if it 
were `true`, so they shouldn't change.
   
   
   
   ### Gluten version
   
   main branch
   
   ### Spark version
   
   Spark-4.1.x
   
   ### Spark configurations
   
   Default (`spark.sql.legacy.parquet.returnNullStructIfAllFieldsMissing` unset)
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   ```bash
   
   ```


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

  • [I] [VL] Spark 4.1+: native... shivadarshan-devadiga (via GitHub) via commits

Reply via email to