lokeshj1703 commented on code in PR #8574:
URL: https://github.com/apache/hudi/pull/8574#discussion_r1180288322


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/transform/ChainedTransformer.java:
##########
@@ -46,9 +110,40 @@ public List<String> getTransformersNames() {
   @Override
   public Dataset<Row> apply(JavaSparkContext jsc, SparkSession sparkSession, 
Dataset<Row> rowDataset, TypedProperties properties) {
     Dataset<Row> dataset = rowDataset;
+    Schema incomingSchema = enableSchemaValidation ? sourceSchemaOpt.get() : 
null;
     for (Transformer t : transformers) {
-      dataset = t.apply(jsc, sparkSession, dataset, properties);
+      String suffix = transformerToPropKeySuffix.get(t);
+      TypedProperties transformerProps = properties;
+      if (StringUtils.nonEmpty(suffix)) {
+        transformerProps = new TypedProperties(properties);
+        Map<String, Object> overrideKeysMap = new HashMap<>();
+        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+          String key = (String) entry.getKey();
+          if (key.endsWith("." + suffix)) {
+            overrideKeysMap.put(key.substring(0, key.length() - 
(suffix.length() + 1)), entry.getValue());
+          }
+        }
+        transformerProps.putAll(overrideKeysMap);
+      }
+      dataset = t.apply(jsc, sparkSession, dataset, transformerProps);
+      if (enableSchemaValidation) {
+        incomingSchema = validateAndGetTransformedSchema(t, dataset, 
incomingSchema, jsc, sparkSession, properties);
+      }
     }
     return dataset;
   }
+
+  private Schema validateAndGetTransformedSchema(Transformer transformer, 
Dataset<Row> dataset, Schema incomingSchema,

Review Comment:
   Added tests in TestTransformer class.



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