Hello!
I'm trying to implement schema of Twitter pointed in
http://blog.evanweaver.com/articles/2009/07/06/up-and-running-with-cassandra/ to
play and make experiments with Cassandra. That schema and code was developed for
Cassandra-0.3 and I'm trying to modify it to work with last Cassandra version.
I'm using Perl client generated by Thrift-r796538.
So, related fragments from storage-conf.xml:
<Keyspace Name="Twitter">
<KeysCachedFraction>0.01</KeysCachedFraction>
<ColumnFamily CompareWith="AsciiType" Name="Statuses" />
<ColumnFamily CompareWith="AsciiType" Name="Users" />
<ColumnFamily ColumnType="Super" CompareWith="AsciiType"
CompareSubcolumnsWith="AsciiType" Name="UserRelationships" />
</Keyspace>
Keyspace 'Twitter' is a second keyspace, first one is a default 'Keyspace1'
Fragments of code:
$result = $client->get_slice(
'Twitter',
$uid,
Cassandra::ColumnParent->new({
column_family=>'UserRelationships',
super_column=>'user_timeline',
}),
Cassandra::SlicePredicate->new({
#column_names=>['user_timeline'],
slice_range=>Cassandra::SliceRange->new({
reversed=>0,
count=>3
})
}),
Cassandra::ConsistencyLevel::ONE
);
It produces following error messages
$VAR1 = 'Can\'t use string ("0") as a SCALAR ref while "strict refs" in use at
/usr/lib/perl5/site_perl/5.8.8/Thrift/BinaryProtocol.pm line 376.'
If 'user_timeline' is moving to SlicePredicate (it's commented out in code
above) then get_slice returns all columns in super column. But I'd like to get
only 3 results...
With 0.3 version equivalent query works well:
$result = $client->get_slice(
'Twitter',
$uid,
'UserRelationships:user_timeline',
0, 3
);
What am I doing wrong? Thank you very much!
PS The same was in apache-cassandra-incubating-2009-08-17_13-23-14 snapshot too,
but I don't know about other versions/snapshot
--
Teodor Sigaev E-mail: [email protected]
WWW: http://www.sigaev.ru/