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 0829404178f31..b62b9e62e513f 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 @@ -207,7 +207,7 @@ private List getPartitionListFromPartitionNames( { if (isOptimizeParsingOfPartitionValues(session) && partitionNames.size() >= getOptimizeParsingOfPartitionValuesThreshold(session)) { List partitionList = partitionNames.stream() - .map(partitionNameWithVersion -> parsePartition(tableName, partitionNameWithVersion, partitionColumns, partitionTypes, timeZone)) + .map(partitionNameWithVersion -> parsePartition(tableName, partitionNameWithVersion, partitionColumns, partitionTypes)) .collect(toImmutableList()); Map domains = constraint.getSummary().getDomains().get(); @@ -425,6 +425,7 @@ public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastor Table table = getTable(session, metastore, hiveTableHandle, isOfflineDataDebugModeEnabled(session)); List partitionColumns = getPartitionKeyColumnHandles(table); + List partitionColumnTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toImmutableList()); @@ -455,7 +456,7 @@ private Optional parseValuesAndFilterPartition( List partitionColumnTypes, Constraint constraint) { - HivePartition partition = parsePartition(tableName, partitionNameWithVersion, partitionColumns, partitionColumnTypes, timeZone); + HivePartition partition = parsePartition(tableName, partitionNameWithVersion, partitionColumns, partitionColumnTypes); Map domains = constraint.getSummary().getDomains().get(); for (HiveColumnHandle column : partitionColumns) { @@ -512,12 +513,11 @@ private List getAllPartitionNames(ConnectorSession ses .orElseThrow(() -> new TableNotFoundException(hiveTableHandle.getSchemaTableName())); } - public static HivePartition parsePartition( + public HivePartition parsePartition( SchemaTableName tableName, PartitionNameWithVersion partitionNameWithVersion, List partitionColumns, - List partitionColumnTypes, - DateTimeZone timeZone) + List partitionColumnTypes) { List partitionColumnNames = partitionColumns.stream() .map(HiveColumnHandle::getName) 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 b9dcdf6979db1..d2c5edd9bbefa 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 @@ -16,11 +16,13 @@ import com.facebook.presto.cache.CacheConfig; import com.facebook.presto.common.predicate.NullableValue; import com.facebook.presto.common.type.DecimalType; +import com.facebook.presto.common.type.TestingTypeManager; import com.facebook.presto.common.type.Type; import com.facebook.presto.hive.HiveBasicStatistics; import com.facebook.presto.hive.HiveClientConfig; import com.facebook.presto.hive.HiveColumnHandle; import com.facebook.presto.hive.HivePartition; +import com.facebook.presto.hive.HivePartitionManager; import com.facebook.presto.hive.HiveSessionProperties; import com.facebook.presto.hive.NamenodeStats; import com.facebook.presto.hive.OrcFileWriterConfig; @@ -65,7 +67,6 @@ 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; import static com.facebook.presto.hive.HiveTestUtils.DO_NOTHING_DIRECTORY_LISTER; import static com.facebook.presto.hive.HiveTestUtils.HDFS_ENVIRONMENT; import static com.facebook.presto.hive.HiveType.HIVE_LONG; @@ -110,6 +111,8 @@ public class TestMetastoreHiveStatisticsProvider private static final QuickStatsProvider quickStatsProvider = new QuickStatsProvider(new TestingExtendedHiveMetastore(), HDFS_ENVIRONMENT, DO_NOTHING_DIRECTORY_LISTER, new HiveClientConfig(), new NamenodeStats(), ImmutableList.of()); + private final HivePartitionManager hivePartitionManager = new HivePartitionManager(new TestingTypeManager(), new HiveClientConfig()); + @Test public void testGetPartitionsSample() { @@ -825,9 +828,9 @@ private static String invalidColumnStatistics(String message) return format("Corrupted partition statistics (Table: %s Partition: [%s] Column: %s): %s", TABLE, PARTITION, COLUMN, message); } - private static HivePartition partition(String name) + private HivePartition partition(String name) { - return parsePartition(TABLE, new PartitionNameWithVersion(name, Optional.empty()), ImmutableList.of(PARTITION_COLUMN_1, PARTITION_COLUMN_2), ImmutableList.of(VARCHAR, BIGINT), DateTimeZone.getDefault()); + return hivePartitionManager.parsePartition(TABLE, new PartitionNameWithVersion(name, Optional.empty()), ImmutableList.of(PARTITION_COLUMN_1, PARTITION_COLUMN_2), ImmutableList.of(VARCHAR, BIGINT)); } private static PartitionStatistics rowsCount(long rowsCount)