LucassLin commented on issue #4550:
URL: https://github.com/apache/hudi/issues/4550#issuecomment-1016807182


   Hi Team,
   
   I followed https://hudi.apache.org/docs/quick-start-guide#mergeinto and do a 
partial update on a table but getting 
   ```
   22/01/18 23:22:40 ERROR org.apache.spark.deploy.yarn.ApplicationMaster: User 
class threw exception: java.lang.AssertionError: assertion failed: No plan for 
MergeIntoTable (((col1#4217 = col1#258) && (col2#4230 = col2#305)) && 
((col3#4241 = col3#316) && (col4#4287 = col4#1441))), [updateaction(None, 
assignment(col5#4242, col5#317), assignment(col6#4244, col6#319))], 
[insertaction(None)]
   ```
   
   Following is the code I have:
   ```
   val historicalDF = spark.read.format("org.apache.hudi").load(basePath)
       historicalDF.createOrReplaceTempView("historical_data")
       dataFrameMap(incremental).createOrReplaceTempView("incremental_data")
       val sqlPartialUpdate =
         s"""
          | merge into historical_data as target
          | using (
          |   select * from incremental_data
          | ) source
          | on  target.col1 = source.col1
          | and target.col2 = source.col2
          | and target.col3 = source.col3
          | and target.col4 = source.col4
          | when matched then
          |   update set target.col5 = source.col5, target.col6 = source.col6
          | when not matched then insert *
          """.stripMargin
      spark.sql(sqlPartialUpdate)
   ```
   
   I would really appreciate if anyone can give me an example for that, or 
point me in the right direction if in case I've missed anything.
   Thanks.
   


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