/** * When a nested data sources exist, convert the plan to use the join operator. * * @return List of algebraic rewrite rules. */ public final static List<IAlgebraicRewriteRule> buildNestedDataSourceRuleCollection() { List<IAlgebraicRewriteRule> xquery = new LinkedList<IAlgebraicRewriteRule>(); xquery.add(new BreakSelectIntoConjunctsRule()); xquery.add(new SimpleUnnestToProductRule()); xquery.add(new PushMapOperatorDownThroughProductRule()); xquery.add(new PushSubplanWithAggregateDownThroughProductRule()); xquery.add(new PushSelectDownRule()); xquery.add(new PushSelectIntoJoinRule()); // Clean up xquery.add(new RemoveRedundantVariablesRule()); xquery.add(new RemoveUnusedAssignAndAggregateRule()); return xquery; }
private boolean descOrSelfIsSourceScan(ILogicalOperator op) { if (op.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) { return true; } for (Mutable<ILogicalOperator> cRef : op.getInputs()) { if (descOrSelfIsSourceScan(cRef.getValue())) { return true; } } return false; }
throws AlgebricksException { ILogicalOperator op = opRef.getValue(); if (!isScanOrUnnest(op)) { return false; if (!isScanOrUnnest(op2) && !descOrSelfIsSourceScan(op2)) { return false; if (!opsAreIndependent(op, op2)) { return false; && descOrSelfIsSourceScan(currentOpRef.getValue())) { if (opsAreIndependent(currentOpRef.getValue(), tupleSourceOpRef.getValue())) { && !descOrSelfIsLeafSourceScan(innerBranchOperator, boundaryOperator)) { return false;
private boolean descOrSelfIsLeafSourceScan(ILogicalOperator op, ILogicalOperator bottomOp) { if (op == bottomOp) { return false; } if (op.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) { DataSourceScanOperator dataSourceScanOperator = (DataSourceScanOperator) op; return dataSourceScanOperator.getDataSource().isScanAccessPathALeaf(); } for (Mutable<ILogicalOperator> cRef : op.getInputs()) { if (descOrSelfIsLeafSourceScan(cRef.getValue(), bottomOp)) { return true; } } return false; }
/** * Unnest more complex structures. * * @return List of algebraic rewrite rules. */ public final static List<IAlgebraicRewriteRule> buildUnnestingRuleCollection() { List<IAlgebraicRewriteRule> xquery = new LinkedList<IAlgebraicRewriteRule>(); xquery.add(new PushSelectDownRule()); xquery.add(new SimpleUnnestToProductRule()); xquery.add(new ComplexUnnestToProductRule()); xquery.add(new ComplexJoinInferenceRule()); xquery.add(new PushSelectIntoJoinRule()); xquery.add(new IntroJoinInsideSubplanRule()); xquery.add(new PushMapOperatorDownThroughProductRule()); xquery.add(new PushSubplanWithAggregateDownThroughProductRule()); xquery.add(new IntroduceGroupByForSubplanRule()); xquery.add(new SubplanOutOfGroupRule()); xquery.add(new InsertOuterJoinRule()); xquery.add(new ExtractFunctionsFromJoinConditionRule()); xquery.add(new RemoveRedundantVariablesRule()); xquery.add(new RemoveUnusedAssignAndAggregateRule()); xquery.add(new FactorRedundantGroupAndDecorVarsRule()); xquery.add(new EliminateSubplanRule()); xquery.add(new EliminateGroupByEmptyKeyRule()); xquery.add(new PushSubplanIntoGroupByRule()); xquery.add(new NestedSubplanToJoinRule()); xquery.add(new EliminateSubplanWithInputCardinalityOneRule()); return xquery; }
condPushDownAndJoinInference.add(new RemoveRedundantListifyRule()); condPushDownAndJoinInference.add(new CancelUnnestWithNestedListifyRule()); condPushDownAndJoinInference.add(new SimpleUnnestToProductRule()); condPushDownAndJoinInference.add(new ComplexUnnestToProductRule()); condPushDownAndJoinInference.add(new DisjunctivePredicateToJoinRule());