You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Cesar Lopez-Nataren (JIRA)" <ji...@apache.org> on 2012/11/09 02:14:12 UTC

[jira] [Created] (CASSANDRA-4936) Less than operator when comparing timeuuids behaves as less than equal.

Cesar Lopez-Nataren created CASSANDRA-4936:
----------------------------------------------

             Summary: Less than operator when comparing timeuuids behaves as less than equal.
                 Key: CASSANDRA-4936
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4936
             Project: Cassandra
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.1.6
         Environment: Linux CentOS.

Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
            Reporter: Cesar Lopez-Nataren


If we define the following column family using CQL3:

CREATE TABLE useractivity (
  user_id int,
  activity_id 'TimeUUIDType',
  data text,
  PRIMARY KEY (user_id, activity_id)
);

Add some values to it.

And then query it like:

SELECT * FROM useractivity WHERE user_id = '3' AND activity_id < '2012-11-07 18:18:22-0800' ORDER BY activity_id DESC LIMIT 1;

the record with timeuuid '2012-11-07 18:18:22-0800' returns in the results.

According to the documentation, on CQL3 the '<' and '>' operators are strict, meaning not inclusive, so this seems to be a bug.

--
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

[jira] [Commented] (CASSANDRA-4936) Less than operator when comparing timeuuids behaves as less than equal.

Posted by "Sylvain Lebresne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493788#comment-13493788 ] 

Sylvain Lebresne commented on CASSANDRA-4936:
---------------------------------------------

This reminds me, I think that at the minimum we should provide a cqlsh option to display timeuuid as UUID rather than date. Otherwise it's painful to even check that the actual UUID differs. Though tbh I'm still not sure using dates by default is the best idea given this is a lossy representation and I'm afraid will confuse more people not used to type 1 UUID than anything else. Unless of course we adopt of the the format discussed in CASSANDRA-4284 (alternatively, we could just display the date *and* the uuid in parenthesis, though it'll be verbose). 
                
> Less than operator when comparing timeuuids behaves as less than equal.
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-4936
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4936
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.6
>         Environment: Linux CentOS.
> Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
>            Reporter: Cesar Lopez-Nataren
>
> If we define the following column family using CQL3:
> CREATE TABLE useractivity (
>   user_id int,
>   activity_id 'TimeUUIDType',
>   data text,
>   PRIMARY KEY (user_id, activity_id)
> );
> Add some values to it.
> And then query it like:
> SELECT * FROM useractivity WHERE user_id = '3' AND activity_id < '2012-11-07 18:18:22-0800' ORDER BY activity_id DESC LIMIT 1;
> the record with timeuuid '2012-11-07 18:18:22-0800' returns in the results.
> According to the documentation, on CQL3 the '<' and '>' operators are strict, meaning not inclusive, so this seems to be a bug.

--
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

[jira] [Commented] (CASSANDRA-4936) Less than operator when comparing timeuuids behaves as less than equal.

Posted by "Cesar Lopez-Nataren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494229#comment-13494229 ] 

Cesar Lopez-Nataren commented on CASSANDRA-4936:
------------------------------------------------

Jonathan: What's the easiest way to find that out?
                
> Less than operator when comparing timeuuids behaves as less than equal.
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-4936
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4936
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.6
>         Environment: Linux CentOS.
> Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
>            Reporter: Cesar Lopez-Nataren
>
> If we define the following column family using CQL3:
> CREATE TABLE useractivity (
>   user_id int,
>   activity_id 'TimeUUIDType',
>   data text,
>   PRIMARY KEY (user_id, activity_id)
> );
> Add some values to it.
> And then query it like:
> SELECT * FROM useractivity WHERE user_id = '3' AND activity_id < '2012-11-07 18:18:22-0800' ORDER BY activity_id DESC LIMIT 1;
> the record with timeuuid '2012-11-07 18:18:22-0800' returns in the results.
> According to the documentation, on CQL3 the '<' and '>' operators are strict, meaning not inclusive, so this seems to be a bug.

--
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

[jira] [Commented] (CASSANDRA-4936) Less than operator when comparing timeuuids behaves as less than equal.

Posted by "Tyler Hobbs (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494449#comment-13494449 ] 

Tyler Hobbs commented on CASSANDRA-4936:
----------------------------------------

bq. Are you sure the UUIDs do not differ in their non-time-based component?

(Note: I suggested that Cesar open this ticket.)  It almost certainly is a problem with the non-time-based component.  However, the intention of the user is pretty clear for this query: select anything where the timestamp component is less than the provided one.

I've been handling this specially in pycassa for quite a while.  If the comparator is TimeUUID, and a datetime/timestamp is passed as a slice end, it will create a TimeUUID with special non-timestamp components.  For example, since slice ends are inclusive in the thrift api, when creating the TimeUUID for the slice 'finish', the highest possible TimeUUID with the given timestamp will be used.

We could do something similar with CQL, it would just require passing along information about whether to create the highest or lowest TimeUUID representation for a given datestamp based on the comparison operator that's used.

If details about what non-timestamp components pycassa uses would be useful, let me know.
                
> Less than operator when comparing timeuuids behaves as less than equal.
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-4936
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4936
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.6
>         Environment: Linux CentOS.
> Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
>            Reporter: Cesar Lopez-Nataren
>
> If we define the following column family using CQL3:
> CREATE TABLE useractivity (
>   user_id int,
>   activity_id 'TimeUUIDType',
>   data text,
>   PRIMARY KEY (user_id, activity_id)
> );
> Add some values to it.
> And then query it like:
> SELECT * FROM useractivity WHERE user_id = '3' AND activity_id < '2012-11-07 18:18:22-0800' ORDER BY activity_id DESC LIMIT 1;
> the record with timeuuid '2012-11-07 18:18:22-0800' returns in the results.
> According to the documentation, on CQL3 the '<' and '>' operators are strict, meaning not inclusive, so this seems to be a bug.

--
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

[jira] [Commented] (CASSANDRA-4936) Less than operator when comparing timeuuids behaves as less than equal.

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493672#comment-13493672 ] 

Jonathan Ellis commented on CASSANDRA-4936:
-------------------------------------------

Are you sure the UUIDs do not differ in their non-time-based component?  See CASSANDRA-4284.
                
> Less than operator when comparing timeuuids behaves as less than equal.
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-4936
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4936
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.6
>         Environment: Linux CentOS.
> Linux localhost.localdomain 2.6.18-308.16.1.el5 #1 SMP Tue Oct 2 22:01:37 EDT 2012 i686 i686 i386 GNU/Linux
>            Reporter: Cesar Lopez-Nataren
>
> If we define the following column family using CQL3:
> CREATE TABLE useractivity (
>   user_id int,
>   activity_id 'TimeUUIDType',
>   data text,
>   PRIMARY KEY (user_id, activity_id)
> );
> Add some values to it.
> And then query it like:
> SELECT * FROM useractivity WHERE user_id = '3' AND activity_id < '2012-11-07 18:18:22-0800' ORDER BY activity_id DESC LIMIT 1;
> the record with timeuuid '2012-11-07 18:18:22-0800' returns in the results.
> According to the documentation, on CQL3 the '<' and '>' operators are strict, meaning not inclusive, so this seems to be a bug.

--
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