Sha256: 989611fa1180f6f7df3c6e395b9569bfcec569889898e8e884be645af318e0d0
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 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! add_coprocessor! 'org.apache.hadoop.hbase.coprocessor.AggregateImplementation' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hbase-jruby-0.1.2-java | lib/hbase-jruby/scoped/aggregation.rb |