You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/01/08 14:38:18 UTC

[PR] Improvements to `list_files_cache` table function [datafusion]

alamb opened a new pull request, #19703:
URL: https://github.com/apache/datafusion/pull/19703

   ## Which issue does this PR close?
   
   - Follow on to https://github.com/apache/datafusion/pull/19616
   
   ## Rationale for this change
   
   I had a few minor comments / suggestions while reviewing https://github.com/apache/datafusion/pull/19616 from @jizezhang but they weren't needed to do the initial merge, so I would like to propose them in a follow up PR
   
   ## What changes are included in this PR?
   
   1. Improve documentation
   2. Improve handling of `table_ref` in ListingTableURL
   3. use Null rather than `"NULL"` in `list_files_cache` table function
   
   I can break this into separate PRs if that would help
   
   ## Are these changes tested?
   
   Yes by CI
   
   ## Are there any user-facing changes?
   
   The `list_files_cache` function now might return null
   


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvements to `list_files_cache` table function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #19703:
URL: https://github.com/apache/datafusion/pull/19703#issuecomment-3751892406

   Thanks again @comphead and @jizezhang 


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvements to `list_files_cache` table function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #19703:
URL: https://github.com/apache/datafusion/pull/19703


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvements to `list_files_cache` table function [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvements to `list_files_cache` table function [datafusion]

Posted by "jizezhang (via GitHub)" <gi...@apache.org>.
jizezhang commented on PR #19703:
URL: https://github.com/apache/datafusion/pull/19703#issuecomment-3724674874

   thanks a lot!


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org