System memory 259522560 must be at least 4.718592
[学习笔记]
/*没有下面的话, 会报一个错误,java.lang.IllegalArgumentException: System memory 259522560 must be at least 4.718592E8(470M). Please use a larger heap size.这是memory不够,导致无法启动SparkContext*/
conf.set("spark.testing.memory", "2000000000");
JavaSparkContext sc = new JavaSparkContext(conf);
/*下面的这种倒入的方法也行*/
// JavaRDD<String> text = sc.textFile("hdfs://localhost:9000/README.txt");
/*原文件是:o1abc 45
o1abc 77
o1abc o1abc */
JavaRDD<String> text = sc.textFile("E://temp//input//friend.txt");
List<String> strList = text.collect();
/*输出str:o1abc 45
str:o1abc 77
str:o1abc o1abc*/
for (String str : strList) {
System.out.println("str:" + str);
}
/*Interface FlatMapFunction<T,R>, Iterable<R> call(T t)(注意之后的版本,返回值有所变化。)*/
JavaRDD<String> words = text.flatMap(new FlatMapFunction<String, String>() {
/*List的super Interface 是java.lang.Iterable*/
public Iterable<String> call(String line) throws Exception {
System.out.println("flatMap once, line is "+line );
String[] wordsArray=line.split(" ");
List<String> wordsList=Arrays.asList(wordsArray);
return wordsList;
}
});
List<String> wordsList = words.collect();
/*输出
flatMap once, line is o1abc 45
flatMap once, line is o1abc 77
flatMap once, line is o1abc o1abc
word:o1abc
word:45
word:o1abc
word:77
word:o1abc
word:o1abc*/
for (String word : wordsList) {
System.out.println("word:" + word);
}
/* http://spark.apache.org/docs/latest/
Interface PairFunction<T,K,V>
A function that returns key-value pairs (Tuple2<K, V>), and can be used to construct PairRDDs.
scala.Tuple2<K,V> call(T t)
*/
/*
flatMap once, line is o1abc 45(这句说明前面语句再次被执行)
in tuple2 word: o1abc
文章转载原文:https://blog.csdn.net/qq_44596980/article/details/93385009
System memory 259522560 must be at least 4.718592的更多相关文章
- java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200.
报错信息 java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200. Please ...
- There is insufficient system memory to run this query 错误
服务器环境大致情况如下: 操作系统: Microsoft Windows Server 2003 R2 Enterprise Edition Service Pack 2 数据库 : Mic ...
- System memory,AGP memory和video memory【转】
system memory就是电脑的内存条上的,一般都很大.显卡不能访问 . video memory就是显示卡上的显存,一般是32,64,128M这样,速度最快,显卡可直接访问 .用来描述电脑上一 ...
- spark System memory must be at least
运行 ScalaSpark 程序的时候出现错误: System memory * must be at least *.Please increase heap size using the --dr ...
- STM32 microcontroller system memory boot mode
The bootloader is stored in the internal boot ROM memory (system memory) of STM32 devices. It is pro ...
- Exception in thread "main" java.lang.IllegalArgumentException: System memory 202768384 must be at least 4.718592E8. Please use a larger heap size.
Spark-submit 提交任务时候报错 Exception in thread "main" java.lang.IllegalArgumentException: Syste ...
- STM32的System memory
Main Flash memory 是STM32内置的Flash,一般我们使用JTAG或者SWD模式下载程序时,就是下载到这个里面,重启后也直接从这启动程序. System memory 从系统存储器 ...
- System.Span, System.Memory,还有System.IO.Pipelines
System.Span, System.Memory,还有System.IO.Pipelines 使用高性能Pipelines构建.NET通讯程序 .NET Standard支持一组新的API,Sys ...
- PatentTips - Modified buddy system memory allocation
BACKGROUND Memory allocation systems assign blocks of memory on request. A memory allocation system ...
随机推荐
- bzoj3508: 开灯
题目链接 题解 设\(b[i]=a[i]\ xor\ a[i+1]\) 我们可以发现,修改只会改变\(b[l-1]\)和\(b[r]\) 然后发现\(b[i]=1\)的点最多\(2*k\)个 状压\( ...
- 【概率论】3-6:条件分布(Conditional Distributions Part II)
title: [概率论]3-6:条件分布(Conditional Distributions Part II) categories: Mathematic Probability keywords: ...
- String 类型的数据强转成int的方法
有2个方法:1). int i = Integer.parseInt(str); 2). int i = Integer.valueOf(str).intValue();
- 微信浏览器H5开发常见的坑
ios端兼容input光标高度 问题详情描述: input输入框光标,在安卓手机上显示没有问题,但是在苹果手机上 当点击输入的时候,光标的高度和父盒子的高度一样.例如下图,左图是正常所期待的输入框光标 ...
- 2015-2016 ACM ICPC Baltic Selection Contest
这是上礼拜三的训练赛,以前做过一次,这次仅剩B题没补.题目链接:https://vjudge.net/contest/153192#overview. A题,水题. C题,树形DP,其实是一个贪心问题 ...
- Atcoder ABC 139A
Atcoder ABC 139A 题意: 给你两个字符串,记录对应位置字符相同的个数 $ (n=3) $ 解法: 暴力枚举. CODE: #include<iostream> #inclu ...
- windows下安装mongodb数据库以及使用数据库
首先下载mongodb, 链接: https://pan.baidu.com/s/1KyvF7bAqGM8K-ir-hFNhPw 密码: vlc9 双击进行安装 勾选我接受并单击next 选择cust ...
- grindtest 测试
性能工程的性能测试 测试的关键趋势之一是将性能测试角色不断转变为成熟的性能工程角色.性能工程现在不仅包括测试方面,还包括监控系统性能.资源的自动伸缩.A/B 测试.ELB.数据库优化.瓶颈识别和监控. ...
- OpenResty之指令与常用API
1. 指令 通过 Lua 编写 Nginx 脚本的基本构建块是指令.指令常用于指定 Lua 代码是几时执行的以及如何使用运行的结果.下图展示了指令执行的顺序. lua_capture_error_lo ...
- 转贴:PLSQL中 commit 和 rollback 的区别
PLSQL中 commit 和 rollback 的区别 原文链接:https://blog.csdn.net/jerrytomcat/article/details/82250915 一. comm ...