Search in sources :

Example 1 with RemoveUnusedAssignAndAggregateRule

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

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

the class PigletRewriteRuleset method buildConsolidationRuleCollection.

public static final List<IAlgebraicRewriteRule> buildConsolidationRuleCollection() {
    List<IAlgebraicRewriteRule> consolidation = new LinkedList<IAlgebraicRewriteRule>();
    consolidation.add(new ConsolidateSelectsRule());
    consolidation.add(new ConsolidateAssignsRule());
    consolidation.add(new RemoveUnusedAssignAndAggregateRule());
    return consolidation;
}
Also used : ConsolidateAssignsRule(org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule) LinkedList(java.util.LinkedList) ConsolidateSelectsRule(org.apache.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule)

Example 3 with RemoveUnusedAssignAndAggregateRule

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

the class RuleCollections method buildConsolidationRuleCollection.

public static final List<IAlgebraicRewriteRule> buildConsolidationRuleCollection() {
    List<IAlgebraicRewriteRule> consolidation = new LinkedList<>();
    consolidation.add(new ConsolidateSelectsRule());
    consolidation.add(new ConsolidateAssignsRule());
    consolidation.add(new InlineAssignIntoAggregateRule());
    consolidation.add(new AsterixIntroduceGroupByCombinerRule());
    consolidation.add(new IntroduceAggregateCombinerRule());
    consolidation.add(new CountVarToCountOneRule());
    consolidation.add(new RemoveUnusedAssignAndAggregateRule());
    consolidation.add(new RemoveRedundantGroupByDecorVarsRule());
    //PushUnnestDownUnion => RemoveRedundantListifyRule cause these rules are correlated
    consolidation.add(new PushUnnestDownThroughUnionRule());
    consolidation.add(new RemoveRedundantListifyRule());
    return consolidation;
}
Also used : RemoveRedundantListifyRule(org.apache.asterix.optimizer.rules.RemoveRedundantListifyRule) ConsolidateAssignsRule(org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule) InlineAssignIntoAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.InlineAssignIntoAggregateRule) RemoveRedundantGroupByDecorVarsRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantGroupByDecorVarsRule) LinkedList(java.util.LinkedList) ConsolidateSelectsRule(org.apache.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule) PushUnnestDownThroughUnionRule(org.apache.hyracks.algebricks.rewriter.rules.PushUnnestDownThroughUnionRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) AsterixIntroduceGroupByCombinerRule(org.apache.asterix.optimizer.rules.AsterixIntroduceGroupByCombinerRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule) CountVarToCountOneRule(org.apache.asterix.optimizer.rules.CountVarToCountOneRule) IntroduceAggregateCombinerRule(org.apache.hyracks.algebricks.rewriter.rules.IntroduceAggregateCombinerRule)

Example 4 with RemoveUnusedAssignAndAggregateRule

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

the class RuleCollections method buildPhysicalRewritesAllLevelsRuleCollection.

public static final List<IAlgebraicRewriteRule> buildPhysicalRewritesAllLevelsRuleCollection() {
    List<IAlgebraicRewriteRule> physicalRewritesAllLevels = new LinkedList<>();
    physicalRewritesAllLevels.add(new PullSelectOutOfEqJoin());
    //Turned off the following rule for now not to change OptimizerTest results.
    physicalRewritesAllLevels.add(new SetupCommitExtensionOpRule());
    physicalRewritesAllLevels.add(new SetAlgebricksPhysicalOperatorsRule());
    physicalRewritesAllLevels.add(new SetAsterixPhysicalOperatorsRule());
    physicalRewritesAllLevels.add(new AddEquivalenceClassForRecordConstructorRule());
    physicalRewritesAllLevels.add(new EnforceStructuralPropertiesRule());
    physicalRewritesAllLevels.add(new RemoveSortInFeedIngestionRule());
    physicalRewritesAllLevels.add(new RemoveUnnecessarySortMergeExchange());
    physicalRewritesAllLevels.add(new PushProjectDownRule());
    physicalRewritesAllLevels.add(new InsertProjectBeforeUnionRule());
    physicalRewritesAllLevels.add(new IntroduceMaterializationForInsertWithSelfScanRule());
    physicalRewritesAllLevels.add(new InlineSingleReferenceVariablesRule());
    physicalRewritesAllLevels.add(new RemoveUnusedAssignAndAggregateRule());
    physicalRewritesAllLevels.add(new ConsolidateAssignsRule());
    // After adding projects, we may need need to set physical operators again.
    physicalRewritesAllLevels.add(new SetAlgebricksPhysicalOperatorsRule());
    return physicalRewritesAllLevels;
}
Also used : PushProjectDownRule(org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule) ConsolidateAssignsRule(org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule) InsertProjectBeforeUnionRule(org.apache.hyracks.algebricks.rewriter.rules.InsertProjectBeforeUnionRule) SetAsterixPhysicalOperatorsRule(org.apache.asterix.optimizer.rules.SetAsterixPhysicalOperatorsRule) InlineSingleReferenceVariablesRule(org.apache.hyracks.algebricks.rewriter.rules.InlineSingleReferenceVariablesRule) LinkedList(java.util.LinkedList) RemoveUnnecessarySortMergeExchange(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnnecessarySortMergeExchange) IntroduceMaterializationForInsertWithSelfScanRule(org.apache.asterix.optimizer.rules.IntroduceMaterializationForInsertWithSelfScanRule) SetupCommitExtensionOpRule(org.apache.asterix.optimizer.rules.SetupCommitExtensionOpRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) AddEquivalenceClassForRecordConstructorRule(org.apache.asterix.optimizer.rules.AddEquivalenceClassForRecordConstructorRule) RemoveSortInFeedIngestionRule(org.apache.asterix.optimizer.rules.RemoveSortInFeedIngestionRule) EnforceStructuralPropertiesRule(org.apache.hyracks.algebricks.rewriter.rules.EnforceStructuralPropertiesRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule) PullSelectOutOfEqJoin(org.apache.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin) SetAlgebricksPhysicalOperatorsRule(org.apache.hyracks.algebricks.rewriter.rules.SetAlgebricksPhysicalOperatorsRule)

