【发布时间】:2018-10-24 01:40:22
【问题描述】:
我有一个简单的测试用例,将Seq[(Int,Int)] 转换为 DataFrame:
test("SparkTest 0280") {
val conf = new SparkConf().set("spark.sql.codegen.wholeStage", "false").set("spark.sql.cbo.enabled", "true")
val spark = SparkSession.builder().config(conf).master("local").appName("SparkTest").enableHiveSupport().getOrCreate()
import spark.implicits._
Seq[(Int,Int)]((null, 1), (2, null), (null, 3)).toDF("a", "b").createOrReplaceTempView("t")
spark.sql("select a,b,nvl(a,b) from t").show(truncate = false)
}
编译有问题:
Error:(565, 21) an expression of type Null is ineligible for implicit conversion
Seq[(Int,Int)]((null, 1), (2, null), (null, 3)).toDF("a", "b").createOrReplaceTempView("t")
这里有什么问题?
【问题讨论】:
标签: scala apache-spark null apache-spark-sql