dbwong commented on a change in pull request #515: PHOENIX-5318 Slots passed to
SkipScan filter is incorrect for desc pr…
URL: https://github.com/apache/phoenix/pull/515#discussion_r291678726
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
##########
@@ -584,4 +585,52 @@ public void testSkipScanJoinOptimization() throws
Exception {
assertTrue(rs.next());
}
}
+
+ @Test
+ public void testOrWithMixedOrderPKs() throws Exception {
+ String tableName = generateUniqueName();
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ conn.setAutoCommit(true);
+ Statement stmt = conn.createStatement();
+
+ stmt.execute("CREATE TABLE " + tableName +
+ " (COL1 VARCHAR, COL2 VARCHAR CONSTRAINT PK PRIMARY KEY
(COL1 DESC, COL2)) ");
+
+ // this is the order the rows will be stored on disk
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('8', 'a')");
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('6', 'a')");
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('23', 'b')");
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('23', 'bb')");
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('2', 'a')");
+ stmt.execute("UPSERT INTO " + tableName + " (COL1, COL2) VALUES
('17', 'a')");
+
+
+ // test values in the skip scan filter which are prefixes of
another value, eg 1,12 and 2,23
+ String sql = "select COL1, COL2 from " + tableName + " where
COL1='1' OR COL1='2' OR COL1='3' OR COL1='4' " +
+ "OR COL1='5' OR COL1='6' OR COL1='8' OR COL1='17' OR
COL1='12' OR COL1='23'";
+
+
+ ResultSet rs = stmt.executeQuery(sql);
+ assertTrue(rs.next());
+ QueryPlan plan =
stmt.unwrap(PhoenixStatement.class).getQueryPlan();
Review comment:
nit: We don't seem to use the plan for anything remove?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services