Search in sources :

Example 1 with Captures

use of io.prestosql.matching.Captures in project hetu-core by openlookeng.

the class InlineProjections method apply.

@Override
public Result apply(ProjectNode parent, Captures captures, Context context) {
    ProjectNode child = captures.get(CHILD);
    Sets.SetView<Symbol> targets = extractInliningTargets(parent, child);
    if (targets.isEmpty()) {
        return Result.empty();
    }
    // inline the expressions
    Assignments assignments = child.getAssignments().filter(targets::contains);
    Map<Symbol, RowExpression> parentAssignments = parent.getAssignments().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> (inlineReferences(entry.getValue(), assignments))));
    // Synthesize identity assignments for the inputs of expressions that were inlined
    // to place in the child projection.
    // If all assignments end up becoming identity assignments, they'll get pruned by
    // other rules
    Set<Symbol> inputs = child.getAssignments().entrySet().stream().filter(entry -> targets.contains(entry.getKey())).map(Map.Entry::getValue).flatMap(entry -> extractInputs(entry).stream()).collect(toSet());
    Assignments.Builder childAssignments = Assignments.builder();
    for (Map.Entry<Symbol, RowExpression> assignment : child.getAssignments().entrySet()) {
        if (!targets.contains(assignment.getKey())) {
            childAssignments.put(assignment);
        }
    }
    boolean allTranslated = child.getAssignments().entrySet().stream().map(Map.Entry::getValue).noneMatch(OriginalExpressionUtils::isExpression);
    for (Symbol input : inputs) {
        if (allTranslated) {
            Type inputType = context.getSymbolAllocator().getSymbols().get(input);
            childAssignments.put(input, new VariableReferenceExpression(input.getName(), inputType));
        } else {
            childAssignments.put(input, castToRowExpression(toSymbolReference(input)));
        }
    }
    return Result.ofPlanNode(new ProjectNode(parent.getId(), new ProjectNode(child.getId(), child.getSource(), childAssignments.build()), Assignments.copyOf(parentAssignments)));
}
Also used : Patterns.source(io.prestosql.sql.planner.plan.Patterns.source) ConstantExpression(io.prestosql.spi.relation.ConstantExpression) ExpressionSymbolInliner.inlineSymbols(io.prestosql.sql.planner.ExpressionSymbolInliner.inlineSymbols) Literal(io.prestosql.sql.tree.Literal) TryFunction(io.prestosql.operator.scalar.TryFunction) Pattern(io.prestosql.matching.Pattern) RowExpressionVariableInliner(io.prestosql.sql.planner.RowExpressionVariableInliner) Function(java.util.function.Function) OriginalExpressionUtils.isExpression(io.prestosql.sql.relational.OriginalExpressionUtils.isExpression) CallExpression(io.prestosql.spi.relation.CallExpression) Capture.newCapture(io.prestosql.matching.Capture.newCapture) Map(java.util.Map) OriginalExpressionUtils.castToRowExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression) Type(io.prestosql.spi.type.Type) OriginalExpressionUtils.castToExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToExpression) Patterns.project(io.prestosql.sql.planner.plan.Patterns.project) Collectors.toSet(java.util.stream.Collectors.toSet) Symbol(io.prestosql.spi.plan.Symbol) ImmutableSet(com.google.common.collect.ImmutableSet) SymbolsExtractor(io.prestosql.sql.planner.SymbolsExtractor) Assignments(io.prestosql.spi.plan.Assignments) Rule(io.prestosql.sql.planner.iterative.Rule) DefaultRowExpressionTraversalVisitor(io.prestosql.expressions.DefaultRowExpressionTraversalVisitor) Set(java.util.Set) VariableReferenceExpression(io.prestosql.spi.relation.VariableReferenceExpression) ProjectNode(io.prestosql.spi.plan.ProjectNode) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Metadata(io.prestosql.metadata.Metadata) Captures(io.prestosql.matching.Captures) SymbolUtils.toSymbolReference(io.prestosql.sql.planner.SymbolUtils.toSymbolReference) AstUtils(io.prestosql.sql.util.AstUtils) List(java.util.List) FunctionResolution(io.prestosql.sql.relational.FunctionResolution) Capture(io.prestosql.matching.Capture) RowExpression(io.prestosql.spi.relation.RowExpression) TryExpression(io.prestosql.sql.tree.TryExpression) AssignmentUtils.isIdentity(io.prestosql.sql.planner.plan.AssignmentUtils.isIdentity) Expression(io.prestosql.sql.tree.Expression) OriginalExpressionUtils(io.prestosql.sql.relational.OriginalExpressionUtils) Symbol(io.prestosql.spi.plan.Symbol) Assignments(io.prestosql.spi.plan.Assignments) OriginalExpressionUtils.castToRowExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression) RowExpression(io.prestosql.spi.relation.RowExpression) Type(io.prestosql.spi.type.Type) Sets(com.google.common.collect.Sets) VariableReferenceExpression(io.prestosql.spi.relation.VariableReferenceExpression) ProjectNode(io.prestosql.spi.plan.ProjectNode) OriginalExpressionUtils(io.prestosql.sql.relational.OriginalExpressionUtils) Map(java.util.Map)

