Search in sources :

Example 1 with HivePageSinkMetadata

use of com.facebook.presto.hive.metastore.HivePageSinkMetadata in project presto by prestodb.

the class TestHivePageSink method createPageSink.

private static ConnectorPageSink createPageSink(HiveTransactionHandle transaction, HiveClientConfig config, ExtendedHiveMetastore metastore, Path outputPath) {
    LocationHandle locationHandle = new LocationHandle(outputPath, Optional.of(outputPath), false);
    HiveOutputTableHandle handle = new HiveOutputTableHandle(CLIENT_ID, SCHEMA_NAME, TABLE_NAME, getColumnHandles(), "test", new HivePageSinkMetadata(new SchemaTableName(SCHEMA_NAME, TABLE_NAME), metastore.getTable(SCHEMA_NAME, TABLE_NAME), ImmutableMap.of()), locationHandle, config.getHiveStorageFormat(), config.getHiveStorageFormat(), ImmutableList.of(), Optional.empty(), "test", ImmutableMap.of());
    JsonCodec<PartitionUpdate> partitionUpdateCodec = JsonCodec.jsonCodec(PartitionUpdate.class);
    HdfsEnvironment hdfsEnvironment = createTestHdfsEnvironment(config);
    HivePageSinkProvider provider = new HivePageSinkProvider(getDefaultHiveFileWriterFactories(config), hdfsEnvironment, metastore, new GroupByHashPageIndexerFactory(new JoinCompiler()), TYPE_MANAGER, config, new HiveLocationService(hdfsEnvironment), partitionUpdateCodec);
    return provider.createPageSink(transaction, getSession(config), handle);
}
Also used : JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) HivePageSinkMetadata(com.facebook.presto.hive.metastore.HivePageSinkMetadata) SchemaTableName(com.facebook.presto.spi.SchemaTableName) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) HiveTestUtils.createTestHdfsEnvironment(com.facebook.presto.hive.HiveTestUtils.createTestHdfsEnvironment)

Example 2 with HivePageSinkMetadata

use of com.facebook.presto.hive.metastore.HivePageSinkMetadata in project presto by prestodb.

the class TestHivePageSink method createPageSink.

private static ConnectorPageSink createPageSink(HiveTransactionHandle transaction, HiveClientConfig config, MetastoreClientConfig metastoreClientConfig, ExtendedHiveMetastore metastore, Path outputPath, HiveWriterStats stats) {
    LocationHandle locationHandle = new LocationHandle(outputPath, outputPath, Optional.empty(), NEW, DIRECT_TO_TARGET_NEW_DIRECTORY);
    HiveOutputTableHandle handle = new HiveOutputTableHandle(SCHEMA_NAME, TABLE_NAME, getColumnHandles(), new HivePageSinkMetadata(new SchemaTableName(SCHEMA_NAME, TABLE_NAME), metastore.getTable(METASTORE_CONTEXT, SCHEMA_NAME, TABLE_NAME), ImmutableMap.of()), locationHandle, config.getHiveStorageFormat(), config.getHiveStorageFormat(), config.getHiveStorageFormat(), config.getCompressionCodec(), ImmutableList.of(), Optional.empty(), ImmutableList.of(), "test", ImmutableMap.of(), Optional.empty());
    HdfsEnvironment hdfsEnvironment = createTestHdfsEnvironment(config, metastoreClientConfig);
    HivePageSinkProvider provider = new HivePageSinkProvider(getDefaultHiveFileWriterFactories(config, metastoreClientConfig), hdfsEnvironment, PAGE_SORTER, metastore, new GroupByHashPageIndexerFactory(new JoinCompiler(MetadataManager.createTestMetadataManager(), new FeaturesConfig())), FUNCTION_AND_TYPE_MANAGER, config, metastoreClientConfig, new HiveLocationService(hdfsEnvironment), HiveTestUtils.PARTITION_UPDATE_CODEC, HiveTestUtils.PARTITION_UPDATE_SMILE_CODEC, new TestingNodeManager("fake-environment"), new HiveEventClient(), new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig(), new CacheConfig()), stats, getDefaultOrcFileWriterFactory(config, metastoreClientConfig), HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER);
    return provider.createPageSink(transaction, getSession(config), handle, TEST_HIVE_PAGE_SINK_CONTEXT);
}
Also used : JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) HivePageSinkMetadata(com.facebook.presto.hive.metastore.HivePageSinkMetadata) SchemaTableName(com.facebook.presto.spi.SchemaTableName) HiveTestUtils.createTestHdfsEnvironment(com.facebook.presto.hive.HiveTestUtils.createTestHdfsEnvironment) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) CacheConfig(com.facebook.presto.cache.CacheConfig)

Aggregations

GroupByHashPageIndexerFactory (com.facebook.presto.GroupByHashPageIndexerFactory)2 HiveTestUtils.createTestHdfsEnvironment (com.facebook.presto.hive.HiveTestUtils.createTestHdfsEnvironment)2 HivePageSinkMetadata (com.facebook.presto.hive.metastore.HivePageSinkMetadata)2 SchemaTableName (com.facebook.presto.spi.SchemaTableName)2 JoinCompiler (com.facebook.presto.sql.gen.JoinCompiler)2 CacheConfig (com.facebook.presto.cache.CacheConfig)1 FeaturesConfig (com.facebook.presto.sql.analyzer.FeaturesConfig)1 TestingNodeManager (com.facebook.presto.testing.TestingNodeManager)1