-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor how we create listing tables #4227
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6262132
refactor how we create listing tables
timvw 98262af
run linting
timvw 7dfca13
attempt to register default table factories
timvw ef26eab
pass csv as catalog type
timvw 4c39efd
enure that listingschemaprovider can keep working for csv with header
timvw 7b543ff
no need to registery default table factories
timvw 6ab2c7e
remove unused imports
timvw 479f38d
use builder for listingoptions
timvw c8f15a0
remove comment
timvw 1cde797
fix roundtrip test
timvw bef8f78
Update datafusion/core/src/datasource/listing_table_factory.rs
timvw ccca1cf
register a listingtablefactory for NDJSON
timvw 676810d
always verify that a factory is available
timvw 7f79d91
allow NDJSON as an alias for JSON
timvw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ pub struct ListingSchemaProvider { | |
factory: Arc<dyn TableProviderFactory>, | ||
store: Arc<dyn ObjectStore>, | ||
tables: Arc<Mutex<HashMap<String, Arc<dyn TableProvider>>>>, | ||
format: String, | ||
has_header: bool, | ||
} | ||
|
||
impl ListingSchemaProvider { | ||
|
@@ -59,18 +61,24 @@ impl ListingSchemaProvider { | |
/// `path`: The root path that contains subfolders which represent tables | ||
/// `factory`: The `TableProviderFactory` to use to instantiate tables for each subfolder | ||
/// `store`: The `ObjectStore` containing the table data | ||
/// `format`: The `FileFormat` of the tables | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure it matters, but this says |
||
/// `has_header`: Indicates whether the created external table has the has_header flag enabled | ||
pub fn new( | ||
authority: String, | ||
path: object_store::path::Path, | ||
factory: Arc<dyn TableProviderFactory>, | ||
store: Arc<dyn ObjectStore>, | ||
format: String, | ||
has_header: bool, | ||
) -> Self { | ||
Self { | ||
authority, | ||
path, | ||
factory, | ||
store, | ||
tables: Arc::new(Mutex::new(HashMap::new())), | ||
format, | ||
has_header, | ||
} | ||
} | ||
|
||
|
@@ -118,8 +126,8 @@ impl ListingSchemaProvider { | |
schema: Arc::new(DFSchema::empty()), | ||
name: table_name.to_string(), | ||
location: table_url, | ||
file_type: "".to_string(), | ||
has_header: false, | ||
file_type: self.format.clone(), | ||
has_header: self.has_header, | ||
delimiter: ',', | ||
table_partition_cols: vec![], | ||
if_not_exists: false, | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️