Example 2 with Captures

use of io.prestosql.matching.Captures in project hetu-core by openlookeng.

the class PushProjectionIntoTableScan method apply.

@Override
public Result apply(ProjectNode project, Captures captures, Context context) {
    TableScanNode tableScan = captures.get(TABLE_SCAN);
    List<ConnectorExpression> projections;
    try {
        projections = project.getAssignments().getExpressions().stream().map(expression -> ConnectorExpressionTranslator.translate(expression)).collect(toImmutableList());
    } catch (UnsupportedOperationException e) {
        // rewritten in terms of the new assignments for the columns passed in #2
        return Result.empty();
    }
    Map<String, ColumnHandle> assignments = tableScan.getAssignments().entrySet().stream().collect(toImmutableMap(entry -> entry.getKey().getName(), Map.Entry::getValue));
    Optional<ProjectionApplicationResult<TableHandle>> result = metadata.applyProjection(context.getSession(), tableScan.getTable(), projections, assignments);
    if (!result.isPresent()) {
        return Result.empty();
    }
    List<Symbol> newScanOutputs = new ArrayList<>();
    Map<Symbol, ColumnHandle> newScanAssignments = new HashMap<>();
    Map<String, Symbol> variableMappings = new HashMap<>();
    for (ProjectionApplicationResult.Assignment assignment : result.get().getAssignments()) {
        Symbol symbol = context.getSymbolAllocator().newSymbol(assignment.getVariable(), assignment.getType());
        newScanOutputs.add(symbol);
        newScanAssignments.put(symbol, assignment.getColumn());
        variableMappings.put(assignment.getVariable(), symbol);
    }
    // TODO: ensure newProjections.size == original projections.size
    List<RowExpression> newProjections = result.get().getProjections().stream().map(expression -> ConnectorExpressionTranslator.translate(expression, variableMappings, new LiteralEncoder(metadata))).collect(toImmutableList());
    Assignments.Builder newProjectionAssignments = Assignments.builder();
    for (int i = 0; i < project.getOutputSymbols().size(); i++) {
        newProjectionAssignments.put(project.getOutputSymbols().get(i), newProjections.get(i));
    }
    return Result.ofPlanNode(new ProjectNode(context.getIdAllocator().getNextId(), TableScanNode.newInstance(tableScan.getId(), result.get().getHandle(), newScanOutputs, newScanAssignments, tableScan.getStrategy(), tableScan.getReuseTableScanMappingId(), tableScan.getConsumerTableScanNodeCount(), tableScan.isForDelete()), newProjectionAssignments.build()));
}
Also used : Patterns.source(io.prestosql.sql.planner.plan.Patterns.source) ProjectionApplicationResult(io.prestosql.spi.connector.ProjectionApplicationResult) HashMap(java.util.HashMap) Pattern(io.prestosql.matching.Pattern) TableHandle(io.prestosql.spi.metadata.TableHandle) ArrayList(java.util.ArrayList) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) ConnectorExpressionTranslator(io.prestosql.spi.expression.ConnectorExpressionTranslator) Capture.newCapture(io.prestosql.matching.Capture.newCapture) Map(java.util.Map) Patterns.project(io.prestosql.sql.planner.plan.Patterns.project) Symbol(io.prestosql.spi.plan.Symbol) Assignments(io.prestosql.spi.plan.Assignments) Rule(io.prestosql.sql.planner.iterative.Rule) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) TableScanNode(io.prestosql.spi.plan.TableScanNode) ProjectNode(io.prestosql.spi.plan.ProjectNode) Metadata(io.prestosql.metadata.Metadata) Captures(io.prestosql.matching.Captures) List(java.util.List) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) Capture(io.prestosql.matching.Capture) RowExpression(io.prestosql.spi.relation.RowExpression) LiteralEncoder(io.prestosql.sql.planner.LiteralEncoder) Optional(java.util.Optional) Patterns.tableScan(io.prestosql.sql.planner.plan.Patterns.tableScan) ConnectorExpression(io.prestosql.spi.expression.ConnectorExpression) HashMap(java.util.HashMap) ConnectorExpression(io.prestosql.spi.expression.ConnectorExpression) Symbol(io.prestosql.spi.plan.Symbol) ArrayList(java.util.ArrayList) Assignments(io.prestosql.spi.plan.Assignments) LiteralEncoder(io.prestosql.sql.planner.LiteralEncoder) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) RowExpression(io.prestosql.spi.relation.RowExpression) ProjectionApplicationResult(io.prestosql.spi.connector.ProjectionApplicationResult) TableScanNode(io.prestosql.spi.plan.TableScanNode) ProjectNode(io.prestosql.spi.plan.ProjectNode) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap)

