Sha256: c4e2b32df0c6a7dbd97d022e7b7db99e4f6b5daa9a46f71ce30539560aa9dda2
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
class HBase class Scoped # Basic data aggregation with coprocessor based on AggregateImplementation # @author Junegunn Choi <junegunn.c@gmail.com> module Aggregation module Admin # Enables aggregation support for the table # @return [nil] def enable_aggregation! cpc = 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation' add_coprocessor! cpc unless has_coprocessor?(cpc) end end # Performs aggregation with coprocessor # @param [Symbol] op Aggregation type: :sum, :min, :max, :avg, :std, :row_count # @param [Symbol, org.apache.hadoop.hbase.coprocessor.ColumnInterpreter] type # Column type (only :fixnum is supported as of now) or ColumnInterpreter object used to decode the value def aggregate op, type = :fixnum aggregation_impl op, type end private def aggregation_impl method, type raise ArgumentError.new("No column specified") if method != :row_count && @project.empty? @aggregation_client ||= AggregationClient.new(table.config) @aggregation_client.send( method, Util.to_bytes(table.name), column_interpreter_for(type), filtered_scan) end def column_interpreter_for type case type when :fixnum, :int, :integer LongColumnInterpreter.new when org.apache.hadoop.hbase.coprocessor.ColumnInterpreter type else raise ArgumentError, "Column interpreter for #{type} not implemented." end end end#Aggregation end#Scoped end#HBase
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hbase-jruby-0.1.4-java | lib/hbase-jruby/scoped/aggregation.rb |
hbase-jruby-0.1.3-java | lib/hbase-jruby/scoped/aggregation.rb |