Repository navigation
feat(spark): count bytes for files opened with buildColumnarReader(file) - #114
Merged
Merged
Conversation
#108 reports native read bytes to Spark, but only through the connector's own scan: VortexReadMetrics is package-private, and the factory's reader that takes a byte counter is private. A data source that builds VortexPartitionReaderFactory itself and reads files one by one, as the event store's history read does, reports 0 input bytes. - VortexReadMetrics is public, with forTask(scan) for a task's cumulative counter, publish() to move worker-thread bytes into the task's input metrics, and currentMetricsValues(). - VortexPartitionReaderFactory.buildColumnarReader(file, metrics) is public. - The connector's own scan gets its counter from forTask, so both paths share one implementation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the public VortexReadMetrics API with self-reporting readers. The public buildColumnarReader(file) now counts its bytes, publishes them on next() and close(), and exposes a cumulative vortexBytesRead shared by every such file in the task. Callers that open files one by one need no changes to report input bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
States the task-thread requirement and that the custom metric is one cumulative total per task. Looks up TaskContext once per reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a392n328
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#108 reports native read bytes only through the connector's own
createColumnarReader.The public
buildColumnarReader(file)still passes a no-op byte counter. So a source that opens files one by one reports 0 input bytes. The event store's history read does this, with a new factory for each file.On a full-scale history read with 0.93.0-qc51, a task reported 9.5 KB of input (its anchors), while S3A counted 37 MB per Vortex file.
Change
buildColumnarReader(file)on both reader factories now returns a reader that reports its own bytes:next()andclose(), the same way the scan reader does.currentMetricsValues()returnsvortexBytesRead. This is one cumulative total for every file opened this way in the task, so it stays correct when each file has its own factory.So callers get input bytes without code changes. To show
vortexBytesRead, a scan declaresVortexBytesReadMetricand forwards the reader's metric values.Known limitation: if several such scans run in one task, each one's
vortexBytesReadshows their combined total. Task input bytes are still correct. This is documented on the method.VortexReadMetricsstays package-private. The scan path and the single-file path share one wrapper.Tests
filesOpenedOneAtATimeReportInputBytes: a test V2 source (OneFileAtATimeSource) reads every file in one task, with a new factory for each file. It runs throughDataSourceRDD, which overwrites input bytes from thread statistics. It checks that task input bytes andvortexBytesReadboth equal the bytes the file system served. It fails without the change.develop:VortexListElementPruningIoTest(4.0) fails withSparkContext was shut downand passes on its own.VortexV1FallbackTest.readsMissingColumnsWithCodegen(3.5) sometimes misses the appended column. Schema inference reads one footer (fix(spark): infer schemas from one footer by default #105).spotlessCheckfails ondevelopbecause ofNestedSchemaPruning.java, which this PR doesn't touch.🤖 Generated with Claude Code