Example 3 with Captures

use of io.prestosql.matching.Captures in project hetu-core by openlookeng.

the class PushProjectionThroughExchange method apply.

@Override
public Result apply(ProjectNode project, Captures captures, Context context) {
    ExchangeNode exchange = captures.get(CHILD);
    Set<Symbol> partitioningColumns = exchange.getPartitioningScheme().getPartitioning().getColumns();
    ImmutableList.Builder<PlanNode> newSourceBuilder = ImmutableList.builder();
    ImmutableList.Builder<List<Symbol>> inputsBuilder = ImmutableList.builder();
    for (int i = 0; i < exchange.getSources().size(); i++) {
        Map<Symbol, VariableReferenceExpression> outputToInputMap = extractExchangeOutputToInput(exchange, i, context.getSymbolAllocator().getTypes());
        Assignments.Builder projections = Assignments.builder();
        ImmutableList.Builder<Symbol> inputs = ImmutableList.builder();
        // Need to retain the partition keys for the exchange
        partitioningColumns.stream().map(outputToInputMap::get).forEach(nameReference -> {
            Symbol symbol = new Symbol(nameReference.getName());
            projections.put(symbol, nameReference);
            inputs.add(symbol);
        });
        if (exchange.getPartitioningScheme().getHashColumn().isPresent()) {
            // Need to retain the hash symbol for the exchange
            projections.put(exchange.getPartitioningScheme().getHashColumn().get(), toVariableReference(exchange.getPartitioningScheme().getHashColumn().get(), context.getSymbolAllocator().getTypes()));
            inputs.add(exchange.getPartitioningScheme().getHashColumn().get());
        }
        if (exchange.getOrderingScheme().isPresent()) {
            // need to retain ordering columns for the exchange
            exchange.getOrderingScheme().get().getOrderBy().stream().filter(symbol -> !partitioningColumns.contains(symbol)).map(outputToInputMap::get).forEach(nameReference -> {
                Symbol symbol = new Symbol(nameReference.getName());
                projections.put(symbol, nameReference);
                inputs.add(symbol);
            });
        }
        for (Map.Entry<Symbol, RowExpression> projection : project.getAssignments().entrySet()) {
            checkArgument(!isExpression(projection.getValue()), "Cannot contain OriginalExpression after AddExchange");
            Map<VariableReferenceExpression, VariableReferenceExpression> variableOutputToInputMap = new LinkedHashMap<>();
            outputToInputMap.forEach(((symbol, variable) -> variableOutputToInputMap.put(new VariableReferenceExpression(symbol.getName(), context.getSymbolAllocator().getTypes().get(symbol)), variable)));
            RowExpression translatedExpression = RowExpressionVariableInliner.inlineVariables(variableOutputToInputMap, projection.getValue());
            Symbol symbol = context.getSymbolAllocator().newSymbol(translatedExpression);
            projections.put(symbol, translatedExpression);
            inputs.add(symbol);
        }
        newSourceBuilder.add(new ProjectNode(context.getIdAllocator().getNextId(), exchange.getSources().get(i), projections.build()));
        inputsBuilder.add(inputs.build());
    }
    // Construct the output symbols in the same order as the sources
    ImmutableList.Builder<Symbol> outputBuilder = ImmutableList.builder();
    partitioningColumns.forEach(outputBuilder::add);
    exchange.getPartitioningScheme().getHashColumn().ifPresent(outputBuilder::add);
    if (exchange.getOrderingScheme().isPresent()) {
        exchange.getOrderingScheme().get().getOrderBy().stream().filter(symbol -> !partitioningColumns.contains(symbol)).forEach(outputBuilder::add);
    }
    for (Map.Entry<Symbol, RowExpression> projection : project.getAssignments().entrySet()) {
        outputBuilder.add(projection.getKey());
    }
    // outputBuilder contains all partition and hash symbols so simply swap the output layout
    PartitioningScheme partitioningScheme = new PartitioningScheme(exchange.getPartitioningScheme().getPartitioning(), outputBuilder.build(), exchange.getPartitioningScheme().getHashColumn(), exchange.getPartitioningScheme().isReplicateNullsAndAny(), exchange.getPartitioningScheme().getBucketToPartition());
    PlanNode result = new ExchangeNode(exchange.getId(), exchange.getType(), exchange.getScope(), partitioningScheme, newSourceBuilder.build(), inputsBuilder.build(), exchange.getOrderingScheme(), AggregationNode.AggregationType.HASH);
    // we need to strip unnecessary symbols (hash, partitioning columns).
    return Result.ofPlanNode(restrictOutputs(context.getIdAllocator(), result, ImmutableSet.copyOf(project.getOutputSymbols()), true, context.getSymbolAllocator().getTypes()).orElse(result));
}
Also used : Patterns.source(io.prestosql.sql.planner.plan.Patterns.source) TypeProvider(io.prestosql.sql.planner.TypeProvider) HashMap(java.util.HashMap) Pattern(io.prestosql.matching.Pattern) RowExpressionVariableInliner(io.prestosql.sql.planner.RowExpressionVariableInliner) AggregationNode(io.prestosql.spi.plan.AggregationNode) PartitioningScheme(io.prestosql.sql.planner.PartitioningScheme) LinkedHashMap(java.util.LinkedHashMap) OriginalExpressionUtils.isExpression(io.prestosql.sql.relational.OriginalExpressionUtils.isExpression) ExchangeNode(io.prestosql.sql.planner.plan.ExchangeNode) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Capture.newCapture(io.prestosql.matching.Capture.newCapture) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) OriginalExpressionUtils.castToExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToExpression) Util.restrictOutputs(io.prestosql.sql.planner.iterative.rule.Util.restrictOutputs) Patterns.project(io.prestosql.sql.planner.plan.Patterns.project) Symbol(io.prestosql.spi.plan.Symbol) ImmutableSet(com.google.common.collect.ImmutableSet) Assignments(io.prestosql.spi.plan.Assignments) Rule(io.prestosql.sql.planner.iterative.Rule) Set(java.util.Set) PlanNode(io.prestosql.spi.plan.PlanNode) VariableReferenceExpression(io.prestosql.spi.relation.VariableReferenceExpression) ProjectNode(io.prestosql.spi.plan.ProjectNode) VariableReferenceSymbolConverter.toVariableReference(io.prestosql.sql.planner.VariableReferenceSymbolConverter.toVariableReference) Patterns.exchange(io.prestosql.sql.planner.plan.Patterns.exchange) Captures(io.prestosql.matching.Captures) List(java.util.List) SymbolReference(io.prestosql.sql.tree.SymbolReference) Capture(io.prestosql.matching.Capture) InputReferenceExpression(io.prestosql.spi.relation.InputReferenceExpression) RowExpression(io.prestosql.spi.relation.RowExpression) ExchangeNode(io.prestosql.sql.planner.plan.ExchangeNode) Symbol(io.prestosql.spi.plan.Symbol) ImmutableList(com.google.common.collect.ImmutableList) PartitioningScheme(io.prestosql.sql.planner.PartitioningScheme) Assignments(io.prestosql.spi.plan.Assignments) RowExpression(io.prestosql.spi.relation.RowExpression) LinkedHashMap(java.util.LinkedHashMap) PlanNode(io.prestosql.spi.plan.PlanNode) VariableReferenceExpression(io.prestosql.spi.relation.VariableReferenceExpression) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) ProjectNode(io.prestosql.spi.plan.ProjectNode) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 4 with Captures

