Search in sources :

Example 1 with Catalog

use of com.facebook.presto.metadata.Catalog in project presto by prestodb.

the class TestAnalyzer method createTestingCatalog.

private Catalog createTestingCatalog(String catalogName, ConnectorId connectorId) {
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    Connector connector = createTestingConnector();
    InternalNodeManager nodeManager = new InMemoryNodeManager();
    return new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, accessControl), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId)));
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) QualifiedObjectName(com.facebook.presto.metadata.QualifiedObjectName) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) TypeManager(com.facebook.presto.spi.type.TypeManager) MetadataManager(com.facebook.presto.metadata.MetadataManager) MISSING_SCHEMA(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_SCHEMA) TypeRegistry(com.facebook.presto.type.TypeRegistry) APPLY_FUNCTION(com.facebook.presto.operator.scalar.ApplyFunction.APPLY_FUNCTION) MISMATCHED_COLUMN_ALIASES(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISMATCHED_COLUMN_ALIASES) Test(org.testng.annotations.Test) ConnectorTransactionHandle(com.facebook.presto.spi.connector.ConnectorTransactionHandle) VIEW_IS_RECURSIVE(com.facebook.presto.sql.analyzer.SemanticErrorCode.VIEW_IS_RECURSIVE) BIGINT(com.facebook.presto.spi.type.BigintType.BIGINT) CATALOG_NOT_SPECIFIED(com.facebook.presto.sql.analyzer.SemanticErrorCode.CATALOG_NOT_SPECIFIED) NON_NUMERIC_SAMPLE_PERCENTAGE(com.facebook.presto.sql.analyzer.SemanticErrorCode.NON_NUMERIC_SAMPLE_PERCENTAGE) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) SchemaTableName(com.facebook.presto.spi.SchemaTableName) MISMATCHED_SET_COLUMN_TYPES(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISMATCHED_SET_COLUMN_TYPES) INVALID_WINDOW_FRAME(com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_WINDOW_FRAME) TransactionBuilder.transaction(com.facebook.presto.transaction.TransactionBuilder.transaction) SCHEMA_NOT_SPECIFIED(com.facebook.presto.sql.analyzer.SemanticErrorCode.SCHEMA_NOT_SPECIFIED) ORDER_BY_MUST_BE_IN_SELECT(com.facebook.presto.sql.analyzer.SemanticErrorCode.ORDER_BY_MUST_BE_IN_SELECT) WILDCARD_WITHOUT_FROM(com.facebook.presto.sql.analyzer.SemanticErrorCode.WILDCARD_WITHOUT_FROM) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) COLUMN_TYPE_UNKNOWN(com.facebook.presto.sql.analyzer.SemanticErrorCode.COLUMN_TYPE_UNKNOWN) MUST_BE_AGGREGATION_FUNCTION(com.facebook.presto.sql.analyzer.SemanticErrorCode.MUST_BE_AGGREGATION_FUNCTION) Collections.emptyList(java.util.Collections.emptyList) INVALID_SCHEMA_NAME(com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_SCHEMA_NAME) BeforeMethod(org.testng.annotations.BeforeMethod) VARCHAR(com.facebook.presto.spi.type.VarcharType.VARCHAR) MISSING_ATTRIBUTE(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_ATTRIBUTE) NESTED_WINDOW(com.facebook.presto.sql.analyzer.SemanticErrorCode.NESTED_WINDOW) NOT_SUPPORTED(com.facebook.presto.sql.analyzer.SemanticErrorCode.NOT_SUPPORTED) VIEW_ANALYSIS_ERROR(com.facebook.presto.sql.analyzer.SemanticErrorCode.VIEW_ANALYSIS_ERROR) TestingMetadata(com.facebook.presto.testing.TestingMetadata) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) String.format(java.lang.String.format) SqlParser(com.facebook.presto.sql.parser.SqlParser) AMBIGUOUS_ATTRIBUTE(com.facebook.presto.sql.analyzer.SemanticErrorCode.AMBIGUOUS_ATTRIBUTE) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) MISSING_COLUMN(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_COLUMN) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId) Optional(java.util.Optional) STANDALONE_LAMBDA(com.facebook.presto.sql.analyzer.SemanticErrorCode.STANDALONE_LAMBDA) ConnectorId(com.facebook.presto.connector.ConnectorId) SystemConnector(com.facebook.presto.connector.system.SystemConnector) AllowAllAccessControl(com.facebook.presto.security.AllowAllAccessControl) JsonCodec(io.airlift.json.JsonCodec) CANNOT_HAVE_AGGREGATIONS_OR_WINDOWS(com.facebook.presto.sql.analyzer.SemanticErrorCode.CANNOT_HAVE_AGGREGATIONS_OR_WINDOWS) ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) DOUBLE(com.facebook.presto.spi.type.DoubleType.DOUBLE) WINDOW_REQUIRES_OVER(com.facebook.presto.sql.analyzer.SemanticErrorCode.WINDOW_REQUIRES_OVER) DUPLICATE_RELATION(com.facebook.presto.sql.analyzer.SemanticErrorCode.DUPLICATE_RELATION) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) ArrayType(com.facebook.presto.type.ArrayType) AccessControlManager(com.facebook.presto.security.AccessControlManager) TYPE_MISMATCH(com.facebook.presto.sql.analyzer.SemanticErrorCode.TYPE_MISMATCH) MULTIPLE_FIELDS_FROM_SUBQUERY(com.facebook.presto.sql.analyzer.SemanticErrorCode.MULTIPLE_FIELDS_FROM_SUBQUERY) COLUMN_NAME_NOT_SPECIFIED(com.facebook.presto.sql.analyzer.SemanticErrorCode.COLUMN_NAME_NOT_SPECIFIED) NESTED_AGGREGATION(com.facebook.presto.sql.analyzer.SemanticErrorCode.NESTED_AGGREGATION) INVALID_ORDINAL(com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_ORDINAL) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) MISSING_CATALOG(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_CATALOG) ImmutableList(com.google.common.collect.ImmutableList) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) TransactionManager(com.facebook.presto.transaction.TransactionManager) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager) INVALID_LITERAL(com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_LITERAL) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) Connector(com.facebook.presto.spi.connector.Connector) Language(org.intellij.lang.annotations.Language) MISSING_TABLE(com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_TABLE) Session(com.facebook.presto.Session) NodeLocation(com.facebook.presto.sql.tree.NodeLocation) MUST_BE_AGGREGATE_OR_GROUP_BY(com.facebook.presto.sql.analyzer.SemanticErrorCode.MUST_BE_AGGREGATE_OR_GROUP_BY) Assert.fail(org.testng.Assert.fail) TestingSession.testSessionBuilder(com.facebook.presto.testing.TestingSession.testSessionBuilder) SAMPLE_PERCENTAGE_OUT_OF_RANGE(com.facebook.presto.sql.analyzer.SemanticErrorCode.SAMPLE_PERCENTAGE_OUT_OF_RANGE) CatalogManager(com.facebook.presto.metadata.CatalogManager) VIEW_IS_STALE(com.facebook.presto.sql.analyzer.SemanticErrorCode.VIEW_IS_STALE) Consumer(java.util.function.Consumer) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId) IsolationLevel(com.facebook.presto.spi.transaction.IsolationLevel) ViewColumn(com.facebook.presto.metadata.ViewDefinition.ViewColumn) DUPLICATE_COLUMN_NAME(com.facebook.presto.sql.analyzer.SemanticErrorCode.DUPLICATE_COLUMN_NAME) TransactionManager.createTestTransactionManager(com.facebook.presto.transaction.TransactionManager.createTestTransactionManager) BlockEncodingManager(com.facebook.presto.block.BlockEncodingManager) Metadata(com.facebook.presto.metadata.Metadata) AccessControl(com.facebook.presto.security.AccessControl) Statement(com.facebook.presto.sql.tree.Statement) SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) Connector(com.facebook.presto.spi.connector.Connector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId) ConnectorId(com.facebook.presto.connector.ConnectorId) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Example 2 with Catalog

use of com.facebook.presto.metadata.Catalog in project presto by prestodb.

the class TestAccessControlManager method registerBogusConnector.

private static ConnectorId registerBogusConnector(CatalogManager catalogManager, TransactionManager transactionManager, AccessControl accessControl, String catalogName) {
    ConnectorId connectorId = new ConnectorId(catalogName);
    Connector connector = new TpchConnectorFactory().create(catalogName, ImmutableMap.of(), new TestingConnectorContext());
    InMemoryNodeManager nodeManager = new InMemoryNodeManager();
    MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, accessControl, ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
    return connectorId;
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) Connector(com.facebook.presto.spi.connector.Connector) SystemConnector(com.facebook.presto.connector.system.SystemConnector) TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) MetadataManager(com.facebook.presto.metadata.MetadataManager) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ConnectorId(com.facebook.presto.spi.ConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Example 3 with Catalog

use of com.facebook.presto.metadata.Catalog in project presto by prestodb.

the class TestPrestoDriver method testGetSchemas.

@Test
public void testGetSchemas() throws Exception {
    List<List<String>> system = new ArrayList<>();
    system.add(list("system", "information_schema"));
    system.add(list("system", "jdbc"));
    system.add(list("system", "metadata"));
    system.add(list("system", "runtime"));
    List<List<String>> blackhole = new ArrayList<>();
    blackhole.add(list("blackhole", "information_schema"));
    blackhole.add(list("blackhole", "default"));
    blackhole.add(list("blackhole", "blackhole"));
    List<List<String>> test = new ArrayList<>();
    test.add(list(TEST_CATALOG, "information_schema"));
    for (String schema : TpchMetadata.SCHEMA_NAMES) {
        test.add(list(TEST_CATALOG, schema));
    }
    List<List<String>> all = new ArrayList<>();
    all.addAll(system);
    all.addAll(test);
    all.addAll(blackhole);
    try (Connection connection = createConnection()) {
        try (ResultSet rs = connection.getMetaData().getSchemas()) {
            assertGetSchemasResult(rs, all);
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(null, null)) {
            assertGetSchemasResult(rs, all);
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(TEST_CATALOG, null)) {
            assertGetSchemasResult(rs, test);
        }
        try (ResultSet rs = connection.getMetaData().getSchemas("", null)) {
            // all schemas in presto have a catalog name
            assertGetSchemasResult(rs, list());
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(TEST_CATALOG, "information_schema")) {
            assertGetSchemasResult(rs, list(list(TEST_CATALOG, "information_schema")));
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(null, "information_schema")) {
            assertGetSchemasResult(rs, list(list(TEST_CATALOG, "information_schema"), list("blackhole", "information_schema"), list("system", "information_schema")));
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(null, "sf_")) {
            assertGetSchemasResult(rs, list(list(TEST_CATALOG, "sf1")));
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(null, "sf%")) {
            List<List<String>> expected = test.stream().filter(item -> item.get(1).startsWith("sf")).collect(toList());
            assertGetSchemasResult(rs, expected);
        }
        try (ResultSet rs = connection.getMetaData().getSchemas("unknown", null)) {
            assertGetSchemasResult(rs, list());
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(null, "unknown")) {
            assertGetSchemasResult(rs, list());
        }
        try (ResultSet rs = connection.getMetaData().getSchemas(TEST_CATALOG, "unknown")) {
            assertGetSchemasResult(rs, list());
        }
        try (ResultSet rs = connection.getMetaData().getSchemas("unknown", "unknown")) {
            assertGetSchemasResult(rs, list());
        }
    }
}
Also used : CharType.createCharType(com.facebook.presto.common.type.CharType.createCharType) DateTimeZone(org.joda.time.DateTimeZone) Connection(java.sql.Connection) Time(java.sql.Time) VarcharType.createUnboundedVarcharType(com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType) SQLFeatureNotSupportedException(java.sql.SQLFeatureNotSupportedException) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.testng.annotations.Test) Duration(io.airlift.units.Duration) Assertions.assertLessThan(com.facebook.airlift.testing.Assertions.assertLessThan) BigDecimal(java.math.BigDecimal) Future(java.util.concurrent.Future) ResultSet(java.sql.ResultSet) Duration.nanosSince(io.airlift.units.Duration.nanosSince) Arrays.asList(java.util.Arrays.asList) FAILED(com.facebook.presto.execution.QueryState.FAILED) TimeWithTimeZoneType(com.facebook.presto.common.type.TimeWithTimeZoneType) TEST_CATALOG_PROPERTIES(com.facebook.presto.tests.AbstractTestQueries.TEST_CATALOG_PROPERTIES) Assert.assertFalse(org.testng.Assert.assertFalse) POSITIVE_INFINITY(java.lang.Float.POSITIVE_INFINITY) TinyintType(com.facebook.presto.common.type.TinyintType) ImmutableSet(com.google.common.collect.ImmutableSet) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) GregorianCalendar(java.util.GregorianCalendar) ImmutableMap(com.google.common.collect.ImmutableMap) TimeZone(java.util.TimeZone) BigintType(com.facebook.presto.common.type.BigintType) BeforeClass(org.testng.annotations.BeforeClass) Timestamp(java.sql.Timestamp) Set(java.util.Set) UUID(java.util.UUID) Assertions.assertContains(com.facebook.airlift.testing.Assertions.assertContains) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Assert.assertNotNull(org.testng.Assert.assertNotNull) RealType(com.facebook.presto.common.type.RealType) TpchMetadata(com.facebook.presto.tpch.TpchMetadata) ZoneId(java.time.ZoneId) String.format(java.lang.String.format) Threads.daemonThreadsNamed(com.facebook.airlift.concurrent.Threads.daemonThreadsNamed) TimestampWithTimeZoneType(com.facebook.presto.common.type.TimestampWithTimeZoneType) CountDownLatch(java.util.concurrent.CountDownLatch) SmallintType(com.facebook.presto.common.type.SmallintType) List(java.util.List) Catalog(com.facebook.presto.metadata.Catalog) TESTING_CATALOG(com.facebook.presto.testing.TestingSession.TESTING_CATALOG) VarbinaryType(com.facebook.presto.common.type.VarbinaryType) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) ResultSetMetaData(java.sql.ResultSetMetaData) TimestampType(com.facebook.presto.common.type.TimestampType) Types(java.sql.Types) Assert.assertNull(org.testng.Assert.assertNull) BooleanType(com.facebook.presto.common.type.BooleanType) Assert.assertEquals(org.testng.Assert.assertEquals) DatabaseMetaData(java.sql.DatabaseMetaData) AtomicReference(java.util.concurrent.atomic.AtomicReference) VarcharType.createVarcharType(com.facebook.presto.common.type.VarcharType.createVarcharType) ArrayList(java.util.ArrayList) ColorType(com.facebook.presto.type.ColorType) SQLException(java.sql.SQLException) IntegerType(com.facebook.presto.common.type.IntegerType) ImmutableList(com.google.common.collect.ImmutableList) Objects.requireNonNull(java.util.Objects.requireNonNull) Assertions.assertInstanceOf(com.facebook.airlift.testing.Assertions.assertInstanceOf) ArrayType(com.facebook.presto.common.type.ArrayType) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) Type(com.facebook.presto.common.type.Type) ExecutorService(java.util.concurrent.ExecutorService) AfterClass(org.testng.annotations.AfterClass) SelectedRole(com.facebook.presto.spi.security.SelectedRole) RUNNING(com.facebook.presto.execution.QueryState.RUNNING) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assert.fail(org.testng.Assert.fail) DateTime(org.joda.time.DateTime) Date(java.sql.Date) TimeType(com.facebook.presto.common.type.TimeType) BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) TimeZoneKey(com.facebook.presto.common.type.TimeZoneKey) Collectors.toList(java.util.stream.Collectors.toList) TestingSession.createBogusTestingCatalog(com.facebook.presto.testing.TestingSession.createBogusTestingCatalog) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) Logging(com.facebook.airlift.log.Logging) Driver(java.sql.Driver) Statement(java.sql.Statement) Assert.assertTrue(org.testng.Assert.assertTrue) DateType(com.facebook.presto.common.type.DateType) QueryState(com.facebook.presto.execution.QueryState) DriverManager(java.sql.DriverManager) SECONDS(java.util.concurrent.TimeUnit.SECONDS) DoubleType(com.facebook.presto.common.type.DoubleType) DecimalType.createDecimalType(com.facebook.presto.common.type.DecimalType.createDecimalType) ArrayList(java.util.ArrayList) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) Collectors.toList(java.util.stream.Collectors.toList) Test(org.testng.annotations.Test)

Example 4 with Catalog

use of com.facebook.presto.metadata.Catalog in project presto by prestodb.

the class ConnectorManager method addCatalogConnector.

private synchronized void addCatalogConnector(String catalogName, ConnectorId connectorId, ConnectorFactory factory, Map<String, String> properties) {
    // create all connectors before adding, so a broken connector does not leave the system half updated
    MaterializedConnector connector = new MaterializedConnector(connectorId, createConnector(connectorId, factory, properties));
    MaterializedConnector informationSchemaConnector = new MaterializedConnector(createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadataManager, accessControlManager, connector.getSessionProperties()));
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    SystemTablesProvider systemTablesProvider;
    if (nodeManager.getCurrentNode().isCoordinator()) {
        systemTablesProvider = new DelegatingSystemTablesProvider(new StaticSystemTablesProvider(connector.getSystemTables()), new MetadataBasedSystemTablesProvider(metadataManager, catalogName));
    } else {
        systemTablesProvider = new StaticSystemTablesProvider(connector.getSystemTables());
    }
    MaterializedConnector systemConnector = new MaterializedConnector(systemId, new SystemConnector(systemId, nodeManager, systemTablesProvider, transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId), connector.getSessionProperties()));
    Catalog catalog = new Catalog(catalogName, connector.getConnectorId(), connector.getConnector(), informationSchemaConnector.getConnectorId(), informationSchemaConnector.getConnector(), systemConnector.getConnectorId(), systemConnector.getConnector());
    try {
        addConnectorInternal(connector);
        addConnectorInternal(informationSchemaConnector);
        addConnectorInternal(systemConnector);
        catalogManager.registerCatalog(catalog);
    } catch (Throwable e) {
        catalogManager.removeCatalog(catalog.getCatalogName());
        removeConnectorInternal(systemConnector.getConnectorId());
        removeConnectorInternal(informationSchemaConnector.getConnectorId());
        removeConnectorInternal(connector.getConnectorId());
        throw e;
    }
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) MetadataBasedSystemTablesProvider(com.facebook.presto.connector.system.MetadataBasedSystemTablesProvider) MetadataManager(com.facebook.presto.metadata.MetadataManager) ConnectorFilterStatsCalculatorService(com.facebook.presto.cost.ConnectorFilterStatsCalculatorService) RecordPageSourceProvider(com.facebook.presto.split.RecordPageSourceProvider) RowExpressionOptimizer(com.facebook.presto.sql.relational.RowExpressionOptimizer) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) PropertyMetadata(com.facebook.presto.spi.session.PropertyMetadata) ConnectorNodePartitioningProvider(com.facebook.presto.spi.connector.ConnectorNodePartitioningProvider) PreDestroy(javax.annotation.PreDestroy) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) ConnectorRecordSetProvider(com.facebook.presto.spi.connector.ConnectorRecordSetProvider) Map(java.util.Map) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) SystemTable(com.facebook.presto.spi.SystemTable) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) ConnectorPageSourceProvider(com.facebook.presto.spi.connector.ConnectorPageSourceProvider) FilterStatsCalculator(com.facebook.presto.cost.FilterStatsCalculator) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ImmutableSet(com.google.common.collect.ImmutableSet) PageSinkManager(com.facebook.presto.split.PageSinkManager) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) DomainTranslator(com.facebook.presto.spi.relation.DomainTranslator) Set(java.util.Set) ThreadSafe(javax.annotation.concurrent.ThreadSafe) SplitManager(com.facebook.presto.split.SplitManager) GuardedBy(javax.annotation.concurrent.GuardedBy) String.format(java.lang.String.format) SystemTablesProvider(com.facebook.presto.connector.system.SystemTablesProvider) Preconditions.checkState(com.google.common.base.Preconditions.checkState) Procedure(com.facebook.presto.spi.procedure.Procedure) List(java.util.List) Catalog(com.facebook.presto.metadata.Catalog) Optional(java.util.Optional) SystemConnector(com.facebook.presto.connector.system.SystemConnector) PredicateCompiler(com.facebook.presto.spi.relation.PredicateCompiler) ConnectorId(com.facebook.presto.spi.ConnectorId) StaticSystemTablesProvider(com.facebook.presto.connector.system.StaticSystemTablesProvider) ConnectorRowExpressionService(com.facebook.presto.sql.relational.ConnectorRowExpressionService) DeterminismEvaluator(com.facebook.presto.spi.relation.DeterminismEvaluator) Logger(com.facebook.airlift.log.Logger) NodeInfo(com.facebook.airlift.node.NodeInfo) DelegatingSystemTablesProvider(com.facebook.presto.connector.system.DelegatingSystemTablesProvider) AccessControlManager(com.facebook.presto.security.AccessControlManager) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) BlockEncodingSerde(com.facebook.presto.common.block.BlockEncodingSerde) ConcurrentMap(java.util.concurrent.ConcurrentMap) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) ConnectorPlanOptimizerProvider(com.facebook.presto.spi.connector.ConnectorPlanOptimizerProvider) Inject(javax.inject.Inject) RowExpressionFormatter(com.facebook.presto.sql.planner.planPrinter.RowExpressionFormatter) ImmutableList(com.google.common.collect.ImmutableList) PageSourceManager(com.facebook.presto.split.PageSourceManager) TypeManager(com.facebook.presto.common.type.TypeManager) Objects.requireNonNull(java.util.Objects.requireNonNull) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId) IndexManager(com.facebook.presto.index.IndexManager) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) FunctionResolution(com.facebook.presto.sql.relational.FunctionResolution) PageSorter(com.facebook.presto.spi.PageSorter) ConnectorContext(com.facebook.presto.spi.connector.ConnectorContext) ConnectorPageSinkProvider(com.facebook.presto.spi.connector.ConnectorPageSinkProvider) TransactionManager(com.facebook.presto.transaction.TransactionManager) Connector(com.facebook.presto.spi.connector.Connector) ConnectorIndexProvider(com.facebook.presto.spi.connector.ConnectorIndexProvider) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) CatalogManager(com.facebook.presto.metadata.CatalogManager) ConnectorMetadataUpdaterProvider(com.facebook.presto.spi.connector.ConnectorMetadataUpdaterProvider) HandleResolver(com.facebook.presto.metadata.HandleResolver) ConnectorAccessControl(com.facebook.presto.spi.connector.ConnectorAccessControl) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) StaticSystemTablesProvider(com.facebook.presto.connector.system.StaticSystemTablesProvider) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) DelegatingSystemTablesProvider(com.facebook.presto.connector.system.DelegatingSystemTablesProvider) MetadataBasedSystemTablesProvider(com.facebook.presto.connector.system.MetadataBasedSystemTablesProvider) MetadataBasedSystemTablesProvider(com.facebook.presto.connector.system.MetadataBasedSystemTablesProvider) SystemTablesProvider(com.facebook.presto.connector.system.SystemTablesProvider) StaticSystemTablesProvider(com.facebook.presto.connector.system.StaticSystemTablesProvider) DelegatingSystemTablesProvider(com.facebook.presto.connector.system.DelegatingSystemTablesProvider) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ConnectorId(com.facebook.presto.spi.ConnectorId) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId)

