You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@amoro.apache.org by ta...@apache.org on 2024/12/10 01:59:31 UTC

(amoro) branch issue_3359 updated: issue_3359 only set parallelism on parallelismSourceFunciton

This is an automated email from the ASF dual-hosted git repository.

taowang pushed a commit to branch issue_3359
in repository https://gitbox.apache.org/repos/asf/amoro.git


The following commit(s) were added to refs/heads/issue_3359 by this push:
     new 70186f54f issue_3359  only set parallelism on parallelismSourceFunciton
70186f54f is described below

commit 70186f54f3fede9fc506a52492e85d2df156fd5e
Author: Aireed <wt...@gmail.com>
AuthorDate: Tue Dec 10 09:59:21 2024 +0800

    issue_3359  only set parallelism on parallelismSourceFunciton
---
 .../java/org/apache/amoro/flink/table/FlinkSource.java     | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/table/FlinkSource.java b/amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/table/FlinkSource.java
index b57b5fb3d..3e4080e8a 100644
--- a/amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/table/FlinkSource.java
+++ b/amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/table/FlinkSource.java
@@ -38,6 +38,7 @@ import org.apache.flink.streaming.api.datastream.DataStream;
 import org.apache.flink.streaming.api.datastream.DataStreamSource;
 import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
 import org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction;
+import org.apache.flink.streaming.api.functions.source.ParallelSourceFunction;
 import org.apache.flink.streaming.api.functions.source.SourceFunction;
 import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory;
 import org.apache.flink.streaming.api.operators.StreamSource;
@@ -289,12 +290,13 @@ public class FlinkSource {
         DataStreamSource sourceStream =
             env.addSource(functionProxy, tfSource.getName(), tfSource.getOutputType());
         context.generateUid(MIXED_FORMAT_FILE_TRANSFORMATION).ifPresent(sourceStream::uid);
-        return sourceStream
-            .setParallelism(scanParallelism)
-            .transform(
-                tf.getName(),
-                tf.getOutputType(),
-                new UnkeyedInputFormatOperatorFactory(inputFormatProxyFactory));
+        if (sourceStream instanceof ParallelSourceFunction) {
+          sourceStream.setParallelism(scanParallelism);
+        }
+        return sourceStream.transform(
+            tf.getName(),
+            tf.getOutputType(),
+            new UnkeyedInputFormatOperatorFactory(inputFormatProxyFactory));
       }
 
       LegacySourceTransformation tfSource = (LegacySourceTransformation) origin;