use of io.prestosql.matching.Captures in project hetu-core by openlookeng.

the class TransformCorrelatedLateralJoinToJoin method apply.

@Override
public Result apply(LateralJoinNode lateralJoinNode, Captures captures, Context context) {
    PlanNode subquery = lateralJoinNode.getSubquery();
    PlanNodeDecorrelator planNodeDecorrelator = new PlanNodeDecorrelator(context.getIdAllocator(), context.getLookup());
    Optional<DecorrelatedNode> decorrelatedNodeOptional = planNodeDecorrelator.decorrelateFilters(subquery, lateralJoinNode.getCorrelation());
    return decorrelatedNodeOptional.map(decorrelatedNode -> {
        Expression joinFilter = combineConjuncts(decorrelatedNode.getCorrelatedPredicates().orElse(TRUE_LITERAL), lateralJoinNode.getFilter());
        return Result.ofPlanNode(new JoinNode(context.getIdAllocator().getNextId(), lateralJoinNode.getType().toJoinNodeType(), lateralJoinNode.getInput(), decorrelatedNode.getNode(), ImmutableList.of(), lateralJoinNode.getOutputSymbols(), joinFilter.equals(TRUE_LITERAL) ? Optional.empty() : Optional.of(castToRowExpression(joinFilter)), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of()));
    }).orElseGet(Result::empty);
}
Also used : Patterns.lateralJoin(io.prestosql.sql.planner.plan.Patterns.lateralJoin) LateralJoin.correlation(io.prestosql.sql.planner.plan.Patterns.LateralJoin.correlation) ExpressionUtils.combineConjuncts(io.prestosql.sql.ExpressionUtils.combineConjuncts) ImmutableMap(com.google.common.collect.ImmutableMap) Rule(io.prestosql.sql.planner.iterative.Rule) Pattern.nonEmpty(io.prestosql.matching.Pattern.nonEmpty) PlanNodeDecorrelator(io.prestosql.sql.planner.optimizations.PlanNodeDecorrelator) LateralJoinNode(io.prestosql.sql.planner.plan.LateralJoinNode) Pattern(io.prestosql.matching.Pattern) PlanNode(io.prestosql.spi.plan.PlanNode) TRUE_LITERAL(io.prestosql.sql.tree.BooleanLiteral.TRUE_LITERAL) Captures(io.prestosql.matching.Captures) ImmutableList(com.google.common.collect.ImmutableList) OriginalExpressionUtils.castToRowExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression) Optional(java.util.Optional) DecorrelatedNode(io.prestosql.sql.planner.optimizations.PlanNodeDecorrelator.DecorrelatedNode) Expression(io.prestosql.sql.tree.Expression) JoinNode(io.prestosql.spi.plan.JoinNode) PlanNodeDecorrelator(io.prestosql.sql.planner.optimizations.PlanNodeDecorrelator) PlanNode(io.prestosql.spi.plan.PlanNode) OriginalExpressionUtils.castToRowExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression) Expression(io.prestosql.sql.tree.Expression) LateralJoinNode(io.prestosql.sql.planner.plan.LateralJoinNode) JoinNode(io.prestosql.spi.plan.JoinNode) DecorrelatedNode(io.prestosql.sql.planner.optimizations.PlanNodeDecorrelator.DecorrelatedNode)

