danielcweeks commented on code in PR #13933:
URL: https://github.com/apache/iceberg/pull/13933#discussion_r2457669672


##########
core/src/main/java/org/apache/iceberg/stats/BaseFieldStats.java:
##########
@@ -0,0 +1,292 @@
+/*
+ * 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.iceberg.stats;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+import org.apache.iceberg.types.Type;
+
+public class BaseFieldStats<T> implements FieldStats<T>, Serializable {
+  private final int fieldId;
+  private final Type type;
+  private final Long valueCount;
+  private final Long nullValueCount;
+  private final Long nanValueCount;
+  private final Integer avgValueSize;
+  private final Integer maxValueSize;
+  private final T lowerBound;
+  private final T upperBound;
+
+  private BaseFieldStats(
+      int fieldId,
+      Type type,
+      Long valueCount,
+      Long nullValueCount,
+      Long nanValueCount,
+      Integer avgValueSize,
+      Integer maxValueSize,
+      T lowerBound,
+      T upperBound) {
+    this.fieldId = fieldId;
+    this.type = type;
+    this.valueCount = valueCount;
+    this.nullValueCount = nullValueCount;
+    this.nanValueCount = nanValueCount;
+    this.avgValueSize = avgValueSize;
+    this.maxValueSize = maxValueSize;
+    this.lowerBound = lowerBound;
+    this.upperBound = upperBound;
+  }
+
+  @Override
+  public int fieldId() {
+    return fieldId;
+  }
+
+  @Override
+  public Type type() {
+    return type;
+  }
+
+  @Override
+  public Long valueCount() {
+    return valueCount;
+  }
+
+  @Override
+  public Long nullValueCount() {
+    return nullValueCount;
+  }
+
+  @Override
+  public Long nanValueCount() {
+    return nanValueCount;
+  }
+
+  @Override
+  public Integer avgValueSize() {
+    return avgValueSize;
+  }
+
+  @Override
+  public Integer maxValueSize() {
+    return maxValueSize;
+  }
+
+  @Override
+  public T lowerBound() {
+    return lowerBound;
+  }
+
+  @Override
+  public T upperBound() {
+    return upperBound;
+  }
+
+  @Override
+  public int size() {
+    return 6;
+  }
+
+  @Override
+  public <X> X get(int pos, Class<X> javaClass) {
+    switch (pos) {

Review Comment:
   I feel like a `ContentStatistic` enum would make this a little clearner as 
well since you could use `switch (ContentStatistic.forOffset(pos())) . . . `. 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to