wxplovecc commented on code in PR #5362:
URL: https://github.com/apache/hudi/pull/5362#discussion_r853851616
##########
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 ?
- Shuffle with custom partitioner was not friendly to partition table with
less bucket (eg. partition by day and 1 bucket),It only use 1 write task
- Make sure the same partition processed in same task avoid duplicated fileId
--
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]