ashishsinghi commented on issue #5180:
URL: https://github.com/apache/hudi/issues/5180#issuecomment-1243719433

   I came across this and added a unit test case in 
_TestOverwriteNonDefaultsWithLatestAvroPayload_ to check whether partial 
updates works or not by using _OverwriteNonDefaultsWithLatestAvroPayload_.  It 
does work! JFYR below is sample UT which I used to verify the same.
   
   ```
   @Test
   public void test() throws IOException {
     Schema schema = Schema.createRecord(Arrays.asList(
             new Schema.Field("id", 
Schema.createUnion(Schema.create(Schema.Type.STRING), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("salesordernumber", 
Schema.createUnion(Schema.create(Schema.Type.STRING), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("salesorderline", 
Schema.createUnion(Schema.create(Schema.Type.INT), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("tenant", 
Schema.createUnion(Schema.create(Schema.Type.INT), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("martid", 
Schema.createUnion(Schema.create(Schema.Type.INT), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("businessunitid", 
Schema.createUnion(Schema.create(Schema.Type.INT), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("ordertakents", 
Schema.createUnion(Schema.create(Schema.Type.LONG), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("orderpurpose", 
Schema.createUnion(Schema.create(Schema.Type.STRING), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("ordermanagementcreatedts", 
Schema.createUnion(Schema.create(Schema.Type.LONG), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("purchasecontractid", 
Schema.createUnion(Schema.create(Schema.Type.INT), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("orderprocessedby", 
Schema.createUnion(Schema.create(Schema.Type.STRING), 
Schema.create(Schema.Type.NULL)), "", null),
             new Schema.Field("test", 
Schema.createUnion(Schema.create(Schema.Type.STRING), 
Schema.create(Schema.Type.NULL)), "", null)
             ));
        
     GenericRecord insert = new GenericData.Record(schema);
     insert.put("id", "5732110509405_1");
     insert.put("salesordernumber", "5732110509405");
     insert.put("ordertakents", 1635969661000L);
     insert.put("test", "inserted");
    
     GenericRecord upsert = new GenericData.Record(schema);
     upsert.put("id", "5732110509405_1");
     upsert.put("salesorderline", 1);
     upsert.put("tenant", 1);
     upsert.put("martid", 21);
     upsert.put("ordertakents", 1635969661000L);
     upsert.put("test", "updated");
    
     GenericRecord final_output = new GenericData.Record(schema);
     final_output.put("id", "5732110509405_1");
     final_output.put("salesordernumber", "5732110509405");
     final_output.put("salesorderline", 1);
     final_output.put("tenant", 1);
     final_output.put("martid", 21);
     final_output.put("ordertakents", 1635969661000L);
     final_output.put("test", "updated");
    
     OverwriteNonDefaultsWithLatestAvroPayload payload2 = new 
OverwriteNonDefaultsWithLatestAvroPayload(upsert, 2);
     assertEquals(payload2.combineAndGetUpdateValue(insert, schema).get(), 
final_output);
   }
   ```
   


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