You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2016/10/26 00:10:58 UTC
[jira] [Assigned] (PHOENIX-3382) Query using Row Value Constructor
comprised of non leading PK columns returns incorrect results
[ https://issues.apache.org/jira/browse/PHOENIX-3382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Taylor reassigned PHOENIX-3382:
-------------------------------------
Assignee: James Taylor
> Query using Row Value Constructor comprised of non leading PK columns returns incorrect results
> -----------------------------------------------------------------------------------------------
>
> Key: PHOENIX-3382
> URL: https://issues.apache.org/jira/browse/PHOENIX-3382
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.8.0
> Reporter: Joel Palmert
> Assignee: James Taylor
> Priority: Critical
> Attachments: PHOENIX-3382.patch, PHOENIX-3382_wip.patch
>
>
> I'm trying to use Row Value Constructors to do paging in a query in the below table:
> # TABLE #
> CREATE TABLE IF NOT EXISTS COMMUNITIES.TEST (
> ORGANIZATION_ID CHAR(15) NOT NULL,
> SCORE DOUBLE NOT NULL,
> ENTITY_ID CHAR(15) NOT NULL
> CONSTRAINT TEST_PK PRIMARY KEY (
> ORGANIZATION_ID,
> SCORE DESC,
> ENTITY_ID DESC
> )
> ) VERSIONS=1, MULTI_TENANT=TRUE, REPLICATION_SCOPE=1, TTL=43200
> UPSERT INTO COMMUNITIES.TEST VALUES ('org1',3,'01');
> UPSERT INTO COMMUNITIES.TEST VALUES ('org1',2,'04');
> UPSERT INTO COMMUNITIES.TEST VALUES ('org1',2,'03');
> UPSERT INTO COMMUNITIES.TEST VALUES ('org1',1,'02');
> # QUERY #
> SELECT entity_id, score
> FROM communities.test
> WHERE organization_id = 'org1'
> AND (score, entity_id) < (2, '04')
> ORDER BY score DESC, entity_id DESC
> LIMIT 3
> I'm specifying the score and entity_id of the second row so I'm expecting it to return the 2 last values (with id 03 and 02). However, it returns the 3 first values (and if it wasn't for the LIMIT 3 it would just return all).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)