mkleen commented on code in PR #23201:
URL: https://github.com/apache/datafusion/pull/23201#discussion_r3485811124


##########
datafusion/catalog-listing/src/table.rs:
##########
@@ -990,17 +985,21 @@ impl ListingTable {
         store: &Arc<dyn ObjectStore>,
         part_file: &PartitionedFile,
     ) -> datafusion_common::Result<(Arc<Statistics>, Option<LexOrdering>)> {
-        use datafusion_execution::cache::cache_manager::CachedFileMetadata;
-
-        let path = TableScopedPath {
+        let key = FileStatisticsCacheKey {
             table: part_file.table_reference.clone(),
             path: part_file.object_meta.location.clone(),
+            // Statistics are computed against `file_schema`, so key on its
+            // fingerprint: reads of the same path under a different schema get
+            // their own entry rather than reusing incompatible column 
statistics.
+            // The fingerprint is precomputed once per table (see `try_new`).
+            schema: Arc::clone(&self.file_schema_fingerprint),

Review Comment:
   Precalculating the hash for the fingerprint could be a solution to avoid the 
regression. Right now we calculate the hash for the fingerprint for each entry 
which is expensive.



-- 
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]

Reply via email to