我在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.
1条答案
按热度按时间sauutmhj1#
spark不支持hive表的任何功能。
请检查:https://issues.apache.org/jira/browse/spark-15348