spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bit1129@163.com" <bit1...@163.com>
Subject Error occurs when running Spark SQL example
Date Sat, 17 Jan 2015 11:49:16 GMT
When I run the following spark sql example within Idea, I got the StackOverflowError, lookes
like the scala.util.parsing.combinator.Parsers are calling recursively and infinitely. 
Anyone encounters this?



package spark.examples 
import org.apache.spark.{SparkContext, SparkConf} 
import org.apache.spark.sql._ 

case class Person(name: String, age: Int) 

object SparkSQLExample { 

def main (args: Array[String]) { 
System.setProperty("hadoop.home.dir", "E:\\devsoftware\\hadoop-2.5.2\\hadoop-2.5.2"); 
val conf = new SparkConf() 
conf.setAppName("SparkSQLExample") 
conf.setMaster("local") 
val sc = new SparkContext(conf) 
val sqlContext = new org.apache.spark.sql.SQLContext(sc) 
import sqlContext._ 

val people = sc.textFile("file:///D:/people.txt").map(_.split(",")).map(p => Person(p(0),
p(1).trim.toInt)) 
people.registerTempTable("people") 

val teenagers = sqlContext.sql("SELECT name FROM people WHERE age >= 13 AND age <= 19")

teenagers.map(t => "Name: " + t(0)).collect().foreach(println) 
} 
} 


The errors is:

15/01/17 19:42:14.489 main INFO SparkContext: Created broadcast 0 from textFile at SparkSQLExample.scala:24

15/01/17 19:42:15.464 main DEBUG DDLParser: Not recognized as DDL: [1.1] failure: ``CREATE''
expected but identifier SELECT found 

SELECT name FROM people WHERE age >= 13 AND age <= 19 
^ 
Exception in thread "main" java.lang.StackOverflowError 
at scala.util.parsing.combinator.Parsers$$anon$3.apply(Parsers.scala:222) 
at scala.util.parsing.combinator.Parsers$Parser$$anonfun$append$1.apply(Parsers.scala:254)

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

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

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

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

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

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

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

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

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

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

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







Mime
View raw message