You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/09/16 08:56:24 UTC
[GitHub] [arrow-datafusion] rdettai opened a new pull request #1010: Reorganize table providers by table format
rdettai opened a new pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010
# Which issue does this PR close?
Closes 1009.
# Rationale for this change
Currently the `TableProvider` implementations are split by file format (Parquet, CSV...). One other solution would be to organize `TableProvider`s would be by table format (file system listing, Iceberg, [Delta](https://github.com/delta-io/delta-rs/blob/main/rust/src/delta_datafusion.rs)). **This is discussed in this [design document](https://docs.google.com/document/d/1Bd4-PLLH-pHj0BquMDsJ6cVr_awnxTuvwNJuWsTHxAQ/edit?usp=sharing).**
# What changes are included in this PR?
- this change will delete the file format specific implementation of `TableProvider`
- this change will remove the `TableDescriptor` abstraction
- this change will replace the `GetFileMetadata` Ballista rpc endpoint with `GetSchema`
# Are there any user-facing changes?
The current implementations of `TableProvider` will be replaced, but this will partly be abstracted by methods such as `ExecutionContext.read_parquet()` or `ExecutionContext.read_sql()`
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-926453208
Thank you again for your feedback. I don't mind having to manage a large PR, my only concern is the reviewer experience as it is crucial to allow us to lead this to the merge 😉. I have created a PR to the PR https://github.com/rdettai/arrow-datafusion/pull/1 with the addition of the `ObjectStore` abstraction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714234694
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
Review comment:
I think that it is still a "TODO" to use `ObjectStore` in this module
What do you think about doing that in this PR? The use of `ObjectStore` seems like one of the key outcomes of this restructuring work to me, so I do wonder about postponing it (especially as this proposed PR is additive and doesn't change the existing providers)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-925611895
Thanks for all your great feedback!
> How do you deal with a table with mixed file format? I didn't get the possibilities in the current implementation. I perceive it as the biggest benefit from this reorganization.
Frankly speaking, I have never met a case of mixed file formats, so I wouldn't really know what is important to take into consideration. Can you describe your usecase precisely? Do you have an example of API that supports it?
> I agree with @alamb on putting ObjectStore listing API in use in this PR, I think we have all prerequisites needed to use it for real. Since you already made scan in TableProvider async and doing the refactor of data sources in this one.
Sold! I'm working in it 😄
> Will this refactor wipe out all the git history for each source file? both in datasource module and in physical_plan module? I think at least we should remove the deprecated ones in the same PR to preserve git history for each file?
I think that the change is so massive that git will not recognize it as the previous files anyway, especially in the `datasource` module. This is a bit annoying but not sure we can do much about it :grimacing:
> Again, does it make much sense to reorder the ones in physcial_plan? I didn't quite get the reason here.
By "reorder", you mean moving them to a separate folder? The `physical_plan` folder is pretty huge, so I thought restructuring it a bit wouldn't harm. Also, it creates a nice symmetry with the folder structure in `datasource`.
> I think at least we should remove the deprecated ones in the same PR to preserve git history for each file?
We can, but it would make this PR huuuuuuuuge. From the development side, that's ok, but for the reviewers it might get tricky. @alamb @houqp what do you think about it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924131108
@houqp @alamb @yjshen this is now getting closer to what I am targeting. Some notes for anyone who would want to go through the code:
- I have duplicated the `TableProvider` and the `ExecutionPlan` implementations for the file formats (parquet, csv, json). The objective is to remove the old ones once this is functional.
- In general, I am trying to minimize the number of constructor overloading because I find them very hard to read and test
- The `ListingTable` does not support partitioning yet, but the stubs are there to show how and where it will be implemented. I don't plan to include implementations in this PR.
- The `ListingTable` and `FileFormat` implems still use the file system calls. The next step (another PR) will be to use the `ObjectStore`.
- Avro is missing from the `FileFormat` trait implems, I will add it while finalizing this PR.
- On the Ballista side I have only added a few function stubs. I will probably remove those before finalizing this PR and add them back with their implementation in a further PR.
- I know the datasource side lacks tests as I have not ported existing ones yet. I will do this before finalizing this PR.
Note that I am really trying not to add any feature, just re-organize the code. But I think that ones this is done, it will be fairly easy to add the Hive partitioning implem and use the ObjectStore.
I know it is a lot to ask (as this is again a fairly large change) but it would be great if you could take a "quick" look and at least validate the overall approach. Thanks 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924929358
I hope to have a look at this PR later today
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-937944518
haven't finished yet but I am making good progress. I'll submit the PR tomorrow 😉
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
Dandandan commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-942686567
Wow thank you so much @rdettai truly astonishing work!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714652205
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
Review comment:
Interesting turn of event, I just realized that the `LocalFileReader` reader from `ObjectReader` isn't fully implemented yet. 🙃
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] yjshen commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
yjshen commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-925786194
> Frankly speaking, I have never met a case of mixed file formats, so I wouldn't really know what is important to take into consideration. Can you describe your usecase precisely? Do you have an example of API that supports it?
I may get this wrong if you are not implying it's possible that a table can have its data in different file formats in the original doc.
I thought data lake implementations may store regular data in a columnar format such as parquet, and deltas (add or removes) in a row-based format like Avro or JSON, which makes me feel similar to SAP HANA http://www.vldb.org/pvldb/vol5/p061_jenskrueger_vldb2012.pdf and HyPer http://db.in.tum.de/downloads/publications/datablocks.pdf
If it is not the case for existing implementations and not the intention of the PR, please just ignore this one.
> By "reorder", you mean moving them to a separate folder? The physical_plan folder is pretty huge, so I thought restructuring it a bit wouldn't harm.
Yes, I find it hard to tell what has been removed and what are the additions for the physical_plan files.
I diff the files manually and find out `try_new_from_reader`s have been removed from JSON/Avro/CSV, I think it is worth some reasons for the removal to avoid something just slipped away silently. (because I'm not familiar with the use case of these existing readers).
For the removal of `TableDescriptor` I think is fine since we now have `ListingTable`'s scan method that takes care of listing and partition files.
But I what really want to argue is: why should we use diff manually and leave git diff away? Where can I find the original PR and related issue while reading code but it points to a reorganize PR with little information about it?
Do I have to browse through all the discussions in this PR to find out another separate PR that contains the removal of the stale code? And dig again into the history of that removed file and finally find the right background I need?
If we are following the rule that each PR should target at one problem, why should we tell apart reorganize PR into one addition and one stale-removal? And why do we involve restructure the physical_plan module for "nice symmetry" but leave "git will not recognize it as the previous files "?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] yjshen commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
yjshen commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714511626
##########
File path: datafusion/src/datasource/file_format/mod.rs
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Module containing helper methods for the various file formats
+
+pub mod avro;
+pub mod csv;
+pub mod json;
+pub mod parquet;
+
+use std::pin::Pin;
+use std::sync::Arc;
+
+use crate::arrow::datatypes::SchemaRef;
+use crate::datasource::{create_max_min_accs, get_col_stats};
+use crate::error::Result;
+use crate::logical_plan::Expr;
+use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
+
+use async_trait::async_trait;
+use futures::Stream;
+
+/// A stream of String that can be used accross await calls
+pub type StringStream = Pin<Box<dyn Stream<Item = String> + Send + Sync>>;
+
+/// Convert a vector into a stream
+pub fn string_stream(strings: Vec<String>) -> StringStream {
+ Box::pin(futures::stream::iter(strings))
+}
+
+/// This trait abstracts all the file format specific implementations
+/// from the `TableProvider`. This helps code re-utilization accross
+/// providers that support the the same file formats.
+#[async_trait]
+pub trait FileFormat: Send + Sync {
+ /// Open the files at the paths provided by iterator and infer the
+ /// common schema
+ async fn infer_schema(&self, paths: StringStream) -> Result<SchemaRef>;
+
+ /// Open the file at the given path and infer its statistics
+ async fn infer_stats(&self, path: &str) -> Result<Statistics>;
+
+ /// Take a list of files and convert it to the appropriate executor
+ /// according to this file format.
+ /// TODO group params into TableDescription(schema,files,stats) and
+ /// ScanOptions(projection,batch_size,filters) to avoid too_many_arguments
+ #[allow(clippy::too_many_arguments)]
+ async fn create_executor(
Review comment:
The name `executor` seems vague to me. Since it creates a scan physical plan, can we name it more precisely?
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
Review comment:
Regarding the comments here, we haven't think about how to deal with default partition semantics yet.
I.e while inserting a table with a partition column values NULL, how do we deal with a=20210922/b=NULL/1.parquet? how to differentiate if the NULL is a valid string value or it denotes none exists?
I recall Hive have `__HIVE_DEFAULT_PARTITION__` for this purpose.
##########
File path: datafusion/src/datasource/file_format/mod.rs
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Module containing helper methods for the various file formats
+
+pub mod avro;
+pub mod csv;
+pub mod json;
+pub mod parquet;
+
+use std::pin::Pin;
+use std::sync::Arc;
+
+use crate::arrow::datatypes::SchemaRef;
+use crate::datasource::{create_max_min_accs, get_col_stats};
+use crate::error::Result;
+use crate::logical_plan::Expr;
+use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
+
+use async_trait::async_trait;
+use futures::Stream;
+
+/// A stream of String that can be used accross await calls
+pub type StringStream = Pin<Box<dyn Stream<Item = String> + Send + Sync>>;
+
+/// Convert a vector into a stream
+pub fn string_stream(strings: Vec<String>) -> StringStream {
+ Box::pin(futures::stream::iter(strings))
+}
+
+/// This trait abstracts all the file format specific implementations
+/// from the `TableProvider`. This helps code re-utilization accross
+/// providers that support the the same file formats.
+#[async_trait]
+pub trait FileFormat: Send + Sync {
+ /// Open the files at the paths provided by iterator and infer the
+ /// common schema
+ async fn infer_schema(&self, paths: StringStream) -> Result<SchemaRef>;
Review comment:
Maybe `FileMetaStream` as arguments instead?
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
+ /// Note that only `DataType::Utf8` is supported for the column type.
+ /// TODO implement case where partitions.len() > 0
+ pub partitions: Vec<String>,
Review comment:
Does it make sense to have `partitions` a schema instead of `Vec<String>`, and introduce a cast if needed from path string to its `partition_values` or `Vec<ScalarValue>`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-921227556
`Too many APIs are async in the rust ecosystem, we want to be able to use them in the planning 😄`
Once `async` has creeped into the stack, I think it ends up getting pretty far down..
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai edited a comment on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai edited a comment on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924131108
@houqp @alamb @yjshen this is now getting closer to what I am targeting. Some notes for anyone who would want to go through the code:
- I have duplicated the `TableProvider` and the `ExecutionPlan` implementations for the file formats (parquet, csv, json). The objective is to remove the old ones once this is functional.
- In general, I am trying to minimize the number of constructor overloading because I find them very hard to read and test
- The `ListingTable` does not support partitioning yet, but the stubs are there to show how and where it will be implemented. I don't plan to include implementations in this PR.
- The `ListingTable` and `FileFormat` implems still use the file system calls. The next step (another PR) will be to use the `ObjectStore`.
Note that I am really trying not to add any feature, just re-organize the code. But I think that ones this is done, it will be fairly easy to add the Hive partitioning implem and use the ObjectStore.
I know it is a lot to ask (as this is again a fairly large change) but it would be great if you could take a "quick" look and at least validate the overall approach. Thanks 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714601397
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
Review comment:
From what I know, there isn't an official standard regarding this partitioning. The feature set that I am proposing here is pretty basic:
- you should know the partitions in advance an specify them
- files that don't comply are ignored
- all partition values will be read with type string
I believe this feature set is simple to implement and understand, it is predictable, and it covers most usecases:
- if your partitioning type is not string, you can cast it later in your query as you want
- if you have encoded NULL somehow, you can also parse that with a CASE expression in your query
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714603700
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
+ /// Note that only `DataType::Utf8` is supported for the column type.
+ /// TODO implement case where partitions.len() > 0
+ pub partitions: Vec<String>,
Review comment:
See https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714601397
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-936573494
> It looks like we are almost there in terms removing the legacy code.
I'll give it a try tomorrow and I'll submit the result in another PR to the PR 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb merged pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-942964524
Indeed, legendary PR @rdettai ! Also really cool to see @yjshen 's object store in action.
Now the arrow2 branch merge is going to be really fun :D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714601397
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
Review comment:
From what I know, there isn't an official standard regarding this partitioning. The feature set that I am proposing here is pretty basic:
- you should know the partitions in advance an specify them
- files that don't comply are ignored
- all partition values will be read with type string
I believe this feature set is simple to implement and understand, it is predictable, and it covers most usecases:
- if your partitioning type is not string, you can cast it later in your query as you want
- if you have encoded NULL somehow, you can also parse that with a CASE expression in your query
- performance wise, we can have an equally efficient materialization into an Arrow array than most types if we use [dictionary encoding](https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-920922893
TLDR: I wonder "if DataFusion planning was `async` would you be able to implement the table format as you would like"?
I really like the idea of splitting the details of reading formats from the "metadata management" (called "table format" in the linked doc) so that users of DataFusion can extend DataFusion to manage metadata in ways suited to their use.
I thought, however, we were headed towards a slightly different abstraction where would still have a `ParquetReader` that didn't use `Path` / `File` directly, but instead would use the [`ObjectStore`](https://github.com/apache/arrow-datafusion/blob/6f531807176e49110c33a01722014552024fa412/datafusion/src/datasource/object_store/mod.rs#L77) abstraction recently added by @yjshen.
In terms of the document, https://docs.google.com/document/d/1Bd4-PLLH-pHj0BquMDsJ6cVr_awnxTuvwNJuWsTHxAQ/edit?usp=sharing, my biggest takeaway was that:
1) Any `TableProvider` needs to provide the schema (columns, types) without almost any information from the query to create a `LogicalPlan`
2) The details of how `statistics()` and `scan()` work will be different based on:
- The actual file format (parquet, json, etc)
- The cost of accessing the statistics and creating requested `ExecutionPlan`s (e.g. a bunch of remote files on S3 vs cached in memory copies)
At the moment, the user has to synchronously create a `TableProvider` for each named table in the query and (synchronously) provide the Schema, as well as synchronously provide statistics. The creating of `ExecutionPlans` via `execute` is already `async`.
This, I am wondering if the fetching of the `TableProvider` and statistics creation was `async`, would that be sufficient?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714076692
##########
File path: datafusion/src/logical_plan/expr.rs
##########
@@ -2107,4 +2107,27 @@ mod tests {
assert!(exp2 < exp3);
assert!(exp3 > exp2);
}
+
+ #[test]
+ fn combine_zero_filters() {
+ let result = combine_filters(&[]);
+ assert_eq!(result, None);
+ }
+
+ #[test]
+ fn combine_one_filter() {
+ let filter = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let result = combine_filters(&[filter.clone()]);
+ assert_eq!(result, Some(filter));
+ }
+
+ #[test]
+ fn combine_multiple_filters() {
+ let filter1 = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let filter2 = binary_expr(col("c2"), Operator::Lt, lit(2));
+ let filter3 = binary_expr(col("c3"), Operator::Lt, lit(3));
+ let result =
+ combine_filters(&[filter1.clone(), filter2.clone(), filter3.clone()]);
+ assert_eq!(result, Some(and(and(filter1, filter2), filter3)));
+ }
Review comment:
this tests were in the wrong place (`datasource::parquet.rs`), moving them here to avoid losing them
##########
File path: datafusion/src/logical_plan/expr.rs
##########
@@ -2107,4 +2107,27 @@ mod tests {
assert!(exp2 < exp3);
assert!(exp3 > exp2);
}
+
+ #[test]
+ fn combine_zero_filters() {
+ let result = combine_filters(&[]);
+ assert_eq!(result, None);
+ }
+
+ #[test]
+ fn combine_one_filter() {
+ let filter = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let result = combine_filters(&[filter.clone()]);
+ assert_eq!(result, Some(filter));
+ }
+
+ #[test]
+ fn combine_multiple_filters() {
+ let filter1 = binary_expr(col("c1"), Operator::Lt, lit(1));
+ let filter2 = binary_expr(col("c2"), Operator::Lt, lit(2));
+ let filter3 = binary_expr(col("c3"), Operator::Lt, lit(3));
+ let result =
+ combine_filters(&[filter1.clone(), filter2.clone(), filter3.clone()]);
+ assert_eq!(result, Some(and(and(filter1, filter2), filter3)));
+ }
Review comment:
these tests were in the wrong place (`datasource::parquet.rs`), moving them here to avoid losing them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-921034340
> I thought, however, we were headed towards a slightly different abstraction where would still have a ParquetReader that didn't use Path / File directly, but instead would use the ObjectStore abstraction recently added by @yjshen.
Correct, that will be the next step
> TLDR: I wonder "if DataFusion planning was async would you be able to implement the table format as you would like"?
Yes, that would really bring a huge amount of flexibility. A funny example: I have just added a sketch implementation of the partition pruning algorithm. One interesting approach is to load the partitions into a `RecordBatch` to be able to run the pushed down filter on it. DataFusion inside Datafusion! But we are stuck because that requires `async`. Too many APIs are async in the rust ecosystem, we want to be able to use them in the planning 😄
I am going to try to make the `TableProvider.scan()` method async, and if it works I'll submit that in a separate PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714601397
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
Review comment:
From what I know, there isn't an official standard regarding this partitioning. The feature set that I am proposing here is pretty basic:
- you should know the partitions in advance an specify them
- files that don't comply are ignored
- all partition values will be read with type string
I believe this feature set is simple to implement and understand, it is predictable, and it covers most usecases:
- if your partitioning type is not string, you can cast it later in your query as you want
- if you have encoded NULL somehow, you can also parse that with a CASE expression in your query
- performance wise, we can have an equally efficient materialization into an Arrow array if we use [dictionary encoding](https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai edited a comment on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai edited a comment on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924131108
@houqp @alamb @yjshen this is now getting closer to what I am targeting. Some notes for anyone who would want to go through the code:
- I have duplicated the `TableProvider` and the `ExecutionPlan` implementations for the file formats (parquet, csv, json). The objective is to remove the old ones once this is functional.
- In general, I am trying to minimize the number of constructor overloading because I find them very hard to read and test
- The `ListingTable` does not support partitioning yet, but the stubs are there to show how and where it will be implemented. I don't plan to include implementations in this PR.
- The `ListingTable` and `FileFormat` implems still use the file system calls. The next step (another PR) will be to use the `ObjectStore`.
- [x] Avro is missing from the `FileFormat` trait implems, I will add it while finalizing this PR.
- [ ] On the Ballista side I have only added a few function stubs. I will probably remove those before finalizing this PR and add them back with their implementation in a further PR.
- [x] the datasource side lacks tests as I have not ported existing ones yet. I will do this before finalizing this PR.
Note that I am really trying not to add any feature, just re-organize the code. But I think that ones this is done, it will be fairly easy to add the Hive partitioning implem and use the ObjectStore.
I know it is a lot to ask (as this is again a fairly large change) but it would be great if you could take a "quick" look and at least validate the overall approach. Thanks 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-926330270
To @yjshen 's point of supporting mixed file formats, it's totally a valid use-case and a widely adopted practice. But I agree with @alamb that we don't need to make the list table do everything now. We can keep it simple to only support partitioned table with single file format. For these more complex mixed file format table formats, they typically have their own specific file organization and schema management logics, so it would be hard to come up with one table provider to capture them all. For example, Hudi uses avro and parquet, DeltaLake uses parquet and json, etc. The better approach in my mind is to create table format specific providers for each of these specialized table formats as plugins.
I also think there is value in grouping logically coupled changes into a single commit so it's easier to do git diff. I care less about whether git is smart enough to keep track of the file rename, but at least being able to do a git blame and find all logical related changes to this single commit helps a lot. I totally understand how painful it is to do a large PR because of the needs of having to constantly manage merge conflicts, so I am happy to help if there is anything I can do on my end to alleviate your pain. Just let me know ;) I think it's a good tradeoff do a bit of extra work now for the peace of mind in the future.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-934768426
TLDR: this PR (after including the code in https://github.com/rdettai/arrow-datafusion/pull/1) extracts the file format and the file manipulation parts of the CSV, Avro, Parquet and Json providers so they can be reused and alternate, non file based table providers can be implemented more easily.
However, at the moment the PR is entirely additive (adds all new code, doesn't remove the old table providers).
However, I would like to propose:
1. merging https://github.com/rdettai/arrow-datafusion/pull/1 into this PR
2. merging this pr into datafusion/master
3. Do follow on PR(s) refactor the old table providers (e.g.`ParquetExec` et al) to use the ne code
cc @Dandandan, @houqp , @yjshen, @Jimexist
There is a risk of having the both sets of datasource implementations live on master for some time, but I think it would be better than an even larger PR.
Given @rdettai 's track record and the amount of PR review @houqp @yjshen and I have done already, I think the risk that we end up in a split brain state for an extended period of time is minimal
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-935662269
+1 for merging https://github.com/rdettai/arrow-datafusion/pull/1 into this PR.
I think the changes in this PR is really really solid. I think the newly added code is ready to merge for sure. My only recommendation would be to remove the old format execution plan code in the same PR to make git blame easier to keep track of the changes and the git diff easier to reason for future developers. It looks like we are almost there in terms removing the legacy code. We can even just wrap the existing csv/parquet/json table providers with the new list table providers and call it a day. The biggest pain with long running PRs is conflict resolution. But given what we have right now is only additive change, I think there is not much of a difference between sending follow up clean up PRs into this PR v.s. master. I could help with the final clean up too during weekends if you want to keep this PR going.
That said, it's not a strong no from me and I am cool with us merging it into master if you all think this would speed up the iteration process.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-939994423
@houqp @alamb I finally managed to propagate the provider change everywhere in https://github.com/rdettai/arrow-datafusion/pull/2 ! As you will see, it implies a lot of changes, mostly mechanical ones 😃
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-937473432
Sounds good, thanks @rdettai for being patient with this big change :) I should be able to with the clean up in two days if you still need a second hand by then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-942533273
🚀 -- thank you so much @rdettai / @houqp / @yjshen and everyone else who worked to make this happen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-942533273
🚀 -- thank you so much @rdettai / @houqp / @yjshen and everyone else who worked to make this happen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714513596
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
Review comment:
I think your are right. I didn't want to add `ObjectStore` useage yet to keep the PR simpler, but it definitively makes sense to do it all at once.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714590077
##########
File path: datafusion/src/datasource/file_format/mod.rs
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Module containing helper methods for the various file formats
+
+pub mod avro;
+pub mod csv;
+pub mod json;
+pub mod parquet;
+
+use std::pin::Pin;
+use std::sync::Arc;
+
+use crate::arrow::datatypes::SchemaRef;
+use crate::datasource::{create_max_min_accs, get_col_stats};
+use crate::error::Result;
+use crate::logical_plan::Expr;
+use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
+
+use async_trait::async_trait;
+use futures::Stream;
+
+/// A stream of String that can be used accross await calls
+pub type StringStream = Pin<Box<dyn Stream<Item = String> + Send + Sync>>;
+
+/// Convert a vector into a stream
+pub fn string_stream(strings: Vec<String>) -> StringStream {
+ Box::pin(futures::stream::iter(strings))
+}
+
+/// This trait abstracts all the file format specific implementations
+/// from the `TableProvider`. This helps code re-utilization accross
+/// providers that support the the same file formats.
+#[async_trait]
+pub trait FileFormat: Send + Sync {
+ /// Open the files at the paths provided by iterator and infer the
+ /// common schema
+ async fn infer_schema(&self, paths: StringStream) -> Result<SchemaRef>;
+
+ /// Open the file at the given path and infer its statistics
+ async fn infer_stats(&self, path: &str) -> Result<Statistics>;
+
+ /// Take a list of files and convert it to the appropriate executor
+ /// according to this file format.
+ /// TODO group params into TableDescription(schema,files,stats) and
+ /// ScanOptions(projection,batch_size,filters) to avoid too_many_arguments
+ #[allow(clippy::too_many_arguments)]
+ async fn create_executor(
Review comment:
agreed, changing it to `create_physical_plan` (just like in `ExecutionContext`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai edited a comment on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai edited a comment on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924131108
@houqp @alamb @yjshen this is now getting closer to what I am targeting. Some notes for anyone who would want to go through the code:
- I have duplicated the `TableProvider` and the `ExecutionPlan` implementations for the file formats (parquet, csv, json). The objective is to remove the old ones once this is functional.
- In general, I am trying to minimize the number of constructor overloading because I find them very hard to read and test
- The `ListingTable` does not support partitioning yet, but the stubs are there to show how and where it will be implemented. I don't plan to include implementations in this PR.
- The `ListingTable` and `FileFormat` implems still use the file system calls. The next step (another PR) will be to use the `ObjectStore`.
- [ ] Avro is missing from the `FileFormat` trait implems, I will add it while finalizing this PR.
- [ ] On the Ballista side I have only added a few function stubs. I will probably remove those before finalizing this PR and add them back with their implementation in a further PR.
- [x] the datasource side lacks tests as I have not ported existing ones yet. I will do this before finalizing this PR.
Note that I am really trying not to add any feature, just re-organize the code. But I think that ones this is done, it will be fairly easy to add the Hive partitioning implem and use the ObjectStore.
I know it is a lot to ask (as this is again a fairly large change) but it would be great if you could take a "quick" look and at least validate the overall approach. Thanks 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-926082267
> I have never met a case of mixed file formats, so I wouldn't really know what is important to take into consideration
For what it is worth, I think the design of this PR makes it easier to support a mixed file format `TableProvider` in the future, even though `ListingProvider` may not do so at the moment. Introducing the `FileFormat` abstraction will allow someone to create something like `MixedProvider` that then calls the appropriate FileFormats if they so desire.
> I do know that git history is very important, I am not arguing that 😃. Do we all agree that we should directly replace the old implementations in this PR, even if it means that we will need to modify a large part of the code base at once?
I can see both sides here (one massive PR vs multiple smaller PRs) and they both involve tradeoffs. Some thoughts on making reviewss easier:
1. Make separate PRs on to this branch (as you seem to be planning for the `ObjectStore` use)
2. Keep the commits separated into logical chunks
Regardless of the route, I wonder if this PR is one we may want to draw some extra attention to
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-926014564
> I may get this wrong if you are not implying it's possible that a table can have its data in different file formats in the original doc
I was not implying anything! 😄 I just didn't have an example in mind. Thanks for the pointers! I think that handling these cases will require creating dedicated `ExecutionPlan`s and do some further refactoring of the execution plan to allow re-utilization of the file format specific code.
> But I what really want to argue is: why should we use diff manually and leave git diff away?
I do know that git history is very important, I am not arguing that 😃. Do we all agree that we should directly replace the old implementations in this PR, even if it means that we will need to modify a large part of the code base at once? Does someone have a better split for this PR in mind?
PS: just opened a new [branch](https://github.com/rdettai/arrow-datafusion/tree/refacto-providers-store) with the addition of the `ObjectStore`. I will pull it into this one once (and if) I am satisfied with the result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-925552091
I haven't had the time to take a close look at all the changes yet, I am running out of time so I plan to do it tomorrow. From a quick glance, I think the design is solid and on the right track, great work @rdettai :+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-937473432
Sounds good, thanks @rdettai for being patient with this big change :) I should be able to with the clean up in two days if you still need a second hand by then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-937944518
haven't finished yet but I am making good progress. I'll submit the PR tomorrow 😉
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
houqp commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r715301839
##########
File path: datafusion/src/datasource/listing.rs
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! A table that uses the `ObjectStore` listing capability
+//! to get the list of files to process.
+
+use std::{any::Any, sync::Arc};
+
+use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
+use async_trait::async_trait;
+use futures::{StreamExt, TryStreamExt};
+
+use crate::{
+ datasource::file_format::{self, PartitionedFile},
+ error::Result,
+ logical_plan::Expr,
+ physical_plan::{common, ExecutionPlan, Statistics},
+};
+
+use super::{
+ datasource::TableProviderFilterPushDown, file_format::FileFormat, TableProvider,
+};
+
+/// Options for creating a `ListingTable`
+pub struct ListingOptions {
+ /// A suffix on which files should be filtered (leave empty to
+ /// keep all files on the path)
+ pub file_extension: String,
+ /// The file format
+ pub format: Arc<dyn FileFormat>,
+ /// The expected partition column names.
+ /// For example `Vec["a", "b"]` means that the two first levels of
+ /// partitioning expected should be named "a" and "b":
+ /// - If there is a third level of partitioning it will be ignored.
+ /// - Files that don't follow this partitioning will be ignored.
Review comment:
> I recall Hive have __HIVE_DEFAULT_PARTITION__ for this purpose.
This is correct, hive, and spark inherited from this, uses `__HIVE_DEFAULT_PARTITION__` to denote null partition value by default. I feel like we can make this configurable and use `__HIVE_DEFAULT_PARTITION__` as the default for compatibility with other systems.
> From what I know, there isn't an official standard regarding this partitioning.
I think so too. AFAIK, there is no consensus in the big data ecosystem on a formal partition file path ser/de convention. Most systems are just trying to replicate what hive has.
> if your partitioning type is not string, you can cast it later in your query as you want
Could you give us an example on what the UX would look like? How does a user perform partition value type casting in a query? Did you mean user need to manually cast the filter value to string if the filter is applied to a partition column?
Same for the CASE expression for handling NULLs. It would be helpful to have an example.
I think we should probably put more thoughts into this since this design decision will have a big impact to downstream query UX.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-920720209
- @yjshen this change is impacting your recent changes as it removes the `TableDescriptor` that you recently added
- @houqp @alamb this change is still mostly an empty skeleton of what the new structure would be, but I would like to first discuss this before moving further with the implementation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-925067109
If you agree with this new way of organizing the file format datasources, my feeling would be that we should merge this as is. We can then remove the existing parquet/csv/json/avro `TableProvider` implems and `ExecutionPlan` implems and rewire all the tests/examples/benchmarks to the new ones in a separate PR:
- if we realize while trying to migrate all the tests/examples/benchmarks that won't make it, we can easily revert by simply deleting the `datasource::file_format` modules and the `execution_plan::file_format`
- the PRs will be easier to review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai edited a comment on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai edited a comment on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-924131108
@houqp @alamb @yjshen this is now getting closer to what I am targeting. Some notes for anyone who would want to go through the code:
- I have duplicated the `TableProvider` and the `ExecutionPlan` implementations for the file formats (parquet, csv, json). The objective is to remove the old ones once this is functional.
- In general, I am trying to minimize the number of constructor overloading because I find them very hard to read and test
- The `ListingTable` does not support partitioning yet, but the stubs are there to show how and where it will be implemented. I don't plan to include implementations in this PR.
- The `ListingTable` and `FileFormat` implems still use the file system calls. The next step (another PR) will be to use the `ObjectStore`.
- [x] Avro is missing from the `FileFormat` trait implems, I will add it while finalizing this PR.
- [x] On the Ballista side I have only added a few function stubs. I will probably remove those before finalizing this PR and add them back with their implementation in a further PR.
- [x] the datasource side lacks tests as I have not ported existing ones yet. I will do this before finalizing this PR.
Note that I am really trying not to add any feature, just re-organize the code. But I think that ones this is done, it will be fairly easy to add the Hive partitioning implem and use the ObjectStore.
I know it is a lot to ask (as this is again a fairly large change) but it would be great if you could take a "quick" look and at least validate the overall approach. Thanks 😄
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on a change in pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on a change in pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#discussion_r714593305
##########
File path: datafusion/src/datasource/file_format/mod.rs
##########
@@ -0,0 +1,192 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Module containing helper methods for the various file formats
+
+pub mod avro;
+pub mod csv;
+pub mod json;
+pub mod parquet;
+
+use std::pin::Pin;
+use std::sync::Arc;
+
+use crate::arrow::datatypes::SchemaRef;
+use crate::datasource::{create_max_min_accs, get_col_stats};
+use crate::error::Result;
+use crate::logical_plan::Expr;
+use crate::physical_plan::{Accumulator, ExecutionPlan, Statistics};
+
+use async_trait::async_trait;
+use futures::Stream;
+
+/// A stream of String that can be used accross await calls
+pub type StringStream = Pin<Box<dyn Stream<Item = String> + Send + Sync>>;
+
+/// Convert a vector into a stream
+pub fn string_stream(strings: Vec<String>) -> StringStream {
+ Box::pin(futures::stream::iter(strings))
+}
+
+/// This trait abstracts all the file format specific implementations
+/// from the `TableProvider`. This helps code re-utilization accross
+/// providers that support the the same file formats.
+#[async_trait]
+pub trait FileFormat: Send + Sync {
+ /// Open the files at the paths provided by iterator and infer the
+ /// common schema
+ async fn infer_schema(&self, paths: StringStream) -> Result<SchemaRef>;
Review comment:
yes, I think it will get to that while I add the `ObjectStore` abstraction
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] rdettai commented on pull request #1010: Reorganize table providers by table format
Posted by GitBox <gi...@apache.org>.
rdettai commented on pull request #1010:
URL: https://github.com/apache/arrow-datafusion/pull/1010#issuecomment-940786105
I [ran Ballista on TPC-H 1GB a few times](https://docs.google.com/spreadsheets/d/1bAgkPjW4FdhGb1X7UU-5jU-8mNqvaVhBWnR3isZeCEU/edit?usp=sharing), It seems there is no significant difference.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org