← Back to Pull requests

[FEA] Configure RapidsFileIO and route file reads and writes by URI scheme [databricks] #17055

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 20, 2026 02:08 UTC
Author

Fixes #17025.
Stacked on #17054.

Description

An application selects how RAPIDS opens data files with spark.rapids.sql.fileio.impl. Its registered default is com.nvidia.spark.rapids.fileio.hadoop.HadoopFileIO (both HadoopFileIO and ResolvingRapidsFileIO are also accepted by simple name). A custom implementation must be a public concrete RapidsFileIO with a public java.util.Map<String, String> constructor. RAPIDS strips spark.rapids.sql.fileio. and consumes the selecting impl key while preserving the original string values.

FileIOConfig and ResolvingRapidsFileIO live in sql-plugin-fileio. RapidsConf.fileIOConfig lazily caches a snapshot of the session settings, and RapidsConf.fileIOConfig(SQLConf) reads directly from SQLConf via TrampolineUtil.getPrefixedSqlConfs (skipping option scanning for HadoopFileIO) so callers without an existing RapidsConf avoid copying the full conf map. Driver planning eagerly validates top-level and per-scheme custom classes, modifiers, Map constructors, and scheme-key casings via ResolvingRapidsFileIO.parseRoutes (supporting dotted URI schemes such as custom.io:// while preserving dotted options such as s3.client.impl and rejecting conflicting case variants).

Parquet and ORC reader factories share BroadcastedFileIO and write jobs use GpuWriteJobDescription to broadcast FileIOConfig (registered with KryoJavaSerializer in GpuKryoRegistrator so both Java serialization and KryoSerializer — including spark.kryo.registrationRequired=true — are supported) and construct RapidsFileIO lazily once per task on executors. ResolvingRapidsFileIO and custom AutoCloseable RapidsFileIO implementations are closed via Spark task completion listeners when the task ends; ResolvingRapidsFileIO also tracks closure (volatile boolean closed) so any delegate constructed concurrently with close() is removed and closed once rather than leaked. Non-FileIO reader factories (CSV, JSON, Avro, Hive text) do not broadcast FileIOConfig.

This covers GPU Parquet and ORC reads (including hybrid Parquet scans, which restrict KvikIO local-file reads to exact HadoopFileIO and keep custom RapidsFileIO implementations and HadoopFileIO subclasses on RapidsFileIORangeReader), writes through the shared GPU file-format writer, and OSS Delta Lake on-disk deletion vectors with pushdown enabled. Parquet passes known PartitionedFile.fileSize via newInputFile(path, length) to avoid extra S3/GCS metadata HEAD requests on HadoopFileIO and validates footerIndex bounds in ParquetFooterUtils.readFooterBufferFromInputFile before allocating host buffers. IcebergS3InputFile records recordPerfioS3BackendOnce so Iceberg-on-S3 PerfIO task metrics remain intact. Dictionary and Bloom filter pruning retain ParquetFileReader through Hadoop, and CSV/JSON/Avro/Hive text, legacy/Databricks Delta DVs, Spark file discovery/commits, and Iceberg table I/O continue using their existing paths. Follow-up #17200 tracks simplifying HadoopFileIO with this configuration framework.

AI assistance was used to implement and test this change.

Verification

Validated commit cb5bbea4308022e7b3b9f99eb2576a51d62a35e2 (combined with main 6283d81f92296a24bc91d19e5ba91da61173f477) on 2026-12-04:

  • Scala unit tests (Spark 3.5.9, local RTX 5880 Ada GPU): 28 succeeded, 0 failed across RapidsFileIOSuite (18/18, including latch-controlled concurrent ResolvingRapidsFileIO.close() delegate cleanup and local hybrid Parquet scan with a HadoopFileIO subclass), HybridScanNativeFileSuite (8/8), and GpuKryoRegistratorSuite (2/2, including GPU Parquet & ORC scans with spark.kryo.registrationRequired=true); additionally on 350a0c5038 / 4f7f7a0b21, GpuFileFormatDataWriterSuite, OrcPerfIOReadSuite, IcebergS3InputFileSuite, and RapidsConfSuite all passed.

  • Builds, style, & static shim preflight: Packaged cleanly for Spark 3.3.0 (Scala 2.12), Spark 3.5.9 (Scala 2.12, full tests reactor), and Spark 4.0.4 (Scala 2.13). scalastyle-all-modules (0 errors/warnings), with-resource-nesting-audit, test_root_safe_provider_selection.py, iceberg-matrix-tests, and static shim preflight across all 34 main profiles (330–421, including 400db173 and 410db183) all passed with 0 new findings.

  • Full PySpark integration tests (EC2 g6.4xlarge L4 GPU, INCLUDE_SPARK_AVRO_JAR=true ./run_pyspark_from_build.sh, previously run on 1ff4fcfef9): Spark 3.3.0 (Scala 2.12) passed 30,896/30,896 (0 failed); Spark 4.0.2 (Scala 2.13) passed 32,364/32,364 (0 failed).

  • Remaining validation gaps: Databricks runtime profiles (400db173, 410db183) are validated statically via shim preflight only (no local Databricks JARs). S3/GCS end-to-end runs on this head (including Parquet and Iceberg S3 path tests) remain to be run against S3/GCS storage.
  • Performance

    On Spark 3.5.9 and a local RTX 5880 Ada GPU (measured on feff4baaa40e055ef7ca9b5f67d980c1ad436629), a filtered Parquet aggregation over 2 million rows in 16 files had a median of 73.85 ms with the default HadoopFileIO and 75.21 ms with ResolvingRapidsFileIO falling back to Hadoop. Each setting had three warmups and nine interleaved measurements.

    Reader and writer setup paths that only hold SQLConf avoid copying SQLConf.getAllConfs, using a single FILE_IO_IMPL.get(sqlConf) lookup for HadoopFileIO and prefix-only scanning of SQLConf.settings for custom implementations. Parquet passes PartitionedFile.fileSize via newInputFile(path, length) so HadoopInputFile / S3InputFile / GCSInputFile return the known length directly without an extra S3 HEAD or GCS metadata request, and ParquetFooterUtils.readFooterBufferFromInputFile prefetches a 64 KiB tail in a single suffix-range read. Parquet/ORC reader factories and write jobs broadcast FileIOConfig rather than serializing RapidsFileIO, while non-FileIO reader factories (CSV, JSON, Avro, Hive text) do not create any FileIOConfig broadcast.

    Dictionary and Bloom filter pruning still require Hadoop read access even when data and footer reads use a custom FileIO. Production cloud latency remains unmeasured.

    Checklists

    Documentation

  • Updated for new or modified user-facing features or behaviors

  • No user-facing change
  • Testing

  • Added or modified tests to cover new code paths

  • Covered by existing tests

  • Not required
  • Performance

  • Tests ran and results are added in the PR description

  • Issue filed with a link in the PR description

  • Not required
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: gerashegalov Review duration: 22047m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.75) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #17055"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 43.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 42.9% · Moderate risk
    42.9%