danny0405 commented on code in PR #5362:
URL: https://github.com/apache/hudi/pull/5362#discussion_r853796060


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/utils/Pipelines.java:
##########
@@ -102,9 +102,15 @@ public static DataStreamSink<Object> 
bulkInsert(Configuration conf, RowType rowT
       InternalTypeInfo<RowData> typeInfo = 
InternalTypeInfo.of(rowTypeWithFileId);
 
       Map<String, String> bucketIdToFileId = new HashMap<>();
-      dataStream = dataStream.partitionCustom(partitioner, 
keyGen::getRecordKey)
-          .map(record -> 
BucketBulkInsertWriterHelper.rowWithFileId(bucketIdToFileId, keyGen, record, 
indexKeys, numBuckets), typeInfo)
-          .setParallelism(conf.getInteger(FlinkOptions.WRITE_TASKS)); // same 
parallelism as write task to avoid shuffle
+      if (OptionsResolver.isPartitionedTable(conf)) {
+        dataStream = dataStream.keyBy(keyGen::getPartitionPath)
+                .map(record -> 
BucketBulkInsertWriterHelper.rowWithFileId(bucketIdToFileId, keyGen, record, 
indexKeys, numBuckets), typeInfo)
+                .setParallelism(conf.getInteger(FlinkOptions.WRITE_TASKS)); // 
same parallelism as write task to avoid shuffle
+      } else {
+        dataStream = dataStream.partitionCustom(partitioner, 
keyGen::getRecordKey)
+                .map(record -> 
BucketBulkInsertWriterHelper.rowWithFileId(bucketIdToFileId, keyGen, record, 
indexKeys, numBuckets), typeInfo)

Review Comment:
   Why shuffle the input with partition path first ?



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