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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to