它看起来不像带有hive支持的spark sql" sql喜欢"。这是我用于在spark-shell中进行测试的示例代码
case class Department(id: String, name: String)
val department1 = new Department("123456", "Computer Science")
val department2 = new Department("789012", "Mechanical Engineering")
val department3 = new Department("345678", "Theater and Drama")
val department4 = new Department("901234", "Indoor Recreation")
val dSeq = Seq(department1, department2, department3, department4)
val dfd = dSeq.toDF()
dfd.registerTempTable("departments")
val re=sqlContext.sql("select * from departments where name like '*Rec*'")
re.show()
没有结果。我检查sqlContext,它是hiveContext
阶> sqlContext
res15:org.apache.spark.sql.SQLContext =org.apache.spark.sql.hive.HiveContext@4f03729f
有人知道为什么吗?