diff --git a/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/IntroduceGroupByForSubplanRule.java b/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/IntroduceGroupByForSubplanRule.java index 67e8d42a3..34dde2a56 100644 --- a/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/IntroduceGroupByForSubplanRule.java +++ b/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/IntroduceGroupByForSubplanRule.java @@ -295,9 +295,11 @@ protected Set computeGbyVars(AbstractLogicalOperator op, Set all = new ArrayList(); VariableUtilities.getLiveVariables(op, all); all.retainAll(freeVars); - for (FunctionalDependency fd : fdList) { - if (fd.getTail().containsAll(all)) { - return new HashSet(fd.getHead()); + if (!all.isEmpty()) { + for (FunctionalDependency fd : fdList) { + if (fd.getTail().containsAll(all)) { + return new HashSet(fd.getHead()); + } } } return null; diff --git a/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughProductRule.java b/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughJoinRule.java similarity index 93% rename from algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughProductRule.java rename to algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughJoinRule.java index f3f0e0242..4ea2480a2 100644 --- a/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughProductRule.java +++ b/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/PushAssignDownThroughJoinRule.java @@ -34,7 +34,7 @@ import org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities; import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule; -public class PushAssignDownThroughProductRule implements IAlgebraicRewriteRule { +public class PushAssignDownThroughJoinRule implements IAlgebraicRewriteRule { @Override public boolean rewritePre(Mutable opRef, IOptimizationContext context) throws AlgebricksException { @@ -53,10 +53,10 @@ public boolean rewritePost(Mutable opRef, IOptimizationContext if (op2.getOperatorTag() != LogicalOperatorTag.INNERJOIN) { return false; } - AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2; - if (join.getCondition().getValue() != ConstantExpression.TRUE) { - return false; - } +// AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2; +// if (join.getCondition().getValue() != ConstantExpression.TRUE) { +// return false; +// } List used = new ArrayList(); VariableUtilities.getUsedVariables(op1, used);