alamb commented on code in PR #19703:
URL: https://github.com/apache/datafusion/pull/19703#discussion_r2672617547
##########
datafusion-cli/src/functions.rs:
##########
@@ -788,7 +791,7 @@ impl TableFunctionImpl for ListFilesCacheFunc {
Field::new("metadata", DataType::Struct(nested_fields.clone()),
true);
let schema = Arc::new(Schema::new(vec![
- Field::new("table", DataType::Utf8, false),
+ Field::new("table", DataType::Utf8, true),
Review Comment:
This uses `NULL` (rather than `"NULL"`) in `list_files_cache`
##########
datafusion/core/src/datasource/listing_table_factory.rs:
##########
@@ -161,9 +161,7 @@ impl TableProviderFactory for ListingTableFactory {
}
None => format!("*.{}", cmd.file_type.to_lowercase()),
};
- table_path = table_path
- .with_glob(glob.as_ref())?
- .with_table_ref(cmd.name.clone());
+ table_path = table_path.with_glob(glob.as_ref())?;
Review Comment:
This can be simplified due to the change in `with_glob`
##########
datafusion/datasource/src/url.rs:
##########
@@ -340,17 +340,19 @@ impl ListingTableUrl {
}
/// Returns a copy of current [`ListingTableUrl`] with a specified `glob`
- pub fn with_glob(self, glob: &str) -> Result<Self> {
- let glob =
- Pattern::new(glob).map_err(|e|
DataFusionError::External(Box::new(e)))?;
- Self::try_new(self.url, Some(glob))
+ pub fn with_glob(mut self, glob: &str) -> Result<Self> {
+ self.glob =
Review Comment:
There is no need to call the constructor again as `self.path` hasn't changed
and the constructor doesn't do anything with glob
https://github.com/apache/datafusion/blob/8a9bf43edd3013e73a7ce2d981549eb9e2e6471a/datafusion/datasource/src/url.rs#L149-L157
This then simplifies the code in
`datafusion/core/src/datasource/listing_table_factory.rs`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]