#857 Add source-level record limit - #860
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
WalkthroughThe PR adds a ChangesRecord limit support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SparkRead
participant DefaultSource
participant CobolRelation
participant DecodedRDD
SparkRead->>DefaultSource: supply record_limit
DefaultSource->>CobolRelation: pass recordLimit
CobolRelation->>DecodedRDD: build decoded rows
CobolRelation->>DecodedRDD: applyRecordLimit
DecodedRDD-->>SparkRead: return capped rows
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
JaCoCo code coverage report - 'cobol-parser'
|
JaCoCo code coverage report - 'spark-cobol'
|
Closes #857.
What changed
record_limitread option and parsed it as a non-negative 32-bit integer.CobolParametersandDefaultSourceintoCobolRelation.record_limitis read-only.Behavior
record_limit: existing unlimited behavior is unchanged.record_limit = 0: returns an empty RDD without evaluating parent scan partitions.IllegalArgumentException.The implementation uses a narrow single-partition coalesce and lazily consumes rows until the requested count is reached. This provides a source-level cap and can avoid opening later partitions/files once the cap is satisfied. While enabled, the scan runs through one task. Indexed readers may still build indexes before row consumption.
This does not make
df.limit(N)push down automatically. Cobrix currently implements Spark DataSource V1TableScan, whosebuildScan()API does not receive an optimizer limit. Automatic logical-plan limit pushdown would require a separate DataSource V2 implementation usingSupportsPushDownLimitand a compatibility design spanning Spark 2.4 through 3.5.Validation
Focused suites passed across every supported CI matrix combination (96 test executions total):
CobolParametersParserSuiteCobolRelationSpecCobolParametersValidatorSuiteTest43RecordLimitSpecMatrix:
git diff --checkalso passes.Summary by CodeRabbit
New Features
record_limitSpark read option to cap decoded rows across all input files and paths.Bug Fixes
record_limitoption.