You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2014/06/20 22:24:39 UTC
[03/32] git commit: DRILL-1006 : Fix case expression when conditions
are expression of nullable types.
DRILL-1006 : Fix case expression when conditions are expression of nullable types.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/c373a278
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/c373a278
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/c373a278
Branch: refs/heads/master
Commit: c373a278f637235e989787517416f141d42b2d29
Parents: 4205780
Author: Jinfeng Ni <jn...@maprtech.com>
Authored: Tue Jun 17 13:12:05 2014 -0700
Committer: Jinfeng Ni <jn...@maprtech.com>
Committed: Wed Jun 18 07:14:10 2014 -0700
----------------------------------------------------------------------
.../common/expression/visitors/ExpressionValidator.java | 6 +++---
.../org/apache/drill/exec/expr/EvaluationVisitor.java | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c373a278/common/src/main/java/org/apache/drill/common/expression/visitors/ExpressionValidator.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/visitors/ExpressionValidator.java b/common/src/main/java/org/apache/drill/common/expression/visitors/ExpressionValidator.java
index c8b7857..1bfb57d 100644
--- a/common/src/main/java/org/apache/drill/common/expression/visitors/ExpressionValidator.java
+++ b/common/src/main/java/org/apache/drill/common/expression/visitors/ExpressionValidator.java
@@ -78,14 +78,14 @@ public class ExpressionValidator implements ExprVisitor<Void, ErrorCollector, Ru
int i = 0;
for (IfCondition c : ifExpr.conditions) {
MajorType mt = c.condition.getMajorType();
- if (mt.getMode() != DataMode.REQUIRED || mt.getMinorType() != MinorType.BIT) {
+ if ( mt.getMinorType() != MinorType.BIT) {
errors
.addGeneralError(
c.condition.getPosition(),
String
.format(
- "Failure composing If Expression. All conditions must return a required value and be of type boolean. Condition %d was DatMode %s and Type %s.",
- i, mt.getMode(), mt.getMinorType()));
+ "Failure composing If Expression. All conditions must return a boolean type. Condition %d was of Type %s.",
+ i, mt.getMinorType()));
}
i++;
}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c373a278/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
index efc7259..d65e618 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
@@ -159,15 +159,15 @@ public class EvaluationVisitor {
HoldingContainer holdingContainer = c.condition.accept(this, generator);
if (jc == null) {
if (holdingContainer.isOptional()) {
- jc = conditionalBlock._if(holdingContainer.getIsSet().cand(holdingContainer.getValue()));
+ jc = conditionalBlock._if(holdingContainer.getIsSet().eq(JExpr.lit(1)).cand(holdingContainer.getValue().eq(JExpr.lit(1))));
} else {
jc = conditionalBlock._if(holdingContainer.getValue().eq(JExpr.lit(1)));
}
} else {
if (holdingContainer.isOptional()) {
- jc = jc._else()._if(holdingContainer.getIsSet().cand(holdingContainer.getValue()));
+ jc = jc._else()._if(holdingContainer.getIsSet().eq(JExpr.lit(1)).cand(holdingContainer.getValue().eq(JExpr.lit(1))));
} else {
- jc = jc._else()._if(holdingContainer.getValue());
+ jc = jc._else()._if(holdingContainer.getValue().eq(JExpr.lit(1)));
}
}
@@ -176,7 +176,7 @@ public class EvaluationVisitor {
JConditional newCond = jc._then()._if(thenExpr.getIsSet().ne(JExpr.lit(0)));
JBlock b = newCond._then();
b.assign(output.getHolder(), thenExpr.getHolder());
- b.assign(output.getIsSet(), thenExpr.getIsSet());
+ //b.assign(output.getIsSet(), thenExpr.getIsSet());
} else {
jc._then().assign(output.getHolder(), thenExpr.getHolder());
}
@@ -188,7 +188,7 @@ public class EvaluationVisitor {
JConditional newCond = jc._else()._if(elseExpr.getIsSet().ne(JExpr.lit(0)));
JBlock b = newCond._then();
b.assign(output.getHolder(), elseExpr.getHolder());
- b.assign(output.getIsSet(), elseExpr.getIsSet());
+ //b.assign(output.getIsSet(), elseExpr.getIsSet());
} else {
jc._else().assign(output.getHolder(), elseExpr.getHolder());
}