codope commented on code in PR #5294:
URL: https://github.com/apache/hudi/pull/5294#discussion_r847876926
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -477,14 +479,19 @@ private Pair<SchemaProvider, Pair<String,
JavaRDD<HoodieRecord>>> fetchFromSourc
}
boolean shouldCombine = cfg.filterDupes ||
cfg.operation.equals(WriteOperationType.UPSERT);
+ boolean isDropPartitionColumns =
props.getBoolean(DROP_PARTITION_COLUMNS.key());
Review Comment:
let's also pass the default value:
`props.getBoolean(DROP_PARTITION_COLUMNS.key(),
DROP_PARTITION_COLUMNS.defaultValue())`
I don't think TypedProperties applies default directly.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -727,6 +734,13 @@ public void setupWriteClient() throws IOException {
private void reInitWriteClient(Schema sourceSchema, Schema targetSchema)
throws IOException {
LOG.info("Setting up new Hoodie Write Client");
+ final boolean isDropPartitionColumns =
props.getBoolean(DROP_PARTITION_COLUMNS.key());
Review Comment:
same here.. let's pass default value.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -477,14 +479,19 @@ private Pair<SchemaProvider, Pair<String,
JavaRDD<HoodieRecord>>> fetchFromSourc
}
boolean shouldCombine = cfg.filterDupes ||
cfg.operation.equals(WriteOperationType.UPSERT);
+ boolean isDropPartitionColumns =
props.getBoolean(DROP_PARTITION_COLUMNS.key());
+ String partitionColumns =
HoodieSparkUtils.getPartitionColumns(keyGenerator, props);
+ List<String> listOfPartitionColumns =
Arrays.asList(partitionColumns.split(","));
JavaRDD<GenericRecord> avroRDD = avroRDDOptional.get();
+ HoodieKey key = keyGenerator.getKey(avroRDD.first());
JavaRDD<HoodieRecord> records = avroRDD.map(gr -> {
+ gr = isDropPartitionColumns ? HoodieAvroUtils.removeFields(gr,
listOfPartitionColumns) : gr;
Review Comment:
Would be good if we can also also add a UT in `TestHoodieDeltaStreamer`.
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/deltastreamer/DeltaSync.java:
##########
@@ -477,14 +479,19 @@ private Pair<SchemaProvider, Pair<String,
JavaRDD<HoodieRecord>>> fetchFromSourc
}
boolean shouldCombine = cfg.filterDupes ||
cfg.operation.equals(WriteOperationType.UPSERT);
+ boolean isDropPartitionColumns =
props.getBoolean(DROP_PARTITION_COLUMNS.key());
+ String partitionColumns =
HoodieSparkUtils.getPartitionColumns(keyGenerator, props);
+ List<String> listOfPartitionColumns =
Arrays.asList(partitionColumns.split(","));
Review Comment:
For a non-partitioned table, will this be empty list or a list of single
element that is empty string?
--
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]