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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to