Search in sources :

Example 1 with NoHdfsAuthentication

use of com.facebook.presto.hive.authentication.NoHdfsAuthentication in project presto by prestodb.

the class HiveQueryRunner method createQueryRunner.

public static DistributedQueryRunner createQueryRunner(Iterable<TpchTable<?>> tables, Map<String, String> extraProperties, String security, Map<String, String> extraHiveProperties) throws Exception {
    assertEquals(DateTimeZone.getDefault(), TIME_ZONE, "Timezone not configured correctly. Add -Duser.timezone=Asia/Katmandu to your JVM arguments");
    DistributedQueryRunner queryRunner = new DistributedQueryRunner(createSession(), 4, extraProperties);
    try {
        queryRunner.installPlugin(new TpchPlugin());
        queryRunner.createCatalog("tpch", "tpch");
        File baseDir = queryRunner.getCoordinator().getBaseDataDir().resolve("hive_data").toFile();
        HiveClientConfig hiveClientConfig = new HiveClientConfig();
        HiveS3Config s3Config = new HiveS3Config();
        HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationUpdater(hiveClientConfig, s3Config));
        HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveClientConfig, new NoHdfsAuthentication());
        FileHiveMetastore metastore = new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test");
        metastore.createDatabase(createDatabaseMetastoreObject(TPCH_SCHEMA));
        metastore.createDatabase(createDatabaseMetastoreObject(TPCH_BUCKETED_SCHEMA));
        queryRunner.installPlugin(new HivePlugin(HIVE_CATALOG, metastore));
        Map<String, String> hiveProperties = ImmutableMap.<String, String>builder().putAll(extraHiveProperties).put("hive.metastore.uri", "thrift://localhost:8080").put("hive.time-zone", TIME_ZONE.getID()).put("hive.security", security).build();
        Map<String, String> hiveBucketedProperties = ImmutableMap.<String, String>builder().putAll(hiveProperties).put("hive.max-initial-split-size", // so that each bucket has multiple splits
        "10kB").put("hive.max-split-size", // so that each bucket has multiple splits
        "10kB").put("hive.storage-format", // so that there's no minimum split size for the file
        "TEXTFILE").put("hive.compression-codec", // so that the file is splittable
        "NONE").build();
        queryRunner.createCatalog(HIVE_CATALOG, HIVE_CATALOG, hiveProperties);
        queryRunner.createCatalog(HIVE_BUCKETED_CATALOG, HIVE_CATALOG, hiveBucketedProperties);
        copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
        copyTpchTablesBucketed(queryRunner, "tpch", TINY_SCHEMA_NAME, createBucketedSession(), tables);
        return queryRunner;
    } catch (Exception e) {
        queryRunner.close();
        throw e;
    }
}
Also used : DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) NoHdfsAuthentication(com.facebook.presto.hive.authentication.NoHdfsAuthentication) FileHiveMetastore(com.facebook.presto.hive.metastore.file.FileHiveMetastore) File(java.io.File)

Example 2 with NoHdfsAuthentication

use of com.facebook.presto.hive.authentication.NoHdfsAuthentication in project presto by prestodb.

the class TestHiveClientFileMetastore method createMetastore.

@Override
protected ExtendedHiveMetastore createMetastore(File tempDir) {
    File baseDir = new File(tempDir, "metastore");
    HiveClientConfig hiveConfig = new HiveClientConfig();
    MetastoreClientConfig metastoreClientConfig = new MetastoreClientConfig();
    HdfsConfigurationInitializer updator = new HdfsConfigurationInitializer(hiveConfig, metastoreClientConfig);
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(updator, ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, metastoreClientConfig, new NoHdfsAuthentication());
    return new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test");
}
Also used : FileHiveMetastore(com.facebook.presto.hive.metastore.file.FileHiveMetastore) File(java.io.File) NoHdfsAuthentication(com.facebook.presto.hive.authentication.NoHdfsAuthentication)

Example 3 with NoHdfsAuthentication

use of com.facebook.presto.hive.authentication.NoHdfsAuthentication in project presto by prestodb.

the class TestSpatialJoins method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().setSource(TestSpatialJoins.class.getSimpleName()).setCatalog("hive").setSchema("default").build(), 4);
    queryRunner.installPlugin(new GeoPlugin());
    File baseDir = queryRunner.getCoordinator().getBaseDataDir().resolve("hive_data").toFile();
    HiveClientConfig hiveClientConfig = new HiveClientConfig();
    MetastoreClientConfig metastoreClientConfig = new MetastoreClientConfig();
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hiveClientConfig, metastoreClientConfig), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, metastoreClientConfig, new NoHdfsAuthentication());
    FileHiveMetastore metastore = new FileHiveMetastore(hdfsEnvironment, baseDir.toURI().toString(), "test");
    ColumnConverterProvider columnConverterProvider = HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER;
    metastore.createDatabase(new MetastoreContext("test_user", "test_queryId", Optional.empty(), Optional.empty(), Optional.empty(), false, columnConverterProvider), Database.builder().setDatabaseName("default").setOwnerName("public").setOwnerType(PrincipalType.ROLE).build());
    queryRunner.installPlugin(new HivePlugin("hive", Optional.of(metastore)));
    queryRunner.createCatalog("hive", "hive");
    return queryRunner;
}
Also used : HdfsConfigurationInitializer(com.facebook.presto.hive.HdfsConfigurationInitializer) DistributedQueryRunner(com.facebook.presto.tests.DistributedQueryRunner) HiveHdfsConfiguration(com.facebook.presto.hive.HiveHdfsConfiguration) HivePlugin(com.facebook.presto.hive.HivePlugin) MetastoreContext(com.facebook.presto.hive.metastore.MetastoreContext) HdfsConfiguration(com.facebook.presto.hive.HdfsConfiguration) HiveHdfsConfiguration(com.facebook.presto.hive.HiveHdfsConfiguration) NoHdfsAuthentication(com.facebook.presto.hive.authentication.NoHdfsAuthentication) MetastoreClientConfig(com.facebook.presto.hive.MetastoreClientConfig) HdfsEnvironment(com.facebook.presto.hive.HdfsEnvironment) FileHiveMetastore(com.facebook.presto.hive.metastore.file.FileHiveMetastore) File(java.io.File) HiveColumnConverterProvider(com.facebook.presto.hive.HiveColumnConverterProvider) ColumnConverterProvider(com.facebook.presto.hive.ColumnConverterProvider) HiveClientConfig(com.facebook.presto.hive.HiveClientConfig)

