Merge scan options into FileIO at TableScan.__init__ time#3258
Open
rccreager wants to merge 1 commit intoapache:mainfrom
Open
Merge scan options into FileIO at TableScan.__init__ time#3258rccreager wants to merge 1 commit intoapache:mainfrom
rccreager wants to merge 1 commit intoapache:mainfrom
Conversation
3 tasks
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.
Closes #3166
Rationale for this change
The
Table.scan(..)method accepts a parameteroptions: Properties; this parameter is not actually threaded into the FileIO instance used in the DataScan class which scans the data. Instead, the internal callers were using a FileIO instance with only the basic catalog-level parameters set and were not respecting the user-specified options.This is resolved by merging scan
optionsinto the FileIO atTableScan.__init__time, using the existingload_file_iomethod. This means that if the user provides new parameters toscan, a new FileIO instance must be created with the merged properties. FileIO properties are immutable after construction, and the cached filesystem objects are built from those properties at first access, so a new instance is required.If the
optionsare empty or if the key:value pairs are all present in the existing FileIO options, you can use the existing FileIO instance.I wanted to fix the problem at initialization, rather than at the various callsites, because
self.iois also used inscan_plan_helper()for manifest reads, not just into_arrow()for data reads. Fixing at init time covers both.Are these changes tested?
I added tests to confirm that the init method has the expected behavior.
Are there any user-facing changes?
Yes. Scan-level options passed to Table.scan(options=...) are now respected by the underlying FileIO during data and manifest reads. Previously these options were silently ignored.