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


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/HoodieFlinkWriteClient.java:
##########
@@ -246,7 +246,21 @@ public List<WriteStatus> bulkInsert(List<HoodieRecord<T>> 
records, String instan
 
   @Override
   public List<WriteStatus> bulkInsertPreppedRecords(List<HoodieRecord<T>> 
preppedRecords, String instantTime, Option<BulkInsertPartitioner> 
bulkInsertPartitioner) {
-    throw new HoodieNotSupportedException("BulkInsertPrepped operation is not 
supported yet");
+    // only used for metadata table, the bulk_insert happens in single JVM 
process
+    HoodieTable<T, List<HoodieRecord<T>>, List<HoodieKey>, List<WriteStatus>> 
table =
+        initTable(WriteOperationType.BULK_INSERT_PREPPED, 
Option.ofNullable(instantTime));
+    table.validateInsertSchema();
+    preWrite(instantTime, WriteOperationType.BULK_INSERT_PREPPED, 
table.getMetaClient());
+    Map<String, List<HoodieRecord<T>>> preppedRecordsByFileId = 
preppedRecords.stream().parallel()
+        .collect(Collectors.groupingBy(r -> 
r.getCurrentLocation().getFileId()));
+    return preppedRecordsByFileId.values().stream().parallel().map(records -> {
+      HoodieWriteMetadata<List<WriteStatus>> result;
+      records.get(0).getCurrentLocation().setInstantTime("I");

Review Comment:
   Flink relies on this flag to distinguish which write handle to use. A little 
hacky but it's the minimum change right now.



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