phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject phoenix git commit: PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE
Date Fri, 08 May 2015 21:46:19 GMT
Repository: phoenix
Updated Branches:
  refs/heads/3.2 acbfea4b8 -> 0df4dd2ee


PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE

Conflicts:

	phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java


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

Branch: refs/heads/3.2
Commit: 0df4dd2ee6f658f67bb627ce6805c0ee9cf2e504
Parents: acbfea4
Author: James Taylor <jtaylor@salesforce.com>
Authored: Fri May 8 13:13:44 2015 -0700
Committer: James Taylor <jamestaylor@apache.org>
Committed: Fri May 8 14:45:29 2015 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/EvaluationOfORIT.java     | 11 +++++++++++
 .../org/apache/phoenix/compile/ExpressionCompiler.java   |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0df4dd2e/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/0df4dd2e/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 409950c..4ee261b 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
@@ -236,7 +236,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);
@@ -1240,4 +1240,4 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitor<Expressio
         Object result = context.getSubqueryResult(node.getSelectNode());
         return LiteralExpression.newConstant(result);
     }
-}
\ No newline at end of file
+}


Mime
View raw message