You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "vortual (via GitHub)" <gi...@apache.org> on 2023/02/03 10:17:26 UTC

[GitHub] [hudi] vortual commented on a diff in pull request #7795: [HUDI-5651] sort the inputs by record keys for bulk insert tasks

vortual commented on code in PR #7795:
URL: https://github.com/apache/hudi/pull/7795#discussion_r1095633522


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/utils/Pipelines.java:
##########
@@ -150,6 +150,22 @@ public static DataStreamSink<Object> bulkInsert(Configuration conf, RowType rowT
             conf.getInteger(FlinkOptions.WRITE_SORT_MEMORY) * 1024L * 1024L);
       }
     }
+
+    final String[] recordKeyFields = conf.getString(FlinkOptions.RECORD_KEY_FIELD).split(",");
+    if (recordKeyFields.length > 0) {
+      if (conf.getBoolean(FlinkOptions.WRITE_BULK_INSERT_SORT_INPUT_BY_RECORD_KEY)) {
+        SortOperatorGen sortOperatorGen = new SortOperatorGen(rowType, recordKeyFields);
+        // sort by record keys
+        dataStream = dataStream
+            .transform("record_key_sorter",
+                InternalTypeInfo.of(rowType),
+                sortOperatorGen.createSortOperator())

Review Comment:
   I didn't notice that would broke partition key sequence. I have modified the code, please help review it again, thks



-- 
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-unsubscribe@hudi.apache.org

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