在Apache Spark SQL中我们可以回滚事务吗 [英] In Apache spark SQL can we roll back the transactions
本文介绍了在Apache Spark SQL中我们可以回滚事务吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使数据的spark sql持久化,在那种情况下我可以使用回滚数据来保持持久化.例
假设我们有3个表t1,t2和t3. t1和t2表数据已成功持久保存,但在数据完整性级别上t3如何失败.所以我可以回滚我一直坚持的t1和t2数据.我的意思是我可以回滚交易吗?
解决方案
浏览Spark代码(从v1.6.2到v2.1.0),似乎甚至没有指定 when 提交,也不回滚.
假设您保存/写入一个数据框,最终savePartition
被调用并以:
if (supportsTransactions) {
conn.commit()
}
来源: 解决方案
Looking through the Spark code (v1.6.2 up to v2.1.0), there doesn't even seem to be an option to specify when to commit, nor rollback.
Assuming you save/write a Dataframe, eventually savePartition
gets called and ends with:
if (supportsTransactions) {
conn.commit()
}
You can always look into adding this feature yourself in the source code :) (and pull-request upstream!)
这篇关于在Apache Spark SQL中我们可以回滚事务吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文