shivadarshan-devadiga opened a new pull request, #13827:
URL: https://github.com/apache/gluten/pull/13827

   ## What changes are proposed in this pull request?
   
   Fixes #13826
   
   With `ignoreCorruptFiles` set, Spark skips a file it can't read. The native 
scan can't: Velox has no such option, and Gluten passes none of these settings 
to it. So the query fails, with `No magic bytes found at end of the Parquet 
file` for example, where Spark returns the rows of the other files.
   
   This PR makes the scan fall back to Spark when Spark would skip corrupt 
files:
   
   - `BasicScanExecTransformer` gets `ignoreCorruptFiles`, `false` by default, 
and `doValidateInternal` fails validation when it is true, next to the 
`ignoreMissingFiles` check from #13207. The fallback reason is "The native scan 
can't skip corrupt files, which ignoreCorruptFiles asks for."
   - `FileSourceScanExecTransformer` (V1) and `BatchScanExecTransformer` for 
`ParquetScan` and `OrcScan` (V2) take it from 
`FileSourceOptions(getReadOptions).ignoreCorruptFiles`, so the read option wins 
over `spark.sql.files.ignoreCorruptFiles`, as in Spark.
   - `HiveTableScanExecTransformer` takes it from the setting Spark's 
`HadoopRDD` uses for Hive tables: `spark.sql.files.ignoreCorruptFiles` since 
Spark 4.0 (SPARK-45316), and the core conf `spark.files.ignoreCorruptFiles` on 
Spark 3.x.
   - Other scans, such as Iceberg's, keep `false`: their Spark readers honor 
neither setting, so falling back wouldn't help.
   
   With the settings off, which is the default, nothing changes.
   
   ## How was this patch tested?
   
   - New test in `VeloxScanSuite`, like the `ignoreMissingFiles` test from 
#13207. It reads a Parquet dir and a dir whose only file isn't Parquet, with 
the V1 and the V2 scan, for the four combinations of the conf and the read 
option. When Spark skips the file, the result is the good dir's row and the 
scan falls back. Otherwise the query fails and the scan is offloaded.
   - New `VeloxHiveScanSuite` with a Hive ORC table that has a good file and a 
garbage file, read with `convertMetastoreOrc=false` and Hive's `BI` split 
strategy, which doesn't read the footers to split the files. It sets the conf 
the running Spark version reads. When it's set, the result is the good file's 
row and the scan falls back; otherwise the query fails and the scan is 
offloaded.
   - Both suites pass on Spark 3.5 and Spark 4.1, 14 tests each. Without the 
change to `gluten-substrait`, exactly the two new tests fail, with `No magic 
bytes found at end of the Parquet file` and `Corrupted file, Post script size 
is invalid` from the native scan. I ran them in a Linux aarch64 container 
against main 78e8f82e6, with the native libraries of the 2026-11-27 nightly 
bundles for Spark 3.5 and 4.1.
   - `backends-velox` compiles, including test sources, and passes 
`spotless:check` and scalastyle with `-Pspark-3.5` and with `-Pspark-4.1 
-Pscala-2.13 -Pjava-17`.
   - The tables in #13826 come from Spark 3.5.4 with the Spark 3.5 nightly 
bundle.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Co-authored by: Claude Sonnet 4.5


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