gene-bordegaray commented on code in PR #22657:
URL: https://github.com/apache/datafusion/pull/22657#discussion_r3455377430


##########
datafusion/catalog-listing/src/table.rs:
##########
@@ -761,27 +942,46 @@ impl ListingTable {
         // hash repartitioning for aggregates and joins on partition columns.
         let threshold = 
ctx.config_options().optimizer.preserve_file_partitions;
 
-        let (file_groups, grouped_by_partition) =
-            if threshold > 0 && !self.options.table_partition_cols.is_empty() {
-                let grouped = file_group
-                    
.group_by_partition_values(ctx.config().target_partitions());
-                if grouped.len() >= threshold {
-                    (grouped, true)
-                } else {
-                    let all_files: Vec<_> =
-                        grouped.into_iter().flat_map(|g| 
g.into_inner()).collect();
-                    (
-                        FileGroup::new(all_files)
-                            .split_files(ctx.config().target_partitions()),
-                        false,
-                    )
-                }
+        let (mut file_groups, grouped_by_partition) = if 
has_declared_partitioning {

Review Comment:
   I split this into two function with some helpers, I thnk make logic more 
linear 👍 



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