JingsongLi commented on code in PR #1425: URL: https://github.com/apache/incubator-paimon/pull/1425#discussion_r1252756297
########## paimon-core/src/main/java/org/apache/paimon/operation/DefaultValueAssiger.java: ########## @@ -0,0 +1,135 @@ +/* + * 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.operation; + +import org.apache.paimon.CoreOptions; +import org.apache.paimon.casting.CastExecutor; +import org.apache.paimon.casting.CastExecutors; +import org.apache.paimon.casting.DefaultValueRow; +import org.apache.paimon.data.BinaryString; +import org.apache.paimon.data.GenericRow; +import org.apache.paimon.data.InternalRow; +import org.apache.paimon.options.Options; +import org.apache.paimon.predicate.Predicate; +import org.apache.paimon.predicate.PredicateBuilder; +import org.apache.paimon.predicate.PredicateReplaceVisitor; +import org.apache.paimon.reader.RecordReader; +import org.apache.paimon.schema.TableSchema; +import org.apache.paimon.types.DataField; +import org.apache.paimon.types.RowType; +import org.apache.paimon.types.VarCharType; +import org.apache.paimon.utils.Projection; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * the field Default value assigner. note that the invoke of assigning should be after merge and + * schema evolution + */ +public class DefaultValueAssiger { + private int[][] project; + + private TableSchema tableSchema; + + private RowType valueType; + + public DefaultValueAssiger(int[][] project, TableSchema tableSchema, RowType valueType) { + this.project = project; + this.tableSchema = tableSchema; + this.valueType = valueType; + } + + /** assign default value for colomn which value is null. */ + public RecordReader<InternalRow> assignFieldsDefaultValue(RecordReader<InternalRow> reader) { Review Comment: This method will be invoked every reader. Please prepare some fields in constructor. And just return `reader` in the first if there is no default value columns. -- 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]
