spark sql没有返回hdp上配置单元事务表的记录

lyr7nygr  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(280)

我在hdp设置中遇到了这个问题,在hdp设置中,事务表只需要压缩一次就可以用sparksql获取记录。另一方面,apache安装程序甚至不需要压缩一次。
可能是压缩后的元存储触发了什么,sparksql开始识别delta文件。
如果需要其他细节来找出根本原因,请告诉我。
试试这个,
查看完整场景:

hive> create table default.foo(id int) clustered by (id) into 2 buckets STORED AS ORC TBLPROPERTIES ('transactional'='true');
hive> insert into default.foo values(10);

scala> sqlContext.table("default.foo").count // Gives 0, which is wrong because data is still in delta files

# Now run major compaction:

hive> ALTER TABLE default.foo COMPACT 'MAJOR';

scala> sqlContext.table("default.foo").count // Gives 1

hive> insert into foo values(20);

scala> sqlContext.table("default.foo").count // Gives 2 , no compaction required.
sauutmhj

sauutmhj1#

spark不支持hive表的任何功能。
请检查:https://issues.apache.org/jira/browse/spark-15348

相关问题