Search in sources :

Example 11 with IAlgebraicRewriteRule

use of org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule in project asterixdb by apache.

the class RuleCollections method prepareForJobGenRuleCollection.

public static final List<IAlgebraicRewriteRule> prepareForJobGenRuleCollection() {
    List<IAlgebraicRewriteRule> prepareForJobGenRewrites = new LinkedList<>();
    prepareForJobGenRewrites.add(new IsolateHyracksOperatorsRule(HeuristicOptimizer.hyraxOperatorsBelowWhichJobGenIsDisabled));
    prepareForJobGenRewrites.add(new ExtractCommonOperatorsRule());
    // Re-infer all types, so that, e.g., the effect of not-is-null is
    // propagated.
    prepareForJobGenRewrites.add(new ReinferAllTypesRule());
    prepareForJobGenRewrites.add(new PushGroupByIntoSortRule());
    prepareForJobGenRewrites.add(new SetExecutionModeRule());
    prepareForJobGenRewrites.add(new SweepIllegalNonfunctionalFunctions());
    return prepareForJobGenRewrites;
}
Also used : IsolateHyracksOperatorsRule(org.apache.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule) SetExecutionModeRule(org.apache.hyracks.algebricks.rewriter.rules.SetExecutionModeRule) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) ExtractCommonOperatorsRule(org.apache.hyracks.algebricks.rewriter.rules.ExtractCommonOperatorsRule) PushGroupByIntoSortRule(org.apache.hyracks.algebricks.rewriter.rules.PushGroupByIntoSortRule) ReinferAllTypesRule(org.apache.hyracks.algebricks.rewriter.rules.ReinferAllTypesRule) SweepIllegalNonfunctionalFunctions(org.apache.asterix.optimizer.rules.SweepIllegalNonfunctionalFunctions) LinkedList(java.util.LinkedList)

Example 12 with IAlgebraicRewriteRule

use of org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule in project asterixdb by apache.

the class SequentialFixpointRuleController method rewriteWithRuleCollection.

@Override
public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root, Collection<IAlgebraicRewriteRule> ruleCollection) throws AlgebricksException {
    boolean anyRuleFired = false;
    boolean anyChange = false;
    do {
        anyChange = false;
        for (IAlgebraicRewriteRule rule : ruleCollection) {
            boolean ruleFired = rewriteOperatorRef(root, rule, true, fullDfs);
            if (ruleFired) {
                anyChange = true;
                anyRuleFired = true;
            }
        }
    } while (anyChange);
    return anyRuleFired;
}
Also used : IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule)

Example 13 with IAlgebraicRewriteRule

use of org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule in project asterixdb by apache.

the class PigletCompiler method buildDefaultPhysicalRewrites.

private static List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> buildDefaultPhysicalRewrites() {
    List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> defaultPhysicalRewrites = new ArrayList<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>>();
    SequentialOnceRuleController seqOnceCtrlAllLevels = new SequentialOnceRuleController(true);
    SequentialOnceRuleController seqOnceCtrlTopLevel = new SequentialOnceRuleController(false);
    defaultPhysicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrlAllLevels, PigletRewriteRuleset.buildPhysicalRewritesAllLevelsRuleCollection()));
    defaultPhysicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrlTopLevel, PigletRewriteRuleset.buildPhysicalRewritesTopLevelRuleCollection()));
    defaultPhysicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrlAllLevels, PigletRewriteRuleset.prepareForJobGenRuleCollection()));
    return defaultPhysicalRewrites;
}
Also used : AbstractRuleController(org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController) SequentialOnceRuleController(org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Pair(org.apache.hyracks.algebricks.common.utils.Pair)

Example 14 with IAlgebraicRewriteRule

use of org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule in project asterixdb by apache.

the class PigletCompiler method buildDefaultLogicalRewrites.

private static List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> buildDefaultLogicalRewrites() {
    List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> defaultLogicalRewrites = new ArrayList<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>>();
    SequentialFixpointRuleController seqCtrlNoDfs = new SequentialFixpointRuleController(false);
    SequentialFixpointRuleController seqCtrlFullDfs = new SequentialFixpointRuleController(true);
    SequentialOnceRuleController seqOnceCtrl = new SequentialOnceRuleController(true);
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrl, PigletRewriteRuleset.buildTypeInferenceRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqCtrlFullDfs, PigletRewriteRuleset.buildNormalizationRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqCtrlNoDfs, PigletRewriteRuleset.buildCondPushDownRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqCtrlNoDfs, PigletRewriteRuleset.buildJoinInferenceRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqCtrlNoDfs, PigletRewriteRuleset.buildOpPushDownRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqOnceCtrl, PigletRewriteRuleset.buildDataExchangeRuleCollection()));
    defaultLogicalRewrites.add(new Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>(seqCtrlNoDfs, PigletRewriteRuleset.buildConsolidationRuleCollection()));
    return defaultLogicalRewrites;
}
Also used : AbstractRuleController(org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController) SequentialOnceRuleController(org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController) IAlgebraicRewriteRule(org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule) SequentialFixpointRuleController(org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialFixpointRuleController) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Pair(org.apache.hyracks.algebricks.common.utils.Pair)

Example 15 with IAlgebraicRewriteRule

use of org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule in project asterixdb by apache.

the class PigletRewriteRuleset method buildTypeInferenceRuleCollection.

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

Aggregations

IAlgebraicRewriteRule (org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule)31 LinkedList (java.util.LinkedList)25 RemoveUnusedAssignAndAggregateRule (org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggregateRule)7 ArrayList (java.util.ArrayList)5 Pair (org.apache.hyracks.algebricks.common.utils.Pair)4 SequentialOnceRuleController (org.apache.hyracks.algebricks.compiler.rewriter.rulecontrollers.SequentialOnceRuleController)4 PushProjectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule)4 PushSelectDownRule (org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule)4 SetExecutionModeRule (org.apache.hyracks.algebricks.rewriter.rules.SetExecutionModeRule)4 EliminateSubplanRule (org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule)4 ConstantFoldingRule (org.apache.asterix.optimizer.rules.ConstantFoldingRule)3 ConsolidateAssignsRule (org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule)3 CopyLimitDownRule (org.apache.hyracks.algebricks.rewriter.rules.CopyLimitDownRule)3 InferTypesRule (org.apache.hyracks.algebricks.rewriter.rules.InferTypesRule)3 List (java.util.List)2 AsterixInlineVariablesRule (org.apache.asterix.optimizer.rules.AsterixInlineVariablesRule)2 ByNameToByIndexFieldAccessRule (org.apache.asterix.optimizer.rules.ByNameToByIndexFieldAccessRule)2 IntroduceDynamicTypeCastForExternalFunctionRule (org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastForExternalFunctionRule)2 IntroduceDynamicTypeCastRule (org.apache.asterix.optimizer.rules.IntroduceDynamicTypeCastRule)2 RemoveRedundantListifyRule (org.apache.asterix.optimizer.rules.RemoveRedundantListifyRule)2