thobbs / phpcassa

PHP client library for Apache Cassandra
thobbs.github.com/phpcassa
MIT License
248 stars 78 forks source link

Integers are blank when returned #85

Closed walkowicz closed 12 years ago

walkowicz commented 12 years ago

When i query the database after upgrading to cassandra 1.1 all my columns that have integers are returned with no data. I verified the data is there with CQL and opscenter.

For example if print_r the results a column will show:

[level_access] =>

when it shoud be:

[level_access] => 2

thobbs commented 12 years ago

What is the schema for this column family?

walkowicz commented 12 years ago

CREATE COLUMNFAMILY userdata ( username text PRIMARY KEY, level_access int, active int ) WITH comment='User Data' AND comparator=text AND read_repair_chance=0.100000 AND gc_grace_seconds=864000 AND default_validation=text AND min_compaction_threshold=4 AND max_compaction_threshold=32 AND replicate_on_write=True AND compaction_strategy_class='SizeTieredCompactionStrategy' AND compression_parameters:sstable_compression='org.apache.cassandra.io.compress.SnappyCompressor';

thobbs commented 12 years ago

CQL's int type corresponds Int32Type, which is different from IntegerType and not yet supported by phpcassa. Adding support for that should resolve the issue.

walkowicz commented 12 years ago

What CQL datatype should I use that would be compatible?

thobbs commented 12 years ago

The varint (arbitrary-precision integer) type should be compatible. I should be able to get Int32Type support added shortly, so you may just want to wait for that.

walkowicz commented 12 years ago

great, thank you!

walkowicz commented 12 years ago

If i understand correctly varinit can't have a negative number is that correct?

thobbs commented 12 years ago

I can. It's modeled after Java's BigInteger.

thobbs commented 12 years ago

Alright, Int32Type support is in, so take your pick. If you're dealing with small numbers, varint will save you a few bytes.