Search in sources :

Example 1 with PushSelectDownRule

use of org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule 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 PushSelectDownRule

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

the class PigletRewriteRuleset method buildCondPushDownRuleCollection.

public static final List<IAlgebraicRewriteRule> buildCondPushDownRuleCollection() {
    List<IAlgebraicRewriteRule> condPushDown = new LinkedList<IAlgebraicRewriteRule>();
    condPushDown.add(new PushSelectDownRule());
    condPushDown.add(new InlineVariablesRule());
    condPushDown.add(new FactorRedundantGroupAndDecorVarsRule());
    condPushDown.add(new EliminateSubplanRule());
    return condPushDown;
}
Also used : IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) InlineVariablesRule(org.apache.hyracks.algebricks.rewriter.rules.InlineVariablesRule) FactorRedundantGroupAndDecorVarsRule(org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule) LinkedList(java.util.LinkedList) PushSelectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule) EliminateSubplanRule(org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule)

Example 3 with PushSelectDownRule

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

the class PigletRewriteRuleset method buildOpPushDownRuleCollection.

public static final List<IAlgebraicRewriteRule> buildOpPushDownRuleCollection() {
    List<IAlgebraicRewriteRule> opPushDown = new LinkedList<IAlgebraicRewriteRule>();
    opPushDown.add(new PushProjectDownRule());
    opPushDown.add(new PushSelectDownRule());
    return opPushDown;
}
Also used : PushProjectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) LinkedList(java.util.LinkedList) PushSelectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule)

Example 4 with PushSelectDownRule

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

the class RuleCollections method buildPlanCleanupRuleCollection.

public static final List<IAlgebraicRewriteRule> buildPlanCleanupRuleCollection() {
    List<IAlgebraicRewriteRule> planCleanupRules = new LinkedList<>();
    planCleanupRules.add(new SwitchInnerJoinBranchRule());
    planCleanupRules.add(new PushAssignBelowUnionAllRule());
    planCleanupRules.add(new ExtractCommonExpressionsRule());
    planCleanupRules.add(new RemoveRedundantVariablesRule());
    planCleanupRules.add(new PushProjectDownRule());
    planCleanupRules.add(new PushSelectDownRule());
    planCleanupRules.add(new SetClosedRecordConstructorsRule());
    planCleanupRules.add(new IntroduceDynamicTypeCastRule());
    planCleanupRules.add(new IntroduceDynamicTypeCastForExternalFunctionRule());
    planCleanupRules.add(new RemoveUnusedAssignAndAggregateRule());
    planCleanupRules.add(new RemoveCartesianProductWithEmptyBranchRule());
    planCleanupRules.add(new InjectTypeCastForSwitchCaseRule());
    planCleanupRules.add(new InjectTypeCastForUnionRule());
    // Needs to invoke ByNameToByIndexFieldAccessRule as the last logical optimization rule because
    // some rules can push a FieldAccessByName to a place where the name it tries to access is in the closed part.
    // For example, a possible scenario is that a field-access-by-name can be pushed down through UnionAllOperator.
    planCleanupRules.add(new ByNameToByIndexFieldAccessRule());
    return planCleanupRules;
}
Also used : IntroduceDynamicTypeCastRule(org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastRule) ByNameToByIndexFieldAccessRule(org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule) PushProjectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule) SwitchInnerJoinBranchRule(org.apache.hyracks.algebricks.rewriter.rules.SwitchInnerJoinBranchRule) IntroduceDynamicTypeCastForExternalFunctionRule(org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastForExternalFunctionRule) ExtractCommonExpressionsRule(org.apache.hyracks.algebricks.rewriter.rules.ExtractCommonExpressionsRule) PushAssignBelowUnionAllRule(org.apache.hyracks.algebricks.rewriter.rules.PushAssignBelowUnionAllRule) LinkedList(java.util.LinkedList) PushSelectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule) RemoveCartesianProductWithEmptyBranchRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveCartesianProductWithEmptyBranchRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) InjectTypeCastForUnionRule(org.apache.asterix.optimizer.rules.InjectTypeCastForUnionRule) SetClosedRecordConstructorsRule(org.apache.asterix.optimizer.rules.SetClosedRecordConstructorsRule) RemoveRedundantVariablesRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule) InjectTypeCastForSwitchCaseRule(org.apache.asterix.optimizer.rules.InjectTypeCastForSwitchCaseRule)

Aggregations

LinkedList (java.util.LinkedList)4 IAlgebraicRewriteRule (org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule)4 PushSelectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule)4 FactorRedundantGroupAndDecorVarsRule (org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecorVarsRule)2 PushProjectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule)2 RemoveCartesianProductWithEmptyBranchRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveCartesianProductWithEmptyBranchRule)2 RemoveRedundantVariablesRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule)2 RemoveUnusedAssignAndAggregateRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)2 EliminateSubplanRule (org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule)2 AsterixExtractFunctionsFromJoinConditionRule (org.apache.asterix.optimizer.rules.AsterixExtractFunctionsFromJoinConditionRule)1 AsterixInlineVariablesRule (org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule)1 ByNameToByIndexFieldAccessRule (org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule)1 CancelUnnestWithNestedListifyRule (org.apache.asterix.optimizer.rules.CancelUnnestWithNestedListifyRule)1 DisjunctivePredicateToJoinRule (org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule)1 InjectTypeCastForSwitchCaseRule (org.apache.asterix.optimizer.rules.InjectTypeCastForSwitchCaseRule)1 InjectTypeCastForUnionRule (org.apache.asterix.optimizer.rules.InjectTypeCastForUnionRule)1 IntroduceDynamicTypeCastForExternalFunctionRule (org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastForExternalFunctionRule)1 IntroduceDynamicTypeCastRule (org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastRule)1 NestGroupByRule (org.apache.asterix.optimizer.rules.NestGroupByRule)1 PushAggregateIntoNestedSubplanRule (org.apache.asterix.optimizer.rules.PushAggregateIntoNestedSubplanRule)1