为什么我无法在终端中获取完整的hbase数据
host = 'localhost'
table = 'student'
conf = {"hbase.zookeeper.quorum": host, "hbase.mapreduce.inputtable": table}
keyConv = "org.apache.spark.examples.pythonconverters.ImmutableBytesWritableToStringConverter"
valueConv = "org.apache.spark.examples.pythonconverters.HBaseResultToStringConverter"
hbase_rdd = sc.newAPIHadoopRDD("org.apache.hadoop.hbase.mapreduce.TableInputFormat","org.apache.hadoop.hbase.io.ImmutableBytesWritable","org.apache.hadoop.hbase.client.Result",keyConverter=keyConv,valueConverter=valueConv,conf=conf)
hbase_rdd.collect()
[('1', '23'), ('2', '24'), ('3', '10')]
但是原始数据 Hbase
像这样:
ROW COLUMN+CELL
1 column=info:age, timestamp=1525153512915, value=23
1 column=info:gender, timestamp=1525153501730, value=F
1 column=info:name, timestamp=1525153481472, value=lihuan
2 column=info:age, timestamp=1525153553378, value=24
2 column=info:gender, timestamp=1525153542869, value=F
2 column=info:name, timestamp=1525153531737, value=sunzhesi
3 column=info:age, timestamp=1525157971696, value=10
3 column=info:gender, timestamp=1525157958967, value=M
3 column=info:name, timestamp=1525157941132, value=axin
系统环境:ubuntu16.04;Python3.5.2;Spark2.3.0;hadoop2.9.0版本;hbase1.4.2版
1条答案
按热度按时间wkyowqbh1#
实际上,我不确定当您像以前那样使用newapihadooprdd时会发生什么,但是当我尝试从hbase扫描数据时,我将“hbase.mapreduce.scan”添加到conf中。因此,也许可以尝试添加如下内容: