afilipchik commented on a change in pull request #862: Add support for 
composite key
URL: https://github.com/apache/incubator-hudi/pull/862#discussion_r327735139
 
 

 ##########
 File path: 
hudi-utilities/src/main/java/org/apache/hudi/utilities/keygen/TimestampBasedKeyGenerator.java
 ##########
 @@ -102,7 +109,12 @@ public HoodieKey getKey(GenericRecord record) {
             "Unexpected type for partition field: " + 
partitionVal.getClass().getName());
       }
 
-      return new HoodieKey(DataSourceUtils.getNestedFieldValAsString(record, 
recordKeyField),
+      return new HoodieKey(
+          fields.stream()
+              .map(
+                  recordKeyField ->
+                      DataSourceUtils.getNestedFieldValAsString(record, 
recordKeyField))
+              .collect(Collectors.joining(".")),
 
 Review comment:
   Hey, not sure I understood the edge case example. Here is how we are using 
it:
   We have an object with id and a version. Version suppose to monotonically 
increase, and we want to be able to dedub based on key and the version (there 
should be at most 1 object with the same id and version).
   
   Our config looks like:
   hoodie.datasource.write.recordkey.field=object.id,object.version for insert 
table and
   
   What can go wrong with this one?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to