n3nash commented on a change in pull request #2172:
URL: https://github.com/apache/hudi/pull/2172#discussion_r511708914
##########
File path:
hudi-integ-test/src/main/java/org/apache/hudi/integ/testsuite/generator/GenericRecordFullPayloadGenerator.java
##########
@@ -130,43 +132,60 @@ public GenericRecord getUpdatePayload(GenericRecord
record, List<String> blackli
}
/**
- * Create a new {@link GenericRecord} with random values. Not all the fields
have value, it is random, and its value
- * is random too.
+ * Create a new {@link GenericRecord} with random values. Not all the fields
have value, it is random, and its value is random too.
*
* @param schema Schema to create with.
* @return A {@link GenericRecord} with random value.
*/
protected GenericRecord convertPartial(Schema schema) {
GenericRecord result = new GenericData.Record(schema);
for (Schema.Field f : schema.getFields()) {
- boolean setNull = random.nextBoolean();
- if (!setNull) {
- result.put(f.name(), typeConvert(f));
+ if (f.name().equals(DEFAULT_HOODIE_IS_DELETED_COL)) {
+ result.put(f.name(), false);
} else {
- result.put(f.name(), null);
+ boolean setNull = random.nextBoolean();
+ if (!setNull) {
+ result.put(f.name(), typeConvert(f));
+ } else {
+ result.put(f.name(), null);
+ }
}
}
// TODO : pack remaining bytes into a complex field
return result;
}
/**
- * Set random value to {@link GenericRecord} according to the schema type of
field.
- * The field in blacklist will not be set.
+ * Set random value to {@link GenericRecord} according to the schema type of
field. The field in blacklist will not be set.
*
- * @param record GenericRecord to randomize.
+ * @param record GenericRecord to randomize.
* @param blacklistFields blacklistFields where the filed will not be
randomized.
* @return Randomized GenericRecord.
*/
protected GenericRecord randomize(GenericRecord record, List<String>
blacklistFields) {
for (Schema.Field f : record.getSchema().getFields()) {
- if (blacklistFields == null || !blacklistFields.contains(f.name())) {
- record.put(f.name(), typeConvert(f));
+ if (f.name().equals(DEFAULT_HOODIE_IS_DELETED_COL)) {
+ record.put(f.name(), false);
+ } else {
Review comment:
Make this an inline else-if ?
----------------------------------------------------------------
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]