ahmedabu98 commented on code in PR #31172:
URL: https://github.com/apache/beam/pull/31172#discussion_r1595687475
##########
sdks/java/managed/src/main/java/org/apache/beam/sdk/managed/ManagedSchemaTransformProvider.java:
##########
@@ -202,7 +203,26 @@ Row getConfigurationRow() {
static Row getRowConfig(ManagedConfig config, Schema transformSchema) {
// May return an empty row (perhaps the underlying transform doesn't have
any required
// parameters)
- return YamlUtils.toBeamRow(config.resolveUnderlyingConfig(),
transformSchema, false);
+ String yamlConfig = config.resolveUnderlyingConfig();
+ Map<String, Object> configMap = YamlUtils.yamlStringToMap(yamlConfig);
+
+ // The config Row object will be used to build the underlying
SchemaTransform.
+ // If a mapping for the SchemaTransform exists, we use it to update
parameter names and align
+ // with the underlying config schema
+ Map<String, String> mapping =
MAPPINGS.get(config.getTransformIdentifier());
+ if (mapping != null && configMap != null) {
+ Map<String, Object> remappedConfig = new HashMap<>();
+ for (Map.Entry<String, Object> entry : configMap.entrySet()) {
+ String paramName = entry.getKey();
+ if (mapping.containsKey(paramName)) {
Review Comment:
P.S. alternatively we can make it mandatory to include all parameter names
in the mapping, regardless if they need to be updated or not.
--
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]