Search in sources :

Example 6 with RemoveUnusedAssignAndAggregateRule

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

Example 7 with RemoveUnusedAssignAndAggregateRule

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