Github user dbwong commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/362#discussion_r225743277
  
    --- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java ---
    @@ -511,4 +513,122 @@ private void upsertRows(PhoenixConnection conn, 
String fullTableName) throws SQL
                 stmt.execute();
             }
         }
    +
    +    @Test public void testRVCWithDescAndAscendingPK() throws Exception {
    +        final Connection conn = DriverManager.getConnection(getUrl());
    +        String fullTableName = generateUniqueName();
    +        try (Statement stmt = conn.createStatement()) {
    +            stmt.execute("CREATE TABLE " + fullTableName + "(\n"
    +                    + "    ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "    
SCORE VARCHAR NOT NULL,\n"
    +                    + "    ENTITY_ID VARCHAR NOT NULL\n"
    +                    + "    CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n"
    +                    + "        ORGANIZATION_ID,\n" + "        SCORE 
DESC,\n" + "        ENTITY_ID\n"
    +                    + "    )\n" + ") MULTI_TENANT=TRUE");
    +        }
    +
    +        conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','c','1')");
    +        conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','b','3')");
    +        conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','b','4')");
    +        conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES ('org1','a','2')");
    +        conn.commit();
    +
    +        try (Statement stmt = conn.createStatement()) {
    +            final ResultSet
    +                    rs =
    +                    stmt.executeQuery("SELECT score, entity_id \n" + "FROM 
" + fullTableName + "\n"
    +                            + "WHERE organization_id = 'org1'\n"
    +                            + "AND (score, entity_id) < ('b', '4')\n"
    +                            + "ORDER BY score DESC, entity_id\n" + "LIMIT 
3");
    +            assertTrue(rs.next());
    +            assertEquals("b", rs.getString(1));
    +            assertEquals("3", rs.getString(2));
    +            assertTrue(rs.next());
    +            assertEquals("a", rs.getString(1));
    +            assertEquals("2", rs.getString(2));
    +            assertFalse(rs.next());
    +        }
    +    }
    +
    +    @Test public void testRVCOrderByDesc() throws Exception {
    --- End diff --
    
    Sure


---

Reply via email to