alexeykudinkin commented on code in PR #7413:
URL: https://github.com/apache/hudi/pull/7413#discussion_r1066351876


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/BulkInsertPartitioner.java:
##########
@@ -72,4 +79,37 @@ default Option<WriteHandleFactory> getWriteHandleFactory(int 
partitionId) {
     return Option.empty();
   }
 
+  /*
+   * If possible, we want to sort the data by partition path. Doing so will 
reduce the number of files written.
+   * This will not change the desired sort order, it is just a performance 
improvement.
+   **/
+  static String[] tryPrependPartitionPathColumns(String[] columnNames, 
HoodieWriteConfig config) {
+    ArrayList<String> sortCols = new ArrayList<>();
+    Set<String> used = new HashSet<>();
+    if (config.getMetadataConfig().populateMetaFields()) {
+      //If we have meta fields we can just leverage those instead
+      
sortCols.add(HoodieRecord.HoodieMetadataField.PARTITION_PATH_METADATA_FIELD.getFieldName());
+      
used.add(HoodieRecord.HoodieMetadataField.PARTITION_PATH_METADATA_FIELD.getFieldName());
+    } else {
+      String partitionPath = 
config.getString(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key());

Review Comment:
   We should lift this check at the top of this method



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/BulkInsertPartitioner.java:
##########
@@ -72,4 +79,37 @@ default Option<WriteHandleFactory> getWriteHandleFactory(int 
partitionId) {
     return Option.empty();
   }
 
+  /*
+   * If possible, we want to sort the data by partition path. Doing so will 
reduce the number of files written.
+   **/
+  static String[] prependPartitionPathColumn(String[] columnNames, 
HoodieWriteConfig config) {
+    if (config.getMetadataConfig().populateMetaFields()) {

Review Comment:
   I don't think this has been addressed



-- 
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: commits-unsubscr...@hudi.apache.org

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

Reply via email to