如何使用 Perl 的 Net::Cassandra::Easy 检索所有匹配行的所有列?

发布于 2024-08-25 23:36:32 字数 747 浏览 14 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恋你朝朝暮暮 2024-09-01 23:36:32

怎么样

$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', standard => 1);

standard => ? 1 将强制 Net::Cassandra::Easy 使用与族中所有列匹配的切片谓词。

How about

$result = $cassandra->get(['row1', 'row2', 'row3'], family => 'Standard1', standard => 1);

standard => 1 will force Net::Cassandra::Easy to use a slice predicate that matches all columns in the family.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文