Search in sources :

Example 1 with NestedSubplanToJoinRule

use of org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule in project asterixdb by apache.

the class RuleCollections method buildCondPushDownAndJoinInferenceRuleCollection.

public static final List<IAlgebraicRewriteRule> buildCondPushDownAndJoinInferenceRuleCollection() {
    List<IAlgebraicRewriteRule> condPushDownAndJoinInference = new LinkedList<>();
    condPushDownAndJoinInference.add(new PushSelectDownRule());
    condPushDownAndJoinInference.add(new PushSortDownRule());
    condPushDownAndJoinInference.add(new RemoveRedundantListifyRule());
    condPushDownAndJoinInference.add(new CancelUnnestWithNestedListifyRule());
    condPushDownAndJoinInference.add(new SimpleUnnestToProductRule());
    condPushDownAndJoinInference.add(new ComplexUnnestToProductRule());
    condPushDownAndJoinInference.add(new DisjunctivePredicateToJoinRule());
    condPushDownAndJoinInference.add(new PushSelectIntoJoinRule());
    condPushDownAndJoinInference.add(new IntroJoinInsideSubplanRule());
    // Apply RemoveCartesianProductWithEmptyBranchRule before PushMapOperatorDownThroughProductRule
    // to avoid that a constant assignment gets pushed into an empty branch.
    condPushDownAndJoinInference.add(new RemoveCartesianProductWithEmptyBranchRule());
    condPushDownAndJoinInference.add(new PushMapOperatorDownThroughProductRule());
    condPushDownAndJoinInference.add(new PushSubplanWithAggregateDownThroughProductRule());
    condPushDownAndJoinInference.add(new SubplanOutOfGroupRule());
    condPushDownAndJoinInference.add(new AsterixExtractFunctionsFromJoinConditionRule());
    condPushDownAndJoinInference.add(new RemoveRedundantVariablesRule());
    condPushDownAndJoinInference.add(new AsterixInlineVariablesRule());
    condPushDownAndJoinInference.add(new RemoveUnusedAssignAndAggregateRule());
    condPushDownAndJoinInference.add(new FactorRedundantGroupAndDecorVarsRule());
    condPushDownAndJoinInference.add(new PushAggregateIntoNestedSubplanRule());
    condPushDownAndJoinInference.add(new EliminateSubplanRule());
    condPushDownAndJoinInference.add(new PushProperJoinThroughProduct());
    condPushDownAndJoinInference.add(new PushGroupByThroughProduct());
    condPushDownAndJoinInference.add(new NestGroupByRule());
    condPushDownAndJoinInference.add(new EliminateGroupByEmptyKeyRule());
    condPushDownAndJoinInference.add(new PushSubplanIntoGroupByRule());
    condPushDownAndJoinInference.add(new NestedSubplanToJoinRule());
    condPushDownAndJoinInference.add(new EliminateSubplanWithInputCardinalityOneRule());
    // The following rule should be fired after PushAggregateIntoNestedSubplanRule because
    // pulling invariants out of a subplan will make PushAggregateIntoGroupby harder.
    condPushDownAndJoinInference.add(new AsterixMoveFreeVariableOperatorOutOfSubplanRule());
    return condPushDownAndJoinInference;
}
Also used : PushMapOperatorDownThroughProductRule(org.apache.hyracks.algebricks.rewriter.rules.PushMapOperatorDownThroughProductRule) RemoveRedundantListifyRule(org.apache.asterix.optimizer.rules.RemoveRedundantListifyRule) NestedSubplanToJoinRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule) SimpleUnnestToProductRule(org.apache.hyracks.algebricks.rewriter.rules.SimpleUnnestToProductRule) PushSubplanWithAggregateDownThroughProductRule(org.apache.hyracks.algebricks.rewriter.rules.PushSubplanWithAggregateDownThroughProductRule) PushSortDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushSortDownRule) PushSelectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule) EliminateSubplanWithInputCardinalityOneRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanWithInputCardinalityOneRule) PushGroupByThroughProduct(org.apache.asterix.optimizer.rules.PushGroupByThroughProduct) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) PushSubplanIntoGroupByRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.PushSubplanIntoGroupByRule) CancelUnnestWithNestedListifyRule(org.apache.asterix.optimizer.rules.CancelUnnestWithNestedListifyRule) DisjunctivePredicateToJoinRule(org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule) RemoveRedundantVariablesRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule) IntroJoinInsideSubplanRule(org.apache.hyracks.algebricks.rewriter.rules.IntroJoinInsideSubplanRule) FactorRedundantGroupAndDecorVarsRule(org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule) PushProperJoinThroughProduct(org.apache.asterix.optimizer.rules.PushProperJoinThroughProduct) ComplexUnnestToProductRule(org.apache.hyracks.algebricks.rewriter.rules.ComplexUnnestToProductRule) PushSelectIntoJoinRule(org.apache.hyracks.algebricks.rewriter.rules.PushSelectIntoJoinRule) AsterixInlineVariablesRule(org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule) PushAggregateIntoNestedSubplanRule(org.apache.asterix.optimizer.rules.PushAggregateIntoNestedSubplanRule) NestGroupByRule(org.apache.asterix.optimizer.rules.NestGroupByRule) LinkedList(java.util.LinkedList) EliminateSubplanRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule) AsterixExtractFunctionsFromJoinConditionRule(org.apache.asterix.optimizer.rules.AsterixExtractFunctionsFromJoinConditionRule) RemoveCartesianProductWithEmptyBranchRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveCartesianProductWithEmptyBranchRule) AsterixMoveFreeVariableOperatorOutOfSubplanRule(org.apache.asterix.optimizer.rules.subplan.AsterixMoveFreeVariableOperatorOutOfSubplanRule) EliminateGroupByEmptyKeyRule(org.apache.hyracks.algebricks.rewriter.rules.EliminateGroupByEmptyKeyRule) SubplanOutOfGroupRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.SubplanOutOfGroupRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)

