Description
Test that can be added in RowValueConstructorIT
@Test public void testRVCExpressionWithOr() throws Exception { String tableDDL = "CREATE TABLE t (tenantId char(15) NOT NULL, pk2 char(15) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key (tenantId,pk2,pk3))"; createTestTable(getUrl(), tableDDL, null, nextTimestamp()); Connection conn = nextConnection(getUrl()); conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1) values ('ABC', 'helo1', 1, 1)"); conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1) values ('ABC', 'helo2', 2, 2)"); conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1) values ('DEF', 'helo3', 3, 3)"); conn.commit(); conn.close(); conn = nextConnection(getUrl()); PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t WHERE (tenantId = ? OR tenantId = ?) AND (tenantId, pk2, pk3) > (?, ?, ?) LIMIT 100"); stmt.setString(1, "ABC"); stmt.setString(2, "DEF"); // give back all rows after row 1 - ABC|helo1|1 stmt.setString(3, "ABC"); stmt.setString(4, "helo1"); stmt.setInt(5, 1); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertEquals("helo2", rs.getString(1)); assertEquals(2, rs.getInt(2)); assertTrue(rs.next()); assertEquals("helo3", rs.getString(1)); assertEquals(3, rs.getInt(2)); } Stacktrace: java.lang.NullPointerException at org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.orKeySlots(WhereOptimizer.java:706) at org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.visitLeave(WhereOptimizer.java:836) at org.apache.phoenix.compile.WhereOptimizer$KeyExpressionVisitor.visitLeave(WhereOptimizer.java:1) at org.apache.phoenix.expression.OrExpression.accept(OrExpression.java:59) at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:122) at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:142) at org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:96) at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:375) at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:139) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:311) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:1) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:215) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:1) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:210) at org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeQuery(PhoenixPreparedStatement.java:183) at org.apache.phoenix.end2end.RowValueConstructorIT.testRVCExpressionWithOr(RowValueConstructorIT.java:1306)
Attachments
Attachments
Issue Links
- is duplicated by
-
PHOENIX-1398 RVC combined with OR on a row key column that is not the first column in row key doesn't return all rows
- Resolved