完整报错如下:

'call(Tuple2<Long, Row>)' in 'Anonymous class derived from org.apache.spark.api.java.function.PairFlatMapFunction'

clashes with 'call(T)' in 'org.apache.spark.api.java.function.PairFlatMapFunction';

attempting to use incompatible return type

点击PairFlatMapFunction源码:

@FunctionalInterface
public interface PairFlatMapFunction<T, K, V> extends Serializable {Iterator<Tuple2<K, V>> call(T t) throws Exception;
}

发现要求返回iterator

原因:

两处不一致:

①return处与public后面的类型不一致。

②Tuple2<String,Row>应该改成Tuple2<String,Row>

解决方案如下:

    private static PairFlatMapFunction<Tuple2<Long,Row>, String, Row>func7= new PairFlatMapFunction<Tuple2<Long,Row>, String, Row>() {private static final long serialVersionUID = 1L;public Iterable<Tuple2<String, Row>> call(Tuple2<Long, Row> tuple) throws Exception
{Random random = new Random();List<Tuple2<String, Row>> list = new ArrayList<Tuple2<String, Row>>();for(int i = 0; i < 100; i++) {list.add(new Tuple2<String, Row>(i + "_" + tuple._1, tuple._2));}return list;}
};

改成:

private static  PairFlatMapFunction<Tuple2<String,Row>, String, Row>  func7 = new PairFlatMapFunction<Tuple2<String,Row>, String, Row>(){private static final long serialVersionUID = 1L;
//    @Overridepublic Iterator<Tuple2<String, Row>> call(Tuple2<String, Row> tuple) throws Exception
{Random random = new Random();List<Tuple2<String, Row>> list = new ArrayList<Tuple2<String, Row>>();for(int i = 0; i < 100; i++){list.add(new Tuple2<String, Row>(i + "_" + tuple._1, tuple._2));}return list.iterator();}};

xxx in ‘Anonymous class derived from xxx clashes with ‘call(T)‘ in xxx attempting to use incompati相关推荐

  1. ‘getCurrentWatermark()‘ in ‘Anonymous class derived from xxx

    部分代码如下: @Override public Watermark getCurrentWatermark() {     currentWaterMark = currentTimeStamp - ...

  2. Linux:centos释放缓存,查看磁盘空间大小,xxx文件夹, 查看文件夹大小,查看剩余内存,查看xxx软件位置,统计某文件夹,统计某文件夹下目录数量,查看文件夹大小,给文件夹下所有的文件赋值权限

    一台老的PHP后台服务器,今天用 free -m 查看,发现内存跑满了. 再 top,然后按下shift+m,也就是按内存占用百分比排序,发现排在第一的进程,才占用0.9%,那是什么占用的呢?谷歌了一 ...

  3. Certificate for <xxx.xxx.xxx.com> doesn‘t match any of the subject alternative names: [xxx..com]

    问题和解决 我这里先描述问题和解决方案吧.很多同学不太关心发生的背景. 问题表象 Certificate for <xxx.xxx.xxx.com> doesn't match any o ...

  4. mybatisplus page排序_PostgreSQL使用WITH xxx AS()查询,使用Page中的OrderItem排序,会把WITH xxx AS()这段SQL忽略导致报错...

    当前使用版本(必填,否则不予处理) 3.2.0 该问题是如何引起的?(确定最新版也有问题再提!!!) 目前更新到3.3.2版本问题一样存在 PostgreSQL使用WITH xxx AS()查询,使用 ...

  5. 交易码 MWS X7 会计科目表 XXX 没有在表 T030K 中定义/交易码 VST J2 会计科目表 XXX 没有在表 T030K 中定义

    过帐时提示错误:"交易码 MWS X7 会计科目表 XXX 没有在表 T030K 中定义"或者"交易码 VST J2 会计科目表 XXX 没有在表 T030K 中定义&q ...

  6. require xxx it is missing from your system. Install or enable PHP‘s xxx extension.

    Your requirements could not be resolved to an installable set of packages. 在thinkphp6项目下,使用composer安 ...

  7. electron 打包后启动应用报错:Error: ENOENT: no such file or directory, open ‘xxx/manifest.json‘‘

    使用 electron-builder 打包后启动报错: Reading /xxx/manifest.json failed. Error: ENOENT: no such file or direc ...

  8. 【错误记录】Kotlin 编译报错 ( Class ‘Xxx‘ is not abstract and does not implement abstract member )

    文章目录 一.报错信息 二.解决方案 一.报错信息 Google Play 上架要求 Android 的编译版本 和 目标版本都要高于 30 才可以上传 ; 将 Android 的编译版本 和 目标版 ...

  9. 解决PyCharm中报出 “Shadows built-in name xxx“ 的警告

    解决PyCharm中报出 "Shadows built-in name xxx" 的警告 问题描述: PyCharm中报出 "Shadows built-in name ...

最新文章

  1. 批量新建文件夹并命名_dos命令实现批量新建文件夹
  2. mysql 主键选择_mysql – 无论列名如何,都选择主键?
  3. C++day15 学习笔记
  4. Linux下MySQL数据库的备份与还原,mysql快速导入导出数据库实例演示,解决mysql大数据量数据库导出慢的问题
  5. Oracle数据库的一些常用命令
  6. 处理大并发之四 libevent demo详细分析(对比epoll)
  7. 业界 | 5个步骤开启你的数据科学职业生涯!(附链接)
  8. 【完整示例】采用jenkins pipeline实现自动构建并部署至k8s
  9. PostgreSQL adminpack扩展的作用
  10. c语言实训报告银行存款利息利税,银行存款利息和利税的调查总结.docx
  11. 系统学习深度学习(十四)--权重初始化Xavier
  12. 个人技术博客(α)------javaweb的学习路程
  13. 专题二:MATLAB矩阵处理
  14. Chrome插件hoxx
  15. 21王道计算机网络pdf百度云,王道计算机网络第五章.pdf
  16. tableau计算同环比
  17. 淘宝API接口:item_search - 按关键字搜索淘宝商品
  18. 免费在线pdf转换成word转换器
  19. 质因数分解,(结果简化版)
  20. 最成功的失败学——《创游记:游戏团队创业成长之路》

热门文章

  1. iOS----------使用cocoapods遇到的问题
  2. php用get方式传json数据 变成null了
  3. linux设置永久别名
  4. 如何在官网中下载历史版本的火狐浏览器
  5. hdu 1247 字典树
  6. KindEditor 4 输入框限定字数
  7. 基于ArcGIS10.0和Oracle10g的空间数据管理平台(C#开发)-数据库设计
  8. PSP 战神 奥林匹斯之链(God of War: Chains of Olympus) 试玩版 下载地址
  9. element table 表格设置max-height 没有出现滚动条,多渲染了一列。
  10. php curl 批量,PHP实现的curl批量请求操作