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


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/execution/bulkinsert/GlobalSortPartitionerWithRows.java:
##########
@@ -31,11 +31,14 @@
 public class GlobalSortPartitionerWithRows implements 
BulkInsertPartitioner<Dataset<Row>> {
 
   @Override
-  public Dataset<Row> repartitionRecords(Dataset<Row> rows, int 
outputSparkPartitions) {
+  public Dataset<Row> repartitionRecords(Dataset<Row> rows, int 
outputSparkPartitions, boolean populateMetaFields) {
     // Now, sort the records and line them up nicely for loading.
     // Let's use "partitionPath + key" as the sort key.
-    return 
rows.sort(functions.col(HoodieRecord.PARTITION_PATH_METADATA_FIELD), 
functions.col(HoodieRecord.RECORD_KEY_METADATA_FIELD))
-        .coalesce(outputSparkPartitions);
+    if (populateMetaFields) {
+      return 
rows.sort(functions.col(HoodieRecord.PARTITION_PATH_METADATA_FIELD), 
functions.col(HoodieRecord.RECORD_KEY_METADATA_FIELD))
+          .coalesce(outputSparkPartitions);
+    }
+    return rows.coalesce(outputSparkPartitions);

Review Comment:
   @nsivabalan there's no conceptual reason for us not to support virtual-keys 
for any key-gen, right?
   I think we should actually do that if we claim to support virtual-keys (not 
immediately, but eventually)



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

Reply via email to