PHOENIX-1956 SELECT (FALSE OR FALSE) RETURNS TRUE
Conflicts:
phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.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 @@
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 @@
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);
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 @@
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 @@
Object result = context.getSubqueryResult(node.getSelectNode());
return LiteralExpression.newConstant(result);
}
-}
\ No newline at end of file
+}