From e7b1fda78944a43e9838157593900a63695d4e9c Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (:imjalpreet)" Date: Mon, 1 Jan 2024 08:21:00 +0530 Subject: [PATCH 1/5] Annotate all parameters of DeleteFile constructor with @JsonProperty --- .../presto/iceberg/delete/DeleteFile.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/DeleteFile.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/DeleteFile.java index 12d2374abea90..d560791fcbaf6 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/DeleteFile.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/DeleteFile.java @@ -61,14 +61,14 @@ public static DeleteFile fromIceberg(org.apache.iceberg.DeleteFile deleteFile) @JsonCreator public DeleteFile( - FileContent content, - String path, - FileFormat format, - long recordCount, - long fileSizeInBytes, - List equalityFieldIds, - Map lowerBounds, - Map upperBounds) + @JsonProperty("content") FileContent content, + @JsonProperty("path") String path, + @JsonProperty("format") FileFormat format, + @JsonProperty("recordCount") long recordCount, + @JsonProperty("fileSizeInBytes") long fileSizeInBytes, + @JsonProperty("equalityFieldIds") List equalityFieldIds, + @JsonProperty("lowerBounds") Map lowerBounds, + @JsonProperty("upperBounds") Map upperBounds) { this.content = requireNonNull(content, "content is null"); this.path = requireNonNull(path, "path is null"); From e6402554247997d14d3c42a14643955de39d4730 Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (:imjalpreet)" Date: Tue, 2 Jan 2024 21:06:00 +0530 Subject: [PATCH 2/5] Rename TableType to IcebergTableType in Iceberg Connector --- .../iceberg/IcebergAbstractMetadata.java | 4 +- .../presto/iceberg/IcebergHiveMetadata.java | 2 +- .../presto/iceberg/IcebergNativeMetadata.java | 2 +- .../presto/iceberg/IcebergSplitManager.java | 2 +- .../presto/iceberg/IcebergTableName.java | 36 ++++++++--------- .../{TableType.java => IcebergTableType.java} | 2 +- .../facebook/presto/iceberg/IcebergUtil.java | 2 +- .../presto/iceberg/TestIcebergTableName.java | 40 +++++++++---------- 8 files changed, 45 insertions(+), 45 deletions(-) rename presto-iceberg/src/main/java/com/facebook/presto/iceberg/{TableType.java => IcebergTableType.java} (96%) diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java index f4ffe470f276a..09ba236fb72a4 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java @@ -110,6 +110,8 @@ import static com.facebook.presto.iceberg.IcebergTableProperties.FORMAT_VERSION; import static com.facebook.presto.iceberg.IcebergTableProperties.LOCATION_PROPERTY; import static com.facebook.presto.iceberg.IcebergTableProperties.PARTITIONING_PROPERTY; +import static com.facebook.presto.iceberg.IcebergTableType.CHANGELOG; +import static com.facebook.presto.iceberg.IcebergTableType.DATA; import static com.facebook.presto.iceberg.IcebergUtil.getColumns; import static com.facebook.presto.iceberg.IcebergUtil.getFileFormat; import static com.facebook.presto.iceberg.IcebergUtil.getPartitionKeyColumnHandles; @@ -123,8 +125,6 @@ import static com.facebook.presto.iceberg.PartitionFields.getTransformTerm; import static com.facebook.presto.iceberg.PartitionFields.toPartitionFields; import static com.facebook.presto.iceberg.TableStatisticsMaker.getSupportedColumnStatistics; -import static com.facebook.presto.iceberg.TableType.CHANGELOG; -import static com.facebook.presto.iceberg.TableType.DATA; import static com.facebook.presto.iceberg.TypeConverter.toIcebergType; import static com.facebook.presto.iceberg.TypeConverter.toPrestoType; import static com.facebook.presto.iceberg.changelog.ChangelogUtil.getRowTypeFromColumnMeta; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java index bfea89205f654..1cc939e656427 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java @@ -117,6 +117,7 @@ import static com.facebook.presto.iceberg.IcebergTableProperties.getFormatVersion; import static com.facebook.presto.iceberg.IcebergTableProperties.getPartitioning; import static com.facebook.presto.iceberg.IcebergTableProperties.getTableLocation; +import static com.facebook.presto.iceberg.IcebergTableType.DATA; import static com.facebook.presto.iceberg.IcebergUtil.createIcebergViewProperties; import static com.facebook.presto.iceberg.IcebergUtil.getColumns; import static com.facebook.presto.iceberg.IcebergUtil.getHiveIcebergTable; @@ -124,7 +125,6 @@ import static com.facebook.presto.iceberg.IcebergUtil.toHiveColumns; import static com.facebook.presto.iceberg.IcebergUtil.tryGetProperties; import static com.facebook.presto.iceberg.PartitionFields.parsePartitionFields; -import static com.facebook.presto.iceberg.TableType.DATA; import static com.facebook.presto.iceberg.util.StatisticsUtil.mergeHiveStatistics; import static com.facebook.presto.spi.StandardErrorCode.INVALID_SCHEMA_PROPERTY; import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java index 291a762320dfc..e2e69a7d9e55e 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java @@ -49,10 +49,10 @@ import static com.facebook.presto.iceberg.IcebergTableProperties.getFileFormat; import static com.facebook.presto.iceberg.IcebergTableProperties.getFormatVersion; import static com.facebook.presto.iceberg.IcebergTableProperties.getPartitioning; +import static com.facebook.presto.iceberg.IcebergTableType.DATA; import static com.facebook.presto.iceberg.IcebergUtil.getColumns; import static com.facebook.presto.iceberg.IcebergUtil.getNativeIcebergTable; import static com.facebook.presto.iceberg.PartitionFields.parsePartitionFields; -import static com.facebook.presto.iceberg.TableType.DATA; import static com.facebook.presto.iceberg.util.IcebergPrestoModelConverters.toIcebergNamespace; import static com.facebook.presto.iceberg.util.IcebergPrestoModelConverters.toIcebergTableIdentifier; import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java index 04f8f8fd4ab8d..f045d4b5abf62 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java @@ -35,8 +35,8 @@ import static com.facebook.presto.iceberg.ExpressionConverter.toIcebergExpression; import static com.facebook.presto.iceberg.IcebergSessionProperties.getMinimumAssignedSplitWeight; import static com.facebook.presto.iceberg.IcebergSessionProperties.isPushdownFilterEnabled; +import static com.facebook.presto.iceberg.IcebergTableType.CHANGELOG; import static com.facebook.presto.iceberg.IcebergUtil.getIcebergTable; -import static com.facebook.presto.iceberg.TableType.CHANGELOG; import static java.util.Objects.requireNonNull; public class IcebergSplitManager diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableName.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableName.java index e05d0603ae313..cbaabe3011694 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableName.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableName.java @@ -23,14 +23,14 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.facebook.presto.iceberg.TableType.CHANGELOG; -import static com.facebook.presto.iceberg.TableType.DATA; -import static com.facebook.presto.iceberg.TableType.FILES; -import static com.facebook.presto.iceberg.TableType.HISTORY; -import static com.facebook.presto.iceberg.TableType.MANIFESTS; -import static com.facebook.presto.iceberg.TableType.PARTITIONS; -import static com.facebook.presto.iceberg.TableType.PROPERTIES; -import static com.facebook.presto.iceberg.TableType.SNAPSHOTS; +import static com.facebook.presto.iceberg.IcebergTableType.CHANGELOG; +import static com.facebook.presto.iceberg.IcebergTableType.DATA; +import static com.facebook.presto.iceberg.IcebergTableType.FILES; +import static com.facebook.presto.iceberg.IcebergTableType.HISTORY; +import static com.facebook.presto.iceberg.IcebergTableType.MANIFESTS; +import static com.facebook.presto.iceberg.IcebergTableType.PARTITIONS; +import static com.facebook.presto.iceberg.IcebergTableType.PROPERTIES; +import static com.facebook.presto.iceberg.IcebergTableType.SNAPSHOTS; import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED; import static java.lang.Long.parseLong; import static java.lang.String.format; @@ -45,22 +45,22 @@ public class IcebergTableName "(?:\\$(?[^@]+)(?:@(?[0-9]+))?)?"); private final String tableName; - private final TableType tableType; + private final IcebergTableType icebergTableType; private final Optional snapshotId; private final Optional changelogEndSnapshot; - private static final Set SYSTEM_TABLES = Sets.immutableEnumSet(FILES, MANIFESTS, PARTITIONS, HISTORY, SNAPSHOTS, PROPERTIES); + private static final Set SYSTEM_TABLES = Sets.immutableEnumSet(FILES, MANIFESTS, PARTITIONS, HISTORY, SNAPSHOTS, PROPERTIES); @JsonCreator public IcebergTableName( @JsonProperty("tableName") String tableName, - @JsonProperty("tableType") TableType tableType, + @JsonProperty("tableType") IcebergTableType icebergTableType, @JsonProperty("snapshotId") Optional snapshotId, @JsonProperty("changelogEndSnapshot") Optional changelogEndSnapshot) { this.tableName = requireNonNull(tableName, "tableName is null"); - this.tableType = requireNonNull(tableType, "tableType is null"); + this.icebergTableType = requireNonNull(icebergTableType, "tableType is null"); this.snapshotId = requireNonNull(snapshotId, "snapshotId is null"); this.changelogEndSnapshot = requireNonNull(changelogEndSnapshot, "changelogEndSnapshot is null"); } @@ -72,9 +72,9 @@ public String getTableName() } @JsonProperty - public TableType getTableType() + public IcebergTableType getTableType() { - return tableType; + return icebergTableType; } @JsonProperty @@ -85,7 +85,7 @@ public Optional getChangelogEndSnapshot() public boolean isSystemTable() { - return SYSTEM_TABLES.contains(tableType); + return SYSTEM_TABLES.contains(icebergTableType); } @JsonProperty @@ -96,7 +96,7 @@ public Optional getSnapshotId() public String getTableNameWithType() { - return tableName + "$" + tableType.name().toLowerCase(ROOT); + return tableName + "$" + icebergTableType.name().toLowerCase(ROOT); } @Override @@ -117,10 +117,10 @@ public static IcebergTableName from(String name) String version1 = match.group("ver1"); String version2 = match.group("ver2"); - TableType type = DATA; + IcebergTableType type = DATA; if (typeString != null) { try { - type = TableType.valueOf(typeString.toUpperCase(ROOT)); + type = IcebergTableType.valueOf(typeString.toUpperCase(ROOT)); } catch (IllegalArgumentException e) { throw new PrestoException(NOT_SUPPORTED, format("Invalid Iceberg table name (unknown type '%s'): %s", typeString, name)); diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableType.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableType.java similarity index 96% rename from presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableType.java rename to presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableType.java index 278afafb3fad5..853c38fa48a49 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableType.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableType.java @@ -13,7 +13,7 @@ */ package com.facebook.presto.iceberg; -public enum TableType +public enum IcebergTableType { DATA, HISTORY, diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java index fdb7f035ae2bd..e6b2ed5cd48e1 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java @@ -227,7 +227,7 @@ public static Optional resolveSnapshotIdByName(Table table, IcebergTableNa return name.getSnapshotId(); } - if (name.getTableType() == TableType.CHANGELOG) { + if (name.getTableType() == IcebergTableType.CHANGELOG) { return Optional.ofNullable(SnapshotUtil.oldestAncestor(table)).map(Snapshot::snapshotId); } diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergTableName.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergTableName.java index 063b2d569f3bb..7cabaeea0e8d3 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergTableName.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergTableName.java @@ -27,20 +27,20 @@ public class TestIcebergTableName @Test public void testFrom() { - assertFrom("abc", "abc", TableType.DATA); - assertFrom("abc@123", "abc", TableType.DATA, Optional.of(123L)); - assertFrom("abc$data", "abc", TableType.DATA); - assertFrom("xyz@456", "xyz", TableType.DATA, Optional.of(456L)); - assertFrom("xyz$data@456", "xyz", TableType.DATA, Optional.of(456L)); - assertFrom("abc$partitions@456", "abc", TableType.PARTITIONS, Optional.of(456L)); - assertFrom("abc$manifests@456", "abc", TableType.MANIFESTS, Optional.of(456L)); - assertFrom("abc$manifests@456", "abc", TableType.MANIFESTS, Optional.of(456L)); - assertFrom("abc$history", "abc", TableType.HISTORY); - assertFrom("abc$snapshots", "abc", TableType.SNAPSHOTS); - assertFrom("abc$changelog", "abc", TableType.CHANGELOG); - assertFrom("abc@123$changelog", "abc", TableType.CHANGELOG, Optional.of(123L)); - assertFrom("abc$changelog@123", "abc", TableType.CHANGELOG, Optional.empty(), Optional.of(123L)); - assertFrom("abc@123$changelog@124", "abc", TableType.CHANGELOG, Optional.of(123L), Optional.of(124L)); + assertFrom("abc", "abc", IcebergTableType.DATA); + assertFrom("abc@123", "abc", IcebergTableType.DATA, Optional.of(123L)); + assertFrom("abc$data", "abc", IcebergTableType.DATA); + assertFrom("xyz@456", "xyz", IcebergTableType.DATA, Optional.of(456L)); + assertFrom("xyz$data@456", "xyz", IcebergTableType.DATA, Optional.of(456L)); + assertFrom("abc$partitions@456", "abc", IcebergTableType.PARTITIONS, Optional.of(456L)); + assertFrom("abc$manifests@456", "abc", IcebergTableType.MANIFESTS, Optional.of(456L)); + assertFrom("abc$manifests@456", "abc", IcebergTableType.MANIFESTS, Optional.of(456L)); + assertFrom("abc$history", "abc", IcebergTableType.HISTORY); + assertFrom("abc$snapshots", "abc", IcebergTableType.SNAPSHOTS); + assertFrom("abc$changelog", "abc", IcebergTableType.CHANGELOG); + assertFrom("abc@123$changelog", "abc", IcebergTableType.CHANGELOG, Optional.of(123L)); + assertFrom("abc$changelog@123", "abc", IcebergTableType.CHANGELOG, Optional.empty(), Optional.of(123L)); + assertFrom("abc@123$changelog@124", "abc", IcebergTableType.CHANGELOG, Optional.of(123L), Optional.of(124L)); assertInvalid("abc@xyz", "Invalid Iceberg table name: abc@xyz"); assertInvalid("abc$what", "Invalid Iceberg table name (unknown type 'what'): abc$what"); @@ -61,22 +61,22 @@ private static void assertInvalid(String inputName, String message) } } - private static void assertFrom(String inputName, String tableName, TableType tableType, Optional snapshotId, Optional changelogEndSnapshot) + private static void assertFrom(String inputName, String tableName, IcebergTableType icebergTableType, Optional snapshotId, Optional changelogEndSnapshot) { IcebergTableName name = IcebergTableName.from(inputName); assertEquals(name.getTableName(), tableName); - assertEquals(name.getTableType(), tableType); + assertEquals(name.getTableType(), icebergTableType); assertEquals(name.getSnapshotId(), snapshotId); assertEquals(name.getChangelogEndSnapshot(), changelogEndSnapshot); } - private static void assertFrom(String inputName, String tableName, TableType tableType, Optional snapshotId) + private static void assertFrom(String inputName, String tableName, IcebergTableType icebergTableType, Optional snapshotId) { - assertFrom(inputName, tableName, tableType, snapshotId, Optional.empty()); + assertFrom(inputName, tableName, icebergTableType, snapshotId, Optional.empty()); } - private static void assertFrom(String inputName, String tableName, TableType tableType) + private static void assertFrom(String inputName, String tableName, IcebergTableType icebergTableType) { - assertFrom(inputName, tableName, tableType, Optional.empty(), Optional.empty()); + assertFrom(inputName, tableName, icebergTableType, Optional.empty(), Optional.empty()); } } From ea35d570d40a1de7d1319c9602f213f2e8a32964 Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (:imjalpreet)" Date: Tue, 9 Jan 2024 17:28:00 +0530 Subject: [PATCH 3/5] Move partitionColumns to BaseHiveTableLayoutHandle --- .../hive/BaseHiveTableLayoutHandle.java | 10 +++++++ .../facebook/presto/hive/HiveMetadata.java | 6 ++-- .../presto/hive/HivePageSourceProvider.java | 6 ++-- .../presto/hive/HiveTableLayoutHandle.java | 27 +++++++++--------- .../presto/hive/rule/HiveFilterPushdown.java | 3 +- .../presto/hive/AbstractTestHiveClient.java | 2 +- .../iceberg/IcebergAbstractMetadata.java | 2 +- .../iceberg/IcebergTableLayoutHandle.java | 28 +++++++++---------- .../optimizer/IcebergFilterPushdown.java | 3 +- 9 files changed, 50 insertions(+), 37 deletions(-) diff --git a/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableLayoutHandle.java b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableLayoutHandle.java index 98994c6081166..81aa6742254f8 100644 --- a/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableLayoutHandle.java +++ b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableLayoutHandle.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Optional; @@ -30,6 +31,7 @@ public class BaseHiveTableLayoutHandle implements ConnectorTableLayoutHandle { + private final List partitionColumns; private final TupleDomain domainPredicate; private final RowExpression remainingPredicate; private final boolean pushdownFilterEnabled; @@ -40,12 +42,14 @@ public class BaseHiveTableLayoutHandle @JsonCreator public BaseHiveTableLayoutHandle( + @JsonProperty("partitionColumns") List partitionColumns, @JsonProperty("domainPredicate") TupleDomain domainPredicate, @JsonProperty("remainingPredicate") RowExpression remainingPredicate, @JsonProperty("pushdownFilterEnabled") boolean pushdownFilterEnabled, @JsonProperty("partitionColumnPredicate") TupleDomain partitionColumnPredicate, @JsonProperty("partitions") Optional> partitions) { + this.partitionColumns = ImmutableList.copyOf(requireNonNull(partitionColumns, "partitionColumns is null")); this.domainPredicate = requireNonNull(domainPredicate, "domainPredicate is null"); this.remainingPredicate = requireNonNull(remainingPredicate, "remainingPredicate is null"); this.pushdownFilterEnabled = pushdownFilterEnabled; @@ -53,6 +57,12 @@ public BaseHiveTableLayoutHandle( this.partitions = requireNonNull(partitions, "partitions is null"); } + @JsonProperty + public List getPartitionColumns() + { + return partitionColumns; + } + @JsonProperty public TupleDomain getDomainPredicate() { diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java index f2fd669d18085..80700ceba6f2d 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java @@ -2565,7 +2565,7 @@ public boolean supportsMetadataDelete(ConnectorSession session, ConnectorTableHa .collect(toImmutableSet()); Set partitionColumnNames = layoutHandle.getPartitionColumns().stream() - .map(HiveColumnHandle::getName) + .map(BaseHiveColumnHandle::getName) .collect(toImmutableSet()); return partitionColumnNames.containsAll(predicateColumnNames); @@ -2633,7 +2633,7 @@ public List getTableLayouts(ConnectorSession session new HiveTableLayoutHandle.Builder() .setSchemaTableName(handle.getSchemaTableName()) .setTablePath(table.getStorage().getLocation()) - .setPartitionColumns(hivePartitionResult.getPartitionColumns()) + .setPartitionColumns(ImmutableList.copyOf(hivePartitionResult.getPartitionColumns())) .setDataColumns(pruneColumnComments(hivePartitionResult.getDataColumns())) .setTableParameters(hivePartitionResult.getTableParameters()) .setDomainPredicate(domainPredicate) @@ -3666,7 +3666,7 @@ public TableLayoutFilterCoverage getTableLayoutFilterCoverage(ConnectorTableLayo { HiveTableLayoutHandle tableHandle = (HiveTableLayoutHandle) connectorTableLayoutHandle; Set relevantColumns = tableHandle.getPartitionColumns().stream() - .map(HiveColumnHandle::getName) + .map(BaseHiveColumnHandle::getName) .filter(relevantPartitionColumns::contains) .collect(toImmutableSet()); if (relevantColumns.isEmpty()) { diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java b/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java index 226f5602e5b44..f7778e2f415fd 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java @@ -199,7 +199,7 @@ public ConnectorPageSource createPageSource( hiveStorageTimeZone, typeManager, hiveLayout.getSchemaTableName(), - hiveLayout.getPartitionColumns(), + hiveLayout.getPartitionColumns().stream().map(HiveColumnHandle.class::cast).collect(toList()), hiveLayout.getDataColumns(), hiveLayout.getTableParameters(), hiveSplit.getPartitionDataColumnCount(), @@ -616,7 +616,9 @@ private static boolean shouldSkipBucket(HiveTableLayoutHandle hiveLayout, HiveSp private static boolean shouldSkipPartition(TypeManager typeManager, HiveTableLayoutHandle hiveLayout, DateTimeZone hiveStorageTimeZone, HiveSplit hiveSplit, SplitContext splitContext) { - List partitionColumns = hiveLayout.getPartitionColumns(); + List partitionColumns = hiveLayout.getPartitionColumns().stream() + .map(HiveColumnHandle.class::cast) + .collect(toList()); List partitionTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toList()); diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveTableLayoutHandle.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveTableLayoutHandle.java index cc0c9b324ed83..1d7f19202e5eb 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveTableLayoutHandle.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveTableLayoutHandle.java @@ -44,13 +44,13 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableSet.toImmutableSet; import static java.util.Objects.requireNonNull; +import static java.util.stream.Collectors.toList; public class HiveTableLayoutHandle extends BaseHiveTableLayoutHandle { private final SchemaTableName schemaTableName; private final String tablePath; - private final List partitionColumns; private final List dataColumns; private final Map tableParameters; private final Map predicateColumns; @@ -89,7 +89,7 @@ public HiveTableLayoutHandle( this( schemaTableName, tablePath, - partitionColumns, + partitionColumns.stream().map(BaseHiveColumnHandle.class::cast).collect(toList()), dataColumns, tableParameters, domainPredicate, @@ -111,7 +111,7 @@ public HiveTableLayoutHandle( protected HiveTableLayoutHandle( SchemaTableName schemaTableName, String tablePath, - List partitionColumns, + List partitionColumns, List dataColumns, Map tableParameters, TupleDomain domainPredicate, @@ -129,11 +129,16 @@ protected HiveTableLayoutHandle( boolean footerStatsUnreliable, Optional hiveTableHandle) { - super(domainPredicate, remainingPredicate, pushdownFilterEnabled, partitionColumnPredicate, partitions); + super( + partitionColumns, + domainPredicate, + remainingPredicate, + pushdownFilterEnabled, + partitionColumnPredicate, + partitions); this.schemaTableName = requireNonNull(schemaTableName, "table is null"); this.tablePath = requireNonNull(tablePath, "tablePath is null"); - this.partitionColumns = ImmutableList.copyOf(requireNonNull(partitionColumns, "partitionColumns is null")); this.dataColumns = ImmutableList.copyOf(requireNonNull(dataColumns, "dataColumns is null")); this.tableParameters = ImmutableMap.copyOf(requireNonNull(tableParameters, "tableProperties is null")); this.predicateColumns = requireNonNull(predicateColumns, "predicateColumns is null"); @@ -160,12 +165,6 @@ public String getTablePath() return tablePath; } - @JsonProperty - public List getPartitionColumns() - { - return partitionColumns; - } - @JsonProperty public List getDataColumns() { @@ -284,7 +283,7 @@ private TupleDomain getConstraint(PlanCanonicalizationStrategy can // Constants are only removed from point checks, and not range checks. Example: // `x = 1` is equivalent to `x = 1000` // `x > 1` is NOT equivalent to `x > 1000` - TupleDomain constraint = createPredicate(ImmutableList.copyOf(partitionColumns), partitions.get()); + TupleDomain constraint = createPredicate(ImmutableList.copyOf(getPartitionColumns()), partitions.get()); constraint = getDomainPredicate() .transform(subfield -> subfield.getPath().isEmpty() ? subfield.getRootName() : null) .transform(getPredicateColumns()::get) @@ -356,7 +355,7 @@ public static class Builder { private SchemaTableName schemaTableName; private String tablePath; - private List partitionColumns; + private List partitionColumns; private List dataColumns; private Map tableParameters; private TupleDomain domainPredicate; @@ -387,7 +386,7 @@ public Builder setTablePath(String tablePath) return this; } - public Builder setPartitionColumns(List partitionColumns) + public Builder setPartitionColumns(List partitionColumns) { this.partitionColumns = partitionColumns; return this; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java index c76492a490456..b491b948c1e32 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java @@ -48,6 +48,7 @@ import com.facebook.presto.spi.relation.RowExpression; import com.facebook.presto.spi.relation.RowExpressionService; import com.google.common.base.Functions; +import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Map; @@ -179,7 +180,7 @@ public ConnectorPushdownFilterResult getConnectorPushdownFilterResult( new HiveTableLayoutHandle.Builder() .setSchemaTableName(tableName) .setTablePath(table.getStorage().getLocation()) - .setPartitionColumns(hivePartitionResult.getPartitionColumns()) + .setPartitionColumns(ImmutableList.copyOf(hivePartitionResult.getPartitionColumns())) .setDataColumns(pruneColumnComments(hivePartitionResult.getDataColumns())) .setTableParameters(hivePartitionResult.getTableParameters()) .setDomainPredicate(domainPredicate) diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java index d471956edfe7d..2f830bb6e14d9 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java @@ -894,7 +894,7 @@ protected void setupHive(String connectorId, String databaseName, String timeZon tableLayout = new ConnectorTableLayout( new HiveTableLayoutHandle.Builder() .setSchemaTableName(tablePartitionFormat).setTablePath("path") - .setPartitionColumns(partitionColumns) + .setPartitionColumns(ImmutableList.copyOf(partitionColumns)) .setDataColumns(dataColumns) .setTableParameters(ImmutableMap.of()) .setDomainPredicate(domainPredicate) diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java index 09ba236fb72a4..675902156ea97 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java @@ -198,7 +198,7 @@ public List getTableLayouts( ConnectorTableLayout layout = getTableLayout( session, new IcebergTableLayoutHandle.Builder() - .setPartitionColumns(getPartitionKeyColumnHandles(icebergTable, typeManager)) + .setPartitionColumns(ImmutableList.copyOf(getPartitionKeyColumnHandles(icebergTable, typeManager))) .setDataColumns(toHiveColumns(icebergTable.schema().columns())) .setDomainPredicate(constraint.getSummary().transform(IcebergAbstractMetadata::toSubfield)) .setRemainingPredicate(TRUE_CONSTANT) diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableLayoutHandle.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableLayoutHandle.java index 9f3c93a60ff59..a9a8c3b0b6b74 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableLayoutHandle.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableLayoutHandle.java @@ -15,6 +15,7 @@ import com.facebook.presto.common.Subfield; import com.facebook.presto.common.predicate.TupleDomain; +import com.facebook.presto.hive.BaseHiveColumnHandle; import com.facebook.presto.hive.BaseHiveTableLayoutHandle; import com.facebook.presto.hive.HivePartition; import com.facebook.presto.hive.metastore.Column; @@ -31,11 +32,11 @@ import java.util.Set; import static java.util.Objects.requireNonNull; +import static java.util.stream.Collectors.toList; public class IcebergTableLayoutHandle extends BaseHiveTableLayoutHandle { - private final List partitionColumns; private final List dataColumns; private final Map predicateColumns; private final Optional> requestedColumns; @@ -54,7 +55,7 @@ public IcebergTableLayoutHandle( @JsonProperty("table") IcebergTableHandle table) { this( - partitionColumns, + partitionColumns.stream().map(BaseHiveColumnHandle.class::cast).collect(toList()), dataColumns, domainPredicate, remainingPredicate, @@ -67,7 +68,7 @@ public IcebergTableLayoutHandle( } protected IcebergTableLayoutHandle( - List partitionColumns, + List partitionColumns, List dataColumns, TupleDomain domainPredicate, RowExpression remainingPredicate, @@ -78,21 +79,20 @@ protected IcebergTableLayoutHandle( Optional> partitions, IcebergTableHandle table) { - super(domainPredicate, remainingPredicate, pushdownFilterEnabled, partitionColumnPredicate, partitions); + super( + partitionColumns, + domainPredicate, + remainingPredicate, + pushdownFilterEnabled, + partitionColumnPredicate, + partitions); - this.partitionColumns = ImmutableList.copyOf(requireNonNull(partitionColumns, "partitionColumns is null")); this.dataColumns = ImmutableList.copyOf(requireNonNull(dataColumns, "dataColumns is null")); this.predicateColumns = requireNonNull(predicateColumns, "predicateColumns is null"); this.requestedColumns = requireNonNull(requestedColumns, "requestedColumns is null"); this.table = requireNonNull(table, "table is null"); } - @JsonProperty - public List getPartitionColumns() - { - return partitionColumns; - } - @JsonProperty public List getDataColumns() { @@ -129,7 +129,7 @@ public boolean equals(Object o) IcebergTableLayoutHandle that = (IcebergTableLayoutHandle) o; return Objects.equals(getDomainPredicate(), that.getDomainPredicate()) && Objects.equals(getRemainingPredicate(), that.getRemainingPredicate()) && - Objects.equals(partitionColumns, that.partitionColumns) && + Objects.equals(getPartitionColumns(), that.getPartitionColumns()) && Objects.equals(predicateColumns, that.predicateColumns) && Objects.equals(requestedColumns, that.requestedColumns) && Objects.equals(isPushdownFilterEnabled(), that.isPushdownFilterEnabled()) && @@ -151,7 +151,7 @@ public String toString() public static class Builder { - private List partitionColumns; + private List partitionColumns; private List dataColumns; private TupleDomain domainPredicate; private RowExpression remainingPredicate; @@ -162,7 +162,7 @@ public static class Builder private Optional> partitions; private IcebergTableHandle table; - public Builder setPartitionColumns(List partitionColumns) + public Builder setPartitionColumns(List partitionColumns) { this.partitionColumns = partitionColumns; return this; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergFilterPushdown.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergFilterPushdown.java index fb3fff5128279..3d3744fd6932b 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergFilterPushdown.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergFilterPushdown.java @@ -45,6 +45,7 @@ import com.facebook.presto.spi.relation.RowExpressionService; import com.google.common.base.Functions; import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; import org.apache.iceberg.Table; @@ -192,7 +193,7 @@ protected ConnectorPushdownFilterResult getConnectorPushdownFilterResult( metadata.getTableLayout( session, new IcebergTableLayoutHandle.Builder() - .setPartitionColumns(partitionColumns) + .setPartitionColumns(ImmutableList.copyOf(partitionColumns)) .setDataColumns(toHiveColumns(icebergTable.schema().columns())) .setDomainPredicate(domainPredicate) .setRemainingPredicate(remainingExpressions.getRemainingExpression()) From b39ce48615118a2d73da08bb13bb8882727b9fe2 Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (:imjalpreet)" Date: Wed, 10 Jan 2024 05:37:00 +0530 Subject: [PATCH 4/5] Introduce BaseHiveTableHandle Refactor HiveTableHandle and IcebergTableHandle to extend BaseHiveTableHandle --- .../presto/hive/BaseHiveTableHandle.java | 54 +++++++++++++++++++ .../facebook/presto/hive/HiveTableHandle.java | 40 ++++---------- .../iceberg/IcebergAbstractMetadata.java | 14 ++--- .../presto/iceberg/IcebergHiveMetadata.java | 12 ++--- .../presto/iceberg/IcebergNativeMetadata.java | 4 +- .../iceberg/IcebergPageSourceProvider.java | 2 +- .../presto/iceberg/IcebergSplitManager.java | 10 ++-- .../presto/iceberg/IcebergTableHandle.java | 43 +++++---------- .../facebook/presto/iceberg/IcebergUtil.java | 2 +- .../presto/iceberg/TableStatisticsMaker.java | 8 +-- .../optimizer/IcebergPlanOptimizer.java | 2 +- .../iceberg/TestIcebergLogicalPlanner.java | 2 +- 12 files changed, 104 insertions(+), 89 deletions(-) create mode 100644 presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableHandle.java diff --git a/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableHandle.java b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableHandle.java new file mode 100644 index 0000000000000..0b7c58d4c20a2 --- /dev/null +++ b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveTableHandle.java @@ -0,0 +1,54 @@ +/* + * Licensed 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 com.facebook.presto.hive; + +import com.facebook.presto.spi.ConnectorTableHandle; +import com.facebook.presto.spi.SchemaTableName; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import static java.util.Objects.requireNonNull; + +public class BaseHiveTableHandle + implements ConnectorTableHandle +{ + private final String schemaName; + private final String tableName; + + @JsonCreator + public BaseHiveTableHandle( + @JsonProperty("schemaName") String schemaName, + @JsonProperty("tableName") String tableName) + { + this.schemaName = requireNonNull(schemaName, "schemaName is null"); + this.tableName = requireNonNull(tableName, "tableName is null"); + } + + @JsonProperty + public String getSchemaName() + { + return schemaName; + } + + @JsonProperty + public String getTableName() + { + return tableName; + } + + public SchemaTableName getSchemaTableName() + { + return new SchemaTableName(schemaName, tableName); + } +} diff --git a/presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveTableHandle.java b/presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveTableHandle.java index 527657be5bd5d..9209b1caa7a46 100644 --- a/presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveTableHandle.java +++ b/presto-hive-metastore/src/main/java/com/facebook/presto/hive/HiveTableHandle.java @@ -13,8 +13,6 @@ */ package com.facebook.presto.hive; -import com.facebook.presto.spi.ConnectorTableHandle; -import com.facebook.presto.spi.SchemaTableName; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -26,11 +24,8 @@ import static java.util.Objects.requireNonNull; public class HiveTableHandle - implements ConnectorTableHandle + extends BaseHiveTableHandle { - private final String schemaName; - private final String tableName; - private final Optional>> analyzePartitionValues; @JsonCreator @@ -39,8 +34,8 @@ public HiveTableHandle( @JsonProperty("tableName") String tableName, @JsonProperty("analyzePartitionValues") Optional>> analyzePartitionValues) { - this.schemaName = requireNonNull(schemaName, "schemaName is null"); - this.tableName = requireNonNull(tableName, "tableName is null"); + super(schemaName, tableName); + this.analyzePartitionValues = requireNonNull(analyzePartitionValues, "analyzePartitionValues is null"); } @@ -51,19 +46,7 @@ public HiveTableHandle(String schemaName, String tableName) public HiveTableHandle withAnalyzePartitionValues(Optional>> analyzePartitionValues) { - return new HiveTableHandle(schemaName, tableName, analyzePartitionValues); - } - - @JsonProperty - public String getSchemaName() - { - return schemaName; - } - - @JsonProperty - public String getTableName() - { - return tableName; + return new HiveTableHandle(getSchemaName(), getTableName(), analyzePartitionValues); } @JsonProperty @@ -72,11 +55,6 @@ public Optional>> getAnalyzePartitionValues() return analyzePartitionValues; } - public SchemaTableName getSchemaTableName() - { - return new SchemaTableName(schemaName, tableName); - } - @Override public boolean equals(Object o) { @@ -88,23 +66,23 @@ public boolean equals(Object o) } HiveTableHandle that = (HiveTableHandle) o; // Do not include analyzePartitionValues in hashCode and equals comparison - return Objects.equals(schemaName, that.schemaName) && - Objects.equals(tableName, that.tableName); + return Objects.equals(getSchemaName(), that.getSchemaName()) && + Objects.equals(getTableName(), that.getTableName()); } @Override public int hashCode() { // Do not include analyzePartitionValues in hashCode and equals comparison - return Objects.hash(schemaName, tableName); + return Objects.hash(getSchemaName(), getTableName()); } @Override public String toString() { return toStringHelper(this) - .add("schemaName", schemaName) - .add("tableName", tableName) + .add("schemaName", getSchemaName()) + .add("tableName", getTableName()) .add("analyzePartitionValues", analyzePartitionValues) .toString(); } diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java index 675902156ea97..fde213fa6eee3 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java @@ -328,7 +328,7 @@ protected Optional getIcebergSystemTable(SchemaTableName tableName, public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle table) { IcebergTableHandle icebergTableHandle = (IcebergTableHandle) table; - return getTableMetadata(session, icebergTableHandle.getSchemaTableName(), icebergTableHandle.getTableName()); + return getTableMetadata(session, icebergTableHandle.getSchemaTableName(), icebergTableHandle.getIcebergTableName()); } protected ConnectorTableMetadata getTableMetadata(ConnectorSession session, SchemaTableName table, IcebergTableName icebergTableName) @@ -395,7 +395,7 @@ protected ConnectorInsertTableHandle beginIcebergTableInsert(IcebergTableHandle return new IcebergWritableTableHandle( table.getSchemaName(), - table.getTableName(), + table.getIcebergTableName(), SchemaParser.toJson(icebergTable.schema()), PartitionSpecParser.toJson(icebergTable.spec()), getColumns(icebergTable.schema(), icebergTable.spec(), typeManager), @@ -561,7 +561,7 @@ public void addColumn(ConnectorSession session, ConnectorTableHandle tableHandle } IcebergTableHandle handle = (IcebergTableHandle) tableHandle; - verify(handle.getTableName().getTableType() == DATA, "only the data table can have columns added"); + verify(handle.getIcebergTableName().getTableType() == DATA, "only the data table can have columns added"); Table icebergTable = getIcebergTable(session, handle.getSchemaTableName()); Transaction transaction = icebergTable.newTransaction(); transaction.updateSchema().addColumn(column.getName(), columnType, column.getComment()).commit(); @@ -578,7 +578,7 @@ public void dropColumn(ConnectorSession session, ConnectorTableHandle tableHandl { IcebergTableHandle icebergTableHandle = (IcebergTableHandle) tableHandle; IcebergColumnHandle handle = (IcebergColumnHandle) column; - verify(icebergTableHandle.getTableName().getTableType() == DATA, "only the data table can have columns dropped"); + verify(icebergTableHandle.getIcebergTableName().getTableType() == DATA, "only the data table can have columns dropped"); Table icebergTable = getIcebergTable(session, icebergTableHandle.getSchemaTableName()); // Currently drop partition column used in any partition specs of a table would introduce some problems in Iceberg. @@ -598,7 +598,7 @@ public void dropColumn(ConnectorSession session, ConnectorTableHandle tableHandl public void renameColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle source, String target) { IcebergTableHandle icebergTableHandle = (IcebergTableHandle) tableHandle; - verify(icebergTableHandle.getTableName().getTableType() == DATA, "only the data table can have columns renamed"); + verify(icebergTableHandle.getIcebergTableName().getTableType() == DATA, "only the data table can have columns renamed"); IcebergColumnHandle columnHandle = (IcebergColumnHandle) source; Table icebergTable = getIcebergTable(session, icebergTableHandle.getSchemaTableName()); Transaction transaction = icebergTable.newTransaction(); @@ -613,7 +613,7 @@ public void renameColumn(ConnectorSession session, ConnectorTableHandle tableHan public ConnectorInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle) { IcebergTableHandle table = (IcebergTableHandle) tableHandle; - verify(table.getTableName().getTableType() == DATA, "only the data table can have data inserted"); + verify(table.getIcebergTableName().getTableType() == DATA, "only the data table can have data inserted"); Table icebergTable = getIcebergTable(session, table.getSchemaTableName()); validateTableMode(session, icebergTable); @@ -626,7 +626,7 @@ public Map getColumnHandles(ConnectorSession session, Conn IcebergTableHandle table = (IcebergTableHandle) tableHandle; Table icebergTable = getIcebergTable(session, table.getSchemaTableName()); Schema schema; - if (table.getTableName().getTableType() == CHANGELOG) { + if (table.getIcebergTableName().getTableType() == CHANGELOG) { schema = ChangelogUtil.changelogTableSchema(getRowTypeFromColumnMeta(getColumnMetadatas(icebergTable))); } else { diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java index 1cc939e656427..3b0bb48cc40a4 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java @@ -333,7 +333,7 @@ public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Con public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle) { IcebergTableHandle handle = (IcebergTableHandle) tableHandle; - verify(handle.getTableName().getTableType() == DATA, "only the data table can be dropped"); + verify(handle.getIcebergTableName().getTableType() == DATA, "only the data table can be dropped"); // TODO: support path override in Iceberg table creation org.apache.iceberg.Table table = getIcebergTable(session, handle.getSchemaTableName()); Optional> tableProperties = tryGetProperties(table); @@ -345,15 +345,15 @@ public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle throw new PrestoException(NOT_SUPPORTED, "Table " + handle.getSchemaTableName() + " contains Iceberg path override properties and cannot be dropped from Presto"); } } - metastore.dropTable(getMetastoreContext(session), handle.getSchemaName(), handle.getTableName().getTableName(), true); + metastore.dropTable(getMetastoreContext(session), handle.getSchemaName(), handle.getIcebergTableName().getTableName(), true); } @Override public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTable) { IcebergTableHandle handle = (IcebergTableHandle) tableHandle; - verify(handle.getTableName().getTableType() == DATA, "only the data table can be renamed"); - metastore.renameTable(getMetastoreContext(session), handle.getSchemaName(), handle.getTableName().getTableName(), newTable.getSchemaName(), newTable.getTableName()); + verify(handle.getIcebergTableName().getTableType() == DATA, "only the data table can be renamed"); + metastore.renameTable(getMetastoreContext(session), handle.getSchemaName(), handle.getIcebergTableName().getTableName(), newTable.getSchemaName(), newTable.getTableName()); } @Override @@ -470,7 +470,7 @@ public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTab return new VariableReferenceExpression(Optional.empty(), columnHandle.getName(), columnHandle.getType()); }); RowExpression translatedPredicate = rowExpressionService.getDomainTranslator().toPredicate(predicate); - PartitionStatistics hiveStatistics = metastore.getTableStatistics(getMetastoreContext(session), handle.getSchemaName(), handle.getTableName().getTableName()); + PartitionStatistics hiveStatistics = metastore.getTableStatistics(getMetastoreContext(session), handle.getSchemaName(), handle.getIcebergTableName().getTableName()); TableStatistics mergedStatistics = mergeHiveStatistics(icebergStatistics, hiveStatistics, mergeStrategy, icebergTable.spec()); TableStatistics.Builder filteredStatsBuilder = TableStatistics.builder() .setRowCount(mergedStatistics.getRowCount()); @@ -498,7 +498,7 @@ public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTab IcebergColumnHandle::getType))); }).orElseGet(() -> { if (!mergeStrategy.equals(HiveStatisticsMergeStrategy.NONE)) { - PartitionStatistics hiveStats = metastore.getTableStatistics(getMetastoreContext(session), handle.getSchemaName(), handle.getTableName().getTableName()); + PartitionStatistics hiveStats = metastore.getTableStatistics(getMetastoreContext(session), handle.getSchemaName(), handle.getIcebergTableName().getTableName()); return mergeHiveStatistics(icebergStatistics, hiveStats, mergeStrategy, icebergTable.spec()); } return icebergStatistics; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java index e2e69a7d9e55e..a1e66fe4eb2d1 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergNativeMetadata.java @@ -207,7 +207,7 @@ public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Con public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle) { IcebergTableHandle icebergTableHandle = (IcebergTableHandle) tableHandle; - verify(icebergTableHandle.getTableName().getTableType() == DATA, "only the data table can be dropped"); + verify(icebergTableHandle.getIcebergTableName().getTableType() == DATA, "only the data table can be dropped"); TableIdentifier tableIdentifier = toIcebergTableIdentifier(icebergTableHandle.getSchemaTableName()); resourceFactory.getCatalog(session).dropTable(tableIdentifier); } @@ -216,7 +216,7 @@ public void dropTable(ConnectorSession session, ConnectorTableHandle tableHandle public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTable) { IcebergTableHandle icebergTableHandle = (IcebergTableHandle) tableHandle; - verify(icebergTableHandle.getTableName().getTableType() == DATA, "only the data table can be renamed"); + verify(icebergTableHandle.getIcebergTableName().getTableType() == DATA, "only the data table can be renamed"); TableIdentifier from = toIcebergTableIdentifier(icebergTableHandle.getSchemaTableName()); TableIdentifier to = toIcebergTableIdentifier(newTable); resourceFactory.getCatalog(session).renameTable(from, to); diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java index 36b6fa53e3384..a70d7352cfe6d 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java @@ -737,7 +737,7 @@ public ConnectorPageSource createPageSource( .forEach(regularColumns::add); // TODO: pushdownFilter for icebergLayout - HdfsContext hdfsContext = new HdfsContext(session, table.getSchemaName(), table.getTableName().getTableName()); + HdfsContext hdfsContext = new HdfsContext(session, table.getSchemaName(), table.getIcebergTableName().getTableName()); ConnectorPageSourceWithRowPositions connectorPageSourceWithRowPositions = createDataPageSource( session, hdfsContext, diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java index f045d4b5abf62..b55196dc2ca8b 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergSplitManager.java @@ -63,7 +63,7 @@ public ConnectorSplitSource getSplits( IcebergTableLayoutHandle layoutHandle = (IcebergTableLayoutHandle) layout; IcebergTableHandle table = layoutHandle.getTable(); - if (!table.getTableName().getSnapshotId().isPresent()) { + if (!table.getIcebergTableName().getSnapshotId().isPresent()) { return new FixedSplitSource(ImmutableList.of()); } @@ -77,10 +77,10 @@ public ConnectorSplitSource getSplits( Table icebergTable = getIcebergTable(transactionManager.get(transaction), session, table.getSchemaTableName()); - if (table.getTableName().getTableType() == CHANGELOG) { + if (table.getIcebergTableName().getTableType() == CHANGELOG) { // if the snapshot isn't specified, grab the oldest available version of the table - long fromSnapshot = table.getTableName().getSnapshotId().orElseGet(() -> SnapshotUtil.oldestAncestor(icebergTable).snapshotId()); - long toSnapshot = table.getTableName().getChangelogEndSnapshot().orElse(icebergTable.currentSnapshot().snapshotId()); + long fromSnapshot = table.getIcebergTableName().getSnapshotId().orElseGet(() -> SnapshotUtil.oldestAncestor(icebergTable).snapshotId()); + long toSnapshot = table.getIcebergTableName().getChangelogEndSnapshot().orElse(icebergTable.currentSnapshot().snapshotId()); IncrementalChangelogScan scan = icebergTable.newIncrementalChangelogScan() .fromSnapshotExclusive(fromSnapshot) .toSnapshot(toSnapshot); @@ -89,7 +89,7 @@ public ConnectorSplitSource getSplits( else { TableScan tableScan = icebergTable.newScan() .filter(toIcebergExpression(predicate)) - .useSnapshot(table.getTableName().getSnapshotId().get()); + .useSnapshot(table.getIcebergTableName().getSnapshotId().get()); // TODO Use residual. Right now there is no way to propagate residual to presto but at least we can // propagate it at split level so the parquet pushdown can leverage it. diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableHandle.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableHandle.java index 1a1a4a7fbc78e..e411e0ef72238 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableHandle.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergTableHandle.java @@ -14,8 +14,7 @@ package com.facebook.presto.iceberg; import com.facebook.presto.common.predicate.TupleDomain; -import com.facebook.presto.spi.ConnectorTableHandle; -import com.facebook.presto.spi.SchemaTableName; +import com.facebook.presto.hive.BaseHiveTableHandle; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,10 +24,9 @@ import static java.util.Objects.requireNonNull; public class IcebergTableHandle - implements ConnectorTableHandle + extends BaseHiveTableHandle { - private final String schemaName; - private final IcebergTableName tableName; + private final IcebergTableName icebergTableName; private final TupleDomain predicate; private final boolean snapshotSpecified; private final Optional tableSchemaJson; @@ -36,28 +34,23 @@ public class IcebergTableHandle @JsonCreator public IcebergTableHandle( @JsonProperty("schemaName") String schemaName, - @JsonProperty("tableName") IcebergTableName tableName, + @JsonProperty("icebergTableName") IcebergTableName icebergTableName, @JsonProperty("snapshotSpecified") boolean snapshotSpecified, @JsonProperty("predicate") TupleDomain predicate, @JsonProperty("tableSchemaJson") Optional tableSchemaJson) { - this.schemaName = requireNonNull(schemaName, "schemaName is null"); - this.tableName = requireNonNull(tableName, "tableName is null"); + super(schemaName, icebergTableName.getTableName()); + + this.icebergTableName = requireNonNull(icebergTableName, "tableName is null"); this.snapshotSpecified = snapshotSpecified; this.predicate = requireNonNull(predicate, "predicate is null"); this.tableSchemaJson = requireNonNull(tableSchemaJson, "tableSchemaJson is null"); } @JsonProperty - public String getSchemaName() - { - return schemaName; - } - - @JsonProperty - public IcebergTableName getTableName() + public IcebergTableName getIcebergTableName() { - return tableName; + return icebergTableName; } @JsonProperty @@ -78,16 +71,6 @@ public Optional getTableSchemaJson() return tableSchemaJson; } - public SchemaTableName getSchemaTableName() - { - return new SchemaTableName(schemaName, tableName.getTableName()); - } - - public SchemaTableName getSchemaTableNameWithType() - { - return new SchemaTableName(schemaName, tableName.getTableNameWithType()); - } - @Override public boolean equals(Object o) { @@ -99,8 +82,8 @@ public boolean equals(Object o) } IcebergTableHandle that = (IcebergTableHandle) o; - return Objects.equals(schemaName, that.schemaName) && - Objects.equals(tableName, that.tableName) && + return Objects.equals(getSchemaName(), that.getSchemaName()) && + Objects.equals(icebergTableName, that.icebergTableName) && snapshotSpecified == that.snapshotSpecified && Objects.equals(predicate, that.predicate) && Objects.equals(tableSchemaJson, that.tableSchemaJson); @@ -109,12 +92,12 @@ public boolean equals(Object o) @Override public int hashCode() { - return Objects.hash(schemaName, tableName, predicate, snapshotSpecified, tableSchemaJson); + return Objects.hash(getSchemaName(), icebergTableName, predicate, snapshotSpecified, tableSchemaJson); } @Override public String toString() { - return tableName.toString(); + return icebergTableName.toString(); } } diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java index e6b2ed5cd48e1..670070f25e41c 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java @@ -549,7 +549,7 @@ public static List getPartitions( Constraint constraint, List partitionColumns) { - IcebergTableName name = ((IcebergTableHandle) tableHandle).getTableName(); + IcebergTableName name = ((IcebergTableHandle) tableHandle).getIcebergTableName(); // Empty iceberg table would cause `snapshotId` not present Optional snapshotId = resolveSnapshotIdByName(icebergTable, name); diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java index 32a6b9dbc10b5..5afacd9527a98 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java @@ -107,7 +107,7 @@ public static TableStatistics getTableStatistics(ConnectorSession session, Const private TableStatistics makeTableStatistics(IcebergTableHandle tableHandle, Constraint constraint, List selectedColumns) { - if (!tableHandle.getTableName().getSnapshotId().isPresent() || constraint.getSummary().isNone()) { + if (!tableHandle.getIcebergTableName().getSnapshotId().isPresent() || constraint.getSummary().isNone()) { return TableStatistics.builder() .setRowCount(Estimate.of(0)) .build(); @@ -141,7 +141,7 @@ private TableStatistics makeTableStatistics(IcebergTableHandle tableHandle, Cons TableScan tableScan = icebergTable.newScan() .filter(toIcebergExpression(intersection)) .select(selectedColumns.stream().map(IcebergColumnHandle::getName).collect(Collectors.toList())) - .useSnapshot(tableHandle.getTableName().getSnapshotId().get()) + .useSnapshot(tableHandle.getIcebergTableName().getSnapshotId().get()) .includeColumnStats(); Partition summary = null; @@ -218,7 +218,7 @@ public static void writeTableStatistics(NodeVersion nodeVersion, IcebergTableHan private void writeTableStatistics(NodeVersion nodeVersion, IcebergTableHandle tableHandle, Collection computedStatistics) { - Snapshot snapshot = tableHandle.getTableName().getSnapshotId().map(icebergTable::snapshot).orElseGet(icebergTable::currentSnapshot); + Snapshot snapshot = tableHandle.getIcebergTableName().getSnapshotId().map(icebergTable::snapshot).orElseGet(icebergTable::currentSnapshot); if (snapshot == null) { // this may occur if the table has not been written to. return; @@ -332,7 +332,7 @@ private void updatePartitionedStats( private Optional getClosestStatisticsFileForSnapshot(IcebergTableHandle handle) { - Snapshot target = handle.getTableName().getSnapshotId().map(icebergTable::snapshot).orElseGet(icebergTable::currentSnapshot); + Snapshot target = handle.getIcebergTableName().getSnapshotId().map(icebergTable::snapshot).orElseGet(icebergTable::currentSnapshot); return icebergTable.statisticsFiles() .stream() .min((first, second) -> { diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergPlanOptimizer.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergPlanOptimizer.java index bc77380a93251..79832fd866336 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergPlanOptimizer.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergPlanOptimizer.java @@ -131,7 +131,7 @@ public PlanNode visitFilter(FilterNode filter, RewriteContext context) IcebergTableHandle oldTableHandle = (IcebergTableHandle) handle.getConnectorHandle(); IcebergTableHandle newTableHandle = new IcebergTableHandle( oldTableHandle.getSchemaName(), - oldTableHandle.getTableName(), + oldTableHandle.getIcebergTableName(), oldTableHandle.isSnapshotSpecified(), simplifiedColumnDomain, oldTableHandle.getTableSchemaJson()); diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java index 6d7d1878a5fee..ed0e0f8a0ef69 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java @@ -690,7 +690,7 @@ private void assertTableLayout(Plan plan, String tableName, TupleDomain Date: Wed, 17 Jan 2024 13:57:00 +0530 Subject: [PATCH 5/5] Convert BaseHiveColumnHandle interface into a class --- .../presto/hive/BaseHiveColumnHandle.java | 62 +++++++++++++++- presto-hive-hadoop2/pom.xml | 5 ++ ...TestHiveFileSystemS3SelectCsvPushdown.java | 2 +- ...leSystemS3SelectCsvPushdownWithSplits.java | 2 +- ...estHiveFileSystemS3SelectJsonPushdown.java | 2 +- ...eSystemS3SelectJsonPushdownWithSplits.java | 2 +- .../presto/hive/GenericHiveRecordCursor.java | 2 +- .../presto/hive/HiveColumnHandle.java | 74 +++++-------------- .../facebook/presto/hive/HiveMetadata.java | 8 +- .../presto/hive/HivePageSourceProvider.java | 8 +- .../presto/hive/HivePartitionManager.java | 8 +- .../presto/hive/HivePartitionResult.java | 6 +- .../presto/hive/HiveSplitManager.java | 2 +- .../com/facebook/presto/hive/HiveUtil.java | 4 +- .../presto/hive/orc/OrcBatchPageSource.java | 2 +- .../hive/orc/OrcBatchPageSourceFactory.java | 4 +- .../orc/OrcSelectivePageSourceFactory.java | 4 +- .../parquet/ParquetPageSourceFactory.java | 6 +- .../hive/rcfile/RcFilePageSourceFactory.java | 2 +- .../presto/hive/rule/HiveFilterPushdown.java | 3 +- .../rule/HiveParquetDereferencePushDown.java | 2 +- .../presto/hive/AbstractTestHiveClient.java | 4 +- .../hive/AbstractTestHiveFileFormats.java | 4 +- ...stractDwrfEncryptionInformationSource.java | 2 +- .../hive/TestBackgroundHiveSplitLoader.java | 2 +- .../presto/hive/TestDynamicPruning.java | 4 +- .../TestGenericHiveRecordCursorProvider.java | 2 +- .../presto/hive/TestHiveColumnHandle.java | 4 +- .../presto/hive/TestHiveLogicalPlanner.java | 2 +- .../presto/hive/TestHivePageSink.java | 2 +- .../presto/hive/TestHivePartitionManager.java | 4 +- .../facebook/presto/hive/TestHiveSplit.java | 2 +- .../presto/hive/TestHiveSplitManager.java | 4 +- .../hive/TestHiveTableLayoutHandle.java | 4 +- .../presto/hive/TestIonSqlQueryBuilder.java | 2 +- .../presto/hive/TestJsonHiveHandles.java | 2 +- ...TestMergeRequestedAndPredicateColumns.java | 2 +- .../TestOrcBatchPageSourceMemoryTracking.java | 4 +- .../presto/hive/benchmark/FileFormat.java | 2 +- .../parquet/TestParquetPageSourceFactory.java | 4 +- .../predicate/TestParquetPredicateUtils.java | 2 +- .../s3select/TestS3SelectRecordCursor.java | 4 +- .../TestMetastoreHiveStatisticsProvider.java | 4 +- .../presto/iceberg/IcebergColumnHandle.java | 59 +++------------ .../presto/iceberg/IcebergOrcColumn.java | 2 +- .../iceberg/IcebergPageSourceProvider.java | 4 +- .../facebook/presto/iceberg/IcebergUtil.java | 4 +- .../iceberg/TestIcebergColumnHandle.java | 2 +- .../iceberg/TestIcebergLogicalPlanner.java | 2 +- .../presto/iceberg/TestStatisticsUtil.java | 2 +- .../hive/TestIcebergHiveStatistics.java | 6 +- 51 files changed, 172 insertions(+), 185 deletions(-) diff --git a/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveColumnHandle.java b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveColumnHandle.java index 8d0c2302e5bba..956a213a847cc 100644 --- a/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveColumnHandle.java +++ b/presto-hive-common/src/main/java/com/facebook/presto/hive/BaseHiveColumnHandle.java @@ -13,10 +13,66 @@ */ package com.facebook.presto.hive; +import com.facebook.presto.common.Subfield; import com.facebook.presto.spi.ColumnHandle; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; -public interface BaseHiveColumnHandle - extends ColumnHandle +import java.util.List; +import java.util.Optional; + +import static java.util.Objects.requireNonNull; + +public class BaseHiveColumnHandle + implements ColumnHandle { - String getName(); + public enum ColumnType + { + PARTITION_KEY, + REGULAR, + SYNTHESIZED, + AGGREGATED, + } + + private final String name; + private final Optional comment; + private final ColumnType columnType; + private final List requiredSubfields; + + @JsonCreator + public BaseHiveColumnHandle( + @JsonProperty("name") String name, + @JsonProperty("comment") Optional comment, + @JsonProperty("columnType") ColumnType columnType, + @JsonProperty("requiredSubfields") List requiredSubfields) + { + this.name = requireNonNull(name, "name is null"); + this.comment = requireNonNull(comment, "comment is null"); + this.columnType = requireNonNull(columnType, "columnType is null"); + this.requiredSubfields = requireNonNull(requiredSubfields, "requiredSubfields is null"); + } + + @JsonProperty + public String getName() + { + return name; + } + + @JsonProperty + public Optional getComment() + { + return comment; + } + + @JsonProperty + public ColumnType getColumnType() + { + return columnType; + } + + @JsonProperty + public List getRequiredSubfields() + { + return requiredSubfields; + } } diff --git a/presto-hive-hadoop2/pom.xml b/presto-hive-hadoop2/pom.xml index b46d8c95ae51c..2688c5056e96b 100644 --- a/presto-hive-hadoop2/pom.xml +++ b/presto-hive-hadoop2/pom.xml @@ -22,6 +22,11 @@ presto-hive + + com.facebook.presto + presto-hive-common + + com.facebook.presto presto-hive-metastore diff --git a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdown.java b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdown.java index e0bac6fa3c77b..cb8fb26ae7cd5 100644 --- a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdown.java +++ b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdown.java @@ -28,7 +28,7 @@ import static com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder; import static com.facebook.presto.common.type.BigintType.BIGINT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveType.HIVE_LONG; public class TestHiveFileSystemS3SelectCsvPushdown diff --git a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdownWithSplits.java b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdownWithSplits.java index f1442a45d3a14..d5b5e5b3e7e85 100644 --- a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdownWithSplits.java +++ b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectCsvPushdownWithSplits.java @@ -26,7 +26,7 @@ import java.util.Optional; import static com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveFileSystemTestUtils.newSession; import static com.facebook.presto.hive.HiveType.HIVE_LONG; import static com.facebook.presto.hive.s3select.S3SelectTestHelper.expectedResult; diff --git a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdown.java b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdown.java index ac6d372918707..22d2cc78bc46f 100644 --- a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdown.java +++ b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdown.java @@ -28,7 +28,7 @@ import static com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder; import static com.facebook.presto.common.type.BigintType.BIGINT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveFileSystemTestUtils.filterTable; import static com.facebook.presto.hive.HiveFileSystemTestUtils.newSession; import static com.facebook.presto.hive.HiveFileSystemTestUtils.readTable; diff --git a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdownWithSplits.java b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdownWithSplits.java index b73bcffd32f53..7be723cdac203 100644 --- a/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdownWithSplits.java +++ b/presto-hive-hadoop2/src/test/java/com/facebook/presto/hive/s3select/TestHiveFileSystemS3SelectJsonPushdownWithSplits.java @@ -26,7 +26,7 @@ import java.util.Optional; import static com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveFileSystemTestUtils.newSession; import static com.facebook.presto.hive.HiveType.HIVE_LONG; import static com.facebook.presto.hive.s3select.S3SelectTestHelper.expectedResult; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursor.java b/presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursor.java index c051efd885b39..eddc776ed3c71 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursor.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursor.java @@ -69,7 +69,7 @@ import static com.facebook.presto.common.type.VarbinaryType.VARBINARY; import static com.facebook.presto.common.type.Varchars.isVarcharType; import static com.facebook.presto.common.type.Varchars.truncateToLength; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveErrorCode.HIVE_BAD_DATA; import static com.facebook.presto.hive.HiveErrorCode.HIVE_CURSOR_ERROR; import static com.facebook.presto.hive.HiveUtil.closeWithSuppression; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java index 81e47dc9c42ba..a9250eb40f184 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java @@ -27,9 +27,9 @@ import java.util.Optional; import static com.facebook.presto.common.type.BigintType.BIGINT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveType.HIVE_INT; import static com.facebook.presto.hive.HiveType.HIVE_LONG; import static com.facebook.presto.hive.HiveType.HIVE_STRING; @@ -40,7 +40,7 @@ import static java.util.Objects.requireNonNull; public class HiveColumnHandle - implements BaseHiveColumnHandle + extends BaseHiveColumnHandle { public static final int PATH_COLUMN_INDEX = -11; public static final String PATH_COLUMN_NAME = "$path"; @@ -67,21 +67,9 @@ public class HiveColumnHandle // Ids <= this can be used for distinguishing between different prefilled columns. public static final int MAX_PARTITION_KEY_COLUMN_INDEX = -13; - public enum ColumnType - { - PARTITION_KEY, - REGULAR, - SYNTHESIZED, - AGGREGATED, - } - - private final String name; private final HiveType hiveType; private final TypeSignature typeName; private final int hiveColumnIndex; - private final ColumnType columnType; - private final Optional comment; - private final List requiredSubfields; private final Optional partialAggregation; @JsonCreator @@ -95,14 +83,12 @@ public HiveColumnHandle( @JsonProperty("requiredSubfields") List requiredSubfields, @JsonProperty("partialAggregation") Optional partialAggregation) { - this.name = requireNonNull(name, "name is null"); + super(name, comment, columnType, requiredSubfields); + checkArgument(hiveColumnIndex >= 0 || columnType == PARTITION_KEY || columnType == SYNTHESIZED || columnType == AGGREGATED, format("hiveColumnIndex:%d is negative, columnType:%s", hiveColumnIndex, columnType.toString())); this.hiveColumnIndex = hiveColumnIndex; this.hiveType = requireNonNull(hiveType, "hiveType is null"); this.typeName = requireNonNull(typeSignature, "type is null"); - this.columnType = requireNonNull(columnType, "columnType is null"); - this.comment = requireNonNull(comment, "comment is null"); - this.requiredSubfields = requireNonNull(requiredSubfields, "requiredSubfields is null"); this.partialAggregation = requireNonNull(partialAggregation, "partialAggregation is null"); checkArgument(columnType != AGGREGATED || partialAggregation.isPresent(), "Aggregated column does not have aggregate function"); } @@ -119,12 +105,6 @@ public HiveColumnHandle( this(name, hiveType, typeSignature, hiveColumnIndex, columnType, comment, ImmutableList.of(), partialAggregation); } - @JsonProperty - public String getName() - { - return name; - } - @JsonProperty public HiveType getHiveType() { @@ -139,23 +119,17 @@ public int getHiveColumnIndex() public boolean isPartitionKey() { - return columnType == PARTITION_KEY; + return getColumnType() == PARTITION_KEY; } public boolean isHidden() { - return columnType == SYNTHESIZED; + return getColumnType() == SYNTHESIZED; } public ColumnMetadata getColumnMetadata(TypeManager typeManager) { - return new ColumnMetadata(name, typeManager.getType(typeName), null, isHidden()); - } - - @JsonProperty - public Optional getComment() - { - return comment; + return new ColumnMetadata(getName(), typeManager.getType(typeName), null, isHidden()); } @JsonProperty @@ -170,18 +144,6 @@ public TypeSignature getTypeSignature() return typeName; } - @JsonProperty - public ColumnType getColumnType() - { - return columnType; - } - - @JsonProperty - public List getRequiredSubfields() - { - return requiredSubfields; - } - @Override public ColumnHandle withRequiredSubfields(List subfields) { @@ -190,13 +152,13 @@ public ColumnHandle withRequiredSubfields(List subfields) return this; } - return new HiveColumnHandle(name, hiveType, typeName, hiveColumnIndex, columnType, comment, subfields, partialAggregation); + return new HiveColumnHandle(getName(), hiveType, typeName, hiveColumnIndex, getColumnType(), getComment(), subfields, partialAggregation); } @Override public int hashCode() { - return Objects.hash(name, hiveColumnIndex, hiveType, columnType, comment); + return Objects.hash(getName(), hiveColumnIndex, hiveType, getColumnType(), getComment()); } @Override @@ -209,22 +171,22 @@ public boolean equals(Object obj) return false; } HiveColumnHandle other = (HiveColumnHandle) obj; - return Objects.equals(this.name, other.name) && + return Objects.equals(this.getName(), other.getName()) && Objects.equals(this.hiveColumnIndex, other.hiveColumnIndex) && Objects.equals(this.hiveType, other.hiveType) && - Objects.equals(this.columnType, other.columnType) && - Objects.equals(this.comment, other.comment) && - Objects.equals(this.requiredSubfields, other.requiredSubfields); + Objects.equals(this.getColumnType(), other.getColumnType()) && + Objects.equals(this.getComment(), other.getComment()) && + Objects.equals(this.getRequiredSubfields(), other.getRequiredSubfields()); } @Override public String toString() { - if (requiredSubfields.isEmpty()) { - return name + ":" + hiveType + ":" + hiveColumnIndex + ":" + columnType; + if (getRequiredSubfields().isEmpty()) { + return getName() + ":" + hiveType + ":" + hiveColumnIndex + ":" + getColumnType(); } - return name + ":" + hiveType + ":" + hiveColumnIndex + ":" + columnType + ":" + requiredSubfields; + return getName() + ":" + hiveType + ":" + hiveColumnIndex + ":" + getColumnType() + ":" + getRequiredSubfields(); } public static HiveColumnHandle updateRowIdHandle() diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java index 80700ceba6f2d..b0f9ad0342414 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java @@ -159,6 +159,9 @@ import static com.facebook.presto.common.type.Varchars.isVarcharType; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; import static com.facebook.presto.expressions.LogicalRowExpressions.binaryExpression; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.BucketFunctionType.HIVE_COMPATIBLE; import static com.facebook.presto.hive.BucketFunctionType.PRESTO_NATIVE; import static com.facebook.presto.hive.ColumnEncryptionInformation.ColumnWithStructSubfield; @@ -173,9 +176,6 @@ import static com.facebook.presto.hive.HiveBucketing.getHiveBucketHandle; import static com.facebook.presto.hive.HiveClientConfig.InsertExistingPartitionsBehavior; import static com.facebook.presto.hive.HiveColumnHandle.BUCKET_COLUMN_NAME; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveColumnHandle.FILE_MODIFIED_TIME_COLUMN_NAME; import static com.facebook.presto.hive.HiveColumnHandle.FILE_SIZE_COLUMN_NAME; import static com.facebook.presto.hive.HiveColumnHandle.PATH_COLUMN_NAME; @@ -2633,7 +2633,7 @@ public List getTableLayouts(ConnectorSession session new HiveTableLayoutHandle.Builder() .setSchemaTableName(handle.getSchemaTableName()) .setTablePath(table.getStorage().getLocation()) - .setPartitionColumns(ImmutableList.copyOf(hivePartitionResult.getPartitionColumns())) + .setPartitionColumns(hivePartitionResult.getPartitionColumns()) .setDataColumns(pruneColumnComments(hivePartitionResult.getDataColumns())) .setTableParameters(hivePartitionResult.getTableParameters()) .setDomainPredicate(domainPredicate) diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java b/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java index f7778e2f415fd..292bb240df5f0 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HivePageSourceProvider.java @@ -61,12 +61,12 @@ import java.util.Set; import java.util.function.Function; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveBucketing.getHiveBucketFilter; import static com.facebook.presto.hive.HiveCoercer.createCoercer; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveColumnHandle.isPushedDownSubfield; import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNKNOWN_ERROR; import static com.facebook.presto.hive.HivePageSourceProvider.ColumnMapping.toColumnHandles; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionManager.java b/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionManager.java index 8d1cf936d5a86..a20c019357f0c 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionManager.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionManager.java @@ -277,7 +277,7 @@ && queryAccessesTooManyBuckets(hiveBucketHandle.get(), bucketFilter, partitions, if (effectivePredicate.isNone()) { return new HivePartitionResult( - partitionColumns, + ImmutableList.copyOf(partitionColumns), table.getDataColumns(), table.getParameters(), partitions, @@ -292,7 +292,7 @@ && queryAccessesTooManyBuckets(hiveBucketHandle.get(), bucketFilter, partitions, if (partitionColumns.isEmpty()) { return new HivePartitionResult( - partitionColumns, + ImmutableList.copyOf(partitionColumns), table.getDataColumns(), table.getParameters(), partitions, @@ -307,7 +307,7 @@ && queryAccessesTooManyBuckets(hiveBucketHandle.get(), bucketFilter, partitions, TupleDomain remainingTupleDomain = TupleDomain.withColumnDomains(Maps.filterKeys(effectivePredicate.getDomains().get(), not(Predicates.in(partitionColumns)))); TupleDomain enforcedTupleDomain = TupleDomain.withColumnDomains(Maps.filterKeys(effectivePredicate.getDomains().get(), Predicates.in(partitionColumns))); return new HivePartitionResult( - partitionColumns, + ImmutableList.copyOf(partitionColumns), table.getDataColumns(), table.getParameters(), partitions, @@ -398,7 +398,7 @@ public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastor Optional bucketHandle = shouldIgnoreTableBucketing(session) ? Optional.empty() : getHiveBucketHandle(table); return new HivePartitionResult( - partitionColumns, + ImmutableList.copyOf(partitionColumns), table.getDataColumns(), table.getParameters(), partitionList, diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionResult.java b/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionResult.java index bb6213899177c..905461f740485 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionResult.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HivePartitionResult.java @@ -36,7 +36,7 @@ */ public class HivePartitionResult { - private final List partitionColumns; + private final List partitionColumns; private final List dataColumns; private final Map tableParameters; private final List partitions; @@ -47,7 +47,7 @@ public class HivePartitionResult private final Optional bucketFilter; public HivePartitionResult( - List partitionColumns, + List partitionColumns, List dataColumns, Map tableParameters, List partitions, @@ -68,7 +68,7 @@ public HivePartitionResult( this.bucketFilter = requireNonNull(bucketFilter, "bucketFilter is null"); } - public List getPartitionColumns() + public List getPartitionColumns() { return partitionColumns; } diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java index 72ae6bfaf46d4..8c309c642c849 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java @@ -79,7 +79,7 @@ import static com.facebook.presto.common.type.Decimals.encodeScaledValue; import static com.facebook.presto.common.type.Decimals.isShortDecimal; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveColumnHandle.isPathColumnHandle; import static com.facebook.presto.hive.HiveCommonSessionProperties.isUseParquetColumnNames; import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_METADATA; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java index 7f4882a0f60f0..d359da729a346 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveUtil.java @@ -129,8 +129,8 @@ import static com.facebook.presto.common.type.TypeUtils.isDistinctType; import static com.facebook.presto.common.type.TypeUtils.isEnumType; import static com.facebook.presto.common.type.Varchars.isVarcharType; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveColumnHandle.MAX_PARTITION_KEY_COLUMN_INDEX; import static com.facebook.presto.hive.HiveColumnHandle.bucketColumnHandle; import static com.facebook.presto.hive.HiveColumnHandle.fileModifiedTimeColumnHandle; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSource.java b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSource.java index 46477b7b2cc46..71b2e9bbdf426 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSource.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSource.java @@ -37,7 +37,7 @@ import java.util.List; import java.util.Optional; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveErrorCode.HIVE_BAD_DATA; import static com.facebook.presto.hive.HiveErrorCode.HIVE_CURSOR_ERROR; import static com.facebook.presto.orc.OrcReader.MAX_BATCH_SIZE; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSourceFactory.java b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSourceFactory.java index 76adaea46336b..0083c96e04ce1 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSourceFactory.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcBatchPageSourceFactory.java @@ -63,8 +63,8 @@ import java.util.Map; import java.util.Optional; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcLazyReadSmallRanges; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxBufferSize; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxMergeDistance; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcSelectivePageSourceFactory.java b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcSelectivePageSourceFactory.java index e074618164890..9f74066246200 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcSelectivePageSourceFactory.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/orc/OrcSelectivePageSourceFactory.java @@ -103,9 +103,9 @@ import static com.facebook.presto.expressions.LogicalRowExpressions.binaryExpression; import static com.facebook.presto.expressions.LogicalRowExpressions.extractConjuncts; import static com.facebook.presto.expressions.RowExpressionNodeInliner.replaceExpression; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveBucketing.getHiveBucket; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcLazyReadSmallRanges; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxBufferSize; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxMergeDistance; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/parquet/ParquetPageSourceFactory.java b/presto-hive/src/main/java/com/facebook/presto/hive/parquet/ParquetPageSourceFactory.java index 46aa1c5d09458..40471d325a0af 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/parquet/ParquetPageSourceFactory.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/parquet/ParquetPageSourceFactory.java @@ -96,9 +96,9 @@ import static com.facebook.presto.common.type.StandardTypes.TINYINT; import static com.facebook.presto.common.type.StandardTypes.VARBINARY; import static com.facebook.presto.common.type.StandardTypes.VARCHAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveColumnHandle.getPushedDownSubfield; import static com.facebook.presto.hive.HiveColumnHandle.isPushedDownSubfield; import static com.facebook.presto.hive.HiveCommonSessionProperties.getParquetMaxReadBlockSize; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java b/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java index ad4df04b6e80f..b01e780efdfda 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java @@ -57,7 +57,7 @@ import java.util.Optional; import java.util.Properties; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.AGGREGATED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.AGGREGATED; import static com.facebook.presto.hive.HiveErrorCode.HIVE_BAD_DATA; import static com.facebook.presto.hive.HiveErrorCode.HIVE_CANNOT_OPEN_SPLIT; import static com.facebook.presto.hive.HiveErrorCode.HIVE_MISSING_DATA; diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java index b491b948c1e32..c76492a490456 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveFilterPushdown.java @@ -48,7 +48,6 @@ import com.facebook.presto.spi.relation.RowExpression; import com.facebook.presto.spi.relation.RowExpressionService; import com.google.common.base.Functions; -import com.google.common.collect.ImmutableList; import java.util.List; import java.util.Map; @@ -180,7 +179,7 @@ public ConnectorPushdownFilterResult getConnectorPushdownFilterResult( new HiveTableLayoutHandle.Builder() .setSchemaTableName(tableName) .setTablePath(table.getStorage().getLocation()) - .setPartitionColumns(ImmutableList.copyOf(hivePartitionResult.getPartitionColumns())) + .setPartitionColumns(hivePartitionResult.getPartitionColumns()) .setDataColumns(pruneColumnComments(hivePartitionResult.getDataColumns())) .setTableParameters(hivePartitionResult.getTableParameters()) .setDomainPredicate(domainPredicate) diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveParquetDereferencePushDown.java b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveParquetDereferencePushDown.java index 3b07475e975eb..010db98a74e7a 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveParquetDereferencePushDown.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/rule/HiveParquetDereferencePushDown.java @@ -31,7 +31,7 @@ import java.util.Optional; import java.util.stream.Collectors; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveSessionProperties.isParquetDereferencePushdownEnabled; import static com.facebook.presto.hive.HiveStorageFormat.PARQUET; import static com.facebook.presto.hive.HiveTableProperties.getHiveStorageFormat; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java index 2f830bb6e14d9..5b3bfd30071c4 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveClient.java @@ -212,14 +212,14 @@ import static com.facebook.presto.hive.AbstractTestHiveClient.TransactionDeleteInsertTestTag.ROLLBACK_AFTER_FINISH_INSERT; import static com.facebook.presto.hive.AbstractTestHiveClient.TransactionDeleteInsertTestTag.ROLLBACK_AFTER_SINK_FINISH; import static com.facebook.presto.hive.AbstractTestHiveClient.TransactionDeleteInsertTestTag.ROLLBACK_RIGHT_AWAY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.BucketFunctionType.HIVE_COMPATIBLE; import static com.facebook.presto.hive.CacheQuotaScope.TABLE; import static com.facebook.presto.hive.HiveBasicStatistics.createEmptyStatistics; import static com.facebook.presto.hive.HiveBasicStatistics.createZeroStatistics; import static com.facebook.presto.hive.HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER; import static com.facebook.presto.hive.HiveColumnHandle.BUCKET_COLUMN_NAME; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveColumnHandle.MAX_PARTITION_KEY_COLUMN_INDEX; import static com.facebook.presto.hive.HiveColumnHandle.bucketColumnHandle; import static com.facebook.presto.hive.HiveErrorCode.HIVE_INVALID_PARTITION_VALUE; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java index d40049346031f..fbcb5be6a5385 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java @@ -98,8 +98,8 @@ import static com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType; import static com.facebook.presto.common.type.VarcharType.createVarcharType; import static com.facebook.presto.common.type.Varchars.isVarcharType; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveManifestUtils.getFileSize; import static com.facebook.presto.hive.HiveStorageFormat.DWRF; import static com.facebook.presto.hive.HiveStorageFormat.ORC; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestAbstractDwrfEncryptionInformationSource.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestAbstractDwrfEncryptionInformationSource.java index 54d6f9e49f1c4..9afbde21d5821 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestAbstractDwrfEncryptionInformationSource.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestAbstractDwrfEncryptionInformationSource.java @@ -26,10 +26,10 @@ import java.util.Map; import java.util.Optional; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.ColumnEncryptionInformation.fromHiveProperty; import static com.facebook.presto.hive.DwrfTableEncryptionProperties.forPerColumn; import static com.facebook.presto.hive.DwrfTableEncryptionProperties.forTable; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveStorageFormat.DWRF; import static com.facebook.presto.hive.HiveStorageFormat.ORC; import static com.facebook.presto.hive.HiveTestUtils.SESSION; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestBackgroundHiveSplitLoader.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestBackgroundHiveSplitLoader.java index acc8aa1b23e7b..4ccd4794d3071 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestBackgroundHiveSplitLoader.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestBackgroundHiveSplitLoader.java @@ -15,8 +15,8 @@ import com.facebook.airlift.stats.CounterStat; import com.facebook.presto.common.predicate.Domain; +import com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType; import com.facebook.presto.hive.HiveBucketing.HiveBucketFilter; -import com.facebook.presto.hive.HiveColumnHandle.ColumnType; import com.facebook.presto.hive.authentication.NoHdfsAuthentication; import com.facebook.presto.hive.filesystem.ExtendedFileSystem; import com.facebook.presto.hive.metastore.Column; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestDynamicPruning.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestDynamicPruning.java index ede2adb0a3277..1c92f8a2d5a67 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestDynamicPruning.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestDynamicPruning.java @@ -47,10 +47,10 @@ import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; import static com.facebook.presto.common.type.VarcharType.createVarcharType; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.BucketFunctionType.HIVE_COMPATIBLE; import static com.facebook.presto.hive.CacheQuotaRequirement.NO_CACHE_REQUIREMENT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveQueryRunner.HIVE_CATALOG; import static com.facebook.presto.hive.HiveTestUtils.FUNCTION_AND_TYPE_MANAGER; import static com.facebook.presto.hive.HiveTestUtils.ROW_EXPRESSION_SERVICE; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestGenericHiveRecordCursorProvider.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestGenericHiveRecordCursorProvider.java index 808ac88f29d93..70cb117aa2950 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestGenericHiveRecordCursorProvider.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestGenericHiveRecordCursorProvider.java @@ -42,7 +42,7 @@ import java.util.stream.Collectors; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveTestUtils.FUNCTION_AND_TYPE_MANAGER; import static com.facebook.presto.hive.HiveTestUtils.SESSION; import static com.facebook.presto.hive.HiveType.HIVE_STRING; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveColumnHandle.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveColumnHandle.java index 05f08434b5d89..9475dd548d1e3 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveColumnHandle.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveColumnHandle.java @@ -20,8 +20,8 @@ import java.util.Optional; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static org.testng.Assert.assertEquals; public class TestHiveColumnHandle diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveLogicalPlanner.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveLogicalPlanner.java index fa6cae81bbfed..098371a81f4c9 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveLogicalPlanner.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveLogicalPlanner.java @@ -97,7 +97,7 @@ import static com.facebook.presto.common.type.VarcharType.VARCHAR; import static com.facebook.presto.common.type.VarcharType.createVarcharType; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveColumnHandle.isPushedDownSubfield; import static com.facebook.presto.hive.HiveCommonSessionProperties.RANGE_FILTERS_ON_SUBSCRIPTS_ENABLED; import static com.facebook.presto.hive.HiveQueryRunner.HIVE_CATALOG; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePageSink.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePageSink.java index 5b967024e0082..9ff28729e6259 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePageSink.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePageSink.java @@ -68,8 +68,8 @@ import static com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; import static com.facebook.presto.hive.AbstractTestHiveClient.TEST_HIVE_PAGE_SINK_CONTEXT; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.CacheQuotaRequirement.NO_CACHE_REQUIREMENT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveCompressionCodec.NONE; import static com.facebook.presto.hive.HiveQueryRunner.HIVE_CATALOG; import static com.facebook.presto.hive.HiveQueryRunner.METASTORE_CONTEXT; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePartitionManager.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePartitionManager.java index 9a0d1f7543439..db0986ab5531f 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePartitionManager.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHivePartitionManager.java @@ -37,9 +37,9 @@ import static com.facebook.presto.common.type.IntegerType.INTEGER; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; import static com.facebook.presto.common.type.VarcharType.VARCHAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.BucketFunctionType.HIVE_COMPATIBLE; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveColumnHandle.MAX_PARTITION_KEY_COLUMN_INDEX; import static com.facebook.presto.hive.HiveColumnHandle.bucketColumnHandle; import static com.facebook.presto.hive.HiveStorageFormat.ORC; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplit.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplit.java index 0a731674274c1..ce8c666e8cb1a 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplit.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplit.java @@ -53,8 +53,8 @@ import static com.facebook.airlift.json.JsonBinder.jsonBinder; import static com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder; import static com.facebook.presto.common.type.BigintType.BIGINT; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.CacheQuotaRequirement.NO_CACHE_REQUIREMENT; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveType.HIVE_LONG; import static com.facebook.presto.hive.HiveType.HIVE_STRING; import static com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplitManager.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplitManager.java index df79b44228a78..3aa460a05cc59 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplitManager.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveSplitManager.java @@ -82,8 +82,8 @@ import static com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; import static com.facebook.presto.hive.AbstractTestHiveClient.TEST_SERVER_VERSION; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveFileInfo.createHiveFileInfo; import static com.facebook.presto.hive.HiveStorageFormat.ORC; import static com.facebook.presto.hive.HiveTestUtils.FILTER_STATS_CALCULATOR_SERVICE; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveTableLayoutHandle.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveTableLayoutHandle.java index ce00711f31858..86061711f52d9 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveTableLayoutHandle.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveTableLayoutHandle.java @@ -24,8 +24,8 @@ import static com.facebook.presto.common.plan.PlanCanonicalizationStrategy.CONNECTOR; import static com.facebook.presto.common.predicate.Domain.singleValue; import static com.facebook.presto.common.type.VarcharType.VARCHAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveTableLayoutHandle.canonicalizeDomainPredicate; import static com.facebook.presto.hive.HiveType.HIVE_STRING; import static io.airlift.slice.Slices.utf8Slice; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestIonSqlQueryBuilder.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestIonSqlQueryBuilder.java index 94c03cf84f0a7..2690e5a430b85 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestIonSqlQueryBuilder.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestIonSqlQueryBuilder.java @@ -38,7 +38,7 @@ import static com.facebook.presto.common.type.StandardTypes.TIMESTAMP; import static com.facebook.presto.common.type.StandardTypes.VARCHAR; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveTestUtils.longDecimal; import static com.facebook.presto.hive.HiveTestUtils.shortDecimal; import static com.facebook.presto.hive.HiveType.HIVE_DATE; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestJsonHiveHandles.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestJsonHiveHandles.java index acaf1e9421c9f..7538783a47e5f 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestJsonHiveHandles.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestJsonHiveHandles.java @@ -28,7 +28,7 @@ import static com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder; import static com.facebook.presto.common.type.DoubleType.DOUBLE; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestMergeRequestedAndPredicateColumns.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestMergeRequestedAndPredicateColumns.java index bb19cfe236f17..f87da4fb8ed63 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestMergeRequestedAndPredicateColumns.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestMergeRequestedAndPredicateColumns.java @@ -24,7 +24,7 @@ import static com.facebook.presto.common.type.StandardTypes.BIGINT; import static com.facebook.presto.common.type.StandardTypes.VARCHAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveSplitManager.mergeRequestedAndPredicateColumns; import static com.facebook.presto.hive.HiveType.HIVE_LONG; import static com.facebook.presto.hive.HiveType.HIVE_STRING; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestOrcBatchPageSourceMemoryTracking.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestOrcBatchPageSourceMemoryTracking.java index e22fe66682951..7cfbcf738062a 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestOrcBatchPageSourceMemoryTracking.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestOrcBatchPageSourceMemoryTracking.java @@ -103,8 +103,8 @@ import static com.facebook.airlift.concurrent.Threads.daemonThreadsNamed; import static com.facebook.airlift.testing.Assertions.assertBetweenInclusive; import static com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveFileContext.DEFAULT_HIVE_FILE_CONTEXT; import static com.facebook.presto.hive.HiveTestUtils.FUNCTION_AND_TYPE_MANAGER; import static com.facebook.presto.hive.HiveTestUtils.FUNCTION_RESOLUTION; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/benchmark/FileFormat.java b/presto-hive/src/test/java/com/facebook/presto/hive/benchmark/FileFormat.java index c662f20e955c1..53ed9ef765875 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/benchmark/FileFormat.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/benchmark/FileFormat.java @@ -81,8 +81,8 @@ import java.util.OptionalLong; import java.util.Properties; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.CacheQuota.NO_CACHE_CONSTRAINTS; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveCompressionCodec.NONE; import static com.facebook.presto.hive.HiveStorageFormat.PAGEFILE; import static com.facebook.presto.hive.HiveTestUtils.FUNCTION_AND_TYPE_MANAGER; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/TestParquetPageSourceFactory.java b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/TestParquetPageSourceFactory.java index 98431919c6c4c..8aa6e74ddab01 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/TestParquetPageSourceFactory.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/TestParquetPageSourceFactory.java @@ -27,8 +27,8 @@ import java.util.Optional; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.parquet.ParquetPageSourceFactory.getColumnType; import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BINARY; import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT32; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java index cf49eac459811..4a14d1d7d61b1 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/parquet/predicate/TestParquetPredicateUtils.java @@ -40,7 +40,7 @@ import static com.facebook.presto.common.type.BigintType.BIGINT; import static com.facebook.presto.common.type.IntegerType.INTEGER; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.parquet.ParquetPageSourceFactory.getParquetTupleDomain; import static com.facebook.presto.parquet.ParquetTypeUtils.getDescriptors; import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT32; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/s3select/TestS3SelectRecordCursor.java b/presto-hive/src/test/java/com/facebook/presto/hive/s3select/TestS3SelectRecordCursor.java index bdbdef0cb8bb4..cf38952ac69c5 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/s3select/TestS3SelectRecordCursor.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/s3select/TestS3SelectRecordCursor.java @@ -32,8 +32,8 @@ import java.util.stream.Stream; import static com.facebook.presto.common.type.TypeSignature.parseTypeSignature; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveType.HIVE_INT; import static com.facebook.presto.hive.HiveType.HIVE_STRING; import static com.facebook.presto.hive.s3select.S3SelectRecordCursor.updateSplitSchema; diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/statistics/TestMetastoreHiveStatisticsProvider.java b/presto-hive/src/test/java/com/facebook/presto/hive/statistics/TestMetastoreHiveStatisticsProvider.java index 44944c82d02d8..31f0189df7b5b 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/statistics/TestMetastoreHiveStatisticsProvider.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/statistics/TestMetastoreHiveStatisticsProvider.java @@ -58,8 +58,8 @@ import static com.facebook.presto.common.type.SmallintType.SMALLINT; import static com.facebook.presto.common.type.TinyintType.TINYINT; import static com.facebook.presto.common.type.VarcharType.VARCHAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveErrorCode.HIVE_CORRUPTED_COLUMN_STATISTICS; import static com.facebook.presto.hive.HivePartition.UNPARTITIONED_ID; import static com.facebook.presto.hive.HivePartitionManager.parsePartition; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergColumnHandle.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergColumnHandle.java index 8bb4cf4e8f7aa..14a410db75e38 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergColumnHandle.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergColumnHandle.java @@ -28,10 +28,10 @@ import java.util.Objects; import java.util.Optional; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.iceberg.ColumnIdentity.createColumnIdentity; import static com.facebook.presto.iceberg.ColumnIdentity.primitiveColumnIdentity; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.iceberg.TypeConverter.toPrestoType; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Iterables.getOnlyElement; @@ -40,13 +40,10 @@ import static org.apache.iceberg.MetadataColumns.ROW_POSITION; public class IcebergColumnHandle - implements BaseHiveColumnHandle + extends BaseHiveColumnHandle { private final ColumnIdentity columnIdentity; private final Type type; - private final Optional comment; - private final ColumnType columnType; - private final List requiredSubfields; @JsonCreator public IcebergColumnHandle( @@ -56,11 +53,10 @@ public IcebergColumnHandle( @JsonProperty("columnType") ColumnType columnType, @JsonProperty("requiredSubfields") List requiredSubfields) { + super(columnIdentity.getName(), comment, columnType, requiredSubfields); + this.columnIdentity = requireNonNull(columnIdentity, "columnIdentity is null"); this.type = requireNonNull(type, "type is null"); - this.comment = requireNonNull(comment, "comment is null"); - this.columnType = requireNonNull(columnType, "columnType is null"); - this.requiredSubfields = requireNonNull(requiredSubfields, "requiredSubfields is null"); } public IcebergColumnHandle(ColumnIdentity columnIdentity, Type type, Optional comment, ColumnType columnType) @@ -80,36 +76,12 @@ public int getId() return columnIdentity.getId(); } - @JsonProperty - public String getName() - { - return columnIdentity.getName(); - } - @JsonProperty public Type getType() { return type; } - @JsonProperty - public Optional getComment() - { - return comment; - } - - @JsonProperty - public ColumnType getColumnType() - { - return columnType; - } - - @JsonProperty - public List getRequiredSubfields() - { - return requiredSubfields; - } - @JsonIgnore public boolean isRowPositionColumn() { @@ -124,13 +96,13 @@ public ColumnHandle withRequiredSubfields(List subfields) return this; } - return new IcebergColumnHandle(columnIdentity, type, comment, columnType, subfields); + return new IcebergColumnHandle(columnIdentity, type, getComment(), getColumnType(), subfields); } @Override public int hashCode() { - return Objects.hash(columnIdentity, type, comment, columnType, requiredSubfields); + return Objects.hash(columnIdentity, type, getComment(), getColumnType(), getRequiredSubfields()); } @Override @@ -145,19 +117,19 @@ public boolean equals(Object obj) IcebergColumnHandle other = (IcebergColumnHandle) obj; return Objects.equals(this.columnIdentity, other.columnIdentity) && Objects.equals(this.type, other.type) && - Objects.equals(this.comment, other.comment) && - Objects.equals(this.columnType, other.columnType) && - Objects.equals(this.requiredSubfields, other.requiredSubfields); + Objects.equals(this.getComment(), other.getComment()) && + Objects.equals(this.getColumnType(), other.getColumnType()) && + Objects.equals(this.getRequiredSubfields(), other.getRequiredSubfields()); } @Override public String toString() { - if (requiredSubfields.isEmpty()) { + if (getRequiredSubfields().isEmpty()) { return getId() + ":" + getName() + ":" + type.getDisplayName(); } - return getId() + ":" + getName() + ":" + type.getDisplayName() + ":" + columnType + ":" + requiredSubfields; + return getId() + ":" + getName() + ":" + type.getDisplayName() + ":" + getColumnType() + ":" + getRequiredSubfields(); } public static IcebergColumnHandle primitiveIcebergColumnHandle(int id, String name, Type type, Optional comment) @@ -174,13 +146,6 @@ public static IcebergColumnHandle create(Types.NestedField column, TypeManager t columnType); } - public enum ColumnType - { - PARTITION_KEY, - REGULAR, - SYNTHESIZED - } - public static Subfield getPushedDownSubfield(IcebergColumnHandle column) { checkArgument(isPushedDownSubfield(column), format("not a valid pushed down subfield: type=%s, subfields=%s", column.getColumnType(), column.getRequiredSubfields())); diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergOrcColumn.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergOrcColumn.java index 5ce39b6b90426..88aa52c7891c5 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergOrcColumn.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergOrcColumn.java @@ -13,7 +13,7 @@ */ package com.facebook.presto.iceberg; -import com.facebook.presto.hive.HiveColumnHandle.ColumnType; +import com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType; import com.facebook.presto.orc.metadata.OrcType.OrcTypeKind; import com.google.common.collect.ImmutableMap; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java index a70d7352cfe6d..84c46b5c2d18e 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java @@ -118,9 +118,9 @@ import java.util.stream.IntStream; import static com.facebook.presto.common.type.VarcharType.VARCHAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.CacheQuota.NO_CACHE_CONSTRAINTS; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR; -import static com.facebook.presto.hive.HiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcLazyReadSmallRanges; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxBufferSize; import static com.facebook.presto.hive.HiveCommonSessionProperties.getOrcMaxMergeDistance; diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java index 670070f25e41c..54e31adf06ea5 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java @@ -103,6 +103,8 @@ import static com.facebook.presto.common.type.TinyintType.TINYINT; import static com.facebook.presto.common.type.VarbinaryType.VARBINARY; import static com.facebook.presto.common.type.Varchars.isVarcharType; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.hive.HiveUtil.bigintPartitionKey; import static com.facebook.presto.hive.HiveUtil.booleanPartitionKey; import static com.facebook.presto.hive.HiveUtil.charPartitionKey; @@ -122,8 +124,6 @@ import static com.facebook.presto.hive.metastore.MetastoreUtil.PRESTO_VIEW_FLAG; import static com.facebook.presto.hive.metastore.MetastoreUtil.TABLE_COMMENT; import static com.facebook.presto.iceberg.ExpressionConverter.toIcebergExpression; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.iceberg.IcebergErrorCode.ICEBERG_INVALID_PARTITION_VALUE; import static com.facebook.presto.iceberg.IcebergErrorCode.ICEBERG_INVALID_SNAPSHOT_ID; import static com.facebook.presto.iceberg.IcebergErrorCode.ICEBERG_INVALID_TABLE_TIMESTAMP; diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergColumnHandle.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergColumnHandle.java index 3266da510d18f..bb4599f44b010 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergColumnHandle.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergColumnHandle.java @@ -28,10 +28,10 @@ import java.util.Optional; import static com.facebook.presto.common.type.BigintType.BIGINT; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.iceberg.ColumnIdentity.TypeCategory.ARRAY; import static com.facebook.presto.iceberg.ColumnIdentity.TypeCategory.PRIMITIVE; import static com.facebook.presto.iceberg.ColumnIdentity.TypeCategory.STRUCT; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.iceberg.IcebergColumnHandle.primitiveIcebergColumnHandle; import static com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager; import static org.testng.Assert.assertEquals; diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java index ed0e0f8a0ef69..3075621afee32 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergLogicalPlanner.java @@ -69,8 +69,8 @@ import static com.facebook.presto.common.type.IntegerType.INTEGER; import static com.facebook.presto.common.type.VarcharType.VARCHAR; import static com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.iceberg.IcebergAbstractMetadata.isEntireColumn; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.SYNTHESIZED; import static com.facebook.presto.iceberg.IcebergColumnHandle.getSynthesizedIcebergColumnHandle; import static com.facebook.presto.iceberg.IcebergColumnHandle.isPushedDownSubfield; import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG; diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestStatisticsUtil.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestStatisticsUtil.java index b197b72f65aa4..6d412d20bcda2 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestStatisticsUtil.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestStatisticsUtil.java @@ -32,7 +32,7 @@ import java.util.OptionalLong; import static com.facebook.presto.common.type.IntegerType.INTEGER; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.iceberg.util.HiveStatisticsMergeStrategy.NONE; import static com.facebook.presto.iceberg.util.HiveStatisticsMergeStrategy.USE_NDV; import static com.facebook.presto.iceberg.util.HiveStatisticsMergeStrategy.USE_NULLS_FRACTIONS; diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/hive/TestIcebergHiveStatistics.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/hive/TestIcebergHiveStatistics.java index 8e70bc9ff9529..09bca1ef506ad 100644 --- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/hive/TestIcebergHiveStatistics.java +++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/hive/TestIcebergHiveStatistics.java @@ -46,8 +46,8 @@ import java.util.stream.Collectors; import static com.facebook.presto.common.type.DoubleType.DOUBLE; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.PARTITION_KEY; -import static com.facebook.presto.iceberg.IcebergColumnHandle.ColumnType.REGULAR; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.PARTITION_KEY; +import static com.facebook.presto.hive.BaseHiveColumnHandle.ColumnType.REGULAR; import static com.facebook.presto.iceberg.IcebergQueryRunner.createIcebergQueryRunner; import static com.facebook.presto.testing.assertions.Assert.assertEquals; import static org.testng.Assert.assertFalse; @@ -286,7 +286,7 @@ private void columnStatsEqual(Map actualStats, M ((IcebergColumnHandle) handle).getType(), ((IcebergColumnHandle) handle).getComment(), REGULAR, - ((IcebergColumnHandle) handle).getRequiredSubfields()); + handle.getRequiredSubfields()); } ColumnStatistics actual = actualStats.get(handle); assertEquals(actual.getRange(), expected.getRange(), "range for col: " + handle);