简体   繁体   English

累计插入表中的行数

[英]count of rows inserted into a table in accumulo

I have inserted some rows into a table in Accumulo. 我已经在Accumulo中的表中插入了一些行。 Some rows are newly created and Some rows are updated. 有些行是新创建的,有些行是更新的。

How can I find the count of rows that were inserted or updated into an accumulo table in Java? 如何找到用Java累积表插入或更新的行数?

def obj= jsonObject["obj"]
for(entry in obj) {
                String a = entry["a"];
                String b = entry["b"];
                String c = entry["c"];
                String d = entry["d"];
                String e = entry["e"];

                ColumnVisibility cv = new ColumnVisibility(d);
                Mutation m = new Mutation(a);
                m.put(b, c, cv, e)
                bw.addMutation(m);
                count++;
            }

This is what is currently being done and the count is considered as the number of entries written into the table. 这是当前正在执行的操作,该计数被视为写入表中的条目数。 But if there are only some new entry/rows inserted and the others are to be updated, the count can't be considered as the new entries entered into the table 但是,如果仅插入一些新条目/行,并且要更新其他条目/行,则该计数不能视为将新条目输入表中

As of Accumulo 1.6.x (the latest, as of this post), there is no public API for getting the count of either rows or individual entries in a table. 截至Accumulo 1.6.x(此文章为最新版本)以来,没有公共API用于获取表中行或单个条目的计数。 If maintaining counts were a built-in feature, it would add a bit of overhead, and would be very difficult to implement, given that server-side iterators could change these counts during compactions. 如果维护计数是一项内置功能,则考虑到服务器端迭代器可以在压缩期间更改这些计数,这将增加一些开销,并且很难实现。

So, the best Accumulo provides is estimates of the number of entries in a table (only entries, not rows). 因此,Accumulo最好提供的是估算表中条目的数量(仅条目,而不是行)。

If row-counting is needed, that functionality must be added at the application layer. 如果需要行计数,则必须在应用程序层添加该功能。 Help may be available to do this on the user mailing list . 可以在用户邮件列表上找到帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM