[ 
https://issues.apache.org/jira/browse/PHOENIX-4845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17054216#comment-17054216
 ] 

Hadoop QA commented on PHOENIX-4845:
------------------------------------

{color:red}-1 overall{color}.  Here are the results of testing the latest 
attachment 
  http://issues.apache.org/jira/secure/attachment/12996011/PHOENIX-4845.patch
  against master branch at commit ba2af47436a6b4ed3c2d633752b663893fe460c5.
  ATTACHMENT ID: 12996011

    {color:green}+1 @author{color}.  The patch does not contain any @author 
tags.

    {color:green}+1 tests included{color}.  The patch appears to include 36 new 
or modified tests.

    {color:green}+1 javac{color}.  The applied patch does not increase the 
total number of javac compiler warnings.

    {color:green}+1 release audit{color}.  The applied patch does not increase 
the total number of release audit warnings.

    {color:red}-1 lineLengths{color}.  The patch introduces the following lines 
longer than 100:
    +    private static final String SIMPLE_DDL = "CREATE TABLE %s (t_id 
VARCHAR NOT NULL,\n" + "k1 INTEGER NOT NULL,\n"
+    private static final String DATA_DDL = "CREATE TABLE %s (k1 TINYINT NOT 
NULL,\n" + "k2 TINYINT NOT NULL,\n"
+            + "k3 TINYINT NOT NULL,\n" + "v1 INTEGER,\n" + "CONSTRAINT pk 
PRIMARY KEY (k1, k2, k3)) ";
+        String createIndex = "CREATE INDEX IF NOT EXISTS " + INDEX_NAME + " ON 
" + TABLE_NAME + " (k2 DESC,k1)";
+        String createDataIndex = "CREATE INDEX IF NOT EXISTS " + 
DATA_INDEX_NAME + " ON " + DATA_TABLE_NAME
+        String failureSql = String.format("SELECT %s FROM %s ORDER BY t_id 
DESC, k1, k2 OFFSET (%s)=(%s)",
+        String failureSql = String.format("SELECT T1.k1,T2.k2 FROM %s AS T1, 
%s AS T2 WHERE T1.t_id=T2.t_id OFFSET (T1.t_id, T1.k1, T1.k2)=('a', 1, 2)",
+        String failureSql = String.format("SELECT B.k2 FROM (SELECT %s FROM %s 
OFFSET (%s)=(%s)) AS B",
+        //Note subselect often gets rewritten to a flat query, in this case 
offset is still viable, inner orderby should require failure
+        String failureSql = String.format("SELECT * FROM (SELECT T_ID,K1,K2 AS 
COL3 FROM %s ORDER BY K1 LIMIT 2) AS B OFFSET (%s)=(%s)",

     {color:red}-1 core tests{color}.  The patch failed these unit tests:
     
./phoenix-core/target/failsafe-reports/TEST-org.apache.phoenix.end2end.DropTableWithViewsIT

Test results: 
https://builds.apache.org/job/PreCommit-PHOENIX-Build/3549//testReport/
Console output: 
https://builds.apache.org/job/PreCommit-PHOENIX-Build/3549//console

This message is automatically generated.

> Support using Row Value Constructors in OFFSET clause for paging in tables 
> where the sort order of PK columns varies
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4845
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4845
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Thomas D'Silva
>            Assignee: Daniel Wong
>            Priority: Major
>              Labels: DESC, SFDC
>         Attachments: PHOENIX-4845-4.x-HBase-1.3.patch, 
> PHOENIX-4845-4.x-HBase-1.3.v2.patch, PHOENIX-4845-4.x-HBase-1.3.v3.patch, 
> PHOENIX-4845.patch, PHOENIX-offset.txt
>
>          Time Spent: 16h 10m
>  Remaining Estimate: 0h
>
> RVCs along with the LIMIT clause are useful for efficiently paging through 
> rows (see [http://phoenix.apache.org/paged.html]). This works well if the pk 
> columns are sorted ascending, we can always use the > operator to query for 
> the next batch of row.
> However if the PK of a table is (A  DESC, B DESC) we cannot use the following 
> query to page through the data
> {code:java}
> SELECT * FROM TABLE WHERE (A, B) > (?, ?) ORDER BY A DESC, B DESC LIMIT 20
> {code}
> Since the rows are sorted by A desc and then by B descending we need change 
> the comparison order
> {code:java}
> SELECT * FROM TABLE WHERE (A, B) < (?, ?) ORDER BY A DESC, B DESC LIMIT 20
> {code}
> If the PK of a table contains columns with mixed sort order for eg (A  DESC, 
> B) then we cannot use RVC to page through data.
> If we supported using RVCs in the offset clause we could use the offset to 
> set the start row of the scan. Clients would not have to have logic to 
> determine the comparison operator. This would also support paging through 
> data for tables where the PK columns are sorted in mixed order.
> {code:java}
> SELECT * FROM TABLE ORDER BY A DESC, B LIMIT 20 OFFSET (?,?)
> {code}
> We would only allow using the offset if the rows are ordered by the sort 
> order of the PK columns of and Index or Primary Table.
> Note that there is some care is needed in the use of OFFSET with indexes.  If 
> the OFFSET is coercible to multiple indexes/base table it could mean very 
> different positions based on key.  To Handle This the INDEX hint needs to be 
> used to specify an index offset for safety.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to