-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix inconsistent schema projection in ListingTable when file order varies by tracking schema source #16305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kosiew
wants to merge
21
commits into
apache:main
Choose a base branch
from
kosiew:list-table-config-file-schema-16270
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+560
−457
Conversation
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
…le files in ListingTableConfig
47fcdae
to
a40a448
Compare
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.
Which issue does this PR close?
ListingTableConfig
#16270Rationale for this change
Understanding the origin of a schema (whether it was inferred or explicitly specified) is important for debugging, reproducibility, and behavioral consistency in systems like DataFusion that operate on dynamic data sources. Previously, this information was not available in the
ListingTable
or its configuration, making it hard to reason about schema behavior.What changes are included in this PR?
Schema-source metadata
SchemaSource
enum to track the origin of a schema (None
,Inferred
,Specified
).ListingTableConfig
andListingTable
to carry and expose this metadata.schema_source()
) to inspect schema origin in both config and table.Imports cleanup
table.rs
for clarity and consistency.Test refactoring & additions
read_single_file
.test_table_stats_behaviors
.test_list_files_configurations
.test_insert_into_parameterized
.SchemaSource
cases:test_schema_source_tracking_comprehensive
infer_preserves_provided_schema
create_test_schema
,generate_test_files…
).Deleted tests → New tests mapping
read_single_file
(old)read_single_file
(refactored)do_not_load_table_stats_by_default
load_table_stats_when_no_stats
test_table_stats_behaviors
test_assert_list_files_for_scan_grouping
test_assert_list_files_for_multi_path
test_assert_list_files_for_exact_paths
test_list_files_configurations
test_insert_into_append_new_json_files
test_insert_into_append_new_csv_files
test_insert_into_append_2_new_parquet_files_defaults
test_insert_into_append_1_new_parquet_files_defaults
test_insert_into_parameterized
Are these changes tested?
read_single_file
,test_table_stats_behaviors
test_schema_source_tracking_comprehensive
,infer_preserves_provided_schema
test_list_files_configurations
test_insert_into_parameterized
Shared helpers and parameterized loops ensure that every previously tested scenario is still exercised, with improved maintainability and coverage.
Are there any user-facing changes?
Yes:
ListingTable
now exposes aschema_source()
method, enabling downstream consumers to programmatically check the origin of the schema.There are no breaking changes to the public API, but the enhancement provides improved introspection capabilities.