diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java index 2db0e7a..ce174d2 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/AggregationClient.java @@ -132,8 +132,8 @@ public class AggregationClient { } if (response.getFirstPartCount() > 0) { ByteString b = response.getFirstPart(0); - Q q = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 3, b); - return ci.getCellValueFromProto(q); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 3, b); + return ci.getCellValueFromProto(m); } return null; } @@ -205,8 +205,8 @@ public class AggregationClient { } if (response.getFirstPartCount() > 0) { ByteString b = response.getFirstPart(0); - Q q = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 3, b); - return ci.getCellValueFromProto(q); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 3, b); + return ci.getCellValueFromProto(m); } return null; } @@ -325,8 +325,8 @@ public class AggregationClient { return null; } ByteString b = response.getFirstPart(0); - T t = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); - S s = ci.getPromotedValueFromProto(t); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); + S s = ci.getPromotedValueFromProto(m); return s; } }, sumCallBack); @@ -387,8 +387,8 @@ public class AggregationClient { return pair; } ByteString b = response.getFirstPart(0); - T t = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); - S s = ci.getPromotedValueFromProto(t); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); + S s = ci.getPromotedValueFromProto(m); pair.setFirst(s); ByteBuffer bb = ByteBuffer.allocate(8).put( getBytesFromResponse(response.getSecondPart())); @@ -486,8 +486,8 @@ public class AggregationClient { List list = new ArrayList(); for (int i = 0; i < response.getFirstPartCount(); i++) { ByteString b = response.getFirstPart(i); - T t = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); - S s = ci.getPromotedValueFromProto(t); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); + S s = ci.getPromotedValueFromProto(m); list.add(s); } pair.setFirst(list); @@ -588,8 +588,8 @@ public class AggregationClient { List list = new ArrayList(); for (int i = 0; i < response.getFirstPartCount(); i++) { ByteString b = response.getFirstPart(i); - T t = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); - S s = ci.getPromotedValueFromProto(t); + Message m = ProtobufUtil.getParsedGenericInstance(ci.getClass(), 4, b); + S s = ci.getPromotedValueFromProto(m); list.add(s); } return list; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java index 32edb69..9236be3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java @@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg; import org.apache.hadoop.hbase.util.Bytes; import com.google.protobuf.ByteString; +import com.google.protobuf.Message; /** * ColumnInterpreter for doing Aggregation's with BigDecimal columns. This class diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java index 204bd53..da8e953 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/coprocessor/ColumnInterpreter.java @@ -23,7 +23,6 @@ import com.google.protobuf.Message; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.KeyValue; -import org.apache.hadoop.hbase.client.coprocessor.LongColumnInterpreter; import java.io.IOException; @@ -149,10 +148,10 @@ Q extends Message, R extends Message> { /** * This method gets the PB message corresponding to the cell type - * @param q + * @param m * @return the cell-type instance from the PB message */ - public abstract T getCellValueFromProto(Q q); + public abstract T getCellValueFromProto(Message m); /** * This method gets the PB message corresponding to the promoted type @@ -163,10 +162,10 @@ Q extends Message, R extends Message> { /** * This method gets the promoted type from the proto message - * @param r + * @param m * @return the promoted-type instance from the PB message */ - public abstract S getPromotedValueFromProto(R r); + public abstract S getPromotedValueFromProto(Message m); /** * The response message comes as type S. This will convert/cast it to T. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index 3b826b0..552a4c2 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -1975,16 +1975,15 @@ public final class ProtobufUtil { * @throws IOException */ @SuppressWarnings("unchecked") - public static - T getParsedGenericInstance(Class runtimeClass, int position, ByteString b) + public static Message getParsedGenericInstance(Class runtimeClass, int position, ByteString b) throws IOException { Type type = runtimeClass.getGenericSuperclass(); Type argType = ((ParameterizedType)type).getActualTypeArguments()[position]; - Class classType = (Class)argType; - T inst; + Class classType = (Class)argType; + Message inst; try { Method m = classType.getMethod("parseFrom", ByteString.class); - inst = (T)m.invoke(null, b); + inst = (Message)m.invoke(null, b); return inst; } catch (SecurityException e) { throw new IOException(e);