Example 5 with RemoveUnusedAssignAndAggregateRule

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

the class RuleCollections method buildAccessMethodRuleCollection.

public static final List<IAlgebraicRewriteRule> buildAccessMethodRuleCollection() {
    List<IAlgebraicRewriteRule> accessMethod = new LinkedList<>();
    accessMethod.add(new IntroduceSelectAccessMethodRule());
    accessMethod.add(new IntroduceJoinAccessMethodRule());
    accessMethod.add(new IntroduceLSMComponentFilterRule());
    accessMethod.add(new IntroduceSecondaryIndexInsertDeleteRule());
    accessMethod.add(new RemoveUnusedOneToOneEquiJoinRule());
    accessMethod.add(new PushSimilarityFunctionsBelowJoin());
    accessMethod.add(new RemoveUnusedAssignAndAggregateRule());
    return accessMethod;
}
Also used : PushSimilarityFunctionsBelowJoin(org.apache.asterix.optimizer.rules.PushSimilarityFunctionsBelowJoin) IntroduceSelectAccessMethodRule(org.apache.asterix.optimizer.rules.am.IntroduceSelectAccessMethodRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) IntroduceJoinAccessMethodRule(org.apache.asterix.optimizer.rules.am.IntroduceJoinAccessMethodRule) RemoveUnusedOneToOneEquiJoinRule(org.apache.asterix.optimizer.rules.RemoveUnusedOneToOneEquiJoinRule) IntroduceSecondaryIndexInsertDeleteRule(org.apache.asterix.optimizer.rules.IntroduceSecondaryIndexInsertDeleteRule) RemoveUnusedAssignAndAggregateRule(org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule) IntroduceLSMComponentFilterRule(org.apache.asterix.optimizer.rules.am.IntroduceLSMComponentFilterRule) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)7 IAlgebraicRewriteRule (org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule)7 RemoveUnusedAssignAndAggregateRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)7 ConsolidateAssignsRule (org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule)3 AsterixInlineVariablesRule (org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule)2 ByNameToByIndexFieldAccessRule (org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule)2 RemoveRedundantListifyRule (org.apache.asterix.optimizer.rules.RemoveRedundantListifyRule)2 ConsolidateSelectsRule (org.apache.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule)2 PushProjectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule)2 PushSelectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule)2 RemoveCartesianProductWithEmptyBranchRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveCartesianProductWithEmptyBranchRule)2 RemoveRedundantVariablesRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule)2 AddEquivalenceClassForRecordConstructorRule (org.apache.asterix.optimizer.rules.AddEquivalenceClassForRecordConstructorRule)1 AsterixExtractFunctionsFromJoinConditionRule (org.apache.asterix.optimizer.rules.AsterixExtractFunctionsFromJoinConditionRule)1 AsterixIntroduceGroupByCombinerRule (org.apache.asterix.optimizer.rules.AsterixIntroduceGroupByCombinerRule)1 CancelUnnestWithNestedListifyRule (org.apache.asterix.optimizer.rules.CancelUnnestWithNestedListifyRule)1 ConstantFoldingRule (org.apache.asterix.optimizer.rules.ConstantFoldingRule)1 CountVarToCountOneRule (org.apache.asterix.optimizer.rules.CountVarToCountOneRule)1 DisjunctivePredicateToJoinRule (org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule)1 FeedScanCollectionToUnnest (org.apache.asterix.optimizer.rules.FeedScanCollectionToUnnest)1