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


##########
core/src/main/java/org/apache/iceberg/stats/BaseFieldStats.java:
##########
@@ -0,0 +1,252 @@
+/*
+ * 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.StructLike;
+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>, StructLike, 
Serializable {
+  private final transient int fieldId;
+  private final transient Type type;
+  private final Long columnSize;
+  private final Long valueCount;
+  private final Long nullValueCount;
+  private final Long nanValueCount;
+  private final T lowerBound;
+  private final T upperBound;
+
+  BaseFieldStats(
+      int fieldId,
+      Type type,
+      Long columnSize,
+      Long valueCount,
+      Long nullValueCount,
+      Long nanValueCount,
+      T lowerBound,
+      T upperBound) {
+    this.fieldId = fieldId;
+    this.type = type;
+    this.columnSize = columnSize;
+    this.valueCount = valueCount;
+    this.nullValueCount = nullValueCount;
+    this.nanValueCount = nanValueCount;
+    this.lowerBound = lowerBound;
+    this.upperBound = upperBound;
+  }
+
+  @Override
+  public int fieldId() {
+    return fieldId;
+  }
+
+  @Override
+  public Type type() {
+    return type;
+  }
+
+  @Override
+  public Long columnSize() {
+    return columnSize;
+  }
+
+  @Override
+  public Long valueCount() {
+    return valueCount;
+  }
+
+  @Override
+  public Long nullValueCount() {
+    return nullValueCount;
+  }
+
+  @Override
+  public Long nanValueCount() {
+    return nanValueCount;
+  }
+
+  @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:
   We might be able to check the javaClass here also to match the type



##########
core/src/main/java/org/apache/iceberg/stats/BaseFieldStats.java:
##########
@@ -0,0 +1,252 @@
+/*
+ * 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.StructLike;
+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>, StructLike, 
Serializable {
+  private final transient int fieldId;
+  private final transient Type type;
+  private final Long columnSize;
+  private final Long valueCount;
+  private final Long nullValueCount;
+  private final Long nanValueCount;
+  private final T lowerBound;
+  private final T upperBound;
+
+  BaseFieldStats(
+      int fieldId,
+      Type type,
+      Long columnSize,
+      Long valueCount,
+      Long nullValueCount,
+      Long nanValueCount,
+      T lowerBound,
+      T upperBound) {
+    this.fieldId = fieldId;
+    this.type = type;
+    this.columnSize = columnSize;
+    this.valueCount = valueCount;
+    this.nullValueCount = nullValueCount;
+    this.nanValueCount = nanValueCount;
+    this.lowerBound = lowerBound;
+    this.upperBound = upperBound;

Review Comment:
   Question: Do we want to check that the Type, and `T` are matching?
   Something like:
   ```
   Preconditions.checkArgument(lowerBound == null ||
    lowerBound.getClass().isInstance(type.typeId().javaClass()));
   ```



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