I'm having some problems in building a simple application with Spark SQL. What I want to do is to add a new column to a DataFrame. Thus, I have done:
val sqlContext=new HiveContext(sc)
import sqlContext._
// creating the DataFrame
correctDF.withColumn("COL1", expr("concat('000',COL1)") )
but when I build it with sbt it throws the exception:
not found: value expr
(and also Eclipse complains about it)
Instead in the spark-shell it works like a charm.
In my build.sbt file I have:
scalaVersion := "2.10.5"
libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "1.6.0" % "provided"
libraryDependencies += "org.apache.spark" % "spark-sql_2.10" % "1.6.0" % "provided"
libraryDependencies += "org.apache.spark" % "spark-hive_2.10" % "1.6.0" % "provided"
I've added the last line after I read a post, but nothing changed...
Can someone help me?
I found the answer. I was missing this import:
import org.apache.spark.sql.functions._
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With