Search in sources :

Example 1 with Metadata

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

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

the class PlanPrinter method textDistributedPlan.

public static String textDistributedPlan(List<StageInfo> stages, Metadata metadata, Session session) {
    StringBuilder builder = new StringBuilder();
    List<StageInfo> allStages = stages.stream().flatMap(stage -> getAllStages(Optional.of(stage)).stream()).collect(toImmutableList());
    for (StageInfo stageInfo : allStages) {
        Map<PlanNodeId, PlanNodeStats> aggregatedStats = new HashMap<>();
        List<PlanNodeStats> planNodeStats = stageInfo.getTasks().stream().map(TaskInfo::getStats).flatMap(taskStats -> getPlanNodeStats(taskStats).stream()).collect(toList());
        for (PlanNodeStats stats : planNodeStats) {
            aggregatedStats.merge(stats.getPlanNodeId(), stats, PlanNodeStats::merge);
        }
        builder.append(formatFragment(metadata, session, stageInfo.getPlan(), Optional.of(stageInfo.getStageStats()), Optional.of(aggregatedStats)));
    }
    return builder.toString();
}
Also used : ComparisonExpressionType(com.facebook.presto.sql.tree.ComparisonExpressionType) Arrays(java.util.Arrays) FrameBound(com.facebook.presto.sql.tree.FrameBound) DistinctLimitNode(com.facebook.presto.sql.planner.plan.DistinctLimitNode) OperatorStats(com.facebook.presto.operator.OperatorStats) StageInfo(com.facebook.presto.execution.StageInfo) MarkDistinctNode(com.facebook.presto.sql.planner.plan.MarkDistinctNode) Map(java.util.Map) IndexJoinNode(com.facebook.presto.sql.planner.plan.IndexJoinNode) ImmutableCollectors.toImmutableList(com.facebook.presto.util.ImmutableCollectors.toImmutableList) Double.max(java.lang.Double.max) StageInfo.getAllStages(com.facebook.presto.execution.StageInfo.getAllStages) StageStats(com.facebook.presto.execution.StageStats) RowNumberNode(com.facebook.presto.sql.planner.plan.RowNumberNode) Set(java.util.Set) VARCHAR(com.facebook.presto.spi.type.VarcharType.VARCHAR) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) ExceptNode(com.facebook.presto.sql.planner.plan.ExceptNode) Domain(com.facebook.presto.spi.predicate.Domain) Stream(java.util.stream.Stream) OperatorNotFoundException(com.facebook.presto.metadata.OperatorNotFoundException) ApplyNode(com.facebook.presto.sql.planner.plan.ApplyNode) AssignUniqueId(com.facebook.presto.sql.planner.plan.AssignUniqueId) LimitNode(com.facebook.presto.sql.planner.plan.LimitNode) Lists.reverse(com.google.common.collect.Lists.reverse) Joiner(com.google.common.base.Joiner) Iterables(com.google.common.collect.Iterables) SINGLE_DISTRIBUTION(com.facebook.presto.sql.planner.SystemPartitioningHandle.SINGLE_DISTRIBUTION) Slice(io.airlift.slice.Slice) GroupIdNode(com.facebook.presto.sql.planner.plan.GroupIdNode) DomainUtils.simplifyDomain(com.facebook.presto.sql.planner.DomainUtils.simplifyDomain) DataSize.succinctBytes(io.airlift.units.DataSize.succinctBytes) ArrayList(java.util.ArrayList) TableScanNode(com.facebook.presto.sql.planner.plan.TableScanNode) Strings(com.google.common.base.Strings) Lists(com.google.common.collect.Lists) Type(com.facebook.presto.spi.type.Type) PlanNode(com.facebook.presto.sql.planner.plan.PlanNode) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId) PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) Functions(com.google.common.base.Functions) PipelineStats(com.facebook.presto.operator.PipelineStats) WindowNode(com.facebook.presto.sql.planner.plan.WindowNode) Session(com.facebook.presto.Session) Throwables(com.google.common.base.Throwables) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) Range(com.facebook.presto.spi.predicate.Range) Math.sqrt(java.lang.Math.sqrt) ColumnHandle(com.facebook.presto.spi.ColumnHandle) FunctionInvoker(com.facebook.presto.sql.FunctionInvoker) SemiJoinNode(com.facebook.presto.sql.planner.plan.SemiJoinNode) FilterNode(com.facebook.presto.sql.planner.plan.FilterNode) TaskInfo(com.facebook.presto.execution.TaskInfo) Metadata(com.facebook.presto.metadata.Metadata) TaskStats(com.facebook.presto.operator.TaskStats) ExplainAnalyzeNode(com.facebook.presto.sql.planner.plan.ExplainAnalyzeNode) RemoteSourceNode(com.facebook.presto.sql.planner.plan.RemoteSourceNode) SortNode(com.facebook.presto.sql.planner.plan.SortNode) MetadataDeleteNode(com.facebook.presto.sql.planner.plan.MetadataDeleteNode) TableWriterNode(com.facebook.presto.sql.planner.plan.TableWriterNode) ValuesNode(com.facebook.presto.sql.planner.plan.ValuesNode) Duration(io.airlift.units.Duration) GraphvizPrinter(com.facebook.presto.util.GraphvizPrinter) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Collectors.toMap(java.util.stream.Collectors.toMap) Locale(java.util.Locale) TopNRowNumberNode(com.facebook.presto.sql.planner.plan.TopNRowNumberNode) IndexSourceNode(com.facebook.presto.sql.planner.plan.IndexSourceNode) TopNNode(com.facebook.presto.sql.planner.plan.TopNNode) Assignments(com.facebook.presto.sql.planner.plan.Assignments) NullableValue(com.facebook.presto.spi.predicate.NullableValue) DataSize.succinctDataSize(io.airlift.units.DataSize.succinctDataSize) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) OutputNode(com.facebook.presto.sql.planner.plan.OutputNode) SymbolReference(com.facebook.presto.sql.tree.SymbolReference) ImmutableSet(com.google.common.collect.ImmutableSet) Scope(com.facebook.presto.sql.planner.plan.ExchangeNode.Scope) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) Iterables.getLast(com.google.common.collect.Iterables.getLast) Marker(com.facebook.presto.spi.predicate.Marker) Collectors(java.util.stream.Collectors) BinaryOperator(java.util.function.BinaryOperator) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) TupleDomain(com.facebook.presto.spi.predicate.TupleDomain) DataSize(io.airlift.units.DataSize) List(java.util.List) Window(com.facebook.presto.sql.tree.Window) SampleNode(com.facebook.presto.sql.planner.plan.SampleNode) Optional(java.util.Optional) ConnectorTableLayoutHandle(com.facebook.presto.spi.ConnectorTableLayoutHandle) HashMap(java.util.HashMap) HashSet(java.util.HashSet) WindowFrame(com.facebook.presto.sql.tree.WindowFrame) PlanVisitor(com.facebook.presto.sql.planner.plan.PlanVisitor) ImmutableList(com.google.common.collect.ImmutableList) Objects.requireNonNull(java.util.Objects.requireNonNull) Double.isFinite(java.lang.Double.isFinite) LinkedList(java.util.LinkedList) AggregationNode(com.facebook.presto.sql.planner.plan.AggregationNode) UnnestNode(com.facebook.presto.sql.planner.plan.UnnestNode) JoinNode(com.facebook.presto.sql.planner.plan.JoinNode) Collections.emptyMap(java.util.Collections.emptyMap) TableLayout(com.facebook.presto.metadata.TableLayout) CaseFormat(com.google.common.base.CaseFormat) Signature(com.facebook.presto.metadata.Signature) HashCollisionsInfo(com.facebook.presto.operator.HashCollisionsInfo) ComparisonExpression(com.facebook.presto.sql.tree.ComparisonExpression) DeleteNode(com.facebook.presto.sql.planner.plan.DeleteNode) ProjectNode(com.facebook.presto.sql.planner.plan.ProjectNode) UPPER_UNDERSCORE(com.google.common.base.CaseFormat.UPPER_UNDERSCORE) Collectors.toList(java.util.stream.Collectors.toList) UnionNode(com.facebook.presto.sql.planner.plan.UnionNode) Expression(com.facebook.presto.sql.tree.Expression) TableHandle(com.facebook.presto.metadata.TableHandle) TableFinishNode(com.facebook.presto.sql.planner.plan.TableFinishNode) BYTE(io.airlift.units.DataSize.Unit.BYTE) IntersectNode(com.facebook.presto.sql.planner.plan.IntersectNode) EnforceSingleRowNode(com.facebook.presto.sql.planner.plan.EnforceSingleRowNode) ExchangeNode(com.facebook.presto.sql.planner.plan.ExchangeNode) PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) TaskInfo(com.facebook.presto.execution.TaskInfo) HashMap(java.util.HashMap) StageInfo(com.facebook.presto.execution.StageInfo)

