suremarc commented on code in PR #13296:
URL: https://github.com/apache/datafusion/pull/13296#discussion_r1833160359


##########
datafusion/physical-plan/src/statistics.rs:
##########
@@ -131,14 +95,35 @@ impl MinMaxStatistics {
                 .collect::<Vec<_>>(),
         };
 
+        let projected_statistics = statistics
+            .into_iter()
+            .cloned()
+            .map(|s| s.project(Some(&projection)))
+            .collect::<Vec<_>>();
+
+        // Helper function to get min/max statistics
+        let get_min_max = |i: usize| -> Result<(Vec<ScalarValue>, 
Vec<ScalarValue>)> {
+            Ok(projected_statistics
+                .iter()

Review Comment:
   I moved this code later so it uses the _projected_ statistics, i.e. it only 
relies on stats for sorting columns. I was seeing the code error because some 
columns had unknown statistics. Hopefully this will reduce such cases. 



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