Swarnim Kulkarni created HIVE-4995:
--------------------------------------

             Summary: select * may incorrectly return empty fields with 
hbase-handler
                 Key: HIVE-4995
                 URL: https://issues.apache.org/jira/browse/HIVE-4995
             Project: Hive
          Issue Type: Bug
          Components: HBase Handler
    Affects Versions: 0.11.0
            Reporter: Swarnim Kulkarni
            Assignee: Swarnim Kulkarni


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:

{noformat}
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");
{noformat}

Given the existing logic in HiveHBaseTableInputFormat:

{code}
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);
        }
}
{code}

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.

--
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