data.mapPartitionsWithIndex
{
(index,points)=>
}
怎么在大括号中访问index+i分区中的数据呢,新手请教!
{
(index,points)=>
}
怎么在大括号中访问index+i分区中的数据呢,新手请教!
解决方案 »
- 安装后出错
- 全球云计算七巨头:中国占三席
- 求助~~实在无解~~yum安装openstack-keystone出错
- 参与HP Helion有奖问答活动 赢京东卡
- 你好Cloud Foundry
- 比如我的系统是centos6,然后装了docker,从docker-hub pull 了centos7的image 跑起来有问题吗
- spark往hbase写数据
- 关于aws有没有基于实例的计划任务呢
- 想购买云服务器做镜像(备份)网站,希望能方便同步原主机的数据
- Spark分析Log文件的方式
- spark项目运行,提示无法删除C:/userPaht/AppData/local/Temp/下的文件
- 想用AWS,但是没有信仰卡,有没有什么解决办法
你为什么想访问另一个分区的数据?mapParitions(func) or mapPartitionsWihIndex(func) are for performance optimization, which allow your function to be run once PER partition, that's why its the function type must be Iterator<T> => Iterator<U>. You access the whole parittion's data in one iterator, but should and can NOT access other partitions' data. mapParitions(func) 或mapPartitionsWihIndex(func) 是优化时用到的,这些操作允许你依次访问每个分区,这就是为什这个函数提供一个Iterator迭代引用给你,你可以通过这个迭代器遍历分区内的全部数据,但是一个分区的迭代器不能访问其他分区的数据。