-
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
Simplify creating new ListingTable
#1705
Comments
I think the usecase of defaulting schema and format makes a lot of sense If you are going to change the signature of Something like struct ListingTableConfig {
object_store: Arc<dyn ObjectStore>,
table_path: String,
file_schema: Option<SchemaRef>,
options: Option<ListingOptions>
}
impl LIstingTableConfig {
fn new(object_store: Arc<dyn ObjectStore>, table_path: impl Into<String>) -> Self {
..
}
fn with_schema(mut self, schema: SchemaRef) -> Self {
...
}
fn with_options(mut self, listing_options: ListingOptions) -> Self {
..
}
} And then your example could look like let config = ListingTableConfig::new(
object_store,
"data/alltypes_plain.snappy.parquet"
);
let table = ListingTable::new(config); |
@alamb great idea. Will do that. |
Both of your idea and @alamb's suggestions of builder pattern sounds like a good plan to me 👍 Thank you for bring this up. |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and why for this feature, in addition to the what)
I think that we can simplify creating a
ListingTable
by using some simple inference and reasonable defaults forListingOptions
andSchema
Describe the solution you'd like
A clear and concise description of what you want to happen.
I would like to update the signature to go from:
to
Then, we can look at the suffix of the
table_path
to infer a file type and use that for theformat
andfile_extension
parameters ofListingOptions
. We could use the below as defaults for the other parameters:We could then use
listing_options
to create aSchema
The end result is a much simpler interface for creating tables.
Old
New
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: