Search in sources :

Example 1 with InternalNodeManager

use of com.facebook.presto.metadata.InternalNodeManager 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 InternalNodeManager

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

the class TestTransactionManager method registerConnector.

private static void registerConnector(CatalogManager catalogManager, TransactionManager transactionManager, String catalogName, ConnectorId connectorId, Connector connector) {
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    InternalNodeManager nodeManager = new InMemoryNodeManager();
    MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
    catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, new AllowAllAccessControl(), ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) MetadataManager(com.facebook.presto.metadata.MetadataManager) AllowAllAccessControl(com.facebook.presto.security.AllowAllAccessControl) 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 InternalNodeManager

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

the class AbstractAnalyzerTest method createTestingCatalog.

private Catalog createTestingCatalog(String catalogName, ConnectorId connectorId) {
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    Connector connector = AbstractAnalyzerTest.createTestingConnector();
    InternalNodeManager nodeManager = new InMemoryNodeManager();
    return 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)));
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) WarningCollector(com.facebook.presto.spi.WarningCollector) Parameter(com.facebook.presto.spi.function.Parameter) JsonCodec(com.facebook.airlift.json.JsonCodec) SqlInvokedFunctionNamespaceManagerConfig(com.facebook.presto.functionNamespace.SqlInvokedFunctionNamespaceManagerConfig) SQL(com.facebook.presto.spi.function.RoutineCharacteristics.Language.SQL) TestingWarningCollectorConfig(com.facebook.presto.testing.TestingWarningCollectorConfig) APPLY_FUNCTION(com.facebook.presto.operator.scalar.ApplyFunction.APPLY_FUNCTION) SqlInvokedFunction(com.facebook.presto.spi.function.SqlInvokedFunction) PropertyMetadata(com.facebook.presto.spi.session.PropertyMetadata) ConnectorTransactionHandle(com.facebook.presto.spi.connector.ConnectorTransactionHandle) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) SchemaTableName(com.facebook.presto.spi.SchemaTableName) WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) TransactionBuilder.transaction(com.facebook.presto.transaction.TransactionBuilder.transaction) QualifiedObjectName(com.facebook.presto.common.QualifiedObjectName) PropertyMetadata.stringProperty(com.facebook.presto.spi.session.PropertyMetadata.stringProperty) ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ImmutableMap(com.google.common.collect.ImmutableMap) DOUBLE(com.facebook.presto.common.type.DoubleType.DOUBLE) FunctionImplementationType(com.facebook.presto.spi.function.FunctionImplementationType) InMemoryTransactionManager.createTestTransactionManager(com.facebook.presto.transaction.InMemoryTransactionManager.createTestTransactionManager) Collections.emptyList(java.util.Collections.emptyList) BeforeClass(org.testng.annotations.BeforeClass) DETERMINISTIC(com.facebook.presto.spi.function.RoutineCharacteristics.Determinism.DETERMINISTIC) InMemoryFunctionNamespaceManager(com.facebook.presto.functionNamespace.testing.InMemoryFunctionNamespaceManager) RealType(com.facebook.presto.common.type.RealType) TestingMetadata(com.facebook.presto.testing.TestingMetadata) TestingWarningCollector(com.facebook.presto.testing.TestingWarningCollector) String.format(java.lang.String.format) SqlParser(com.facebook.presto.sql.parser.SqlParser) List(java.util.List) ColumnMetadata(com.facebook.presto.spi.ColumnMetadata) RETURNS_NULL_ON_NULL_INPUT(com.facebook.presto.spi.function.RoutineCharacteristics.NullCallClause.RETURNS_NULL_ON_NULL_INPUT) Catalog(com.facebook.presto.metadata.Catalog) Optional(java.util.Optional) SystemConnector(com.facebook.presto.connector.system.SystemConnector) ConnectorId(com.facebook.presto.spi.ConnectorId) AllowAllAccessControl(com.facebook.presto.security.AllowAllAccessControl) ConnectorMetadata(com.facebook.presto.spi.connector.ConnectorMetadata) StandardTypes(com.facebook.presto.common.type.StandardTypes) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) VARCHAR(com.facebook.presto.common.type.VarcharType.VARCHAR) AccessControlManager(com.facebook.presto.security.AccessControlManager) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) ImmutableList(com.google.common.collect.ImmutableList) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId) ArrayType(com.facebook.presto.common.type.ArrayType) TransactionManager(com.facebook.presto.transaction.TransactionManager) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager) RoutineCharacteristics(com.facebook.presto.spi.function.RoutineCharacteristics) ConnectorTableMetadata(com.facebook.presto.spi.ConnectorTableMetadata) Connector(com.facebook.presto.spi.connector.Connector) BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) Language(org.intellij.lang.annotations.Language) Session(com.facebook.presto.Session) NodeLocation(com.facebook.presto.sql.tree.NodeLocation) Assert.fail(org.testng.Assert.fail) TestingSession.testSessionBuilder(com.facebook.presto.testing.TestingSession.testSessionBuilder) CatalogManager(com.facebook.presto.metadata.CatalogManager) Consumer(java.util.function.Consumer) SqlFunctionExecutors(com.facebook.presto.functionNamespace.execution.SqlFunctionExecutors) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) IsolationLevel(com.facebook.presto.spi.transaction.IsolationLevel) MetadataManager.createTestMetadataManager(com.facebook.presto.metadata.MetadataManager.createTestMetadataManager) FunctionVersion.notVersioned(com.facebook.presto.spi.function.FunctionVersion.notVersioned) PropertyMetadata.integerProperty(com.facebook.presto.spi.session.PropertyMetadata.integerProperty) NoopSqlFunctionExecutor(com.facebook.presto.functionNamespace.execution.NoopSqlFunctionExecutor) RowType(com.facebook.presto.common.type.RowType) 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.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ConnectorId(com.facebook.presto.spi.ConnectorId) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Aggregations

InformationSchemaConnector (com.facebook.presto.connector.informationSchema.InformationSchemaConnector)3 SystemConnector (com.facebook.presto.connector.system.SystemConnector)3 Catalog (com.facebook.presto.metadata.Catalog)3 InMemoryNodeManager (com.facebook.presto.metadata.InMemoryNodeManager)3 InternalNodeManager (com.facebook.presto.metadata.InternalNodeManager)3 AllowAllAccessControl (com.facebook.presto.security.AllowAllAccessControl)3 Session (com.facebook.presto.Session)2 CatalogManager (com.facebook.presto.metadata.CatalogManager)2 Metadata (com.facebook.presto.metadata.Metadata)2 MetadataManager (com.facebook.presto.metadata.MetadataManager)2 ViewDefinition (com.facebook.presto.metadata.ViewDefinition)2 APPLY_FUNCTION (com.facebook.presto.operator.scalar.ApplyFunction.APPLY_FUNCTION)2 AccessControl (com.facebook.presto.security.AccessControl)2 AccessControlManager (com.facebook.presto.security.AccessControlManager)2 ColumnMetadata (com.facebook.presto.spi.ColumnMetadata)2 ConnectorId (com.facebook.presto.spi.ConnectorId)2 ConnectorId.createInformationSchemaConnectorId (com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId)2 ConnectorId.createSystemTablesConnectorId (com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId)2 ConnectorTableMetadata (com.facebook.presto.spi.ConnectorTableMetadata)2 SchemaTableName (com.facebook.presto.spi.SchemaTableName)2