haruki-830 commented on code in PR #4503:
URL: https://github.com/apache/flink-cdc/pull/4503#discussion_r3772044380
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/operators/transform/TransformFilterProcessor.java:
##########
@@ -229,7 +236,8 @@ private TransformExpressionKey
generateTransformExpressionKey(
columns,
udfDescriptors,
supportedMetadataColumns,
- transformFilter.getColumnNameMap());
+ transformFilter.getColumnNameMap(),
+ decimalPrecisionMode);
Review Comment:
Thanks for checking. The `supportedMetadataColumns` used here is the
parameter of `generateTransformExpressionKey(...)`, whose type is
`SupportedMetadataColumn[]`, rather than the class field with the same name
whose type is `Map<String, SupportedMetadataColumn>`.
The map values are converted to an array before this method is called, so
the argument type already matches
`translateFilterExpressionToJaninoExpression(...)`. The runtime module also
compiles successfully.
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/FlinkCdcTypeSystem.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.flink.cdc.runtime.parser;
+
+import org.apache.flink.cdc.common.pipeline.DecimalPrecisionMode;
+
+import org.apache.calcite.rel.type.RelDataTypeSystemImpl;
+
+/** A customized version of {@link
org.apache.calcite.rel.type.RelDataTypeSystem}. */
+public class FlinkCdcTypeSystem extends RelDataTypeSystemImpl {
+
+ public static final FlinkCdcTypeSystem UP_TO_38 = new
FlinkCdcTypeSystem(38);
+ public static final FlinkCdcTypeSystem UP_TO_19 = new
FlinkCdcTypeSystem(19);
+
+ private final int maxPrecision;
+
+ private FlinkCdcTypeSystem(int maxPrecision) {
+ this.maxPrecision = maxPrecision;
+ }
+
+ public static FlinkCdcTypeSystem of(DecimalPrecisionMode mode) {
+ switch (mode) {
+ case UP_TO_38:
+ return UP_TO_38;
+ case UP_TO_19:
+ return UP_TO_19;
+ default:
+ throw new IllegalArgumentException("Unexpected decimal
precision mode: " + mode);
+ }
+ }
Review Comment:
Thanks for the suggestion. In the normal pipeline path, this value cannot be
null: the pipeline option has `UP_TO_19` as its default value, and
`PostTransformOperatorBuilder` also initializes the field to `UP_TO_19`.
Since null is not a valid state and is already prevented by the
configuration and builder paths, I prefer to keep the current implementation
without adding a defensive check 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]