Example 5 with Captures

use of io.prestosql.matching.Captures in project hetu-core by openlookeng.

the class SingleDistinctAggregationToGroupBy method apply.

@Override
public Result apply(AggregationNode aggregation, Captures captures, Context context) {
    List<Set<Expression>> argumentSets = extractArgumentSets(aggregation).collect(Collectors.toList());
    Set<Symbol> symbols = Iterables.getOnlyElement(argumentSets).stream().map(SymbolUtils::from).collect(Collectors.toSet());
    return Result.ofPlanNode(new AggregationNode(aggregation.getId(), new AggregationNode(context.getIdAllocator().getNextId(), aggregation.getSource(), ImmutableMap.of(), singleGroupingSet(ImmutableList.<Symbol>builder().addAll(aggregation.getGroupingKeys()).addAll(symbols).build()), ImmutableList.of(), SINGLE, Optional.empty(), Optional.empty(), aggregation.getAggregationType(), aggregation.getFinalizeSymbol()), // remove DISTINCT flag from function calls
    aggregation.getAggregations().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> removeDistinct(e.getValue()))), aggregation.getGroupingSets(), emptyList(), aggregation.getStep(), aggregation.getHashSymbol(), aggregation.getGroupIdSymbol(), aggregation.getAggregationType(), aggregation.getFinalizeSymbol()));
}
Also used : Iterables(com.google.common.collect.Iterables) Patterns.aggregation(io.prestosql.sql.planner.plan.Patterns.aggregation) Pattern(io.prestosql.matching.Pattern) AggregationNode(io.prestosql.spi.plan.AggregationNode) HashSet(java.util.HashSet) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ImmutableList(com.google.common.collect.ImmutableList) SINGLE(io.prestosql.spi.plan.AggregationNode.Step.SINGLE) Map(java.util.Map) AggregationNode.singleGroupingSet(io.prestosql.spi.plan.AggregationNode.singleGroupingSet) Symbol(io.prestosql.spi.plan.Symbol) SymbolUtils(io.prestosql.sql.planner.SymbolUtils) ImmutableMap(com.google.common.collect.ImmutableMap) Rule(io.prestosql.sql.planner.iterative.Rule) Collections.emptyList(java.util.Collections.emptyList) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) Collectors(java.util.stream.Collectors) Captures(io.prestosql.matching.Captures) List(java.util.List) Stream(java.util.stream.Stream) Aggregation(io.prestosql.spi.plan.AggregationNode.Aggregation) Optional(java.util.Optional) Expression(io.prestosql.sql.tree.Expression) OriginalExpressionUtils(io.prestosql.sql.relational.OriginalExpressionUtils) HashSet(java.util.HashSet) AggregationNode.singleGroupingSet(io.prestosql.spi.plan.AggregationNode.singleGroupingSet) Set(java.util.Set) Symbol(io.prestosql.spi.plan.Symbol) AggregationNode(io.prestosql.spi.plan.AggregationNode) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

Captures (io.prestosql.matching.Captures)8 Pattern (io.prestosql.matching.Pattern)8 Rule (io.prestosql.sql.planner.iterative.Rule)8 List (java.util.List)7 Assignments (io.prestosql.spi.plan.Assignments)6 ProjectNode (io.prestosql.spi.plan.ProjectNode)6 Symbol (io.prestosql.spi.plan.Symbol)6 ImmutableList (com.google.common.collect.ImmutableList)5 Capture (io.prestosql.matching.Capture)5 Capture.newCapture (io.prestosql.matching.Capture.newCapture)5 PlanNode (io.prestosql.spi.plan.PlanNode)5 RowExpression (io.prestosql.spi.relation.RowExpression)5 Patterns.source (io.prestosql.sql.planner.plan.Patterns.source)5 Optional (java.util.Optional)5 Metadata (io.prestosql.metadata.Metadata)4 Map (java.util.Map)4 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 AggregationNode (io.prestosql.spi.plan.AggregationNode)3 Patterns.project (io.prestosql.sql.planner.plan.Patterns.project)3