|
19 | 19 | package org.apache.parquet.column.statistics;
|
20 | 20 |
|
21 | 21 | import java.util.Arrays;
|
| 22 | +import java.util.Collections; |
22 | 23 | import java.util.Optional;
|
23 | 24 | import org.apache.parquet.io.api.Binary;
|
24 | 25 | import org.apache.parquet.schema.LogicalTypeAnnotation;
|
@@ -124,4 +125,20 @@ public void testCopyStatistics() {
|
124 | 125 | Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getRepetitionLevelHistogram());
|
125 | 126 | Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getDefinitionLevelHistogram());
|
126 | 127 | }
|
| 128 | + |
| 129 | + @Test |
| 130 | + public void testOmittedHistogram() { |
| 131 | + PrimitiveType type = Types.optional(PrimitiveType.PrimitiveTypeName.BINARY) |
| 132 | + .as(LogicalTypeAnnotation.stringType()) |
| 133 | + .named("a"); |
| 134 | + SizeStatistics statistics = new SizeStatistics(type, 1024L, null, null); |
| 135 | + Assert.assertEquals(Optional.of(1024L), statistics.getUnencodedByteArrayDataBytes()); |
| 136 | + Assert.assertEquals(Collections.emptyList(), statistics.getRepetitionLevelHistogram()); |
| 137 | + Assert.assertEquals(Collections.emptyList(), statistics.getDefinitionLevelHistogram()); |
| 138 | + |
| 139 | + SizeStatistics copy = statistics.copy(); |
| 140 | + Assert.assertEquals(Optional.of(1024L), copy.getUnencodedByteArrayDataBytes()); |
| 141 | + Assert.assertEquals(Collections.emptyList(), copy.getRepetitionLevelHistogram()); |
| 142 | + Assert.assertEquals(Collections.emptyList(), copy.getDefinitionLevelHistogram()); |
| 143 | + } |
127 | 144 | }
|
0 commit comments