TException: A long is exactly 8 bytes #37

Closed
beiercai opened this Issue May 26, 2010 · 3 comments

Projects

None yet

2 participants

@beiercai

Maybe I'm missing something here, but I can't seem to save a column defined as LongType

              <ColumnFamily Name="MyTest"
                ColumnType="Super"
                CompareWith="LongType"
                KeyCached="0.1"
                CompareSubcolumnsWith="BytesType" />

Here is the PHP code:

if (!PandraCore::auto('192.168.1.1.')) {
die(PandraCore::$lastError);
}

//super column name is a timestamp, and compare with longtype, so column names are sorted by time
$superName = time();
$keyId = '101';
$cfName = 'testCF';
$sc = new PandraSuperColumn($superName, $keyId, $cfName);
$sc->setColumnFamilyName('MyTest');
$sc->addColumn('http://facebook.com')->setValue('37');
$sc->addColumn('http://google.com')->setValue('42');
$sc->save();

I got this error back:

Array
(
[0] => TException: A long is exactly 8 bytes
)

Does Pandra convert an integer to long type Thrift expects?

@mjpearson
Owner

No it's not implemented yet, but depending on your architecture it can be set via pack() ...

eg: 32-bit big-endian :
$time = pack("NN", time(), 0);

and then to extract, the converse 32-bit unpack...
$timeUnpacked = array_pop(unpack('N', $time));

http://au.php.net/manual/en/function.pack.php

Sorry there's not a patch yet for this.

@beiercai

Thanks, that worked!

Any plan to support it in the future? it's just a bit strange to deal with byte stream on a high layer.

@mjpearson
Owner

There will be a solution in place for the 0.3 release, it's currently only stubbed in the column container class

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment