Search in sources :

Example 1 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class TestPruneIndexSourceColumns method buildProjectedIndexSource.

private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) {
    Symbol orderkey = p.symbol("orderkey", INTEGER);
    Symbol custkey = p.symbol("custkey", INTEGER);
    Symbol totalprice = p.symbol("totalprice", DOUBLE);
    ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER);
    ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER);
    ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE);
    return p.project(Assignments.copyOf(ImmutableList.of(orderkey, custkey, totalprice).stream().filter(projectionFilter).collect(Collectors.toMap(v -> v, v -> p.variable(v.getName())))), p.indexSource(new TableHandle(new CatalogName("local"), new TpchTableHandle("orders", TINY_SCALE_FACTOR), TpchTransactionHandle.INSTANCE, Optional.empty()), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of(orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE)))));
}
Also used : BaseRuleTest(io.prestosql.sql.planner.iterative.rule.test.BaseRuleTest) TpchTableHandle(io.prestosql.plugin.tpch.TpchTableHandle) TpchColumnHandle(io.prestosql.plugin.tpch.TpchColumnHandle) Test(org.testng.annotations.Test) INTEGER(io.prestosql.spi.type.IntegerType.INTEGER) TableHandle(io.prestosql.spi.metadata.TableHandle) ImmutableList(com.google.common.collect.ImmutableList) Predicates(com.google.common.base.Predicates) DOUBLE(io.prestosql.spi.type.DoubleType.DOUBLE) TpchTransactionHandle(io.prestosql.plugin.tpch.TpchTransactionHandle) PlanMatchPattern.expression(io.prestosql.sql.planner.assertions.PlanMatchPattern.expression) Symbol(io.prestosql.spi.plan.Symbol) TINY_SCALE_FACTOR(io.prestosql.plugin.tpch.TpchMetadata.TINY_SCALE_FACTOR) PlanMatchPattern.constrainedIndexSource(io.prestosql.sql.planner.assertions.PlanMatchPattern.constrainedIndexSource) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Assignments(io.prestosql.spi.plan.Assignments) PlanMatchPattern.strictProject(io.prestosql.sql.planner.assertions.PlanMatchPattern.strictProject) Predicate(java.util.function.Predicate) TupleDomain(io.prestosql.spi.predicate.TupleDomain) CatalogName(io.prestosql.spi.connector.CatalogName) PlanNode(io.prestosql.spi.plan.PlanNode) Collectors(java.util.stream.Collectors) NullableValue.asNull(io.prestosql.spi.predicate.NullableValue.asNull) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) Domain(io.prestosql.spi.predicate.Domain) Optional(java.util.Optional) PlanBuilder(io.prestosql.sql.planner.iterative.rule.test.PlanBuilder) TpchColumnHandle(io.prestosql.plugin.tpch.TpchColumnHandle) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) TpchColumnHandle(io.prestosql.plugin.tpch.TpchColumnHandle) Symbol(io.prestosql.spi.plan.Symbol) TpchTableHandle(io.prestosql.plugin.tpch.TpchTableHandle) TableHandle(io.prestosql.spi.metadata.TableHandle) CatalogName(io.prestosql.spi.connector.CatalogName) TpchTableHandle(io.prestosql.plugin.tpch.TpchTableHandle)

Example 2 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class TestProcedureCall method setUp.

@BeforeClass
public void setUp() {
    TestingPrestoServer coordinator = ((DistributedQueryRunner) getQueryRunner()).getCoordinator();
    tester = coordinator.getProcedureTester();
    // register procedures in the bogus testing catalog
    ProcedureRegistry procedureRegistry = coordinator.getMetadata().getProcedureRegistry();
    TestingProcedures procedures = new TestingProcedures(coordinator.getProcedureTester());
    procedureRegistry.addProcedures(new CatalogName(TESTING_CATALOG), procedures.getProcedures(PROCEDURE_SCHEMA));
    session = testSessionBuilder().setCatalog(TESTING_CATALOG).setSchema(PROCEDURE_SCHEMA).build();
}
Also used : TestingPrestoServer(io.prestosql.server.testing.TestingPrestoServer) ProcedureRegistry(io.prestosql.metadata.ProcedureRegistry) CatalogName(io.prestosql.spi.connector.CatalogName) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class TestQueryPlanDeterminism method createLocalQueryRunner.

private static LocalQueryRunner createLocalQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    localQueryRunner.getMetadata().getFunctionAndTypeManager().registerBuiltInFunctions(CUSTOM_FUNCTIONS);
    SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
    sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
    sessionPropertyManager.addConnectorSessionProperties(new CatalogName(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
    return localQueryRunner;
}
Also used : TpchConnectorFactory(io.prestosql.plugin.tpch.TpchConnectorFactory) SessionPropertyManager(io.prestosql.metadata.SessionPropertyManager) CatalogName(io.prestosql.spi.connector.CatalogName) LocalQueryRunner(io.prestosql.testing.LocalQueryRunner) Session(io.prestosql.Session)

Example 4 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class TestTransactionManager method registerConnector.

private static void registerConnector(CatalogManager catalogManager, TransactionManager transactionManager, String catalogName, CatalogName catalog, Connector connector) {
    CatalogName systemId = createSystemTablesCatalogName(catalog);
    InternalNodeManager nodeManager = new InMemoryNodeManager();
    Metadata metadata = createTestMetadataManager(catalogManager);
    catalogManager.registerCatalog(new Catalog(catalogName, catalog, connector, createInformationSchemaCatalogName(catalog), new InformationSchemaConnector(catalogName, nodeManager, metadata, new AllowAllAccessControl()), systemId, new SystemConnector(nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, catalog))));
}
Also used : SystemConnector(io.prestosql.connector.system.SystemConnector) InformationSchemaConnector(io.prestosql.connector.informationschema.InformationSchemaConnector) InternalNodeManager(io.prestosql.metadata.InternalNodeManager) AllowAllAccessControl(io.prestosql.security.AllowAllAccessControl) ConnectorMetadata(io.prestosql.spi.connector.ConnectorMetadata) Metadata(io.prestosql.metadata.Metadata) CatalogName.createSystemTablesCatalogName(io.prestosql.spi.connector.CatalogName.createSystemTablesCatalogName) CatalogName.createInformationSchemaCatalogName(io.prestosql.spi.connector.CatalogName.createInformationSchemaCatalogName) CatalogName(io.prestosql.spi.connector.CatalogName) Catalog(io.prestosql.metadata.Catalog) InMemoryNodeManager(io.prestosql.metadata.InMemoryNodeManager)

Example 5 with CatalogName

use of io.prestosql.spi.connector.CatalogName in project hetu-core by openlookeng.

the class StandaloneQueryRunner method createCatalog.

@Override
public void createCatalog(String catalogName, String connectorName, Map<String, String> properties) {
    CatalogName catalog = server.createCatalog(catalogName, connectorName, properties);
    refreshNodes(catalog);
}
Also used : CatalogName(io.prestosql.spi.connector.CatalogName)

Aggregations

CatalogName (io.prestosql.spi.connector.CatalogName)154 ConnectorMetadata (io.prestosql.spi.connector.ConnectorMetadata)82 ConnectorSession (io.prestosql.spi.connector.ConnectorSession)32 TableHandle (io.prestosql.spi.metadata.TableHandle)30 PrestoException (io.prestosql.spi.PrestoException)22 ImmutableList (com.google.common.collect.ImmutableList)21 Optional (java.util.Optional)21 Session (io.prestosql.Session)20 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)20 List (java.util.List)20 HashMap (java.util.HashMap)19 Map (java.util.Map)19 ConnectorDeleteAsInsertTableHandle (io.prestosql.spi.connector.ConnectorDeleteAsInsertTableHandle)18 ConnectorTableHandle (io.prestosql.spi.connector.ConnectorTableHandle)18 ConnectorInsertTableHandle (io.prestosql.spi.connector.ConnectorInsertTableHandle)17 ConnectorOutputTableHandle (io.prestosql.spi.connector.ConnectorOutputTableHandle)17 ConnectorUpdateTableHandle (io.prestosql.spi.connector.ConnectorUpdateTableHandle)17 ConnectorVacuumTableHandle (io.prestosql.spi.connector.ConnectorVacuumTableHandle)17 ConnectorTransactionHandle (io.prestosql.spi.connector.ConnectorTransactionHandle)16 Type (io.prestosql.spi.type.Type)16