rdblue commented on a change in pull request #1829:
URL: https://github.com/apache/iceberg/pull/1829#discussion_r536925504
##########
File path: core/src/main/java/org/apache/iceberg/NaNFieldMetrics.java
##########
@@ -17,51 +17,50 @@
* under the License.
*/
-package org.apache.iceberg.parquet;
+package org.apache.iceberg;
import java.nio.ByteBuffer;
-import org.apache.iceberg.FieldMetrics;
/**
- * Iceberg internally tracked field level metrics, used by Parquet writer only.
+ * Iceberg internally tracked field level metrics, used by Parquet and ORC
writers only.
* <p>
- * Parquet keeps track of most metrics in its footer, and only NaN counter is
actually tracked by writers.
- * This wrapper ensures that metrics not being updated by Parquet writers will
not be incorrectly used, by throwing
+ * Parquet/ORC keeps track of most metrics in file statistics, and only NaN
counter is actually tracked by writers.
+ * This wrapper ensures that metrics not being updated by those writers will
not be incorrectly used, by throwing
* exceptions when they are accessed.
*/
-public class ParquetFieldMetrics extends FieldMetrics {
+public class NaNFieldMetrics extends FieldMetrics {
/**
- * Constructor for creating a Parquet-specific FieldMetrics.
+ * Constructor for creating a FieldMetrics with only NaN counter.
* @param id field id being tracked by the writer
* @param nanValueCount number of NaN values, will only be non-0 for double
or float field.
*/
- public ParquetFieldMetrics(int id,
- long nanValueCount) {
+ public NaNFieldMetrics(int id,
+ long nanValueCount) {
super(id, 0L, 0L, nanValueCount, null, null);
}
@Override
public long valueCount() {
throw new IllegalStateException(
- "Shouldn't access valueCount() within ParquetFieldMetrics, as this
metric is tracked by Parquet footer. ");
+ "Shouldn't access valueCount() within NaNOnlyFieldMetrics, as this
metric is tracked in file statistics. ");
}
@Override
public long nullValueCount() {
throw new IllegalStateException(
- "Shouldn't access nullValueCount() within ParquetFieldMetrics, as this
metric is tracked by Parquet footer. ");
+ "Shouldn't access nullValueCount() within NaNOnlyFieldMetrics, as this
metric is tracked in file statistics. ");
}
@Override
public ByteBuffer lowerBound() {
throw new IllegalStateException(
- "Shouldn't access lowerBound() within ParquetFieldMetrics, as this
metric is tracked by Parquet footer. ");
+ "Shouldn't access lowerBound() within NaNOnlyFieldMetrics, as this
metric is tracked in file statistics. ");
}
@Override
public ByteBuffer upperBound() {
throw new IllegalStateException(
- "Shouldn't access upperBound() within ParquetFieldMetrics, as this
metric is tracked by Parquet footer. ");
+ "Shouldn't access upperBound() within NaNOnlyFieldMetrics, as this
metric is tracked in file statistics. ");
Review comment:
This demonstrates the drawback to adding too much context to an
exception message. The method and class should be in the stack trace and
renames require updating this message. Let's keep the good error message, but
remove the class and method names.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]