我在 HDP 设置上遇到了这个问题,事务表只需要一次压缩就可以使用 Spark SQL 获取记录。 另一方面,Apache 设置甚至不需要压缩一次。
可能是压缩后在元存储上触发了某些东西,Spark SQL 开始识别增量文件。
如果需要其他详细信息来找出根本原因,请告诉我。
试试这个,
查看完整场景:
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.
最佳答案
Spark 不支持 hive 的跨国表的任何特性。
关于hadoop - Spark SQL 不返回 HDP 上 HIVE 事务表的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35955666/