Repository: phoenix
Updated Branches:
  refs/heads/4.3 89f4449f0 -> 9c283b97b


PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9c283b97
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9c283b97
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9c283b97

Branch: refs/heads/4.3
Commit: 9c283b97b741d01a757f0bdeb8b63feea909c62a
Parents: 89f4449
Author: James Taylor <[email protected]>
Authored: Fri May 8 13:13:44 2015 -0700
Committer: James Taylor <[email protected]>
Committed: Fri May 8 14:38:20 2015 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/EvaluationOfORIT.java     | 11 +++++++++++
 .../org/apache/phoenix/compile/ExpressionCompiler.java   |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9c283b97/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
index 5edf7e2..68ef81c 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/EvaluationOfORIT.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.end2end;
  
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.sql.Connection;
@@ -33,6 +34,16 @@ import org.junit.Test;
 
 public class EvaluationOfORIT extends BaseHBaseManagedTimeIT{
                
+    @Test
+    public void testFalseOrFalse() throws SQLException {
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        ResultSet rs = conn.createStatement().executeQuery("SELECT (FALSE OR 
FALSE) AS B FROM SYSTEM.CATALOG LIMIT 1");
+        assertTrue(rs.next());
+        assertFalse(rs.getBoolean(1));
+        conn.close();
+    }
+    
        @Test
        public void testPKOrNotPKInOREvaluation() throws SQLException {
            Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9c283b97/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
index f474772..0208a15 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
@@ -253,7 +253,7 @@ public class ExpressionCompiler extends 
UnsupportedAllParseNodeVisitor<Expressio
             determinism = determinism.combine(child.getDeterminism());
         }
         if (children.size() == 0) {
-            return LiteralExpression.newConstant(true, determinism);
+            return LiteralExpression.newConstant(false, determinism);
         }
         if (children.size() == 1) {
             return children.get(0);

Reply via email to