yuzelin commented on code in PR #1109: URL: https://github.com/apache/incubator-paimon/pull/1109#discussion_r1189812550
########## paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/cdc/mysql/ColumnValueComputer.java: ########## @@ -0,0 +1,98 @@ +/* + * 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.paimon.flink.action.cdc.mysql; + +import org.apache.paimon.types.DataType; +import org.apache.paimon.types.DataTypes; +import org.apache.paimon.utils.DateTimeUtils; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static org.apache.paimon.utils.Preconditions.checkArgument; + +/** Compute value for computed column. */ +public interface ColumnValueComputer extends Serializable { + + List<String> SUPPORTED_EXPRESSION = Collections.singletonList("year"); + + /** Return input column name. */ + String inputName(); + + /** Return {@link DataType} of computed value. */ + DataType outputType(); + + /** Compute value from given input. Input and output are serialize to string. */ + String computeValue(String input); + + static ColumnValueComputer create( + String exprName, Map<String, DataType> typeMapping, String[] args) { Review Comment: But I think we need inputType and args. inputType: `truncate` can process numeric, string. We need input type. args: still truncate: `truncate(width, fieldReference)`. We need the arg width. -- 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]
