[
https://issues.apache.org/jira/browse/SPARK-4557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14581888#comment-14581888
]
Alexis Seigneurin commented on SPARK-4557:
------------------------------------------
I'm using Java 8. Here is what the compiler says:
{code}
[error] /Users/aseigneurin/dev/spark/spark-alexis/src/main/java/Plop.java:37:
error: incompatible types: bad return type in lambda expression
[error] .foreachRDD(tweets -> tweets.foreach(tweet ->
System.out.println(tweet)));
[error] ^
[error] void cannot be converted to Void
{code}
> Spark Streaming' foreachRDD method should accept a VoidFunction<...>, not a
> Function<..., Void>
> -----------------------------------------------------------------------------------------------
>
> Key: SPARK-4557
> URL: https://issues.apache.org/jira/browse/SPARK-4557
> Project: Spark
> Issue Type: Improvement
> Components: Streaming
> Affects Versions: 1.1.0
> Reporter: Alexis Seigneurin
> Priority: Minor
> Labels: starter
>
> In *Java*, using Spark Streaming's foreachRDD function is quite verbose. You
> have to write:
> {code:java}
> .foreachRDD(items -> {
> ...;
> return null;
> });
> {code}
> Instead of:
> {code:java}
> .foreachRDD(items -> ...);
> {code}
> This is because the foreachRDD method accepts a Function<JavaRDD<...>, Void>
> instead of a VoidFunction<JavaRDD<...>>. This would make sense to change it
> to a VoidFunction as, in Spark's API, the foreach method already accepts a
> VoidFunction.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]