Example 3 with Metadata

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

the class TestQueryStateMachine method createQueryStateMachineWithTicker.

private QueryStateMachine createQueryStateMachineWithTicker(Ticker ticker) {
    Metadata metadata = MetadataManager.createTestMetadataManager();
    TransactionManager transactionManager = createTestTransactionManager();
    AccessControl accessControl = new AccessControlManager(transactionManager);
    QueryStateMachine stateMachine = QueryStateMachine.beginWithTicker(QUERY_ID, QUERY, TEST_SESSION, LOCATION, false, transactionManager, accessControl, executor, ticker, metadata);
    stateMachine.setInputs(INPUTS);
    stateMachine.setOutput(OUTPUT);
    stateMachine.setOutputFieldNames(OUTPUT_FIELD_NAMES);
    stateMachine.setUpdateType(UPDATE_TYPE);
    stateMachine.setMemoryPool(MEMORY_POOL);
    for (Entry<String, String> entry : SET_SESSION_PROPERTIES.entrySet()) {
        stateMachine.addSetSessionProperties(entry.getKey(), entry.getValue());
    }
    RESET_SESSION_PROPERTIES.forEach(stateMachine::addResetSessionProperties);
    return stateMachine;
}
Also used : AccessControlManager(com.facebook.presto.security.AccessControlManager) TransactionManager(com.facebook.presto.transaction.TransactionManager) TransactionManager.createTestTransactionManager(com.facebook.presto.transaction.TransactionManager.createTestTransactionManager) Metadata(com.facebook.presto.metadata.Metadata) AccessControl(com.facebook.presto.security.AccessControl)

Example 4 with Metadata

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

the class PrestoSparkModule method setup.

