You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Samarth (JIRA)" <ji...@apache.org> on 2014/02/25 07:11:20 UTC

[jira] [Updated] (PHOENIX-73) Row value constructor doesn't work correctly for a table that has Column in DESC order in row key

     [ https://issues.apache.org/jira/browse/PHOENIX-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Samarth updated PHOENIX-73:
---------------------------

    Description: 
Steps to reproduce:

STEP 1
CREATE TABLE T (
COL1 CHAR(3), 
COL2 DATE, 
COL3 CHAR(3),
COL4 INTEGER CONSTRAINT PK PRIMARY KEY (COL1, COL2 DESC, COL3)
)

Step 2:
UPSERT INTO T (COL1, COL2, COL3) VALUES ('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def');
UPSERT INTO T (COL1, COL2, COL3) VALUES ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456');

Step3:
SELECT * FROM T WHERE COL1 = 'abc' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = 'def'
 
- returns the expected row. 

Similarly,

SELECT * FROM T WHERE COL1 = '123' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = '456'

returns the expected row. 

However, the below query doesn't return any rows. It should have returned the above two rows.

SELECT * FROM T WHERE (COL1, COL2, COL3) IN (('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def'), ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456'))


On removing DESC from the row key in CREATE TABLE statement, then the above query returns the two expected rows.



  was:
Steps to reproduce:

STEP 1
CREATE TABLE T (
COL1 CHAR(3), 
COL2 DATE, 
COL3 CHAR(3),
COL4 INTEGER CONSTRAINT PK PRIMARY KEY (COL1, COL2 DESC, COL3)
)

Step 2:
UPSERT INTO T (COL1, COL2, COL3) VALUES ('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def');
UPSERT INTO T (COL1, COL2, COL3) VALUES ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456');

Step3:
SELECT * FROM T WHERE COL1 = 'abc' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = 'def'
 
- returns the expected row. 

Similarly,

SELECT * FROM T WHERE COL1 = '123' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = '456'

returns the expected row. 

However, the below query doesn't return any rows. It should returned the above two rows.

SELECT * FROM T WHERE (COL1, COL2, COL3) IN (('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def'), ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456'))


If one removes DESC from the row key in CREATE TABLE statement, all the above 3 queries then return the expected rows. 




> Row value constructor doesn't work correctly for a table that has Column in DESC order in row key
> -------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-73
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-73
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 2.2.3, 3.0.0
>            Reporter: Samarth
>            Assignee: James Taylor
>
> Steps to reproduce:
> STEP 1
> CREATE TABLE T (
> COL1 CHAR(3), 
> COL2 DATE, 
> COL3 CHAR(3),
> COL4 INTEGER CONSTRAINT PK PRIMARY KEY (COL1, COL2 DESC, COL3)
> )
> Step 2:
> UPSERT INTO T (COL1, COL2, COL3) VALUES ('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def');
> UPSERT INTO T (COL1, COL2, COL3) VALUES ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456');
> Step3:
> SELECT * FROM T WHERE COL1 = 'abc' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = 'def'
>  
> - returns the expected row. 
> Similarly,
> SELECT * FROM T WHERE COL1 = '123' AND COL2 = to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S') AND COL3 = '456'
> returns the expected row. 
> However, the below query doesn't return any rows. It should have returned the above two rows.
> SELECT * FROM T WHERE (COL1, COL2, COL3) IN (('abc', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), 'def'), ('123', to_date('2014-02-24 20:49:39.959', 'yyyy-MM-dd HH:mm:ss.S'), '456'))
> On removing DESC from the row key in CREATE TABLE statement, then the above query returns the two expected rows.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)