Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-4995

select * may incorrectly return empty fields with hbase-handler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • HBase Handler
    • None

    Description

      HIVE-3725 added capability to pull hbase columns with prefixes. However the way the current logic to add columns stands in HiveHBaseTableInput format, it might cause some columns to incorrectly display empty fields.

      Consider the following query:

      CREATE EXTERNAL TABLE test_table(key string, value1 map<string,string>, value2 string)
      ROW FORMAT SERDE 'org.apache.hadoop.hive.hbase.HBaseSerDe' 
      STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
      WITH SERDEPROPERTIES 
      ("hbase.columns.mapping" = ":key,cf-a:prefix.*,cf-a:another_col") 
      TBLPROPERTIES ("hbase.table.name" = "test_table");
      

      Given the existing logic in HiveHBaseTableInputFormat:

      for (int i = 0; i < columnsMapping.size(); i++) 
      {
              ColumnMapping colMap = columnsMapping.get(i);
              if (colMap.hbaseRowKey) {
                continue;
              }
      
              if (colMap.qualifierName == null) {
                scan.addFamily(colMap.familyNameBytes);
              } else {
                scan.addColumn(colMap.familyNameBytes, colMap.qualifierNameBytes);
              }
      }
      

      So for the above query, the 'addFamily' will be called first followed by 'addColumn' for the column family "cf-a". This will wipe away whatever we had set with the 'addFamily' call in the previous step resulting in an empty column when queried.

      Attachments

        1. HIVE-4995.1.patch.txt
          19 kB
          Swarnim Kulkarni
        2. HIVE-4995.1.patch.txt
          19 kB
          Swarnim Kulkarni

        Activity

          People

            swarnim Swarnim Kulkarni
            swarnim Swarnim Kulkarni
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: