You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/03/15 15:28:51 UTC

[GitHub] [hudi] pengzhiwei2018 commented on issue #2656: HUDI insert operation is working same as upsert

pengzhiwei2018 commented on issue #2656:
URL: https://github.com/apache/hudi/issues/2656#issuecomment-799511860


   Hi @shivabansal1046 , currently hudi would do the insert operator when you have specified a rowkey for insert. You can use `UuidKeyGenKeyGenerator` as the row key to walk around this.
   
   First define a `UuidKeyGenKeyGenerator` class.
   > 
   class UuidKeyGenKeyGenerator(props: TypedProperties) extends ComplexKeyGenerator(props) {
   
       override def getRecordKey(record: GenericRecord): String = {
         UUID.randomUUID().toString
       }
     }
   
   Then config the `DataSourceWriteOptions#KEYGENERATOR_CLASS_OPT_KEY` to `classOf[UuidKeyGenKeyGenerator]`.
   You can have a try , hope it can help you~
   


----------------------------------------------------------------
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:
users@infra.apache.org