Review Board 1.7.22


Support binary qualifiers for Hive/HBase integration

Review Request #9275 - Created Feb. 3, 2013 and updated

Swarnim Kulkarni
trunk
HIVE-3553
Reviewers
hive
hive-git
Added capability to support binary HBase qualifiers along with regular ones. https://issues.apache.org/jira/browse/HIVE-3553
Added unit tests to demonstrate the aded functionality. Ensured all existing unit tests passed.
hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseSerDe.java
Revision 56e7a4a New Change
[20] 186 lines
[+20] [+] public void initialize(Configuration conf, Properties tbl)
187
        columnMapping.familyNameBytes = Bytes.toBytes(parts[0]);
187
        columnMapping.familyNameBytes = Bytes.toBytes(parts[0]);
188
        columnMapping.hbaseRowKey = false;
188
        columnMapping.hbaseRowKey = false;
189

    
   
189

   
190
        if (parts.length == 2) {
190
        if (parts.length == 2) {
191
          columnMapping.qualifierName = parts[1];
191
          columnMapping.qualifierName = parts[1];
192
          columnMapping.qualifierNameBytes = Bytes.toBytes(parts[1]);
192
          columnMapping.qualifierNameBytes = Bytes.toBytesBinary(parts[1]);
193
        } else {
193
        } else {
194
          columnMapping.qualifierName = null;
194
          columnMapping.qualifierName = null;
195
          columnMapping.qualifierNameBytes = null;
195
          columnMapping.qualifierNameBytes = null;
196
        }
196
        }
197
      }
197
      }
[+20] [20] 346 lines
[+20] [+] public Writable serialize(Object obj, ObjectInspector objInspector)
544

    
   
544

   
545
      if (key == null) {
545
      if (key == null) {
546
        throw new SerDeException("HBase row key cannot be NULL");
546
        throw new SerDeException("HBase row key cannot be NULL");
547
      }
547
      }
548

    
   
548

   
549
      if(putTimestamp >= 0)
549
      if(putTimestamp >= 0) {
550
        put = new Put(key,putTimestamp);
550
        put = new Put(key,putTimestamp);
551
      else
551
      } else {
552
        put = new Put(key);
552
        put = new Put(key);

    
   
553
      }
553

    
   
554

   
554
      // Serialize each field
555
      // Serialize each field
555
      for (int i = 0; i < fields.size(); i++) {
556
      for (int i = 0; i < fields.size(); i++) {
556
        if (i == iKey) {
557
        if (i == iKey) {
557
          // already processed the key above
558
          // already processed the key above
[+20] [20] 261 lines
hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestHBaseSerDe.java
Revision cbeecd3 New Change
 
  1. hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseSerDe.java: Loading...
  2. hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestHBaseSerDe.java: Loading...