@Override
protected void setup(Binder binder) {
    // configs
    // TODO: decouple configuration properties that don't make sense on Spark
    configBinder(binder).bindConfig(NodeSchedulerConfig.class);
    configBinder(binder).bindConfig(SimpleTtlNodeSelectorConfig.class);
    configBinder(binder).bindConfig(QueryManagerConfig.class);
    configBinder(binder).bindConfigGlobalDefaults(QueryManagerConfig.class, PrestoSparkSettingsRequirements::setDefaults);
    configBinder(binder).bindConfig(FeaturesConfig.class);
    configBinder(binder).bindConfigGlobalDefaults(FeaturesConfig.class, PrestoSparkSettingsRequirements::setDefaults);
    configBinder(binder).bindConfig(MemoryManagerConfig.class);
    configBinder(binder).bindConfig(TaskManagerConfig.class);
    configBinder(binder).bindConfig(TransactionManagerConfig.class);
    configBinder(binder).bindConfig(NodeMemoryConfig.class);
    configBinder(binder).bindConfig(WarningCollectorConfig.class);
    configBinder(binder).bindConfig(NodeSpillConfig.class);
    configBinder(binder).bindConfig(CompilerConfig.class);
    configBinder(binder).bindConfig(SqlEnvironmentConfig.class);
    configBinder(binder).bindConfig(StaticFunctionNamespaceStoreConfig.class);
    configBinder(binder).bindConfig(PrestoSparkConfig.class);
    configBinder(binder).bindConfig(TracingConfig.class);
    // json codecs
    jsonCodecBinder(binder).bindJsonCodec(ViewDefinition.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkTaskDescriptor.class);
    jsonCodecBinder(binder).bindJsonCodec(PlanFragment.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskSource.class);
    jsonCodecBinder(binder).bindJsonCodec(TableCommitContext.class);
    jsonCodecBinder(binder).bindJsonCodec(ExplainAnalyzeContext.class);
    jsonCodecBinder(binder).bindJsonCodec(ExecutionFailureInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(StageInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(OperatorStats.class);
    jsonCodecBinder(binder).bindJsonCodec(QueryInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkQueryStatusInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkQueryData.class);
    jsonCodecBinder(binder).bindListJsonCodec(TaskMemoryReservationSummary.class);
    // smile codecs
    smileCodecBinder(binder).bindSmileCodec(TaskSource.class);
    smileCodecBinder(binder).bindSmileCodec(TaskInfo.class);
    PrestoSparkConfig prestoSparkConfig = buildConfigObject(PrestoSparkConfig.class);
    if (prestoSparkConfig.isSmileSerializationEnabled()) {
        binder.bind(new TypeLiteral<Codec<TaskSource>>() {
        }).to(new TypeLiteral<SmileCodec<TaskSource>>() {
        }).in(Scopes.SINGLETON);
        binder.bind(new TypeLiteral<Codec<TaskInfo>>() {
        }).to(new TypeLiteral<SmileCodec<TaskInfo>>() {
        }).in(Scopes.SINGLETON);
    } else {
        binder.bind(new TypeLiteral<Codec<TaskSource>>() {
        }).to(new TypeLiteral<JsonCodec<TaskSource>>() {
        }).in(Scopes.SINGLETON);
        binder.bind(new TypeLiteral<Codec<TaskInfo>>() {
        }).to(new TypeLiteral<JsonCodec<TaskInfo>>() {
        }).in(Scopes.SINGLETON);
    }
    // index manager
    binder.bind(IndexManager.class).in(Scopes.SINGLETON);
    // handle resolver
    binder.install(new HandleJsonModule());
    // plugin manager
    configBinder(binder).bindConfig(PluginManagerConfig.class);
    binder.bind(PluginManager.class).in(Scopes.SINGLETON);
    // catalog manager
    binder.bind(StaticCatalogStore.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(StaticCatalogStoreConfig.class);
    // catalog
    binder.bind(ConnectorManager.class).in(Scopes.SINGLETON);
    binder.bind(CatalogManager.class).in(Scopes.SINGLETON);
    // property managers
    binder.bind(SessionPropertyManager.class).toProvider(PrestoSparkSessionPropertyManagerProvider.class).in(Scopes.SINGLETON);
    binder.bind(SystemSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(SessionPropertyDefaults.class).in(Scopes.SINGLETON);
    binder.bind(SchemaPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(TablePropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(ColumnPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(AnalyzePropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(QuerySessionSupplier.class).in(Scopes.SINGLETON);
    // block encodings
    binder.bind(BlockEncodingManager.class).in(Scopes.SINGLETON);
    binder.bind(BlockEncodingSerde.class).to(BlockEncodingManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, BlockEncoding.class);
    jsonBinder(binder).addSerializerBinding(Block.class).to(BlockJsonSerde.Serializer.class);
    jsonBinder(binder).addDeserializerBinding(Block.class).to(BlockJsonSerde.Deserializer.class);
    // metadata
    binder.bind(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    binder.bind(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(Metadata.class).to(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(StaticFunctionNamespaceStore.class).in(Scopes.SINGLETON);
    // type
    newSetBinder(binder, Type.class);
    binder.bind(TypeManager.class).to(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
    // PageSorter
    binder.bind(PageSorter.class).to(PagesIndexPageSorter.class).in(Scopes.SINGLETON);
    // PageIndexer
    binder.bind(PagesIndex.Factory.class).to(PagesIndex.DefaultFactory.class);
    binder.bind(PageIndexerFactory.class).to(GroupByHashPageIndexerFactory.class).in(Scopes.SINGLETON);
    // compilers
    binder.bind(JoinFilterFunctionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinFilterFunctionCompiler.class).withGeneratedName();
    binder.bind(JoinCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinCompiler.class).withGeneratedName();
    binder.bind(OrderingCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(OrderingCompiler.class).withGeneratedName();
    binder.bind(LookupJoinOperators.class).in(Scopes.SINGLETON);
    binder.bind(DomainTranslator.class).to(RowExpressionDomainTranslator.class).in(Scopes.SINGLETON);
    binder.bind(PredicateCompiler.class).to(RowExpressionPredicateCompiler.class).in(Scopes.SINGLETON);
    binder.bind(DeterminismEvaluator.class).to(RowExpressionDeterminismEvaluator.class).in(Scopes.SINGLETON);
    binder.bind(ExpressionCompiler.class).in(Scopes.SINGLETON);
    binder.bind(PageFunctionCompiler.class).in(Scopes.SINGLETON);
    // split manager
    binder.bind(SplitManager.class).in(Scopes.SINGLETON);
    // partitioning provider manager
    binder.bind(PartitioningProviderManager.class).in(Scopes.SINGLETON);
    // executors
    ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("presto-spark-executor-%s"));
    binder.bind(Executor.class).toInstance(executor);
    binder.bind(ExecutorService.class).toInstance(executor);
    binder.bind(ScheduledExecutorService.class).toInstance(newScheduledThreadPool(0, daemonThreadsNamed("presto-spark-scheduled-executor-%s")));
    // task executor
    binder.bind(EmbedVersion.class).in(Scopes.SINGLETON);
    binder.bind(MultilevelSplitQueue.class).in(Scopes.SINGLETON);
    binder.bind(TaskExecutor.class).in(Scopes.SINGLETON);
    // data stream provider
    binder.bind(PageSourceManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSourceProvider.class).to(PageSourceManager.class).in(Scopes.SINGLETON);
    // connector distributed metadata manager
    binder.bind(ConnectorMetadataUpdaterManager.class).in(Scopes.SINGLETON);
    // page sink provider
    binder.bind(PageSinkManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSinkProvider.class).to(PageSinkManager.class).in(Scopes.SINGLETON);
    // query explainer
    binder.bind(QueryExplainer.class).in(Scopes.SINGLETON);
    // parser
    binder.bind(PlanChecker.class).in(Scopes.SINGLETON);
    binder.bind(SqlParser.class).in(Scopes.SINGLETON);
    binder.bind(SqlParserOptions.class).toInstance(sqlParserOptions);
    // planner
    binder.bind(PlanFragmenter.class).in(Scopes.SINGLETON);
    binder.bind(PlanOptimizers.class).in(Scopes.SINGLETON);
    binder.bind(ConnectorPlanOptimizerManager.class).in(Scopes.SINGLETON);
    binder.bind(LocalExecutionPlanner.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(FileFragmentResultCacheConfig.class);
    binder.bind(FragmentCacheStats.class).in(Scopes.SINGLETON);
    binder.bind(IndexJoinLookupStats.class).in(Scopes.SINGLETON);
    binder.bind(QueryIdGenerator.class).in(Scopes.SINGLETON);
    binder.bind(QueryPreparer.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addKeySerializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionSerializer.class);
    jsonBinder(binder).addKeyDeserializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionDeserializer.class);
    // statistics calculator / cost calculator
    binder.install(new StatsCalculatorModule());
    binder.bind(CostCalculator.class).to(CostCalculatorUsingExchanges.class).in(Scopes.SINGLETON);
    binder.bind(CostCalculator.class).annotatedWith(CostCalculator.EstimatedExchanges.class).to(CostCalculatorWithEstimatedExchanges.class).in(Scopes.SINGLETON);
    binder.bind(CostComparator.class).in(Scopes.SINGLETON);
    // JMX (Do not export to the real MXBean server, as the Presto context may be created multiple times per JVM)
    binder.bind(MBeanServer.class).toInstance(new TestingMBeanServer());
    binder.bind(MBeanExporter.class).in(Scopes.SINGLETON);
    // spill
    binder.bind(SpillerFactory.class).to(GenericSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(SingleStreamSpillerFactory.class).to(TempStorageSingleStreamSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(PartitioningSpillerFactory.class).to(GenericPartitioningSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(SpillerStats.class).in(Scopes.SINGLETON);
    binder.bind(StandaloneSpillerFactory.class).to(TempStorageStandaloneSpillerFactory.class).in(Scopes.SINGLETON);
    // monitoring
    jsonCodecBinder(binder).bindJsonCodec(OperatorInfo.class);
    binder.bind(QueryMonitor.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(QueryMonitorConfig.class);
    binder.bind(SplitMonitor.class).in(Scopes.SINGLETON);
    // Determine the NodeVersion
    ServerConfig serverConfig = buildConfigObject(ServerConfig.class);
    NodeVersion nodeVersion = new NodeVersion(serverConfig.getPrestoVersion());
    binder.bind(NodeVersion.class).toInstance(nodeVersion);
    // Support DDL statements. Helper class binds DDL statements to DataDefinitionTasks
    PrestoDataDefBindingHelper.bindDDLDefinitionTasks(binder);
    // TODO: Decouple node specific system tables
    binder.bind(QueryManager.class).to(PrestoSparkQueryManager.class).in(Scopes.SINGLETON);
    binder.bind(TaskManager.class).to(PrestoSparkTaskManager.class).in(Scopes.SINGLETON);
    binder.install(new SystemConnectorModule());
    // TODO: support explain analyze for Spark
    binder.bind(new TypeLiteral<Optional<ExplainAnalyzeContext>>() {
    }).toInstance(Optional.of(new ExplainAnalyzeContext((queryId) -> {
        throw new UnsupportedOperationException("explain analyze is not supported");
    })));
    // TODO: support CBO, supply real nodes count
    binder.bind(TaskCountEstimator.class).toInstance(new TaskCountEstimator(() -> 1000));
    // TODO: Decouple and remove: required by ConnectorManager
    binder.bind(InternalNodeManager.class).toInstance(new PrestoSparkInternalNodeManager());
    // TODO: Decouple and remove: required by PluginManager
    binder.bind(InternalResourceGroupManager.class).in(Scopes.SINGLETON);
    binder.bind(ResourceGroupManager.class).to(InternalResourceGroupManager.class);
    binder.bind(new TypeLiteral<ResourceGroupManager<?>>() {
    }).to(new TypeLiteral<InternalResourceGroupManager<?>>() {
    });
    binder.bind(LegacyResourceGroupConfigurationManager.class).in(Scopes.SINGLETON);
    binder.bind(ClusterMemoryPoolManager.class).toInstance(((poolId, listener) -> {
    }));
    binder.bind(QueryPrerequisitesManager.class).in(Scopes.SINGLETON);
    binder.bind(ResourceGroupService.class).to(NoopResourceGroupService.class).in(Scopes.SINGLETON);
    binder.bind(NodeTtlFetcherManager.class).to(ThrowingNodeTtlFetcherManager.class).in(Scopes.SINGLETON);
    binder.bind(ClusterTtlProviderManager.class).to(ThrowingClusterTtlProviderManager.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by SessionPropertyDefaults, PluginManager, InternalResourceGroupManager, ConnectorManager
    configBinder(binder).bindConfig(NodeConfig.class);
    binder.bind(NodeInfo.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by LocalExecutionPlanner, PlanFragmenter
    binder.bind(NodePartitioningManager.class).to(PrestoSparkNodePartitioningManager.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by PluginManager
    install(new ServerSecurityModule());
    // spark specific
    binder.bind(SparkProcessType.class).toInstance(sparkProcessType);
    binder.bind(PrestoSparkExecutionExceptionFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkSettingsRequirements.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkQueryPlanner.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkPlanFragmenter.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkRddFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkTaskExecutorFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkQueryExecutionFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkService.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkBroadcastTableCacheManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, PrestoSparkServiceWaitTimeMetrics.class);
    // extra credentials and authenticator for Presto-on-Spark
    newSetBinder(binder, PrestoSparkCredentialsProvider.class);
    newSetBinder(binder, PrestoSparkAuthenticatorProvider.class);
}
Also used : RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) PrestoSparkBroadcastTableCacheManager(com.facebook.presto.spark.execution.PrestoSparkBroadcastTableCacheManager) PageSourceProvider(com.facebook.presto.split.PageSourceProvider) PluginManagerConfig(com.facebook.presto.server.PluginManagerConfig) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) OperatorStats(com.facebook.presto.operator.OperatorStats) StageInfo(com.facebook.presto.execution.StageInfo) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) ThrowingNodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.ThrowingNodeTtlFetcherManager) NoOpFragmentResultCacheManager(com.facebook.presto.operator.NoOpFragmentResultCacheManager) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) FragmentResultCacheManager(com.facebook.presto.operator.FragmentResultCacheManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) TaskCountEstimator(com.facebook.presto.cost.TaskCountEstimator) ServerConfig(com.facebook.presto.server.ServerConfig) ClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ClusterTtlProviderManager) SessionPropertyDefaults(com.facebook.presto.server.SessionPropertyDefaults) EmbedVersion(com.facebook.presto.version.EmbedVersion) PageSinkManager(com.facebook.presto.split.PageSinkManager) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) DomainTranslator(com.facebook.presto.spi.relation.DomainTranslator) QueryIdGenerator(com.facebook.presto.execution.QueryIdGenerator) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) QueryInfo(com.facebook.presto.execution.QueryInfo) QueryPreparer(com.facebook.presto.execution.QueryPreparer) QuerySessionSupplier(com.facebook.presto.server.QuerySessionSupplier) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) TaskMemoryReservationSummary(com.facebook.presto.operator.TaskMemoryReservationSummary) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) TypeLiteral(com.google.inject.TypeLiteral) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) NodeInfo(com.facebook.airlift.node.NodeInfo) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) VariableReferenceExpressionDeserializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionDeserializer) ResourceGroupService(com.facebook.presto.resourcemanager.ResourceGroupService) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) Binder(com.google.inject.Binder) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) StaticFunctionNamespaceStoreConfig(com.facebook.presto.metadata.StaticFunctionNamespaceStoreConfig) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) PageSorter(com.facebook.presto.spi.PageSorter) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) TransactionManager(com.facebook.presto.transaction.TransactionManager) ResourceGroupManager(com.facebook.presto.execution.resourceGroups.ResourceGroupManager) LegacyResourceGroupConfigurationManager(com.facebook.presto.execution.resourceGroups.LegacyResourceGroupConfigurationManager) TableCommitContext(com.facebook.presto.operator.TableCommitContext) ClusterMemoryPoolManager(com.facebook.presto.spi.memory.ClusterMemoryPoolManager) PrestoSparkTaskManager(com.facebook.presto.spark.node.PrestoSparkTaskManager) Executor(java.util.concurrent.Executor) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) ServerSecurityModule(com.facebook.presto.server.security.ServerSecurityModule) PrestoSparkNodePartitioningManager(com.facebook.presto.spark.node.PrestoSparkNodePartitioningManager) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) SqlEnvironmentConfig(com.facebook.presto.sql.SqlEnvironmentConfig) PrestoSparkQueryPlanner(com.facebook.presto.spark.planner.PrestoSparkQueryPlanner) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) StaticCatalogStoreConfig(com.facebook.presto.metadata.StaticCatalogStoreConfig) TracingConfig(com.facebook.presto.tracing.TracingConfig) QueryMonitor(com.facebook.presto.event.QueryMonitor) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) InMemoryTransactionManager(com.facebook.presto.transaction.InMemoryTransactionManager) ThrowingClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ThrowingClusterTtlProviderManager) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) TaskInfo(com.facebook.presto.execution.TaskInfo) Metadata(com.facebook.presto.metadata.Metadata) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) JsonCodec(com.facebook.airlift.json.JsonCodec) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) CostCalculatorWithEstimatedExchanges(com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges) MetadataManager(com.facebook.presto.metadata.MetadataManager) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) BlockEncoding(com.facebook.presto.common.block.BlockEncoding) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) NodeVersion(com.facebook.presto.client.NodeVersion) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) PagesIndex(com.facebook.presto.operator.PagesIndex) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) AbstractConfigurationAwareModule(com.facebook.airlift.configuration.AbstractConfigurationAwareModule) ConnectorManager(com.facebook.presto.connector.ConnectorManager) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) ExportBinder.newExporter(org.weakref.jmx.guice.ExportBinder.newExporter) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) OperatorInfo(com.facebook.presto.operator.OperatorInfo) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) FileFragmentResultCacheManager(com.facebook.presto.operator.FileFragmentResultCacheManager) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) CostCalculatorUsingExchanges(com.facebook.presto.cost.CostCalculatorUsingExchanges) CostCalculator(com.facebook.presto.cost.CostCalculator) JsonBinder.jsonBinder(com.facebook.airlift.json.JsonBinder.jsonBinder) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) SplitManager(com.facebook.presto.split.SplitManager) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) Codec(com.facebook.airlift.json.Codec) NodeConfig(com.facebook.airlift.node.NodeConfig) SqlParser(com.facebook.presto.sql.parser.SqlParser) PrestoSparkQueryManager(com.facebook.presto.spark.node.PrestoSparkQueryManager) Threads.daemonThreadsNamed(com.facebook.airlift.concurrent.Threads.daemonThreadsNamed) TransactionManagerConfig(com.facebook.presto.transaction.TransactionManagerConfig) NodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.NodeTtlFetcherManager) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) Optional(java.util.Optional) PredicateCompiler(com.facebook.presto.spi.relation.PredicateCompiler) PluginManager(com.facebook.presto.server.PluginManager) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) DeterminismEvaluator(com.facebook.presto.spi.relation.DeterminismEvaluator) VariableReferenceExpressionSerializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionSerializer) SpillerStats(com.facebook.presto.spiller.SpillerStats) QueryPrerequisitesManager(com.facebook.presto.dispatcher.QueryPrerequisitesManager) PrestoDataDefBindingHelper(com.facebook.presto.util.PrestoDataDefBindingHelper) SimpleTtlNodeSelectorConfig(com.facebook.presto.execution.scheduler.nodeSelection.SimpleTtlNodeSelectorConfig) PageSinkProvider(com.facebook.presto.split.PageSinkProvider) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) ExecutionFailureInfo(com.facebook.presto.execution.ExecutionFailureInfo) QueryManager(com.facebook.presto.execution.QueryManager) Singleton(javax.inject.Singleton) JsonCodecBinder.jsonCodecBinder(com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) BlockEncodingSerde(com.facebook.presto.common.block.BlockEncodingSerde) StatsCalculatorModule(com.facebook.presto.cost.StatsCalculatorModule) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) PageSourceManager(com.facebook.presto.split.PageSourceManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) SmileCodec(com.facebook.airlift.json.smile.SmileCodec) TypeManager(com.facebook.presto.common.type.TypeManager) TaskManager(com.facebook.presto.execution.TaskManager) FileFragmentResultCacheConfig(com.facebook.presto.operator.FileFragmentResultCacheConfig) MBeanServer(javax.management.MBeanServer) Objects.requireNonNull(java.util.Objects.requireNonNull) ExplainAnalyzeContext(com.facebook.presto.execution.ExplainAnalyzeContext) IndexManager(com.facebook.presto.index.IndexManager) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) PlanFragmenter(com.facebook.presto.sql.planner.PlanFragmenter) Type(com.facebook.presto.common.type.Type) ExecutorService(java.util.concurrent.ExecutorService) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) SplitMonitor(com.facebook.presto.event.SplitMonitor) TaskSource(com.facebook.presto.execution.TaskSource) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) Scopes(com.google.inject.Scopes) Executors.newFixedThreadPool(java.util.concurrent.Executors.newFixedThreadPool) CatalogManager(com.facebook.presto.metadata.CatalogManager) CompilerConfig(com.facebook.presto.sql.planner.CompilerConfig) SmileCodecBinder.smileCodecBinder(com.facebook.airlift.json.smile.SmileCodecBinder.smileCodecBinder) TypeDeserializer(com.facebook.presto.type.TypeDeserializer) Provides(com.google.inject.Provides) QueryMonitorConfig(com.facebook.presto.event.QueryMonitorConfig) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) CostComparator(com.facebook.presto.cost.CostComparator) ConfigBinder.configBinder(com.facebook.airlift.configuration.ConfigBinder.configBinder) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) Block(com.facebook.presto.common.block.Block) MBeanExporter(org.weakref.jmx.MBeanExporter) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) PrestoSparkQueryManager(com.facebook.presto.spark.node.PrestoSparkQueryManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) PluginManager(com.facebook.presto.server.PluginManager) NodeVersion(com.facebook.presto.client.NodeVersion) JsonCodec(com.facebook.airlift.json.JsonCodec) Codec(com.facebook.airlift.json.Codec) SmileCodec(com.facebook.airlift.json.smile.SmileCodec) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) QueryMonitor(com.facebook.presto.event.QueryMonitor) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) MBeanServer(javax.management.MBeanServer) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) SessionPropertyDefaults(com.facebook.presto.server.SessionPropertyDefaults) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) NodeInfo(com.facebook.airlift.node.NodeInfo) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) CostCalculatorWithEstimatedExchanges(com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges) ClusterMemoryPoolManager(com.facebook.presto.spi.memory.ClusterMemoryPoolManager) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) PlanFragmenter(com.facebook.presto.sql.planner.PlanFragmenter) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PagesIndex(com.facebook.presto.operator.PagesIndex) PrestoSparkBroadcastTableCacheManager(com.facebook.presto.spark.execution.PrestoSparkBroadcastTableCacheManager) Executor(java.util.concurrent.Executor) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) TypeLiteral(com.google.inject.TypeLiteral) ServerSecurityModule(com.facebook.presto.server.security.ServerSecurityModule) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) CostCalculatorUsingExchanges(com.facebook.presto.cost.CostCalculatorUsingExchanges) EmbedVersion(com.facebook.presto.version.EmbedVersion) ExplainAnalyzeContext(com.facebook.presto.execution.ExplainAnalyzeContext) PrestoSparkQueryPlanner(com.facebook.presto.spark.planner.PrestoSparkQueryPlanner) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) PageSinkManager(com.facebook.presto.split.PageSinkManager) StatsCalculatorModule(com.facebook.presto.cost.StatsCalculatorModule) CostComparator(com.facebook.presto.cost.CostComparator) TaskCountEstimator(com.facebook.presto.cost.TaskCountEstimator) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) ConnectorManager(com.facebook.presto.connector.ConnectorManager) CatalogManager(com.facebook.presto.metadata.CatalogManager) Type(com.facebook.presto.common.type.Type) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) TaskSource(com.facebook.presto.execution.TaskSource) PrestoSparkTaskManager(com.facebook.presto.spark.node.PrestoSparkTaskManager) QueryIdGenerator(com.facebook.presto.execution.QueryIdGenerator) PageSourceManager(com.facebook.presto.split.PageSourceManager) TaskInfo(com.facebook.presto.execution.TaskInfo) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) QueryPreparer(com.facebook.presto.execution.QueryPreparer) ServerConfig(com.facebook.presto.server.ServerConfig) PrestoSparkNodePartitioningManager(com.facebook.presto.spark.node.PrestoSparkNodePartitioningManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) LegacyResourceGroupConfigurationManager(com.facebook.presto.execution.resourceGroups.LegacyResourceGroupConfigurationManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) QueryPrerequisitesManager(com.facebook.presto.dispatcher.QueryPrerequisitesManager) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) SplitMonitor(com.facebook.presto.event.SplitMonitor) MBeanExporter(org.weakref.jmx.MBeanExporter) SqlParser(com.facebook.presto.sql.parser.SqlParser) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) ResourceGroupManager(com.facebook.presto.execution.resourceGroups.ResourceGroupManager) ThrowingNodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.ThrowingNodeTtlFetcherManager) SpillerStats(com.facebook.presto.spiller.SpillerStats) IndexManager(com.facebook.presto.index.IndexManager) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Block(com.facebook.presto.common.block.Block) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) ThrowingClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ThrowingClusterTtlProviderManager) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) SplitManager(com.facebook.presto.split.SplitManager) CostCalculator(com.facebook.presto.cost.CostCalculator) QuerySessionSupplier(com.facebook.presto.server.QuerySessionSupplier) MetadataManager(com.facebook.presto.metadata.MetadataManager) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorService(java.util.concurrent.ExecutorService) SystemSessionProperties(com.facebook.presto.SystemSessionProperties)

Example 5 with Metadata

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

the class CursorProcessorCompiler method generateMethods.

@Override
public void generateMethods(SqlFunctionProperties sqlFunctionProperties, ClassDefinition classDefinition, CallSiteBinder callSiteBinder, RowExpression filter, List<RowExpression> projections) {
    CachedInstanceBinder cachedInstanceBinder = new CachedInstanceBinder(classDefinition, callSiteBinder);
    List<RowExpression> rowExpressions = ImmutableList.<RowExpression>builder().addAll(projections).add(filter).build();
    Map<LambdaDefinitionExpression, CompiledLambda> compiledLambdaMap = generateMethodsForLambda(classDefinition, callSiteBinder, cachedInstanceBinder, rowExpressions, metadata, sqlFunctionProperties, sessionFunctions, "");
    Map<VariableReferenceExpression, CommonSubExpressionFields> cseFields = ImmutableMap.of();
    RowExpressionCompiler compiler = new RowExpressionCompiler(classDefinition, callSiteBinder, cachedInstanceBinder, fieldReferenceCompiler(cseFields), metadata, sqlFunctionProperties, sessionFunctions, compiledLambdaMap);
    if (isOptimizeCommonSubExpressions) {
        Map<Integer, Map<RowExpression, VariableReferenceExpression>> commonSubExpressionsByLevel = collectCSEByLevel(rowExpressions);
        if (!commonSubExpressionsByLevel.isEmpty()) {
            cseFields = declareCommonSubExpressionFields(classDefinition, commonSubExpressionsByLevel);
            compiler = new RowExpressionCompiler(classDefinition, callSiteBinder, cachedInstanceBinder, fieldReferenceCompiler(cseFields), metadata, sqlFunctionProperties, sessionFunctions, compiledLambdaMap);
            generateCommonSubExpressionMethods(classDefinition, compiler, commonSubExpressionsByLevel, cseFields);
            Map<RowExpression, VariableReferenceExpression> commonSubExpressions = commonSubExpressionsByLevel.values().stream().flatMap(m -> m.entrySet().stream()).collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue));
            projections = rewriteRowExpressionsWithCSE(projections, commonSubExpressions);
            filter = rewriteRowExpressionsWithCSE(ImmutableList.of(filter), commonSubExpressions).get(0);
        }
    }
    generateProcessMethod(classDefinition, projections.size(), cseFields);
    generateFilterMethod(classDefinition, compiler, filter);
    for (int i = 0; i < projections.size(); i++) {
        String methodName = "project_" + i;
        generateProjectMethod(classDefinition, compiler, methodName, projections.get(i));
    }
    MethodDefinition constructorDefinition = classDefinition.declareConstructor(a(PUBLIC));
    BytecodeBlock constructorBody = constructorDefinition.getBody();
    Variable thisVariable = constructorDefinition.getThis();
    constructorBody.comment("super();").append(thisVariable).invokeConstructor(Object.class);
    initializeCommonSubExpressionFields(cseFields.values(), thisVariable, constructorBody);
    cachedInstanceBinder.generateInitializations(thisVariable, constructorBody);
    constructorBody.ret();
}
Also used : CursorProcessorOutput(com.facebook.presto.operator.project.CursorProcessorOutput) RowExpressionVisitor(com.facebook.presto.spi.relation.RowExpressionVisitor) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) SqlInvokedFunction(com.facebook.presto.spi.function.SqlInvokedFunction) MethodDefinition(com.facebook.presto.bytecode.MethodDefinition) PageBuilder(com.facebook.presto.common.PageBuilder) Access.a(com.facebook.presto.bytecode.Access.a) JumpInstruction.jump(com.facebook.presto.bytecode.instruction.JumpInstruction.jump) CallSiteBinder(com.facebook.presto.bytecode.CallSiteBinder) ParameterizedType.type(com.facebook.presto.bytecode.ParameterizedType.type) BytecodeUtils.boxPrimitiveIfNecessary(com.facebook.presto.sql.gen.BytecodeUtils.boxPrimitiveIfNecessary) CommonSubExpressionRewriter.collectCSEByLevel(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.collectCSEByLevel) Map(java.util.Map) CallExpression(com.facebook.presto.spi.relation.CallExpression) SpecialFormExpression(com.facebook.presto.spi.relation.SpecialFormExpression) IfStatement(com.facebook.presto.bytecode.control.IfStatement) Variable(com.facebook.presto.bytecode.Variable) CommonSubExpressionRewriter.rewriteExpressionWithCSE(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.rewriteExpressionWithCSE) BlockBuilder(com.facebook.presto.common.block.BlockBuilder) Parameter(com.facebook.presto.bytecode.Parameter) ImmutableMap(com.google.common.collect.ImmutableMap) SqlFunctionProperties(com.facebook.presto.common.function.SqlFunctionProperties) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) LambdaDefinitionExpression(com.facebook.presto.spi.relation.LambdaDefinitionExpression) BytecodeExpressions.constantBoolean(com.facebook.presto.bytecode.expression.BytecodeExpressions.constantBoolean) String.format(java.lang.String.format) CompiledLambda(com.facebook.presto.sql.gen.LambdaBytecodeGenerator.CompiledLambda) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) RecordCursor(com.facebook.presto.spi.RecordCursor) List(java.util.List) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) Scope(com.facebook.presto.bytecode.Scope) Optional(java.util.Optional) InputReferenceExpression(com.facebook.presto.spi.relation.InputReferenceExpression) LabelNode(com.facebook.presto.bytecode.instruction.LabelNode) Parameter.arg(com.facebook.presto.bytecode.Parameter.arg) Logger(com.facebook.airlift.log.Logger) Slice(io.airlift.slice.Slice) DriverYieldSignal(com.facebook.presto.operator.DriverYieldSignal) PRIVATE(com.facebook.presto.bytecode.Access.PRIVATE) HashMap(java.util.HashMap) ConstantExpression(com.facebook.presto.spi.relation.ConstantExpression) BytecodeExpressions.constantFalse(com.facebook.presto.bytecode.expression.BytecodeExpressions.constantFalse) CommonSubExpressionFields.initializeCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.initializeCommonSubExpressionFields) WhileLoop(com.facebook.presto.bytecode.control.WhileLoop) ImmutableList(com.google.common.collect.ImmutableList) BytecodeExpressions.or(com.facebook.presto.bytecode.expression.BytecodeExpressions.or) LambdaBytecodeGenerator.generateMethodsForLambda(com.facebook.presto.sql.gen.LambdaBytecodeGenerator.generateMethodsForLambda) BytecodeExpressions.constantTrue(com.facebook.presto.bytecode.expression.BytecodeExpressions.constantTrue) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) CommonSubExpressionFields.declareCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.declareCommonSubExpressionFields) Type(com.facebook.presto.common.type.Type) RowExpression(com.facebook.presto.spi.relation.RowExpression) PUBLIC(com.facebook.presto.bytecode.Access.PUBLIC) BytecodeExpressions.newInstance(com.facebook.presto.bytecode.expression.BytecodeExpressions.newInstance) Primitives(com.google.common.primitives.Primitives) BytecodeNode(com.facebook.presto.bytecode.BytecodeNode) SqlFunctionId(com.facebook.presto.spi.function.SqlFunctionId) CommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields) BytecodeUtils.unboxPrimitiveIfNecessary(com.facebook.presto.sql.gen.BytecodeUtils.unboxPrimitiveIfNecessary) Metadata(com.facebook.presto.metadata.Metadata) Variable(com.facebook.presto.bytecode.Variable) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) RowExpression(com.facebook.presto.spi.relation.RowExpression) CompiledLambda(com.facebook.presto.sql.gen.LambdaBytecodeGenerator.CompiledLambda) CommonSubExpressionFields.initializeCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.initializeCommonSubExpressionFields) CommonSubExpressionFields.declareCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.declareCommonSubExpressionFields) CommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) MethodDefinition(com.facebook.presto.bytecode.MethodDefinition) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) HashMap(java.util.HashMap) LambdaDefinitionExpression(com.facebook.presto.spi.relation.LambdaDefinitionExpression)

Aggregations

Metadata (com.facebook.presto.metadata.Metadata)59 Optional (java.util.Optional)38 Session (com.facebook.presto.Session)35 List (java.util.List)35 Objects.requireNonNull (java.util.Objects.requireNonNull)29 Map (java.util.Map)26 ImmutableList (com.google.common.collect.ImmutableList)24 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)24 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)21 RowExpression (com.facebook.presto.spi.relation.RowExpression)19 QualifiedObjectName (com.facebook.presto.common.QualifiedObjectName)18 Expression (com.facebook.presto.sql.tree.Expression)18 PlanNode (com.facebook.presto.spi.plan.PlanNode)17 SqlParser (com.facebook.presto.sql.parser.SqlParser)16 ImmutableMap (com.google.common.collect.ImmutableMap)16 Preconditions.checkState (com.google.common.base.Preconditions.checkState)15 Type (com.facebook.presto.common.type.Type)14 TableHandle (com.facebook.presto.spi.TableHandle)14 WarningCollector (com.facebook.presto.spi.WarningCollector)14 Set (java.util.Set)14