[英]Spark's call function
Sorry, basic question about Spark. 抱歉,关于Spark的基本问题。 Can I use Java object different than primitive type inside a Spark's call function?
我可以在Spark的调用函数中使用与原始类型不同的Java对象吗? For instance, imagine that I have something like that:
例如,假设我有这样的事情:
JavaRDD<String> input = sc.textFile(dataFile);
JavaRDD<String> output;
output = input.map(new Function<String, String>() { public String call(String s) throws MalformedURLException {
SystemConfiguration config = new SystemConfiguration();
.... ....
If I remove the instance of my own class SystemConfiguratin it works fine, but with it inside it doesn't work (Spark finished with failure). 如果我删除自己的类SystemConfiguratin的实例,它可以正常工作,但是在它里面没有起作用(Spark因失败而结束)。 Please could you shed light about this?
请您能说明一下吗? Many thanks
非常感谢
只要您在转换中创建的对象是可序列化的或声明为@transient lazy(对于不可序列化的对象),就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.