Search code examples
uuidcassandra-0.7phpcassa

I cannot get TimeUUIDType with phpcassa


Noob here.

I have a super column family sorted by timeuuidtype which has a number of entries. I'm trying to perform a simple get function with phpcassa that wont work. I'm trying to return a specific value from a UTF8 sorted column within a TimeUUID sorted SC. The exact code works with a similar SC Family sorted by BytesType.

Here is the info on the scf I'm trying to get from which i previously entered via -cli.

ColumnFamily: testSCF (Super)
Columns sorted by: org.apache.cassandra.db.marshal.TimeUUIDType/org.apache.cassandra.db.marshal.UTF8Type

RowKey: TestKey
=> (super_column=48dd0330-5bd6-11e0-adc5-343960c1b6b8,
 (column=test, value=74657374, timestamp=1301603831288000))
=> (super_column=141a69b0-5c6e-11e0-bcce-343960c1b6b8,
 (column=new test, value=6e657774657374, timestamp=1301669004440000))

And here is the phpcassa script I'm using to retrieve the data.

<?php

require_once('.../connection.php');
require_once('.../columnfamily.php');

$conn = new Connection('siteRoot');

$scf = 'testSCF';
$key = 'testKey';
$super = '141a69b0-5c6e-11e0-bcce-343960c1b6b8';
$col = 'new test';

$entry = new ColumnFamily($conn, $scf);

$q = ($entry->get($key, $columns=array($super)));

echo $q[$super][$col];

?>

Also if I don't specify the SC like so.

$q = ($entry->get($key));
print_r($q);

It returns:

Array ( [HÝ0[Öà­Å49`Á¶¸] => Array ( [test] => test ) [i°\nà¼Î49`Á¶¸] => Array ( [new test] => newtest ) )

I know part of the issue might have been brought up in How do I insert a row with a TimeUUIDType column in Cassandra? But it didn't really help me as I presumably have accepted timeuuidtypes.

Thanks for any help guys.


Solution

  • Suppose I didn't try hard enough to begin with. The answer in fact was everything to do with the link.

    Appears that the -cli accepted what jbellis in the link describes as 32 byte representation of the timeUUID (141a69b0-5c6e-11e0-bcce-343960c1b6b8) when I inserted it. This confused me.

    It works fine when you 'get()' with the "raw" 16 byte form (HÝ0[Öà­Å49`Á¶¸).

    Cheers.