hailin0 commented on code in PR #7628:
URL: https://github.com/apache/seatunnel/pull/7628#discussion_r1854166943
##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-1/src/test/java/org/apache/seatunnel/e2e/transform/TestCopyIT.java:
##########
@@ -32,4 +34,15 @@ public void testCopy(TestContainer container) throws
IOException, InterruptedExc
Container.ExecResult execResult =
container.executeJob("/copy_transform.conf");
Assertions.assertEquals(0, execResult.getExitCode());
}
+
+ @DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason = "Currently SPARK do not multi table transform")
Review Comment:
Why?
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/flow/TransformFlowLifeCycle.java:
##########
@@ -89,6 +90,20 @@ public void received(Record<?> record) {
// ack after #addState
runningTask.ack(barrier);
collector.collect(record);
+ } else if (record.getData() instanceof SchemaChangeEvent) {
+ if (prepareClose) {
+ return;
+ }
+ SchemaChangeEvent event = (SchemaChangeEvent) record.getData();
+ for (SeaTunnelTransform<T> t : transform) {
+ event = t.mapSchemaChangeEvent(event);
Review Comment:
log print event before/after
##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/seatunnel-transforms-v2-e2e-part-1/src/test/java/org/apache/seatunnel/e2e/transform/TestCopyIT.java:
##########
@@ -32,4 +34,15 @@ public void testCopy(TestContainer container) throws
IOException, InterruptedExc
Container.ExecResult execResult =
container.executeJob("/copy_transform.conf");
Assertions.assertEquals(0, execResult.getExitCode());
}
+
+ @DisabledOnContainer(
+ value = {},
+ type = {EngineType.SPARK},
+ disabledReason = "Currently SPARK do not multi table transform")
Review Comment:
Or please create an issue
##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/AbstractMultiCatalogTransform.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.transform.common;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.catalog.TableIdentifier;
+import org.apache.seatunnel.api.table.catalog.TableSchema;
+import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.transform.SeaTunnelTransform;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public abstract class AbstractMultiCatalogTransform implements
SeaTunnelTransform<SeaTunnelRow> {
Review Comment:
Add code comments
##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/TransformCommonOptions.java:
##########
@@ -17,14 +17,37 @@
package org.apache.seatunnel.transform.common;
+import
org.apache.seatunnel.shade.com.fasterxml.jackson.core.type.TypeReference;
+
import org.apache.seatunnel.api.configuration.Option;
import org.apache.seatunnel.api.configuration.Options;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class TransformCommonOptions {
+
+ public static final Option<List<Map<String, Object>>> MULTI_TABLES =
+ Options.key("table_transform")
+ .type(new TypeReference<List<Map<String, Object>>>() {})
+ .defaultValue(Collections.emptyList())
+ .withDescription("The table transform config");
-public final class CommonOptions {
+ public static final Option<String> TABLE_PATH =
Review Comment:
add into docs
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/flow/TransformFlowLifeCycle.java:
##########
@@ -89,6 +90,20 @@ public void received(Record<?> record) {
// ack after #addState
runningTask.ack(barrier);
collector.collect(record);
+ } else if (record.getData() instanceof SchemaChangeEvent) {
+ if (prepareClose) {
+ return;
+ }
+ SchemaChangeEvent event = (SchemaChangeEvent) record.getData();
+ for (SeaTunnelTransform<T> t : transform) {
+ event = t.mapSchemaChangeEvent(event);
+ if (event == null) {
+ break;
Review Comment:
add log break details
##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/AbstractMultiCatalogFlatMapTransform.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.transform.common;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.transform.SeaTunnelFlatMapTransform;
+
+import java.util.List;
+
+public abstract class AbstractMultiCatalogFlatMapTransform extends
AbstractMultiCatalogTransform
Review Comment:
Add code comments
##########
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/execution/TransformExecuteProcessor.java:
##########
@@ -130,7 +129,7 @@ public List<DataStreamTableInfo>
execute(List<DataStreamTableInfo> upstreamDataS
resultTableName,
new DataStreamTableInfo(
inputStream,
-
Collections.singletonList(transform.getProducedCatalogTable()),
+ transform.getProducedCatalogTables(),
Review Comment:
Do spark/zeta need to be modified?
##########
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/common/AbstractMultiCatalogMapTransform.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.transform.common;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+import org.apache.seatunnel.api.table.catalog.CatalogTable;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.transform.SeaTunnelMapTransform;
+
+import java.util.List;
+
+public abstract class AbstractMultiCatalogMapTransform extends
AbstractMultiCatalogTransform
Review Comment:
Add code comments
--
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]