Search in sources :

Example 6 with TestingNodeManager

use of io.prestosql.testing.TestingNodeManager in project hetu-core by openlookeng.

the class TestMemoryMetadata method setUp.

@BeforeMethod
public void setUp() throws IOException {
    TempFolder tmp = new TempFolder().create();
    Runtime.getRuntime().addShutdownHook(new Thread(tmp::close));
    metadata = new MemoryMetadata(new TestingTypeManager(), new TestingNodeManager(), new HetuFsMetastore(new HetuFsMetastoreConfig().setHetuFileSystemMetastorePath(tmp.getRoot().getCanonicalPath()), new HetuLocalFileSystemClient(new LocalConfig(null), Paths.get(tmp.getRoot().getCanonicalPath()))), null, new MemoryConfig());
}
Also used : HetuFsMetastoreConfig(io.hetu.core.metastore.hetufilesystem.HetuFsMetastoreConfig) TempFolder(io.hetu.core.common.filesystem.TempFolder) TestingNodeManager(io.prestosql.testing.TestingNodeManager) LocalConfig(io.hetu.core.filesystem.LocalConfig) HetuFsMetastore(io.hetu.core.metastore.hetufilesystem.HetuFsMetastore) HetuLocalFileSystemClient(io.hetu.core.filesystem.HetuLocalFileSystemClient) TestingTypeManager(io.prestosql.spi.type.testing.TestingTypeManager) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with TestingNodeManager

use of io.prestosql.testing.TestingNodeManager in project boostkit-bigdata by kunpengcompute.

the class TestHivePageSink method createPageSink.

private static ConnectorPageSink createPageSink(HiveTransactionHandle transaction, HiveConfig config, HiveMetastore metastore, Path outputPath, HiveWriterStats stats) {
    ConnectorSession session = getSession(config);
    HiveIdentity identity = new HiveIdentity(session);
    LocationHandle locationHandle = new LocationHandle(outputPath, outputPath, false, DIRECT_TO_TARGET_NEW_DIRECTORY, Optional.empty());
    HiveOutputTableHandle handle = new HiveOutputTableHandle(SCHEMA_NAME, TABLE_NAME, getColumnHandles(), new HivePageSinkMetadata(new SchemaTableName(SCHEMA_NAME, TABLE_NAME), metastore.getTable(identity, 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 = HiveTestUtils.createTestHdfsEnvironment(config);
    HivePageSinkProvider provider = new HivePageSinkProvider(HiveTestUtils.getDefaultHiveFileWriterFactories(config), hdfsEnvironment, HiveTestUtils.PAGE_SORTER, metastore, new GroupByHashPageIndexerFactory(new JoinCompiler(createTestMetadataManager())), HiveTestUtils.TYPE_MANAGER, config, new HiveLocationService(hdfsEnvironment), partitionUpdateCodec, new TestingNodeManager("fake-environment"), new HiveEventClient(), new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()), stats, HiveTestUtils.getDefaultOrcFileWriterFactory(config));
    return provider.createPageSink(transaction, getSession(config), handle);
}
Also used : JoinCompiler(io.prestosql.sql.gen.JoinCompiler) HivePageSinkMetadata(io.prestosql.plugin.hive.metastore.HivePageSinkMetadata) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) HiveIdentity(io.prestosql.plugin.hive.authentication.HiveIdentity) TestingNodeManager(io.prestosql.testing.TestingNodeManager) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) TestingConnectorSession(io.prestosql.testing.TestingConnectorSession) GroupByHashPageIndexerFactory(io.prestosql.GroupByHashPageIndexerFactory)

Example 8 with TestingNodeManager

use of io.prestosql.testing.TestingNodeManager in project boostkit-bigdata by kunpengcompute.

the class TestHiveWriterFactory method testSortingPath.

