That was it. Thanks thobbs :-) The queries work as expected now.
-Adi On Thu, Mar 10, 2011 at 1:01 PM, Tyler Hobbs <ty...@datastax.com> wrote: > I looked again at the original > email<http://mail-archives.apache.org/mod_mbox//cassandra-user/201101.mbox/raw/%3CAANLkTik4Z_6OfvT4ByQ8_kpX_=thxyl39-bxwmqpc...@mail.gmail.com%3E/1>and > noticed that besides the bit-shift issue that gets corrected in the next > email in the thread, there is another problem. The long is being created in > little-endian order instead of big endian. > > Here's the fully correct way to pack a long: > > int64_t my_long = 12345678; > char chars[8]; > for(int i = 7; i >= 0; i--) { > chars[i] = my_long & 0xff; > my_long = my_long >> 8; > } > > std::string str_long(chars, 8); > > Column c1; > c1.name = str_long; > // etc ... > > > On Thu, Mar 10, 2011 at 11:05 AM, Adi <adi.pan...@gmail.com> wrote: > >> Environment: Cassandra 0.7.0 , C++ Thrift client on windows >> >> I have a column family with a secondary index >> ColumnFamily: Page >> Columns sorted by: org.apache.cassandra.db.marshal.BytesType >> Built indexes: [Page.index_domain, Page.index_content_size] >> Column Metadata: >> Column Name: domain (646f6d61696e) >> Validation Class: org.apache.cassandra.db.marshal.UTF8Type >> Index Name: index_domain >> Index Type: KEYS >> Column Name: original_content_size >> (6f726967696e616c5f636f6e74656e745f73697a65) >> Validation Class: org.apache.cassandra.db.marshal.LongType >> Index Name: index_content_size >> Index Type: KEYS >> >> As suggested by thobbs in an earlier posting I am sending the >> original_content_size as binary strings. I am able to write and read from >> the c++ client correctly. >> But on the cassandra-cli I am not able to see the values of >> original_content_size as longs. following are the results seen for a value 5 >> that was sent. >> >> get Page['test1234'][original_content_size]; >> => (column=6f726967696e616c5f636f6e74656e745f73697a65, >> value=360287970189639680, timestamp=1299773217120) >> >> get Page['test1234'][original_content_size] as bytes; >> => (column=6f726967696e616c5f636f6e74656e745f73697a65, >> value=0500000000000000, timestamp=1299773217120) >> >> Similarly the queries do not work as expected. Example get Page where >> domain = 'testabc.com' and original_content_size = 5; does not return the >> row that was inserted. >> >> Any suggestions on what I might be doing incorrectly either in schema >> definition or the way I am sending the values are welcome. >> >> -Adi >> >> > > -- > Tyler Hobbs > Software Engineer, DataStax <http://datastax.com/> > Maintainer of the pycassa <http://github.com/pycassa/pycassa> Cassandra > Python client library > >