yuxiqian commented on code in PR #3801:
URL: https://github.com/apache/flink-cdc/pull/3801#discussion_r1891243265
##########
flink-cdc-composer/src/main/java/org/apache/flink/cdc/composer/flink/FlinkPipelineComposer.java:
##########
@@ -94,76 +97,124 @@ public PipelineExecution compose(PipelineDef pipelineDef) {
int parallelism =
pipelineDefConfig.get(PipelineOptions.PIPELINE_PARALLELISM);
env.getConfig().setParallelism(parallelism);
+ translate(env, pipelineDef);
+
+ // Add framework JARs
+ addFrameworkJars();
+
+ return new FlinkPipelineExecution(
+ env, pipelineDefConfig.get(PipelineOptions.PIPELINE_NAME),
isBlocking);
+ }
+
+ private void translate(StreamExecutionEnvironment env, PipelineDef
pipelineDef) {
+ Configuration pipelineDefConfig = pipelineDef.getConfig();
+ int parallelism =
pipelineDefConfig.get(PipelineOptions.PIPELINE_PARALLELISM);
SchemaChangeBehavior schemaChangeBehavior =
pipelineDefConfig.get(PipelineOptions.PIPELINE_SCHEMA_CHANGE_BEHAVIOR);
- // Build Source Operator
+ // Initialize translators
DataSourceTranslator sourceTranslator = new DataSourceTranslator();
- DataStream<Event> stream =
- sourceTranslator.translate(
- pipelineDef.getSource(), env, pipelineDefConfig,
parallelism);
-
- // Build PreTransformOperator for processing Schema Event
TransformTranslator transformTranslator = new TransformTranslator();
- stream =
- transformTranslator.translatePreTransform(
- stream,
- pipelineDef.getTransforms(),
- pipelineDef.getUdfs(),
- pipelineDef.getModels());
-
- // Schema operator
+ PartitioningTranslator partitioningTranslator = new
PartitioningTranslator();
SchemaOperatorTranslator schemaOperatorTranslator =
new SchemaOperatorTranslator(
schemaChangeBehavior,
pipelineDefConfig.get(PipelineOptions.PIPELINE_SCHEMA_OPERATOR_UID),
pipelineDefConfig.get(PipelineOptions.PIPELINE_SCHEMA_OPERATOR_RPC_TIMEOUT),
pipelineDefConfig.get(PipelineOptions.PIPELINE_LOCAL_TIME_ZONE));
+ DistributedSchemaOperatorTranslator
distributedSchemaOperatorTranslator =
+ new DistributedSchemaOperatorTranslator(
Review Comment:
Yes it is unnecessary to have two translator classes. Created two
`translate` methods since there's slight difference in their generic type
parameters.
--
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]