title: Cassandra - select query with token() function
body: <p>According to <a href="http://www.datastax.com/dev/blog/a-deep-look-to-the-cql-where-clause" rel="noreferrer">this</a> documentation, I was trying a select query with token() function in it, but it gives wrong results.</p>
  
  <p>I am using below cassandra version </p>
  
  <pre><code>[cqlsh 5.0.1 | Cassandra 2.2.5 | CQL spec 3.3.1 | Native protocol v4]
  </code></pre>
  
  <p>I was trying token query for below table - </p>
  
  <pre><code>CREATE TABLE price_key_test (
  objectid int,
  createdOn bigint,
  price int,
  foo text,
  PRIMARY KEY ((objectid, createdOn), price));
  </code></pre>
  
  <p>Inserted data --</p>
  
  <pre><code>insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,1000,100,'x');
  insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,2000,200,'x');
  insert into nasa.price_key_test (objectid,createdOn,price,foo) values (1,3000,300,'x');
  </code></pre>
  
  <p>Data in table --</p>
  
  <pre><code>        objectid | createdon | price | foo
      ----------+-----------+-------+-----
              1 |      3000 |   300 |   x
              1 |      2000 |   200 |   x
              1 |      1000 |   100 |   x
  </code></pre>
  
  <p>Select query is  --</p>
  
  <pre><code>select * from nasa.price_key_test where token(objectid,createdOn) &gt; token(1,1000) and token(objectid,createdOn) &lt; token(1,3000)
  </code></pre>
  
  <p>This query suppose to return row with createdOn 2000, but it returns zero rows.</p>
  
  <pre><code>                 objectid | createdon | price | foo
              ----------+-----------+-------+-----
  
              (0 rows)
  </code></pre>
  
  <p>According to my understanding, token(objectid,createdOn) > token(1,1000) and token(objectid,createdOn) &lt; token(1,3000) should select row with partition key with value 1 and 2000. </p>
  
  <p>Is my understanding correct? </p>