简体   繁体   English

使用Pig通过HBaseStorage访问HBASE

[英]Using Pig to Access HBASE with HBaseStorage

I have been experimenting with Pig to access HBase with the HBaseStorage class. 我一直在尝试使用Pig通过HBaseStorage类访问HBase。 I am finding strange behavior with the means HBaseStorage employs to match columns. 我发现HBaseStorage用来匹配列的方式有奇怪的行为。 Consider the following example: 考虑以下示例:

test = load 'hbase://resultstable' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('foo:fail','-loadKey false') as (testresults:map[]);

It is certain that the column family 'foo' and the column name 'fail' exist and that records exist in this column. 可以确定存在列族“ foo”和列名“ fail”,并且该列中存在记录。 The query returns no records. 查询不返回任何记录。 However the following query returns records: 但是,以下查询返回记录:

test = load 'hbase://resultstable' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('foo:fail*','-loadKey false') as (testresults:map[]);

Note the difference between the two examples in that the latter uses 'foo:fail*' as a parameter. 请注意,这两个示例之间的区别在于后者使用'foo:fail *'作为参数。 My guess is that there is a null terminator being stored in the column name and the binary exact match comparison fails because in the first example the null terminator is not explicitly passed (it shouldn't be in my opinion). 我的猜测是,列名中存储了一个空终止符,并且二进制完全匹配比较失败,因为在第一个示例中,未明确传递空终止符(我认为这不应该)。

The column 'foo:fail' was created using standard HBase libraries via a java string containing the column name being passed to the appropriate HBase java API call. 列“ foo:fail”是使用标准HBase库通过一个Java字符串创建的,该字符串包含传递给适当的HBase Java API调用的列名。

Is this expected behavior? 这是预期的行为吗? All the documentation (including the O'Reilly book) do not allude that it is. 所有文档(包括O'Reilly书)并不暗示它是事实。

Pig version is 0.13.0. 猪版为0.13.0。 HBase version is 0.94.10. HBase版本是0.94.10。

You are incorrectly specifying the type in the first example. 您在第一个示例中错误地指定了类型。 If you use a wildcard, it will be mapped to a map. 如果使用通配符,它​​将被映射到地图。 If you specify a single column, it will be mapped to a scalar data type. 如果指定单个列,则它将被映射为标量数据类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM