使用带HBase的pig获取记录的时间戳

使用带HBase的pig获取记录的时间戳,hbase,apache-pig,Hbase,Apache Pig,我的任务是获取HBase表中数据的时间戳。如果我在hbase shell中的表上执行扫描,我可以看到给定行的时间戳,例如 scan 'mytable', {LIMIT => 1} ROW COLUMN+CELL 00001000715ce3d569ee256153d column=0:, times

我的任务是获取HBase表中数据的时间戳。如果我在hbase shell中的表上执行
扫描
,我可以看到给定行的时间戳,例如

scan 'mytable', {LIMIT => 1}
ROW                          COLUMN+CELL                                                                       
 00001000715ce3d569ee256153d column=0:, timestamp=1326362691000, value=1320073315600x600                       
 f31db629b                                                                                                     
1 row(s) in 1.9800 seconds
如果我试图从grunt shell中的这个表中加载一些数据,那么我看不到时间戳,只有值

tableinput = LOAD 'hbase://imagestore-new' 
USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('0: ', '-loadKey true')
AS (id:bytearray, thingy:chararray);
illustrate tableinput;
这给了我:

--------------------------------------------------------------------------------
| tableinput     | id:bytearray                         | thingy:chararray     | 
--------------------------------------------------------------------------------
|                | 0000bizrad8156b98bffa60d8968fba0f326 | {=1348461029160x130} | 
--------------------------------------------------------------------------------

我被严重缺乏关于如何使用HBastorage与pig的信息所困扰;我唯一能找到的就是API条目()。我怀疑有一种方法可以将其作为配置添加到对hbastorage的调用中,类似于
'-loadKey true'
,但我不知道在哪里可以找到此信息。请帮忙

你现在真的不能这么做。以下是可用密钥的当前列表(您可以在hbastorage的构造函数javadoc中看到它们):

/**
*构造器。构造要加载或存储的HBase表LoadFunc和StoreFunc。
*@param columnList
*@param optString加载程序选项。已知选项:
    *
  • -loadKey=(true | false)将行键作为第一列加载 *
  • -gt=minKeyVal *
  • -lt=maxKeyVal *
  • -gte=minKeyVal *
  • -lte=maxKeyVal *
  • -limit=numRowsPerRegion每个区域要检索的最大行数 *
  • -delim=解析列名时使用的字符分隔符(默认为空格或逗号) *
  • -ignoreWhitespace=(true | false)在分析列名时忽略空格(默认为true) *
  • -caching=numRows要缓存的行数(更快的扫描,更多的内存)。 *
  • -noWAL=(true | false)将预写设置为false以加快加载速度。 *
  • -minTimestamp=最小时间范围的扫描时间戳 *
  • -maxTimestamp=最大时间范围的扫描时间戳 *
  • -timestamp=扫描的指定时间戳 *
  • -caster=(HBaseBinaryConverter | Utf8StorageConverter)默认为Utf8StorageConverter *使用时要格外小心,因为这可能会导致数据丢失 *(见http://hbase.apache.org/book.html#perf.hbase.client.putwal). *
*@ParseException *@抛出异常 */

如您所见,增加了按时间戳限制扫描的功能,但没有人需要实际返回它。我认为实施起来并不困难。打开一个Jira?甚至可以发布一个补丁?:)

谢谢。我开始得出这个结论,但把这个问题留了下来,以防万一我错了。更糟糕的是,我们使用的是以前的版本,它甚至不包含-min/max/timestamp标志,因此我们甚至无法按值进行筛选:(
/**
 * Constructor. Construct a HBase Table LoadFunc and StoreFunc to load or store.
 * @param columnList
 * @param optString Loader options. Known options:<ul>
 * <li>-loadKey=(true|false)  Load the row key as the first column
 * <li>-gt=minKeyVal
 * <li>-lt=maxKeyVal
 * <li>-gte=minKeyVal
 * <li>-lte=maxKeyVal
 * <li>-limit=numRowsPerRegion max number of rows to retrieve per region
 * <li>-delim=char delimiter to use when parsing column names (default is space or comma)
 * <li>-ignoreWhitespace=(true|false) ignore spaces when parsing column names (default true)
 * <li>-caching=numRows  number of rows to cache (faster scans, more memory).
 * <li>-noWAL=(true|false) Sets the write ahead to false for faster loading.
 * <li>-minTimestamp= Scan's timestamp for min timeRange
 * <li>-maxTimestamp= Scan's timestamp for max timeRange
 * <li>-timestamp= Scan's specified timestamp
 * <li>-caster=(HBaseBinaryConverter|Utf8StorageConverter) Utf8StorageConverter is the default
 * To be used with extreme caution, since this could result in data loss
 * (see http://hbase.apache.org/book.html#perf.hbase.client.putwal).
 * </ul>
 * @throws ParseException
 * @throws IOException
 */