Example 5 with Catalog

use of com.facebook.presto.metadata.Catalog in project presto by prestodb.

the class TestPrestoDriver method setup.

@BeforeClass
public void setup() throws Exception {
    Logging.initialize();
    server = new TestingPrestoServer();
    server.installPlugin(new TpchPlugin());
    server.createCatalog(TEST_CATALOG, "tpch");
    server.installPlugin(new BlackHolePlugin());
    server.createCatalog("blackhole", "blackhole");
    Catalog bogusTestingCatalog = createBogusTestingCatalog(TESTING_CATALOG);
    server.getCatalogManager().registerCatalog(bogusTestingCatalog);
    SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager();
    sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);
    waitForNodeRefresh(server);
    setupTestTables();
    executorService = newCachedThreadPool(daemonThreadsNamed("test-%s"));
}
Also used : BlackHolePlugin(com.facebook.presto.plugin.blackhole.BlackHolePlugin) TpchPlugin(com.facebook.presto.tpch.TpchPlugin) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) Catalog(com.facebook.presto.metadata.Catalog) TestingSession.createBogusTestingCatalog(com.facebook.presto.testing.TestingSession.createBogusTestingCatalog) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

Catalog (com.facebook.presto.metadata.Catalog)10 InformationSchemaConnector (com.facebook.presto.connector.informationSchema.InformationSchemaConnector)5 SystemConnector (com.facebook.presto.connector.system.SystemConnector)5 CatalogManager (com.facebook.presto.metadata.CatalogManager)5 InMemoryNodeManager (com.facebook.presto.metadata.InMemoryNodeManager)4 InternalNodeManager (com.facebook.presto.metadata.InternalNodeManager)4 AccessControlManager (com.facebook.presto.security.AccessControlManager)4 ConnectorId (com.facebook.presto.spi.ConnectorId)4 ConnectorId.createInformationSchemaConnectorId (com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId)4 ConnectorId.createSystemTablesConnectorId (com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId)4 ArrayType (com.facebook.presto.common.type.ArrayType)3 MetadataManager (com.facebook.presto.metadata.MetadataManager)3 AllowAllAccessControl (com.facebook.presto.security.AllowAllAccessControl)3 Connector (com.facebook.presto.spi.connector.Connector)3 ImmutableList (com.google.common.collect.ImmutableList)3 String.format (java.lang.String.format)3 Optional (java.util.Optional)3 BeforeClass (org.testng.annotations.BeforeClass)3 Session (com.facebook.presto.Session)2 RowType (com.facebook.presto.common.type.RowType)2