Skip to content

[VL][Delta] Fall back native write on filesystems the Velox writer cannot open - #13386

Merged
zhztheplayer merged 5 commits into
apache:mainfrom
malinjawi:fix/delta-native-write-path-scheme
Nov 24, 2026
Merged

zhztheplayer merged 5 commits into
apache:mainfrom
malinjawi:fix/delta-native-write-path-scheme

Conversation

@malinjawi

@malinjawi malinjawi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

The Velox Parquet writer only opens files on local, HDFS, S3 (s3, s3a, oss, cos, cosn), GCS and ABFS paths (VeloxRuntime::createDataSource). For any other scheme it throws "The file path is not local when writing data with parquet format in velox runtime!". On Spark 4.x, GlutenDeltaNativeWriteGate never looked at the table path, so a native Delta write to, for example, viewfs, wasbs or a custom Hadoop FileSystem failed the task instead of falling back.

This checks the data path's scheme before the native write and uses Delta's writer for the rest. The fallback list in the docs gets the new entry.

Spark 3.5 has no native write gate yet (#13383 adds the first one). The same check can go there once it lands.

Related to #4963, which was filed from DeltaDataFrameHadoopOptionsSuite. Reads on such paths already fall back through the scan's scheme check, and with this change the Delta writes do too. The plain Parquet write in that issue's repro isn't touched here, so this doesn't close it.

How was this patch tested?

  • New case in GlutenDeltaNativeWriteGateSuite; the suite passes locally on Spark 4.1 (19/19).

  • Several Delta Lake 4.4 suites write through a fake or custom Hadoop filesystem and failed with the error above. They now go through Delta's writer and pass, so 28 entries leave the known-failures baseline:

    • DeletionVectorWriteDurabilitySuite (5)
    • the Hadoop-options suites DeltaTableHadoopOptionsSuite (14) and DeltaDataFrameHadoopOptionsSuite (6)
    • the "No AbstractFileSystem" test in HDFSLogStoreSuite and PublicHDFSLogStoreSuite (2)
    • one DeltaGenerateSymlinkManifestSuite test (1)

    The Delta UT gate checks that they pass.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: IBM Bob

@felipepessoto

Copy link
Copy Markdown
Contributor

@malinjawi Thanks for pointing to this from your review of #13502. Partition materialization now exposes the existing filesystem limitation on default Delta 4.4 partitioned writes, so I would prefer to pick up the safe fallback before that PR lands rather than duplicate it there. Could this gate also check native connector availability? The current allowlist accepts s3a/hdfs/gs/abfs even when the corresponding connector is compiled out, whereas VeloxRuntime::createDataSource then throws. Unknown/custom schemes and supported schemes with missing connectors both need fallback. I am keeping this implementation separate from #13502 and documenting the remaining limitation there.

@malinjawi

malinjawi commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

@malinjawi Thanks for pointing to this from your review of #13502. Partition materialization now exposes the existing filesystem limitation on default Delta 4.4 partitioned writes, so I would prefer to pick up the safe fallback before that PR lands rather than duplicate it there. Could this gate also check native connector availability? The current allowlist accepts s3a/hdfs/gs/abfs even when the corresponding connector is compiled out, whereas VeloxRuntime::createDataSource then throws. Unknown/custom schemes and supported schemes with missing connectors both need fallback. I am keeping this implementation separate from #13502 and documenting the remaining limitation there.

Thanks @felipepessoto, good catch on the missing filesystems. Fixed in 7b23034. On top of the scheme allowlist, the gate now checks that Velox actually has the filesystem registered, using the same check the scan uses. So HDFS/S3/GCS/ABFS writes fall back instead of failing when Gluten is built without them.

Thanks as well for working around this in apache/gluten#13502 · [GLUTEN-13500][VL] Support Delta… in the meantime. I’m happy to coordinate the two so they fit together cleanly.

cc: @zhztheplayer and @zhouyuan

@malinjawi
malinjawi marked this pull request as ready for review November 12, 2026 09:18
try {
VeloxFileSystemValidationJniWrapper.allSupportedByRegisteredFileSystems(Array(path))
} catch {
case _: LinkageError | NonFatal(_) => false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the fallback but distinguish a failed JNI call from a negative registry result? A JAR/native-library mismatch can throw UnsatisfiedLinkError here even for file:. Returning false then makes the log say the local filesystem is missing from the build.

I'd let registeredInVelox call JNI directly and move the catch into the allowed-scheme branch of unsupportedPath:

try {
  Option.when(!registered(path.toString)) {
    s"The Velox filesystem for scheme ${scheme.get} is not available in this build"
  }
} catch {
  case e @ (_: LinkageError | NonFatal(_)) =>
    Some(s"Could not check Velox filesystem registration for scheme ${scheme.get}: $e")
}

Both cases still use Delta's writer, and the transaction's existing log records why.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @felipepessoto, good catch, that log message would have been pretty misleading.

I went with your suggestion: registeredInVelox just calls JNI now, and the catch lives in unsupportedPath. So if the probe itself blows up you get a "could not check" reason with the exception, not a claim that the filesystem is missing. Either way it still falls back to Delta's writer.

Added a test for it too. Let me know if anything else looks off.

@malinjawi
malinjawi force-pushed the fix/delta-native-write-path-scheme branch from c0a9396 to 62dae67 Compare November 23, 2026 12:02
@zhztheplayer

Copy link
Copy Markdown
Member

@malinjawi would you help rebase the PR? Thanks.

malinjawi and others added 5 commits November 24, 2026 14:30
…nnot open

The Velox Parquet writer opens files only on local, HDFS, S3 (s3, s3a,
oss, cos, cosn), GCS and ABFS paths, and throws for any other scheme.
On Spark 4.x, GlutenDeltaNativeWriteGate never checked the table path,
so a native Delta write to, for example, viewfs, wasbs or a custom
Hadoop FileSystem failed the task instead of using Delta's writer.

Check the data path's scheme before writing and fall back for the
others. Delta Lake 4.4's DeletionVectorWriteDurabilitySuite writes
through such a filesystem, so its five tests leave the known-failures
baseline.
DeltaTableHadoopOptionsSuite, DeltaDataFrameHadoopOptionsSuite, the
"No AbstractFileSystem" tests of HDFSLogStoreSuite and
PublicHDFSLogStoreSuite, and one DeltaGenerateSymlinkManifestSuite test
write through fake or custom Hadoop filesystems. With the scheme check
those writes go to Delta's writer and pass, so their 23 entries leave
the known-failures baseline.
The scheme allowlist lets HDFS, S3, GCS and ABFS paths through even when
Gluten is built without that filesystem, and VeloxRuntime::createDataSource
then throws. Also require the path to be supported by Velox's registered
filesystems, the check the scan already uses, so those writes fall back too.
If that native probe cannot run, the write falls back rather than failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VeloxDelta4WriteSuite now checks, with the native library loaded, that
local tables pass the filesystem check and that a table on a file system
the Velox writer cannot open falls back to Delta's writer. Both tests fail
without the gate. The docs no longer say Spark 4.x fails at task time on
those file systems.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ystem

A native library that does not match the jar makes the registry probe throw, even for file: paths. The write still falls back, and the logged reason now says the check could not run instead of naming the filesystem as missing from the build.
@malinjawi
malinjawi force-pushed the fix/delta-native-write-path-scheme branch from 62dae67 to a36b4f0 Compare November 24, 2026 11:31
@malinjawi

Copy link
Copy Markdown
Contributor Author

@zhztheplayer Rebased to clear the conflicts. The red x86 jobs are unrelated: Maven Central download failures (tpc, slow-hive) and a flaky Spark 4.1 streaming test. The Delta gate is green. Back to you.

@zhztheplayer
zhztheplayer merged commit 85c8980 into apache:main Nov 24, 2026
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants