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

问题描述

我希望有人能帮助我解决这个问题。
在spark-shell中,如果我尝试如下所示:

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

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

var我收到错误:

我可以执行简单的简单单行查询,只需要很好......但多命令查询总是会导致此错误。



有没有人遇到并解决了这个问题?
感谢高级!!!

解决方案

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


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)

I recieve an error:

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!!!

解决方案

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