Repository navigation
[GLUTEN-13826][CORE] Fall back the scan when ignoreCorruptFiles is set - #13827
shivadarshan-devadiga wants to merge 6 commits into
Conversation
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
|
@zhouyuan @LuciferYang @philo-he @jinchengchenghh Can you please take a look whenever you get a moment? Thanks! |
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
1 similar comment
|
Run Gluten Clickhouse CI on x86 |
|
Two questions:
|
…e ignoreCorruptFiles fallback, and document it
|
Run Gluten Clickhouse CI on x86 |
|
@yaooqinn Thanks, both good points. Addressed in 7beb4d2:
Can you please take a look again whenever you get a moment? Thanks! |
What changes are proposed in this pull request?
Fixes #13826
With
ignoreCorruptFilesset, 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, withNo magic bytes found at end of the Parquet filefor 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:
BasicScanExecTransformergetsignoreCorruptFiles,falseby default, anddoValidateInternalfails validation when it is true, next to theignoreMissingFilescheck from [GLUTEN-13180][CORE] Fall back the scan when the ignoreMissingFiles read option differs from the conf #13207. The fallback reason is "The native scan can't skip corrupt files, which ignoreCorruptFiles asks for."FileSourceScanExecTransformer(V1) andBatchScanExecTransformerforParquetScanandOrcScan(V2) take it fromFileSourceOptions(getReadOptions).ignoreCorruptFiles, so the read option wins overspark.sql.files.ignoreCorruptFiles, as in Spark.HiveTableScanExecTransformertakes it from the setting Spark'sHadoopRDDuses for Hive tables:spark.sql.files.ignoreCorruptFilessince Spark 4.0 (SPARK-45316), and the core confspark.files.ignoreCorruptFileson Spark 3.x.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?
VeloxScanSuite, like theignoreMissingFilestest from [GLUTEN-13180][CORE] Fall back the scan when the ignoreMissingFiles read option differs from the conf #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.VeloxHiveScanSuitewith a Hive ORC table that has a good file and a garbage file, read withconvertMetastoreOrc=falseand Hive'sBIsplit 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.gluten-substrait, exactly the two new tests fail, withNo magic bytes found at end of the Parquet fileandCorrupted file, Post script size is invalidfrom the native scan. I ran them in a Linux aarch64 container against main 78e8f82, with the native libraries of the 2026-11-27 nightly bundles for Spark 3.5 and 4.1.backends-veloxcompiles, including test sources, and passesspotless:checkand scalastyle with-Pspark-3.5and with-Pspark-4.1 -Pscala-2.13 -Pjava-17.Enabling/disabling ignoreCorruptFilestest, which every gluten-ut module excluded in the ORC and Parquet V1/V2 query suites as unsupported, now has a Gluten version,GlutenIgnoreCorruptFilesTestingluten-ut/common, which theGlutenParquetV1/V2QuerySuiteandGlutenOrcQuerySuiteof Spark 3.5, 4.0, 4.1 and 4.2 mix in. It keeps Spark's cases where the corrupt files are skipped, by the conf or by the read option, with and without schema inference, and with only corrupt files. Where they aren't skipped, Spark's test checks the error message of Spark's reader, which the native scan doesn't give, so the Gluten version checks that the query fails. The original test stays excluded, with that reason.SPARK_TESTING=trueas in CI. Without the change togluten-substrait, the 4 new tests fail on Spark 3.5, with the native scan'sCorrupted file, Post script size is invalidandParquet file is too small. I ran them in a Linux aarch64 container with the native libraries of the 2026-11-27 nightly bundles.gluten-utcompiles and passesspotless:checkand scalastyle for Spark 3.5, 4.0, 4.1 and 4.2.Was this patch authored or co-authored using generative AI tooling?
Co-authored by: Claude Sonnet 4.5