我在hbase上有hive外部表。我在镶木地板上的hive表中看到我们需要做刷新表以获取最新数据。我们是否也需要在hbase上进行配置?
答案 0 :(得分:0)
验证相同,我们不需要为带有基础hbase表的外部配置单元表调用REFRESH TABLE
HBASE
create 'ns_schema:table3', 'col_fam1'
put 'ns_schema:table3', 'row1', 'col_fam1:c11', 'first record'
HIVE外部表
create external table ns_schema.table3(
key string,
col1 string
)
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
with serdeproperties (
"hbase.columns.mapping" = "ns_schema:key,col_fam1:c11"
) tblproperties(
"hbase.table.name" = "ns_schema:table3"
);
SPARK2 SHELL
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
val spark2=SparkSession.builder().master("local").enableHiveSupport().getOrCreate()
import sqlContext.implicits._
spark2.sql("select * from ns_schema.table3").show(false)
+----+------------+
|key |col1 |
+----+------------+
|row1|first record|
+----+------------+
现在在HBASE Shell中再添加一行
put 'ns_gwm_idr_rz:table3', 'row2', 'col_fam1:c11', 'second record'
查询SPARK2 shell
spark2.sql("select * from db_gwm_idr_rz.table3").show(false)
+----+-------------+
|key |col1 |
+----+-------------+
|row1|first record |
|row2|second record|
+----+-------------+