From 776b453d55a293bb89fd200fa3cd48cfa0581ee2 Mon Sep 17 00:00:00 2001 From: Andrii Rosa Date: Tue, 28 Nov 2017 14:50:34 +0100 Subject: [PATCH] Move PrincipalType to presto-spi Extracted-From: https://github.com/prestodb/presto/pull/10904 --- .../io/prestosql/plugin/geospatial/TestSpatialJoins.java | 2 +- .../main/java/io/prestosql/plugin/hive/HiveMetadata.java | 2 +- .../java/io/prestosql/plugin/hive/metastore/Database.java | 1 + .../plugin/hive/metastore/file/DatabaseMetadata.java | 2 +- .../plugin/hive/metastore/file/FileHiveMetastore.java | 6 +++--- .../metastore/glue/converter/GlueToPrestoConverter.java | 2 +- .../plugin/hive/metastore/thrift/ThriftMetastoreUtil.java | 2 +- .../prestosql/plugin/hive/AbstractTestHiveClientLocal.java | 2 +- .../io/prestosql/plugin/hive/HiveBenchmarkQueryRunner.java | 2 +- .../test/java/io/prestosql/plugin/hive/HiveQueryRunner.java | 2 +- .../plugin/hive/metastore/TestRecordingHiveMetastore.java | 1 + .../hive/metastore/glue/TestGlueToPrestoConverter.java | 2 +- .../plugin/hive/metastore/glue/TestingMetastoreObjects.java | 2 +- .../main/java/io/prestosql/spi/security}/PrincipalType.java | 2 +- 14 files changed, 16 insertions(+), 14 deletions(-) rename {presto-hive/src/main/java/io/prestosql/plugin/hive/metastore => presto-spi/src/main/java/io/prestosql/spi/security}/PrincipalType.java (93%) diff --git a/presto-geospatial/src/test/java/io/prestosql/plugin/geospatial/TestSpatialJoins.java b/presto-geospatial/src/test/java/io/prestosql/plugin/geospatial/TestSpatialJoins.java index 072599928f4d..127b38842139 100644 --- a/presto-geospatial/src/test/java/io/prestosql/plugin/geospatial/TestSpatialJoins.java +++ b/presto-geospatial/src/test/java/io/prestosql/plugin/geospatial/TestSpatialJoins.java @@ -22,8 +22,8 @@ import io.prestosql.plugin.hive.HivePlugin; import io.prestosql.plugin.hive.authentication.NoHdfsAuthentication; import io.prestosql.plugin.hive.metastore.Database; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.file.FileHiveMetastore; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.tests.AbstractTestQueryFramework; import io.prestosql.tests.DistributedQueryRunner; import org.testng.annotations.Test; 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 cfd2dfd4ddc1..9694d766e0aa 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 @@ -178,7 +178,6 @@ import static io.prestosql.plugin.hive.metastore.MetastoreUtil.getHiveSchema; import static io.prestosql.plugin.hive.metastore.MetastoreUtil.getProtectMode; import static io.prestosql.plugin.hive.metastore.MetastoreUtil.verifyOnline; -import static io.prestosql.plugin.hive.metastore.PrincipalType.USER; import static io.prestosql.plugin.hive.metastore.StorageFormat.VIEW_STORAGE_FORMAT; import static io.prestosql.plugin.hive.metastore.StorageFormat.fromHiveStorageFormat; import static io.prestosql.plugin.hive.util.ConfigurationUtils.toJobConf; @@ -191,6 +190,7 @@ import static io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED; import static io.prestosql.spi.StandardErrorCode.SCHEMA_NOT_EMPTY; import static io.prestosql.spi.predicate.TupleDomain.withColumnDomains; +import static io.prestosql.spi.security.PrincipalType.USER; import static java.lang.String.format; import static java.util.Collections.emptyList; import static java.util.Objects.requireNonNull; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/Database.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/Database.java index 0c633200a930..18eae5d0a5b3 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/Database.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/Database.java @@ -16,6 +16,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; +import io.prestosql.spi.security.PrincipalType; import javax.annotation.concurrent.Immutable; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/DatabaseMetadata.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/DatabaseMetadata.java index fec7ddd87242..f687b9dda1c3 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/DatabaseMetadata.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/DatabaseMetadata.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; import io.prestosql.plugin.hive.metastore.Database; -import io.prestosql.plugin.hive.metastore.PrincipalType; +import io.prestosql.spi.security.PrincipalType; import java.util.Map; import java.util.Optional; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java index 78f731b7987f..4f1bf5d099b9 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java @@ -39,7 +39,6 @@ import io.prestosql.plugin.hive.metastore.Partition; import io.prestosql.plugin.hive.metastore.PartitionWithStatistics; import io.prestosql.plugin.hive.metastore.PrincipalPrivileges; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.Table; import io.prestosql.plugin.hive.metastore.thrift.ThriftMetastoreUtil; import io.prestosql.spi.PrestoException; @@ -48,6 +47,7 @@ import io.prestosql.spi.connector.SchemaTableName; import io.prestosql.spi.connector.TableNotFoundException; import io.prestosql.spi.security.Identity; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.spi.statistics.ColumnStatisticType; import io.prestosql.spi.type.Type; import org.apache.hadoop.fs.FSDataInputStream; @@ -86,12 +86,12 @@ import static io.prestosql.plugin.hive.metastore.HivePrivilegeInfo.HivePrivilege.OWNERSHIP; import static io.prestosql.plugin.hive.metastore.MetastoreUtil.makePartName; import static io.prestosql.plugin.hive.metastore.MetastoreUtil.verifyCanDropColumn; -import static io.prestosql.plugin.hive.metastore.PrincipalType.ROLE; -import static io.prestosql.plugin.hive.metastore.PrincipalType.USER; import static io.prestosql.plugin.hive.metastore.thrift.ThriftMetastoreUtil.getHiveBasicStatistics; import static io.prestosql.plugin.hive.metastore.thrift.ThriftMetastoreUtil.updateStatisticsParameters; import static io.prestosql.spi.StandardErrorCode.ALREADY_EXISTS; import static io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED; +import static io.prestosql.spi.security.PrincipalType.ROLE; +import static io.prestosql.spi.security.PrincipalType.USER; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.toList; import static org.apache.hadoop.hive.common.FileUtils.unescapePathName; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/glue/converter/GlueToPrestoConverter.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/glue/converter/GlueToPrestoConverter.java index 11c0e418771c..71149c07b945 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/glue/converter/GlueToPrestoConverter.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/glue/converter/GlueToPrestoConverter.java @@ -22,13 +22,13 @@ import io.prestosql.plugin.hive.metastore.Column; import io.prestosql.plugin.hive.metastore.Database; import io.prestosql.plugin.hive.metastore.Partition; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.SortingColumn; import io.prestosql.plugin.hive.metastore.SortingColumn.Order; import io.prestosql.plugin.hive.metastore.Storage; import io.prestosql.plugin.hive.metastore.StorageFormat; import io.prestosql.plugin.hive.metastore.Table; import io.prestosql.spi.PrestoException; +import io.prestosql.spi.security.PrincipalType; import java.util.ArrayList; import java.util.List; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftMetastoreUtil.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftMetastoreUtil.java index d961e7915a4d..5cfcb301ef4a 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftMetastoreUtil.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftMetastoreUtil.java @@ -26,11 +26,11 @@ import io.prestosql.plugin.hive.metastore.Partition; import io.prestosql.plugin.hive.metastore.PartitionWithStatistics; import io.prestosql.plugin.hive.metastore.PrincipalPrivileges; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.Storage; import io.prestosql.plugin.hive.metastore.StorageFormat; import io.prestosql.plugin.hive.metastore.Table; import io.prestosql.spi.PrestoException; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.spi.statistics.ColumnStatisticType; import io.prestosql.spi.type.ArrayType; import io.prestosql.spi.type.DecimalType; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClientLocal.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClientLocal.java index dbc838cce29d..10076673daef 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClientLocal.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/AbstractTestHiveClientLocal.java @@ -16,10 +16,10 @@ import com.google.common.io.Files; import io.prestosql.plugin.hive.metastore.Database; import io.prestosql.plugin.hive.metastore.ExtendedHiveMetastore; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.spi.connector.ConnectorMetadata; import io.prestosql.spi.connector.ConnectorTableHandle; import io.prestosql.spi.connector.SchemaTableName; +import io.prestosql.spi.security.PrincipalType; import org.testng.SkipException; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveBenchmarkQueryRunner.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveBenchmarkQueryRunner.java index f2612b876729..c6980dc0076b 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveBenchmarkQueryRunner.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveBenchmarkQueryRunner.java @@ -19,8 +19,8 @@ import io.prestosql.benchmark.BenchmarkSuite; import io.prestosql.plugin.hive.metastore.Database; import io.prestosql.plugin.hive.metastore.ExtendedHiveMetastore; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.tpch.TpchConnectorFactory; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.testing.LocalQueryRunner; import java.io.File; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveQueryRunner.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveQueryRunner.java index 056fc59c825d..6fb965b55877 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveQueryRunner.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/HiveQueryRunner.java @@ -22,9 +22,9 @@ import io.prestosql.metadata.QualifiedObjectName; import io.prestosql.plugin.hive.authentication.NoHdfsAuthentication; import io.prestosql.plugin.hive.metastore.Database; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.file.FileHiveMetastore; import io.prestosql.plugin.tpch.TpchPlugin; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.testing.QueryRunner; import io.prestosql.tests.DistributedQueryRunner; import org.intellij.lang.annotations.Language; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/TestRecordingHiveMetastore.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/TestRecordingHiveMetastore.java index 8701d7c991a8..87be5e3e9b2f 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/TestRecordingHiveMetastore.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/TestRecordingHiveMetastore.java @@ -24,6 +24,7 @@ import io.prestosql.plugin.hive.PartitionStatistics; import io.prestosql.plugin.hive.metastore.HivePrivilegeInfo.HivePrivilege; import io.prestosql.plugin.hive.metastore.SortingColumn.Order; +import io.prestosql.spi.security.PrincipalType; import io.prestosql.spi.statistics.ColumnStatisticType; import io.prestosql.spi.type.Type; import org.testng.annotations.Test; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestGlueToPrestoConverter.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestGlueToPrestoConverter.java index ea9cf95dcac4..1a696cefc772 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestGlueToPrestoConverter.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestGlueToPrestoConverter.java @@ -20,9 +20,9 @@ import com.google.common.collect.ImmutableList; import io.prestosql.plugin.hive.HiveBucketProperty; import io.prestosql.plugin.hive.metastore.Column; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.Storage; import io.prestosql.plugin.hive.metastore.glue.converter.GlueToPrestoConverter; +import io.prestosql.spi.security.PrincipalType; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestingMetastoreObjects.java b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestingMetastoreObjects.java index 80e8181665bf..ed0bb0eb6999 100644 --- a/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestingMetastoreObjects.java +++ b/presto-hive/src/test/java/io/prestosql/plugin/hive/metastore/glue/TestingMetastoreObjects.java @@ -22,9 +22,9 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import io.prestosql.plugin.hive.HiveType; -import io.prestosql.plugin.hive.metastore.PrincipalType; import io.prestosql.plugin.hive.metastore.Storage; import io.prestosql.plugin.hive.metastore.StorageFormat; +import io.prestosql.spi.security.PrincipalType; import org.apache.hadoop.hive.metastore.TableType; import java.util.List; diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/PrincipalType.java b/presto-spi/src/main/java/io/prestosql/spi/security/PrincipalType.java similarity index 93% rename from presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/PrincipalType.java rename to presto-spi/src/main/java/io/prestosql/spi/security/PrincipalType.java index 1a1db066fa5a..164ecd92c2c6 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/PrincipalType.java +++ b/presto-spi/src/main/java/io/prestosql/spi/security/PrincipalType.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.prestosql.plugin.hive.metastore; +package io.prestosql.spi.security; public enum PrincipalType {