首页 > Spark:在使用combinebykey时抛出了classcastexception

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的类型转换异常呢?而且可以编译通过啊。

【热门文章】
【热门文章】