火花 SQL 计算器

Spark SQL Stackoverflow

我是 spark 和 spark sql 的新手,我试图制作 Spark SQL 网站上的示例,加载后只是一个简单的 SQL 查询JSON 文件目录中的架构和数据,如下所示:

import sqlContext.createSchemaRDD
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val path = "/home/shaza90/Desktop/tweets_1428981780000"
val tweet = sqlContext.jsonFile(path).cache()

tweet.registerTempTable("tweet")
tweet.printSchema() //This one works fine


val texts = sqlContext.sql("SELECT tweet.text FROM tweet").collect().foreach(println) 

我得到的异常是这个:

java.lang.WhosebugError

    at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append.apply(Parsers.scala:254)
at scala.util.parsing.combinator.Parsers$$anon.apply(Parsers.scala:222)

更新

我能够执行 select * from tweet 但每当我使用列名而不是 * 时,我都会收到错误。

有什么建议吗?

这是 SPARK-5009 并且已在 Apache Spark 1.3.0 中修复。

问题是要在任何情况下识别关键字(如 SELECT),所有可能的 uppercase/lowercase 组合(如 seLeCT)都是在递归函数中生成的。如果关键字足够长且堆栈大小足够小,则此递归将导致您看到的 WhosebugError 。 (这表明如果升级到 Apache Spark 1.3.0 或更高版本不是一个选项,您可以使用 -Xss 来增加 JVM 堆栈大小作为解决方法。)