danny0405 commented on code in PR #19858:
URL: https://github.com/apache/hudi/pull/19858#discussion_r3949381941
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/bulk/BulkInsertWriterHelper.java:
##########
@@ -115,20 +118,21 @@ public BulkInsertWriterHelper(Configuration conf,
HoodieTable hoodieTable, Hoodi
? schema
: HoodieSchemaUtils.addMetadataFields(schema,
writeConfig.allowOperationMetadataField());
this.preserveHoodieMetadata = preserveHoodieMetadata;
+ this.preserveRecordKey = preserveHoodieMetadata &&
metaFieldsMode.isRecordKeyPopulated();
this.isInputSorted = OptionsResolver.isBulkInsertOperation(conf)
&& (conf.get(FlinkOptions.WRITE_BULK_INSERT_SORT_INPUT)
|| OptionsResolver.isLsmTreeStorageLayout(conf));
this.fileIdPrefix = UUID.randomUUID().toString();
- this.keyGen = preserveHoodieMetadata ? null :
RowDataKeyGens.instance(conf, rowType, taskPartitionId, instantTime);
+ this.keyGen = preserveRecordKey ? null : RowDataKeyGens.instance(conf,
rowType, taskPartitionId, instantTime);
this.writeMetrics = writeMetrics;
}
public void write(RowData record) throws IOException {
try {
- String recordKey = preserveHoodieMetadata
+ String recordKey = preserveRecordKey
? record.getString(HoodieRecord.RECORD_KEY_META_FIELD_ORD).toString()
Review Comment:
Fixed in ea4cbcb61660: 'only ALL mode populates the partition path meta
field'.
##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/io/FlinkConcatHandle.java:
##########
@@ -56,8 +56,9 @@ public FlinkConcatHandle(HoodieWriteConfig config, String
instantTime, HoodieTab
*/
@Override
public void write(HoodieRecord oldRecord) {
- HoodieSchema oldSchema = config.populateMetaFields() ?
writeSchemaWithMetaFields : writeSchema;
- String key = oldRecord.getRecordKey(oldSchema, keyGeneratorOpt);
+ // HoodieMergeHelper supplies metadata columns even when NONE leaves their
values null.
Review Comment:
Reworded in ea4cbcb61660 to: 'Match the schema supplied by
HoodieMergeHelper: metadata columns are present even in NONE mode.' Applied the
same wording to FlinkIncrementalConcatHandle.
--
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]