Spark:在使用combinebykey时抛出了classcastexception

我的调用方法就像这样

.combineByKey[C]( 
      (v:V)=>new C(v),   //this line throw java.lang.ClassCastException: C cannot be cast to V 
      (v:C,v:V)=>C, 
      (c1:C,c2:C)=>C) 

这让我很疑惑啊,返回值类型就应该是C啊,为什么会有C to V的类型转换异常呢?而且可以编译通过啊。

阅读 4.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进