Cap GPU Parquet metadata-only batches by batch size limits [databricks] #16737
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 556 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.378
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16737"
general
weight: 0.35
sdrp713
Fixes #16617.
Description
When none of the requested columns exist in a Parquet file, the GPU readers build one all null batch covering every row of the split. The batch size ignores
spark.rapids.sql.reader.batchSizeRowsandspark.rapids.sql.batchSizeBytes, so large splits can cause GPU OOM. In the multithreaded reader, combining also merged such entries without limit, and a combined row count aboveInt.MaxValuefailed withArithmeticException.To fix this, each metadata only batch is now capped at
min(batchSizeRows, rows that fit in batchSizeBytes). The byte limit is estimated withGpuBatchUtils.estimateGpuMemoryover the output schema, including partition columns.GpuNullBatchIteratorlazily produces null batches up to the cap, under the GPU semaphore andwithRetryNoSplit. The semaphore is acquired for every batch, including an empty read schema. Partition columns may be added on the GPU afterwards, and the per file and coalescing readers already acquired it unconditionally. The multithreaded reader used to skip it for a plaincount(*)partitionSchemaandtargetBatchSizeBytesare passed toAbstractParquetPartitionReader. A per file chunk is already bounded bypopulateCurrentBlockChunk(a single row group is capped atInt.MaxValuerows, other row groups are added only up tomaxReadBatchSizeRows). So per file streaming aboveInt.MaxValuerows never occurs.computeNumRowsAliveis widened toLongonly for consistency.MultiFileCoalescingPartitionReaderBasenow takes targetBatchSizeBytes (passed by the Parquet, ORC and Avro readers) so it can cap metadata-only batches. This base class is shared with ORC and Avro, so their metadata only reads are now capped too.Int.MaxValuerows, stream as multiple batches throughGpuColumnarBatchWithPartitionValuesIterator, which attaches partition values across batch boundaries.Testing
-
GpuNullBatchIteratorSuitecovers the cap math, lazy andLongsized iteration, and that the semaphore is held for an empty schema.-
ParquetCombineSuitecovers combining at and past the cap, oversized entries, a split aboveInt.MaxValuerows, and a per-file read of twoInt.MaxValue-row groups capped to the byte limit.ParquetScanSuitethey check that every batch is at most the cap and the total is exact, under a small byte target, a row limit, and OOM injection. Other tests cover a partition only read andLIMITstopping early.OrcScanSuiteadds an ORC coalescing test with the same per batch checks. Avro inherits the cap through the shared base class and has no test of its own.test_read_parquet_with_empty_clipped_schema_small_batchesadded.Performance The AB run used a 3.5.7 distribution on a Spark2a GPU cluster over NDS SF3k Parquet. It was counterbalanced, with 10 samples per jar and one warm-up iteration.
The workload scans the NDS SF3k store_sales Parquet table through views that declare columns not present in the files (two INT columns, then three BIGINT columns). It runs count(...) over each view, so every row comes back as an all null batch with nothing decoded. A normal two column count over store_sales serves as the control. The two missing column views are the metadata-only path this change affects.
| Query | Old (ms) | New (ms) | Median speedup | p |
|---|---|---|---|---|
| metadata only scan, int | 964 | 972 | 0.99x | 0.79 |
| metadata only scan, long | 867 | 848 | 1.02x | 0.74 |
| normal scan (control) | 1646 | 1604 | 1.03x | 0.47 |
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance