Skip to content

Commit 1eee30c

Browse files
authored
Merge pull request #86 from Altinity/fix_timestamp_partitioning
Use columnMeta.getPrimitiveType() so that the logical type is kept fo…
2 parents f825850 + 24ca35e commit 1eee30c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ice/src/main/java/com/altinity/ice/cli/internal/iceberg/Partitioning.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,19 @@ public static void apply(UpdatePartitionSpec op, List<Main.IcePartition> columns
141141
boolean same = true;
142142

143143
for (BlockMetaData block : blocks) {
144-
Statistics<?> stats =
144+
ColumnChunkMetaData columnMeta =
145145
block.getColumns().stream()
146146
.filter(c -> c.getPath().toDotString().equals(sourceName))
147147
.findFirst()
148-
.map(ColumnChunkMetaData::getStatistics)
149148
.orElse(null);
150149

150+
if (columnMeta == null) {
151+
same = false;
152+
break;
153+
}
154+
155+
Statistics<?> stats = columnMeta.getStatistics();
156+
151157
if (stats == null
152158
|| !stats.hasNonNullValue()
153159
|| stats.genericGetMin() == null
@@ -159,7 +165,7 @@ public static void apply(UpdatePartitionSpec op, List<Main.IcePartition> columns
159165
Transform<Object, Object> transform = (Transform<Object, Object>) field.transform();
160166
SerializableFunction<Object, Object> boundTransform = transform.bind(type);
161167

162-
PrimitiveType parquetType = stats.type();
168+
PrimitiveType parquetType = columnMeta.getPrimitiveType();
163169

164170
Comparable<?> parquetMin = stats.genericGetMin();
165171
var min = fromParquetPrimitive(type, parquetType, parquetMin);

0 commit comments

Comments
 (0)