如何将平面文件(不是定界文件)加载到 HBase 中?
How to load a flat file(not delimited file) into HBase?
我是 hbase 的新手,我有一个平面文件(不是分隔文件),我想将其加载到单个 hbase table。
这是我文件中一行的预览:
0107E07201512310015071C11100747012015123100
我知道例如,从位置 1 到 7 是一个 ID,从位置 7 到 15 是一个日期....
问题是如何构建与我的文件相对应的模式,或者是否有办法将其转换为分隔文件或使用 jaql 读取此类文件,因为我正在使用 Infosphere BigInsights。
如有任何帮助,我们将不胜感激。
提前致谢。
可以写一个SerDe
反序列化成Hive,再用Hive导出到HBase
使用 RegExSerDe
创建 Hive table
CREATE EXTERNAL TABLE testtable ((col1 STRING, col2 STRING, col3 STRING)
ROW FORMAT SERDE ‘org.apache.hadoop.hive.contrib.serde2.RegexSerDe’
WITH SERDEPROPERTIES (“input.regex” = “(.{5})(.{6})(.{3}).*” )
LOCATION ‘<hdfs-file-location>’;
您可以创建指向 HBase 的配置单元 table
这是说明
http://hortonworks.com/blog/hbase-via-hive-part-1/
你可以使用
insert overwrite table 将数据从 hive table 加载到 HBase-table
https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-SELECTSandFILTERS
我是 hbase 的新手,我有一个平面文件(不是分隔文件),我想将其加载到单个 hbase table。
这是我文件中一行的预览:
0107E07201512310015071C11100747012015123100
我知道例如,从位置 1 到 7 是一个 ID,从位置 7 到 15 是一个日期....
问题是如何构建与我的文件相对应的模式,或者是否有办法将其转换为分隔文件或使用 jaql 读取此类文件,因为我正在使用 Infosphere BigInsights。
如有任何帮助,我们将不胜感激。
提前致谢。
可以写一个SerDe
反序列化成Hive,再用Hive导出到HBase
使用 RegExSerDe
创建 Hive tableCREATE EXTERNAL TABLE testtable ((col1 STRING, col2 STRING, col3 STRING)
ROW FORMAT SERDE ‘org.apache.hadoop.hive.contrib.serde2.RegexSerDe’
WITH SERDEPROPERTIES (“input.regex” = “(.{5})(.{6})(.{3}).*” )
LOCATION ‘<hdfs-file-location>’;
您可以创建指向 HBase 的配置单元 table 这是说明 http://hortonworks.com/blog/hbase-via-hive-part-1/
你可以使用 insert overwrite table 将数据从 hive table 加载到 HBase-table https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-SELECTSandFILTERS