@Test
public void testRVCExpressionWithOr2() 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 ('ABC', 'helo3', 3, 3)");
conn.commit();
conn.close();
conn = nextConnection(getUrl());
PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t WHERE pk2 = ? OR pk2 = ? AND (tenantId, pk2, pk3) > (?, ?, ?) LIMIT 100");
stmt.setString(1, "helo2");
stmt.setString(2, "helo3");
// 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));
}
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at org.apache.phoenix.end2end.RowValueConstructorIT.testRVCExpressionWithOr(RowValueConstructorIT.java:1310)