首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用pig和HBase获取记录的时间戳

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

Stack Overflow用户
提问于 2013-06-07 03:28:16
回答 1查看 1.8K关注 0票数 2

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

代码语言:javascript
复制
scan 'mytable', {LIMIT => 1}
ROW                          COLUMN+CELL                                                                       
 00001000715ce3d569ee256153d column=0:, timestamp=1326362691000, value=1320073315600x600                       
 f31db629b                                                                                                     
1 row(s) in 1.9800 seconds

如果我试图从grunt shell中的这个表中加载一些数据,那么我看不到时间戳,只看到值。

代码语言:javascript
复制
tableinput = LOAD 'hbase://imagestore-new' 
USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('0: ', '-loadKey true')
AS (id:bytearray, thingy:chararray);
illustrate tableinput;

这给了我:

代码语言:javascript
复制
--------------------------------------------------------------------------------
| tableinput     | id:bytearray                         | thingy:chararray     | 
--------------------------------------------------------------------------------
|                | 0000bizrad8156b98bffa60d8968fba0f326 | {=1348461029160x130} | 
--------------------------------------------------------------------------------

我严重缺乏关于如何在pig中使用HBaseStorage的信息;我唯一能找到的就是API entry (http://pig.apache.org/docs/r0.9.1/api/org/apache/pig/backend/hadoop/hbase/HBaseStorage.html)。我怀疑有一种方法可以将它作为配置添加到对HBaseStorage的调用中,可能类似于'-loadKey true',但是我不知道在哪里可以找到这个信息。请帮帮我!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-14 11:49:44

实际上你现在还不能这么做。以下是可用键的当前列表(您可以在HBaseStorage的构造函数javadoc中看到它们):

代码语言:javascript
复制
/**
 * 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
 */

如您所见,添加了按时间戳限制扫描,但没有人需要实际返回它。我认为它不会很难实现。开一瓶吉拉?也许甚至会发布一个补丁?:)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16970565

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档