Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 在MapType为的数据帧上使用except时引发错误_Scala_Apache Spark_Apache Spark Sql - Fatal编程技术网

Scala 在MapType为的数据帧上使用except时引发错误

Scala 在MapType为的数据帧上使用except时引发错误,scala,apache-spark,apache-spark-sql,Scala,Apache Spark,Apache Spark Sql,我发现在使用Spark MapType时,DataFrame中不能有调用set操作的映射类型列 下面是我为复制它而编写的示例代码。我理解这是因为MapType对象是不可散列的,但我有一个用例需要执行以下操作 val schema1 = StructType(Seq( StructField("a", MapType(StringType, StringType, true)), StructField("b", StringTy

我发现在使用Spark MapType时,DataFrame中不能有调用set操作的映射类型列

下面是我为复制它而编写的示例代码。我理解这是因为MapType对象是不可散列的,但我有一个用例需要执行以下操作

val schema1 = StructType(Seq(
                 StructField("a", MapType(StringType, StringType, true)),
                 StructField("b", StringType, true)
              ))
val df = spark.read.schema(schema1).json("path")
val filteredDF = df.filter($"b" === "apple")
val otherDF = df.except(filteredDF)

有什么解决方法的建议吗?

为什么不
val filteredDF=df.filter($“b”==“apple”)
val otherDF=df.filter($“b”!=“apple”)
??