Spark作业的间歇性异常:不支持scala.collection.Map [String,String]类型的架构

时间:2018-08-06 23:09:28

标签: scala apache-spark

在我的火花工作中,我不断断断续续地遇到以下异常:

  

java.lang.UnsupportedOperationException:不支持scala.collection.Map [String,String]类型的架构       位于org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1.apply(ScalaReflection.scala:780)       位于org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1.apply(ScalaReflection.scala:715)       在scala.reflect.internal.tpe.TypeConstraints $ UndoLog.undo(TypeConstraints.scala:56)       在org.apache.spark.sql.catalyst.ScalaReflection $ class.cleanUpReflectionObjects(ScalaReflection.scala:824)       在org.apache.spark.sql.catalyst.ScalaReflection $ .cleanUpReflectionObjects(ScalaReflection.scala:39)       在org.apache.spark.sql.catalyst.ScalaReflection $ .schemaFor(ScalaReflection.scala:714)       在org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1 $$ anonfun $ apply $ 8.apply(ScalaReflection.scala:776)       在org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1 $$ anonfun $ apply $ 8.apply(ScalaReflection.scala:775)       在scala.collection.TraversableLike $$ anonfun $ map $ 1.apply(TraversableLike.scala:234)       在scala.collection.TraversableLike $$ anonfun $ map $ 1.apply(TraversableLike.scala:234)       在scala.collection.immutable.List.foreach(List.scala:381)       在scala.collection.TraversableLike $ class.map(TraversableLike.scala:234)       在scala.collection.immutable.List.map(List.scala:285)       位于org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1.apply(ScalaReflection.scala:775)       位于org.apache.spark.sql.catalyst.ScalaReflection $$ anonfun $ schemaFor $ 1.apply(ScalaReflection.scala:715)       在scala.reflect.internal.tpe.TypeConstraints $ UndoLog.undo(TypeConstraints.scala:56)       在org.apache.spark.sql.catalyst.ScalaReflection $ class.cleanUpReflectionObjects(ScalaReflection.scala:824)       在org.apache.spark.sql.catalyst.ScalaReflection $ .cleanUpReflectionObjects(ScalaReflection.scala:39)       在org.apache.spark.sql.catalyst.ScalaReflection $ .schemaFor(ScalaReflection.scala:714)       在org.apache.spark.sql.catalyst.ScalaReflection $ .schemaFor(ScalaReflection.scala:711)       在org.apache.spark.sql.functions $ .udf(functions.scala:3382)   ...

然后,我在ScalaReflection.scala中查看源代码,看起来Map [String,String]在schemaFor(..)函数中应始终是有效类型,就像在 https://github.com/apache/spark/blob/1a5e460762593c61b7ff2c5f3641d406706616ff/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala#L742 它显示在哪里

case t if t <:< localTypeOf[Map[_, _]] =>
    val TypeRef(_, _, Seq(keyType, valueType)) = t
    val Schema(valueDataType, valueNullable) = schemaFor(valueType)
    Schema(MapType(schemaFor(keyType).dataType,

有人知道Map [String,String]在什么情况下会错过此检查,然后落入“ other”大小写吗?

这个问题也很难重现,每千次运行随机发生一次。

0 个答案:

没有答案