@Test
public void testSortingPath() {
    setUp();
    String targetPath = "/tmp";
    String writePath = "/tmp/table";
    Optional<WriteIdInfo> writeIdInfo = Optional.of(new WriteIdInfo(1, 1, 0));
    StorageFormat storageFormat = StorageFormat.fromHiveStorageFormat(ORC);
    Storage storage = new Storage(storageFormat, "", Optional.empty(), false, ImmutableMap.of());
    Table table = new Table("schema", "table", "user", "MANAGED_TABLE", storage, ImmutableList.of(new Column("col_1", HiveType.HIVE_INT, Optional.empty())), ImmutableList.of(), ImmutableMap.of("transactional", "true"), Optional.of("original"), Optional.of("expanded"));
    HiveConfig hiveConfig = getHiveConfig();
    HivePageSinkMetadata hivePageSinkMetadata = new HivePageSinkMetadata(new SchemaTableName("schema", "table"), Optional.of(table), ImmutableMap.of());
    PageSorter pageSorter = new PagesIndexPageSorter(new PagesIndex.TestingFactory(false));
    Metadata metadata = createTestMetadataManager();
    TypeManager typeManager = new InternalTypeManager(metadata.getFunctionAndTypeManager());
    HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hiveConfig), ImmutableSet.of());
    HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveConfig, new NoHdfsAuthentication());
    LocationService locationService = new HiveLocationService(hdfsEnvironment);
    ConnectorSession session = newSession();
    HiveWriterFactory hiveWriterFactory = new HiveWriterFactory(getDefaultHiveFileWriterFactories(hiveConfig), "schema", "table", false, HiveACIDWriteType.DELETE, ImmutableList.of(new HiveColumnHandle("col_1", HiveType.HIVE_INT, new TypeSignature("integer", ImmutableList.of()), 0, HiveColumnHandle.ColumnType.REGULAR, Optional.empty())), ORC, ORC, ImmutableMap.of(), OptionalInt.empty(), ImmutableList.of(), new LocationHandle(targetPath, writePath, false, LocationHandle.WriteMode.STAGE_AND_MOVE_TO_TARGET_DIRECTORY, writeIdInfo), locationService, session.getQueryId(), new HivePageSinkMetadataProvider(hivePageSinkMetadata, CachingHiveMetastore.memoizeMetastore(metastore, 1000), new HiveIdentity(session)), typeManager, hdfsEnvironment, pageSorter, hiveConfig.getWriterSortBufferSize(), hiveConfig.getMaxOpenSortFiles(), false, UTC, session, new TestingNodeManager("fake-environment"), new HiveEventClient(), new HiveSessionProperties(hiveConfig, new OrcFileWriterConfig(), new ParquetFileWriterConfig()), new HiveWriterStats(), getDefaultOrcFileWriterFactory(hiveConfig));
    HiveWriter hiveWriter = hiveWriterFactory.createWriter(ImmutableList.of(), OptionalInt.empty(), Optional.empty());
    assertEquals(((SortingFileWriter) hiveWriter.getFileWriter()).getTempFilePrefix().getName(), ".tmp-sort.bucket_00000");
}
Also used : HivePageSinkMetadataProvider(io.prestosql.plugin.hive.metastore.HivePageSinkMetadataProvider) HivePageSinkMetadata(io.prestosql.plugin.hive.metastore.HivePageSinkMetadata) Metadata(io.prestosql.metadata.Metadata) StorageFormat(io.prestosql.plugin.hive.metastore.StorageFormat) PagesIndex(io.prestosql.operator.PagesIndex) NoHdfsAuthentication(io.prestosql.plugin.hive.authentication.NoHdfsAuthentication) HiveIdentity(io.prestosql.plugin.hive.authentication.HiveIdentity) PagesIndexPageSorter(io.prestosql.PagesIndexPageSorter) TypeSignature(io.prestosql.spi.type.TypeSignature) Column(io.prestosql.plugin.hive.metastore.Column) TestingNodeManager(io.prestosql.testing.TestingNodeManager) PagesIndexPageSorter(io.prestosql.PagesIndexPageSorter) PageSorter(io.prestosql.spi.PageSorter) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) TestingConnectorSession(io.prestosql.testing.TestingConnectorSession) InternalTypeManager(io.prestosql.type.InternalTypeManager) Table(io.prestosql.plugin.hive.metastore.Table) HivePageSinkMetadata(io.prestosql.plugin.hive.metastore.HivePageSinkMetadata) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) Storage(io.prestosql.plugin.hive.metastore.Storage) InternalTypeManager(io.prestosql.type.InternalTypeManager) TypeManager(io.prestosql.spi.type.TypeManager) Test(org.testng.annotations.Test)

Aggregations

TestingNodeManager (io.prestosql.testing.TestingNodeManager)8 HiveIdentity (io.prestosql.plugin.hive.authentication.HiveIdentity)6 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)6 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)6 TestingConnectorSession (io.prestosql.testing.TestingConnectorSession)6 GroupByHashPageIndexerFactory (io.prestosql.GroupByHashPageIndexerFactory)4 NoHdfsAuthentication (io.prestosql.plugin.hive.authentication.NoHdfsAuthentication)4 Table (io.prestosql.plugin.hive.metastore.Table)4 Test (org.testng.annotations.Test)4 HivePageSinkMetadata (io.prestosql.plugin.hive.metastore.HivePageSinkMetadata)3 JoinCompiler (io.prestosql.sql.gen.JoinCompiler)3 Function (com.google.common.base.Function)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableMultimap (com.google.common.collect.ImmutableMultimap)2 Iterables.getOnlyElement (com.google.common.collect.Iterables.getOnlyElement)2 HostAndPort (com.google.common.net.HostAndPort)2 MoreExecutors.newDirectExecutorService (com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService)2 BoundedExecutor (io.airlift.concurrent.BoundedExecutor)2