From 6ad14f3c73cb5689f623350dbeaf453452c4babc Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 25 Apr 2011 22:02:24 +0000 Subject: [PATCH] HBASE-1512 Coprocessors: Support aggregate functions git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1096620 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../client/coprocessor/AggregationClient.java | 362 ++++++++ .../coprocessor/LongColumnInterpreter.java | 106 +++ .../coprocessor/AggregateImplementation.java | 224 +++++ .../hbase/coprocessor/AggregateProtocol.java | 129 +++ .../hbase/coprocessor/ColumnInterpreter.java | 118 +++ .../coprocessor/TestAggregateProtocol.java | 785 ++++++++++++++++++ 7 files changed, 1725 insertions(+) create mode 100644 src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java create mode 100644 src/main/java/org/apache/hadoop/hbase/client/coprocessor/LongColumnInterpreter.java create mode 100644 src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java create mode 100644 src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateProtocol.java create mode 100644 src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java create mode 100644 src/test/java/org/apache/hadoop/hbase/coprocessor/TestAggregateProtocol.java diff --git a/CHANGES.txt b/CHANGES.txt index 50ae9659db3..2f70c970fe9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -185,6 +185,7 @@ Release 0.91.0 - Unreleased HBASE-3798 [REST] Allow representation to elide row key and column key HBASE-3812 Tidy up naming consistency and documentation in coprocessor framework (Mingjie Lai) + HBASE-1512 Support aggregate functions (Himanshu Vashishtha) TASKS HBASE-3559 Move report of split to master OFF the heartbeat channel diff --git a/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java b/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java new file mode 100644 index 00000000000..3aa9e76530d --- /dev/null +++ b/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java @@ -0,0 +1,362 @@ +/* + * Copyright 2011 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hbase.client.coprocessor; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.client.HTable; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.coprocessor.AggregateProtocol; +import org.apache.hadoop.hbase.coprocessor.ColumnInterpreter; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.util.Pair; + +/** + * This client class is for invoking the aggregate functions deployed on the + * Region Server side via the AggregateProtocol. This class will implement the + * supporting functionality for summing/processing the individual results + * obtained from the AggregateProtocol for each region. + *

+ * This will serve as the client side handler for invoking the aggregate + * functions. + *