wtybxqm commented on code in PR #9688:
URL: https://github.com/apache/seatunnel/pull/9688#discussion_r2345931333
##########
seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/MultipleTableJobConfigParser.java:
##########
@@ -831,4 +847,87 @@ private ChangeStreamTableSourceCheckpoint
getSourceCheckpoint(
.collect(Collectors.toList());
return new ChangeStreamTableSourceCheckpoint(coordinatorState,
subtaskState);
}
+
+ private Config getMetalakeConfig(Config jobConfigTmp) {
+ Config update = jobConfigTmp;
+ String metalakeType = System.getenv("METALAKE_TYPE");
+ String metalakeUrl = System.getenv("METALAKE_URL");
+
+ MetalakeClient metalakeClient =
MetalakeClientFactory.create(metalakeType, metalakeUrl);
+
+ try {
+ ConfigList sourceList = jobConfigTmp.getList("source");
+ List<ConfigValue> newSourceList = new ArrayList<>(sourceList);
+
+ for (int i = 0; i < sourceList.size(); i++) {
+ ConfigObject sourceObj = (ConfigObject) sourceList.get(i);
+ if (sourceObj.containsKey("sourceId")) {
+ ConfigObject tmp = sourceObj;
+ String sourceId =
sourceObj.toConfig().getString("sourceId");
+ JsonNode metalakeJson =
metalakeClient.getMetaInfo(sourceId);
+ for (Map.Entry<String, ConfigValue> entry :
sourceObj.entrySet()) {
+ String subKey = entry.getKey();
+ ConfigValue value = entry.getValue();
+
+ if (value.valueType() == ConfigValueType.STRING) {
+ String strValue = (String) value.unwrapped();
+ if (strValue.startsWith("${") &&
strValue.endsWith("}")) {
+ String placeholder = strValue.substring(2,
strValue.length() - 1);
+
+ if (metalakeJson.has(placeholder)) {
+ String replaced =
metalakeJson.get(placeholder).asText();
+ tmp =
+ tmp.withValue(
+ subKey,
+
ConfigValueFactory.fromAnyRef(replaced));
+ }
Review Comment:
I reused PlaceholderUtils here
--
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]