本文介绍了使用 Spark 和 HiveSQL 执行多个查询的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能帮助我解决这个问题.在 spark-shell 中,如果我尝试以下操作:

I am hoping someone can help me with this issue.Within spark-shell where if I attempt something like below:

var sqlContext = new org.apache.spark.sql.hive.HiveContext(sc) 

var query = "select * from myDB.table limit 10; drop table if exists"

var queryDF = sqlContext.sql(query)

我收到一个错误:

"org.apache.spark.sql.AnlysisException: ';'处缺少 EOF....

我可以很好地执行简单的单行查询......但是多命令查询总是会导致这个错误.

I can execute simple simple single line queries just fine....but multi-command queries always result in this error.

有没有人遇到并解决过这个问题?提前致谢!!!

Has anyone ran into and solved this problem ?Thanks in advanced!!!

推荐答案

这是预期的行为.SQLContext.sql 不支持多个查询,因此解决方案非常简单 - 一次只传递一个查询.

It is an expected behavior. SQLContext.sql doesn't support multiple queries so solution is pretty simple - pass only a single query at the time.

这篇关于使用 Spark 和 HiveSQL 执行多个查询的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 08:43