[ 
https://issues.apache.org/jira/browse/HBASE-7641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13585384#comment-13585384
 ] 

Julian Wissmann commented on HBASE-7641:
----------------------------------------

Hi,

just "found" protobufs output. Followed the README to compile protobuf
and compiled following the directions on the protobuf page [1].
I added the following code snippet to hbase.proto in
/hbase/hbase-protocol/src/main/protobuf:
message BigDecimalMsg {
  required string bigdecimalMsg = 1;
}

Then I compiled from that directory using " protoc --java_out=../java
./hbase.proto". The output will then go to the correct package in the
java source tree, as it is defined at the beginning of hbase.proto.

As mentioned before, this will just define a String, though, as
defining BigDecimal directly is impossible. Therefor I made some
slight changes in BDCI:
@Override
        public BigDecimalMsg getProtoForCellType(BigDecimal t) {
                BigDecimalMsg.Builder builder = BigDecimalMsg.newBuilder();
                return builder.setBigDecimalMsg(t.toString()).build();
        }

        @Override
        public BigDecimalMsg getProtoForPromotedType(BigDecimal s) {
                BigDecimalMsg.Builder builder = BigDecimalMsg.newBuilder();
                return builder.setBigDecimalMsg(s.toString()).build();
        }

        @Override
        public BigDecimal getPromotedValueFromProto(BigDecimalMsg r) {
                return new BigDecimal(r.getBigDecimalMsg());
        }

        @Override
        public BigDecimal getCellValueFromProto(BigDecimalMsg q) {
                return new BigDecimal(q.getBigDecimalMsg());
        }

However there seem to be some methods missing in the generated source.
I'll try to get that fixed.
Also my build system seems a little fucked up right now. I'll get that
fixed and test it.

Julian

[1] https://developers.google.com/protocol-buffers/docs/javatutorial



                
> Port HBASE-6669 'Add BigDecimalColumnInterpreter for doing aggregations using 
> AggregationClient' to trunk
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-7641
>                 URL: https://issues.apache.org/jira/browse/HBASE-7641
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Ted Yu
>
> ColumnInterpreter implementation in trunk is different from that in 0.94
> This issue ports BigDecimalColumnInterpreter to trunk

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to