1
0

[HUDI-2509] OverwriteNonDefaultsWithLatestAvroPayload doesn`t work when upsert data with some null value column (#3761)

Co-authored-by: 502395931@qq.com <lzyadam315>
This commit is contained in:
peanut-chenzhong
2021-11-03 20:23:40 +08:00
committed by GitHub
parent 7fc7e9b2bc
commit f2fb1aac26
2 changed files with 35 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
package org.apache.hudi.common.model;
import org.apache.avro.JsonProperties;
import org.apache.hudi.avro.HoodieAvroUtils;
import org.apache.hudi.common.util.Option;
@@ -99,6 +100,9 @@ public class OverwriteWithLatestAvroPayload extends BaseAvroPayload
* Return true if value equals defaultValue otherwise false.
*/
public Boolean overwriteField(Object value, Object defaultValue) {
if (JsonProperties.NULL_VALUE.equals(defaultValue)) {
return value == null;
}
return Objects.equals(value, defaultValue);
}
}