Example 2 with NestedSubplanToJoinRule

use of org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule in project asterixdb by apache.

the class RuleCollections method buildLoadFieldsRuleCollection.

public static final List<IAlgebraicRewriteRule> buildLoadFieldsRuleCollection(ICcApplicationContext appCtx) {
    List<IAlgebraicRewriteRule> fieldLoads = new LinkedList<>();
    fieldLoads.add(new LoadRecordFieldsRule());
    fieldLoads.add(new PushFieldAccessRule());
    // fieldLoads.add(new ByNameToByHandleFieldAccessRule()); -- disabled
    fieldLoads.add(new ByNameToByIndexFieldAccessRule());
    fieldLoads.add(new RemoveRedundantVariablesRule());
    fieldLoads.add(new AsterixInlineVariablesRule());
    fieldLoads.add(new RemoveUnusedAssignAndAggregateRule());
    fieldLoads.add(new ConstantFoldingRule(appCtx));
    fieldLoads.add(new RemoveRedundantSelectRule());
    fieldLoads.add(new FeedScanCollectionToUnnest());
    fieldLoads.add(new NestedSubplanToJoinRule());
    fieldLoads.add(new InlineSubplanInputForNestedTupleSourceRule());
    fieldLoads.add(new RemoveLeftOuterUnnestForLeftOuterJoinRule());
    return fieldLoads;
}
Also used : ByNameToByIndexFieldAccessRule(org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule) NestedSubplanToJoinRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule) AsterixInlineVariablesRule(org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule) PushFieldAccessRule(org.apache.asterix.optimizer.rules.PushFieldAccessRule) FeedScanCollectionToUnnest(org.apache.asterix.optimizer.rules.FeedScanCollectionToUnnest) LinkedList(java.util.LinkedList) LoadRecordFieldsRule(org.apache.asterix.optimizer.rules.LoadRecordFieldsRule) ConstantFoldingRule(org.apache.asterix.optimizer.rules.ConstantFoldingRule) InlineSubplanInputForNestedTupleSourceRule(org.apache.asterix.optimizer.rules.subplan.InlineSubplanInputForNestedTupleSourceRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) RemoveRedundantSelectRule(org.apache.asterix.optimizer.rules.RemoveRedundantSelectRule) RemoveLeftOuterUnnestForLeftOuterJoinRule(org.apache.asterix.optimizer.rules.RemoveLeftOuterUnnestForLeftOuterJoinRule) RemoveRedundantVariablesRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)

Aggregations

LinkedList (java.util.LinkedList)2 AsterixInlineVariablesRule (org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule)2 IAlgebraicRewriteRule (org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule)2 RemoveRedundantVariablesRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule)2 RemoveUnusedAssignAndAggregateRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)2 NestedSubplanToJoinRule (org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule)2 AsterixExtractFunctionsFromJoinConditionRule (org.apache.asterix.optimizer.rules.AsterixExtractFunctionsFromJoinConditionRule)1 ByNameToByIndexFieldAccessRule (org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule)1 CancelUnnestWithNestedListifyRule (org.apache.asterix.optimizer.rules.CancelUnnestWithNestedListifyRule)1 ConstantFoldingRule (org.apache.asterix.optimizer.rules.ConstantFoldingRule)1 DisjunctivePredicateToJoinRule (org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule)1 FeedScanCollectionToUnnest (org.apache.asterix.optimizer.rules.FeedScanCollectionToUnnest)1 LoadRecordFieldsRule (org.apache.asterix.optimizer.rules.LoadRecordFieldsRule)1 NestGroupByRule (org.apache.asterix.optimizer.rules.NestGroupByRule)1 PushAggregateIntoNestedSubplanRule (org.apache.asterix.optimizer.rules.PushAggregateIntoNestedSubplanRule)1 PushFieldAccessRule (org.apache.asterix.optimizer.rules.PushFieldAccessRule)1 PushGroupByThroughProduct (org.apache.asterix.optimizer.rules.PushGroupByThroughProduct)1 PushProperJoinThroughProduct (org.apache.asterix.optimizer.rules.PushProperJoinThroughProduct)1 RemoveLeftOuterUnnestForLeftOuterJoinRule (org.apache.asterix.optimizer.rules.RemoveLeftOuterUnnestForLeftOuterJoinRule)1 RemoveRedundantListifyRule (org.apache.asterix.optimizer.rules.RemoveRedundantListifyRule)1