spark1.5 scala.collection.mutable.WrappedArray$ofRef cannot be cast to ...解决办法
来源:互联网 发布:印度经济 知乎 编辑:程序博客网 时间:2024/06/08 00:39
下面是我在spark user list的求助贴,很快就得到了正确回答,有遇到问题的同学解决不了也可以去上面提问。
I can use it under spark1.4.1,but error on spark1.5.1,how to deal with this problem?
//define Schema val struct =StructType( StructField("app_name", StringType, true):: StructField("apply_time",LongType ,true) :: StructField("final_decision" , StringType) :: StructField("final_score" ,IntegerType ) :: StructField("partner_code", StringType, true) :: StructField("person_info",MapType(StringType,StringType,true)) :: StructField("report_id",StringType, true) :: StructField("report_time",LongType ,true) :: StructField("risk_items",ArrayType(MapType(StringType,StringType,true))) :: Nil ) val rdd2 = sqlContext.read.schema(struct).json(jsonData).map(r => { ... //Exception val risk_items = r.getAs[List[Map[String, String]]]("risk_items") ... }
报错提示如下:
java.lang.ClassCastException: scala.collection.mutable.WrappedArray$ofRef cannot be cast to scala.collection.immutable.List
很快得到了一个正确的答案,只需要将List改为Seq就行了,回复如下:
0 0
- spark1.5 scala.collection.mutable.WrappedArray$ofRef cannot be cast to ...解决办法
- warning: non-variable type argument Int in type pattern scala.collection.mutable.WrappedArray[Int] i
- cannot be cast to
- ClassCastException: $Proxy0 cannot be cast to (com......) 的解决办法
- cannot be cast to java.lang.Comparable解决办法
- BitmapDrawable cannot be cast to android.graphics.drawable.AnimationDrawable解决办法
- cannot be cast to java.lang.Comparable解决办法
- org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema cannot be cast to scala.Tuple2
- cannot be cast to java.io.Serializable
- $ProxyXX cannot be cast to 类型
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to org.apache
- cannot be cast to android.app.Fragment
- cannot be cast to android.widget.HeaderViewListAdapter
- android.app.Application cannot be cast to
- cannot be cast to android.widget.HeaderViewListAdapter
- $ProxyXX cannot be cast to 类型
- ClassCastException: $Proxy0 cannot be cast to ...
- 我的职业观
- Asoc dapm(一) - kcontrol
- flume+kafka+smart数据接入实施手册
- C#+Jquery实现省地市三级联动下拉
- Yarn HA解决方案
- spark1.5 scala.collection.mutable.WrappedArray$ofRef cannot be cast to ...解决办法
- maven 项目异地导如出错,pom文件报错,jar文件无法下载
- C++ 用户自定义类型
- Android编译系统
- jsp页面 上传图片预览 的处理
- NSFileManager Class Reference
- Xcode6中创建分类、协议等文件的方法
- 云环境下数据保护方案的选择
- JavaScript中创建对象的几种方式