如何使用 Perl 的 Net::Cassandra::Easy 检索所有匹配行的所有列?
使用 Perl 的 Net::Cassandra::Easy 时,以下代码将从行 row[1-3]
中检索列 col[1-3]
>:
$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byname => ['col1', 'col2', 'col3');
相应的 SQL 为:
SELECT col1, col2, col3 FROM rows WHERE id IN ('row1', 'row2', 'row3');
假设我想检索所有列。在 SQL 术语中,这将是:
SELECT * FROM rows WHERE id IN ('row1', 'row2', 'row3');
获取我当前正在使用的所有列:
$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byoffset => { "count" => 1_000_000 });
只要列数不超过一百万,此方法就有效。虽然这有效,但我认为有一种更干净的方法可以做到这一点。有没有更清晰的方法来向 Cassandra 指定我想要检索匹配行的所有列?
When using Perl's Net::Cassandra::Easy
the following code will retrieve columns col[1-3]
from rows row[1-3]
:
$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byname => ['col1', 'col2', 'col3');
The corresponding SQL would be:
SELECT col1, col2, col3 FROM rows WHERE id IN ('row1', 'row2', 'row3');
Suppose instead that I want to retrieve all columns. In SQL terms that would be:
SELECT * FROM rows WHERE id IN ('row1', 'row2', 'row3');
To get all columns I am currently using:
$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', byoffset => { "count" => 1_000_000 });
This works as long as the number of columns does not exceed one million. While this works I'd assume that there is a cleaner way to do it. Is there any cleaner way to specify to Cassandra that I want to retrieve all columns for the matching rows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样
standard => ? 1
将强制 Net::Cassandra::Easy 使用与族中所有列匹配的切片谓词。How about
standard => 1
will force Net::Cassandra::Easy to use a slice predicate that matches all columns in the family.