Search in sources :

Example 6 with MetadataManager

use of io.prestosql.metadata.MetadataManager in project hetu-core by openlookeng.

the class DataCenterUtility method loadDCCatalogForQueryFlow.

/**
 * Utility method to load DC catalog from query flow.
 *
 * @param session session
 * @param metadata metadata
 */
public static void loadDCCatalogForQueryFlow(Session session, Metadata metadata, String catalogName) {
    if (!catalogName.contains(".")) {
        return;
    }
    MetadataManager metadataManager = (MetadataManager) metadata;
    DataCenterConnectorManager dataCenterConnectorManager = metadataManager.getDataCenterConnectorManager();
    if (dataCenterConnectorManager != null) {
        dataCenterConnectorManager.loadDCCatalog(catalogName);
    }
}
Also used : MetadataManager(io.prestosql.metadata.MetadataManager)

Example 7 with MetadataManager

use of io.prestosql.metadata.MetadataManager in project hetu-core by openlookeng.

the class TestMetadataManager method setUp.

@BeforeClass
public void setUp() throws Exception {
    queryRunner = TpchQueryRunnerBuilder.builder().build();
    queryRunner.installPlugin(new Plugin() {

        @Override
        public Iterable<ConnectorFactory> getConnectorFactories() {
            MockConnectorFactory connectorFactory = MockConnectorFactory.builder().withListSchemaNames(session -> ImmutableList.of("UPPER_CASE_SCHEMA")).withListTables((session, schemaNameOrNull) -> {
                throw new UnsupportedOperationException();
            }).withGetViews((session, prefix) -> ImmutableMap.of()).withGetColumnHandles((session, tableHandle) -> {
                throw new UnsupportedOperationException();
            }).build();
            return ImmutableList.of(connectorFactory);
        }
    });
    queryRunner.createCatalog("upper_case_schema_catalog", "mock");
    metadataManager = (MetadataManager) queryRunner.getMetadata();
}
Also used : TestingSessionContext(io.prestosql.execution.TestingSessionContext) FAILED(io.prestosql.execution.QueryState.FAILED) AfterClass(org.testng.annotations.AfterClass) Plugin(io.prestosql.spi.Plugin) TpchQueryRunnerBuilder(io.prestosql.tests.tpch.TpchQueryRunnerBuilder) ImmutableMap(com.google.common.collect.ImmutableMap) Language(org.intellij.lang.annotations.Language) BeforeClass(org.testng.annotations.BeforeClass) Assert.fail(org.testng.Assert.fail) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) MetadataManager(io.prestosql.metadata.MetadataManager) MockConnectorFactory(io.prestosql.connector.MockConnectorFactory) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) BasicQueryInfo(io.prestosql.server.BasicQueryInfo) TransactionBuilder(io.prestosql.transaction.TransactionBuilder) ConnectorFactory(io.prestosql.spi.connector.ConnectorFactory) RUNNING(io.prestosql.execution.QueryState.RUNNING) QueryId(io.prestosql.spi.QueryId) TEST_SESSION(io.prestosql.SessionTestUtils.TEST_SESSION) DispatchManager(io.prestosql.dispatcher.DispatchManager) MockConnectorFactory(io.prestosql.connector.MockConnectorFactory) Plugin(io.prestosql.spi.Plugin) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

MetadataManager (io.prestosql.metadata.MetadataManager)7 ImmutableList (com.google.common.collect.ImmutableList)2 ConnectorFactory (io.prestosql.spi.connector.ConnectorFactory)2 List (java.util.List)2 BeforeClass (org.testng.annotations.BeforeClass)2 Joiner (com.google.common.base.Joiner)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Verify.verify (com.google.common.base.Verify.verify)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Announcer (io.airlift.discovery.client.Announcer)1 ServiceAnnouncement (io.airlift.discovery.client.ServiceAnnouncement)1 Logger (io.airlift.log.Logger)1 NodeInfo (io.airlift.node.NodeInfo)1 TEST_SESSION (io.prestosql.SessionTestUtils.TEST_SESSION)1 MockConnectorFactory (io.prestosql.connector.MockConnectorFactory)1 InformationSchemaConnector (io.prestosql.connector.informationschema.InformationSchemaConnector)1 DelegatingSystemTablesProvider (io.prestosql.connector.system.DelegatingSystemTablesProvider)1 MetadataBasedSystemTablesProvider (io.prestosql.connector.system.MetadataBasedSystemTablesProvider)1