cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timo Nentwig <timo.nent...@toptarif.de>
Subject Re: cassandra-cli: where a and b (works) vs. where b and a (doesn't)
Date Tue, 18 Jan 2011 16:07:37 GMT

On Jan 18, 2011, at 12:05, Timo Nentwig wrote:

> 
> On Jan 18, 2011, at 12:02, Aaron Morton wrote:
> 
>> Does wrapping foo in single quotes help?
> 
> No.
> 
>> Also, does this help http://www.datastax.com/blog/whats-new-cassandra-07-secondary-indexes
> 
> Actually this doesn't even compile because addGtExpression expects a String type (?!).

This works as expected: 

 .addInsertion(now, cf, createColumn("rc", "a", SS, StringSerializer.get())).execute();

while this doesn't:

 .addInsertion(now, cf, createColumn("rc", 97, SS, IntegerSerializer.get())).execute();

The only difference is that the IntegerSerializer pads the byte array with zeros. Shouldn't
matter (?). But it does.

I dumped both versions to JSON and reimported them[*]. Same behavior. Then I manually removed
the trailing six zeros from the IntegerSerializer version and retried. Same behavior.

[*] BTW when reimporting the JSON data the secondary indices are not being recreated. I had
to remove the system keyspace and reimport the schema in order to trigger that...

> StringSerializer ss = StringSerializer.get();
> IndexedSlicesQuery<String, String, String> indexedSlicesQuery = HFactory.createIndexedSlicesQuery(keyspace,
ss, ss, ss);
> indexedSlicesQuery.setColumnNames("full_name", "birth_date", "state");
> indexedSlicesQuery.addGtExpression("birth_date", 1970L);
> indexedSlicesQuery.addEqualsExpression("state", "UT");
> indexedSlicesQuery.setColumnFamily("users");
> indexedSlicesQuery.setStartKey("");
> QueryResult<OrderedRows<String, String, String>> result = indexedSlicesQuery.execute();
> 
>> Aaron
>> 
>> On 18/01/2011, at 11:54 PM, Timo Nentwig <timo.nentwig@toptarif.de> wrote:
>> 
>>> I put a secondary index on rc (IntegerType) and user_agent (AsciiType).
>>> 
>>> Don't understand this bevahiour at all, can somebody explain?
>>> 
>>> [default@tracking] get crawler where user_agent=foo and rc=200;
>>> 
>>> 0 Row Returned.
>>> [default@tracking] get crawler where rc=200 and user_agent=foo;           
>>> -------------------
>>> RowKey: -??>2
>>> => (column=rc, value=200, timestamp=1295347760933000)
>>> => (column=url, value=http://www/0, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760915000)
>>> 
>>> 1 Row Returned.
>>> [default@tracking] get crawler where rc>199 and user_agent=foo;
>>> 
>>> 0 Row Returned.
>>> [default@tracking] get crawler where user_agent=foo; 
>>> -------------------
>>> RowKey: -??>7
>>> => (column=rc, value=207, timestamp=1295347760935000)
>>> => (column=url, value=http://www/8, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760917000)
>>> -------------------
>>> RowKey: -??>8
>>> => (column=rc, value=209, timestamp=1295347760935000)
>>> => (column=url, value=http://www/9, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760916000)
>>> -------------------
>>> RowKey: -??>5
>>> => (column=rc, value=201, timestamp=1295347760937000)
>>> => (column=url, value=http://www/2, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760916000)
>>> -------------------
>>> RowKey: -??>6
>>> => (column=rc, value=205, timestamp=1295347760935000)
>>> => (column=url, value=http://www/5, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760917000)
>>> -------------------
>>> RowKey: -??>2
>>> => (column=rc, value=200, timestamp=1295347760933000)
>>> => (column=url, value=http://www/0, timestamp=1295347760933000)
>>> => (column=user_agent, value=foo, timestamp=1295347760915000)
>>> 
>>> 5 Rows Returned.
>>> 
> 


Mime
View raw message