fix(compaction): handle omitted compaction_options in compact_files#5225
Open
FANNG1 wants to merge 1 commit into
Open
fix(compaction): handle omitted compaction_options in compact_files#5225FANNG1 wants to merge 1 commit into
FANNG1 wants to merge 1 commit into
Conversation
compact_files() declares compaction_options as Optional with a None default, but passed it straight into Compaction.plan(), whose binding rejects non-dict values — calling compact_files() without explicitly passing compaction_options always raised "TypeError: 'None' is not an instance of 'dict'". Substitute an empty CompactionOptions() (a TypedDict, i.e. an empty dict meaning all defaults) when the caller omits it, and add a regression test exercising the default-argument path. Fixes lance-format#5224
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.
Summary
compact_files()declarescompaction_options: Optional[CompactionOptions] = None, but passes the value straight intoCompaction.plan(dataset, compaction_options).Compaction.plan's binding requires a dict, so callingcompact_files()without explicitly passingcompaction_optionsalways fails with:Fixes #5224.
Change
CompactionOptions()when the caller omits the argument (CompactionOptionsis aTypedDict, so an empty instance means "all defaults").test_compaction_without_options, a regression test exercising the default-argument path — existing tests all passedcompaction_optionsexplicitly, which is why this never surfaced.Testing