From f6754bedf43fe8f36e847f7aaf0a21d63951eb20 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 9 Mar 2019 23:16:45 -0800 Subject: [PATCH] Remove unused TableParameterCodec --- .../plugin/hive/HiveClientModule.java | 1 - .../prestosql/plugin/hive/HiveMetadata.java | 9 ----- .../plugin/hive/HiveMetadataFactory.java | 6 --- .../plugin/hive/TableParameterCodec.java | 37 ------------------- .../plugin/hive/AbstractTestHiveClient.java | 1 - .../hive/AbstractTestHiveFileSystem.java | 1 - 6 files changed, 55 deletions(-) delete mode 100644 presto-hive/src/main/java/io/prestosql/plugin/hive/TableParameterCodec.java diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveClientModule.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveClientModule.java index 086d9c17ddb08..290f8e0c444c6 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveClientModule.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveClientModule.java @@ -87,7 +87,6 @@ public void configure(Binder binder) newSetBinder(binder, EventClient.class).addBinding().to(HiveEventClient.class).in(Scopes.SINGLETON); binder.bind(HivePartitionManager.class).in(Scopes.SINGLETON); binder.bind(LocationService.class).to(HiveLocationService.class).in(Scopes.SINGLETON); - binder.bind(TableParameterCodec.class).in(Scopes.SINGLETON); binder.bind(HiveMetadataFactory.class).in(Scopes.SINGLETON); binder.bind(new TypeLiteral>() {}).to(HiveMetadataFactory.class).in(Scopes.SINGLETON); binder.bind(HiveTransactionManager.class).in(Scopes.SINGLETON); diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java index 1f5a52616e462..b6600295dcf94 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java @@ -237,7 +237,6 @@ public class HiveMetadata private final DateTimeZone timeZone; private final TypeManager typeManager; private final LocationService locationService; - private final TableParameterCodec tableParameterCodec; private final JsonCodec partitionUpdateCodec; private final boolean writesToNonManagedTablesEnabled; private final boolean createsOfNonManagedTablesEnabled; @@ -256,7 +255,6 @@ public HiveMetadata( boolean createsOfNonManagedTablesEnabled, TypeManager typeManager, LocationService locationService, - TableParameterCodec tableParameterCodec, JsonCodec partitionUpdateCodec, TypeTranslator typeTranslator, String prestoVersion, @@ -271,7 +269,6 @@ public HiveMetadata( this.timeZone = requireNonNull(timeZone, "timeZone is null"); this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.locationService = requireNonNull(locationService, "locationService is null"); - this.tableParameterCodec = requireNonNull(tableParameterCodec, "tableParameterCodec is null"); this.partitionUpdateCodec = requireNonNull(partitionUpdateCodec, "partitionUpdateCodec is null"); this.writesToNonManagedTablesEnabled = writesToNonManagedTablesEnabled; this.createsOfNonManagedTablesEnabled = createsOfNonManagedTablesEnabled; @@ -495,9 +492,6 @@ private ConnectorTableMetadata doGetTableMetadata(SchemaTableName tableName) properties.put(AVRO_SCHEMA_URL, avroSchemaUrl); } - // Hook point for extended versions of the Hive Plugin - properties.putAll(tableParameterCodec.decode(table.get().getParameters())); - Optional comment = Optional.ofNullable(table.get().getParameters().get(TABLE_COMMENT)); return new ConnectorTableMetadata(tableName, columns.build(), properties.build(), comment); @@ -742,9 +736,6 @@ private Map getEmptyTableProperties(ConnectorTableMetadata table { ImmutableMap.Builder tableProperties = ImmutableMap.builder(); - // Hook point for extended versions of the Hive Plugin - tableProperties.putAll(tableParameterCodec.encode(tableMetadata.getProperties())); - // ORC format specific properties List columns = getOrcBloomFilterColumns(tableMetadata.getProperties()); if (columns != null && !columns.isEmpty()) { diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadataFactory.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadataFactory.java index 12db48a6497c0..1871b2e808192 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadataFactory.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadataFactory.java @@ -48,7 +48,6 @@ public class HiveMetadataFactory private final DateTimeZone timeZone; private final TypeManager typeManager; private final LocationService locationService; - private final TableParameterCodec tableParameterCodec; private final JsonCodec partitionUpdateCodec; private final BoundedExecutor renameExecution; private final TypeTranslator typeTranslator; @@ -64,7 +63,6 @@ public HiveMetadataFactory( @ForHiveClient ExecutorService executorService, TypeManager typeManager, LocationService locationService, - TableParameterCodec tableParameterCodec, JsonCodec partitionUpdateCodec, TypeTranslator typeTranslator, NodeVersion nodeVersion) @@ -84,7 +82,6 @@ public HiveMetadataFactory( hiveClientConfig.getMaxPartitionsPerScan(), typeManager, locationService, - tableParameterCodec, partitionUpdateCodec, executorService, typeTranslator, @@ -106,7 +103,6 @@ public HiveMetadataFactory( int maxPartitions, TypeManager typeManager, LocationService locationService, - TableParameterCodec tableParameterCodec, JsonCodec partitionUpdateCodec, ExecutorService executorService, TypeTranslator typeTranslator, @@ -125,7 +121,6 @@ public HiveMetadataFactory( this.timeZone = requireNonNull(timeZone, "timeZone is null"); this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.locationService = requireNonNull(locationService, "locationService is null"); - this.tableParameterCodec = requireNonNull(tableParameterCodec, "tableParameterCodec is null"); this.partitionUpdateCodec = requireNonNull(partitionUpdateCodec, "partitionUpdateCodec is null"); this.typeTranslator = requireNonNull(typeTranslator, "typeTranslator is null"); this.prestoVersion = requireNonNull(prestoVersion, "prestoVersion is null"); @@ -161,7 +156,6 @@ public HiveMetadata get() createsOfNonManagedTablesEnabled, typeManager, locationService, - tableParameterCodec, partitionUpdateCodec, typeTranslator, prestoVersion, diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/TableParameterCodec.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/TableParameterCodec.java deleted file mode 100644 index 97a152d5f23b8..0000000000000 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/TableParameterCodec.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive; - -import com.google.common.collect.ImmutableMap; - -import java.util.Map; - -public class TableParameterCodec -{ - /** - * Decode Hive table parameters into additional Presto table properties. - */ - public Map decode(Map tableParameters) - { - return ImmutableMap.of(); - } - - /** - * Encode additional Presto table properties into Hive table parameters. - */ - public Map encode(Map tableProperties) - { - return ImmutableMap.of(); - } -} diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClient.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClient.java index afa2070b79210..133134224d509 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClient.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClient.java @@ -745,7 +745,6 @@ protected final void setup(String databaseName, HiveClientConfig hiveClientConfi getHiveClientConfig().getMaxPartitionsPerScan(), TYPE_MANAGER, locationService, - new TableParameterCodec(), partitionUpdateCodec, newFixedThreadPool(2), new HiveTypeTranslator(), diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveFileSystem.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveFileSystem.java index 1e68e53845146..fccaeb8ba8469 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveFileSystem.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveFileSystem.java @@ -178,7 +178,6 @@ protected void setup(String host, int port, String databaseName, Function