JingsongLi commented on code in PR #1425:
URL: https://github.com/apache/incubator-paimon/pull/1425#discussion_r1246069466


##########
docs/content/concepts/primary-key-table.md:
##########
@@ -122,6 +122,47 @@ INSERT INTO T VALUES (1, 3, 3, 1, 3, 3, 3);
 SELECT * FROM T; -- output 1, 2, 2, 2, 3, 3, 3
 ```
 
+#### Default Value

Review Comment:
   Maybe this can be in `/how-to/creating-tables`?



##########
paimon-core/src/main/java/org/apache/paimon/operation/DefaultValueAssiger.java:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.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;
+
+/**
+ * the field Default value assigner. note that the invoke of assigning should 
be after merge and
+ * schema evolution
+ */
+public interface DefaultValueAssiger {

Review Comment:
   Maybe we can have a class:
   ```
   class DefaultValueAssiger {
      static DefaultValueAssiger create(...) {
      }
   
      RecordReader<InternalRow> assignDefaultValues(RecordReader<InternalRow> 
reader) {
      }
   }
   ```
   
   KeyValueFileStoreRead and AppendOnlyFileStoreRead can create 
DefaultValueAssiger in the constructor.



##########
paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java:
##########
@@ -464,6 +466,22 @@ public TableSchema schema(long id) {
         }
     }
 
+    public Set<Integer> getDefaultValueFieldindex(long schemaId) {

Review Comment:
   `fieldsWithDefaultValue`?



##########
paimon-core/src/main/java/org/apache/paimon/stats/FieldStatsConverters.java:
##########
@@ -37,20 +38,27 @@ public class FieldStatsConverters {
     private final ConcurrentMap<Long, FieldStatsArraySerializer> serializers;
     private final AtomicReference<List<DataField>> tableFields;
 
-    public FieldStatsConverters(Function<Long, List<DataField>> schemaFields, 
long tableSchemaId) {
+    Set<Integer> skipFieldIndex;
+
+    public FieldStatsConverters(

Review Comment:
   Maybe just modify this to:
   ```
   public FieldStatsConverters(
               Function<Long, List<DataField>> schemaFields,
               TableSchema currentSchema) 
   ```



##########
paimon-core/src/main/java/org/apache/paimon/stats/FieldStatsArraySerializer.java:
##########
@@ -65,6 +77,7 @@ public FieldStatsArraySerializer(
                         .toArray(InternalRow.FieldGetter[]::new);
         this.indexMapping = indexMapping;
         this.converterMapping = converterMapping;
+        this.skipFieldIndex = skipFieldIndex;

Review Comment:
   It is OK to just name this `fieldsWithDefaultValue`?



-- 
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]

Reply via email to