virajjasani commented on code in PR #6656:
URL: https://github.com/apache/hbase/pull/6656#discussion_r1942259652
##########
hbase-shell/src/main/ruby/hbase/table.rb:
##########
@@ -321,24 +321,21 @@ def _append_internal(row, column, value, args = {})
def _count_internal(interval = 1000, scan = nil, cacheBlocks=false)
raise(ArgumentError, 'Scan argument should be
org.apache.hadoop.hbase.client.Scan') \
unless scan.nil? || scan.is_a?(org.apache.hadoop.hbase.client.Scan)
- # We can safely set scanner caching with the first key only filter
- if scan.nil?
- scan = org.apache.hadoop.hbase.client.Scan.new
- scan.setCacheBlocks(cacheBlocks)
- scan.setCaching(10)
- scan.setFilter(org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter.new)
- else
- scan.setCacheBlocks(cacheBlocks)
- filter = scan.getFilter
- firstKeyOnlyFilter =
org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter.new
- if filter.nil?
- scan.setFilter(firstKeyOnlyFilter)
- else
- firstKeyOnlyFilter.setReversed(filter.isReversed)
- scan.setFilter(org.apache.hadoop.hbase.filter.FilterList.new(filter,
firstKeyOnlyFilter))
- end
+ scan ||= org.apache.hadoop.hbase.client.Scan.new
+ scan.setCacheBlocks(cacheBlocks)
+
+ # Optimize counting by using FirstKeyOnlyFilter and KeyOnlyFilter
+ filters = [
+ org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter.new,
+ org.apache.hadoop.hbase.filter.KeyOnlyFilter.new
Review Comment:
Why not only use KeyOnlyFilter? Do we need FirstKeyOnlyFilter too if we
already get perf improvement for large cells with just KeyOnlyFilter?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]