Example 4 with NoHdfsAuthentication

use of com.facebook.presto.hive.authentication.NoHdfsAuthentication in project presto by prestodb.

the class TestHiveUtil method createTestingFileHiveMetastore.

public static FileHiveMetastore createTestingFileHiveMetastore(File catalogDirectory) {
    HiveClientConfig hiveClientConfig = new HiveClientConfig();
    MetastoreClientConfig metastoreClientConfig = new MetastoreClientConfig();
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hiveClientConfig, metastoreClientConfig), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, metastoreClientConfig, new NoHdfsAuthentication());
    return new FileHiveMetastore(hdfsEnvironment, catalogDirectory.toURI().toString(), "test");
}
Also used : FileHiveMetastore(com.facebook.presto.hive.metastore.file.FileHiveMetastore) NoHdfsAuthentication(com.facebook.presto.hive.authentication.NoHdfsAuthentication)

Example 5 with NoHdfsAuthentication

use of com.facebook.presto.hive.authentication.NoHdfsAuthentication in project presto by prestodb.

the class TestingSemiTransactionalHiveMetastore method create.

public static TestingSemiTransactionalHiveMetastore create() {
    // none of these values matter, as we never use them
    HiveClientConfig config = new HiveClientConfig();
    MetastoreClientConfig metastoreClientConfig = new MetastoreClientConfig();
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config, metastoreClientConfig), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, metastoreClientConfig, new NoHdfsAuthentication());
    HiveCluster hiveCluster = new TestingHiveCluster(metastoreClientConfig, HOST, PORT);
    ColumnConverterProvider columnConverterProvider = HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER;
    ExtendedHiveMetastore delegate = new BridgingHiveMetastore(new ThriftHiveMetastore(hiveCluster, metastoreClientConfig), new HivePartitionMutator());
    ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("hive-%s"));
    ListeningExecutorService renameExecutor = listeningDecorator(executor);
    return new TestingSemiTransactionalHiveMetastore(hdfsEnvironment, delegate, renameExecutor, false, false, true, columnConverterProvider);
}
Also used : TestingHiveCluster(com.facebook.presto.hive.metastore.thrift.TestingHiveCluster) ThriftHiveMetastore(com.facebook.presto.hive.metastore.thrift.ThriftHiveMetastore) NoHdfsAuthentication(com.facebook.presto.hive.authentication.NoHdfsAuthentication) HiveCluster(com.facebook.presto.hive.metastore.thrift.HiveCluster) TestingHiveCluster(com.facebook.presto.hive.metastore.thrift.TestingHiveCluster) HivePartitionMutator(com.facebook.presto.hive.metastore.HivePartitionMutator) ExecutorService(java.util.concurrent.ExecutorService) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ExtendedHiveMetastore(com.facebook.presto.hive.metastore.ExtendedHiveMetastore) BridgingHiveMetastore(com.facebook.presto.hive.metastore.thrift.BridgingHiveMetastore)

Aggregations

NoHdfsAuthentication (com.facebook.presto.hive.authentication.NoHdfsAuthentication)13 FileHiveMetastore (com.facebook.presto.hive.metastore.file.FileHiveMetastore)6 GroupByHashPageIndexerFactory (com.facebook.presto.GroupByHashPageIndexerFactory)4 SchemaTableName (com.facebook.presto.spi.SchemaTableName)4 ExecutorService (java.util.concurrent.ExecutorService)4 CounterStat (com.facebook.airlift.stats.CounterStat)3 CacheConfig (com.facebook.presto.cache.CacheConfig)3 OutputStreamDataSinkFactory (com.facebook.presto.hive.datasink.OutputStreamDataSinkFactory)3 ExtendedHiveMetastore (com.facebook.presto.hive.metastore.ExtendedHiveMetastore)3 ColumnHandle (com.facebook.presto.spi.ColumnHandle)3 ConnectorSplitSource (com.facebook.presto.spi.ConnectorSplitSource)3 JoinCompiler (com.facebook.presto.sql.gen.JoinCompiler)3 TestingConnectorSession (com.facebook.presto.testing.TestingConnectorSession)3 MoreExecutors.newDirectExecutorService (com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService)3 File (java.io.File)3 TYPE_MANAGER (com.facebook.presto.hive.HiveTestUtils.TYPE_MANAGER)2 HiveTestUtils.getDefaultHiveDataStreamFactories (com.facebook.presto.hive.HiveTestUtils.getDefaultHiveDataStreamFactories)2 HiveTestUtils.getDefaultHiveFileWriterFactories (com.facebook.presto.hive.HiveTestUtils.getDefaultHiveFileWriterFactories)2 HiveTestUtils.getDefaultHiveRecordCursorProvider (com.facebook.presto.hive.HiveTestUtils.getDefaultHiveRecordCursorProvider)2 HiveTestUtils.getTypes (com.facebook.presto.hive.HiveTestUtils.getTypes)2