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

Sylvain Lebresne updated CASSANDRA-5472:
----------------------------------------

    Attachment: 5472.txt

Attaching patch to fix. The main problem is that the selector was still using 
the AbstractType to check for type equality, so the ReversedType was messing 
things up. Fixed to use the CQL3 type instead as in other places. Other that 
that, the patch also adds toString() methods so that the error looks readable. 
                
> Timeuuid with CLUSTERING ORDER DESC cannot be used with the dateOf CQL3 
> function
> --------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5472
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5472
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.4
>            Reporter: Gareth Collins
>            Assignee: Sylvain Lebresne
>         Attachments: 5472.txt
>
>
> I originally raised this issue in the mailing lists:
> http://www.mail-archive.com/[email protected]/msg29185.html
> Here is what I tried:
> cqlsh:location> create table test_y (message_id timeuuid, name text,
> PRIMARY KEY (name,message_id));
> cqlsh:location> insert into test_y (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_y (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_y (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_y (message_id,name) VALUES (now(),'foo');
> cqlsh:location> select dateOf(message_id) from test_y;
>  dateOf(message_id)
> --------------------------
>  2013-04-13 00:33:42-0400
>  2013-04-13 00:33:43-0400
>  2013-04-13 00:33:43-0400
>  2013-04-13 00:33:44-0400
> cqlsh:location> create table test_x (message_id timeuuid, name text,
> PRIMARY KEY (name,message_id)) WITH CLUSTERING ORDER BY (message_id DESC);
> cqlsh:location> insert into test_x (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_x (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_x (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_x (message_id,name) VALUES (now(),'foo');
> cqlsh:location> insert into test_x (message_id,name) VALUES (now(),'foo');
> cqlsh:location> select dateOf(message_id) from test_x;
> Bad Request: Type error:
> org.apache.cassandra.cql3.statements.Selection$SimpleSelector@1e7318 cannot
> be passed as argument 0 of function dateof of type timeuuid
> It should be possible to use dateOf on message_id in table test_x

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to