使用复杂类型查询SparkSQLDataFrame如何使用映射/数组等复杂类型查询RDD?例如,当我编写这个测试代码时:case class Test(name: String, map: Map[String, String])val map = Map("hello" -> "world", "hey" -> "there")val map2 = Map("hello" ->
"people", "hey" -> "you")val rdd = sc.parallelize(Array(Test("first", map), Test("second", map2)))我想语法应该是这样的:sqlContext.sql("SELECT * FROM rdd WHERE map.hello = world")或sqlContext.sql("SELECT * FROM rdd WHERE map[hello] = world")但我得到了无法访问MapType类型中的嵌套字段(StringType,true)和org.apache.spark.sql.catalyst.errors.package$TreeNodeException:未解析属性分别。
添加回答
举报
0/150
提交
取消