-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-19533][EXAMPLES] Convert Java tests to use lambdas, Java 8 features #16961
Conversation
… to language level
@@ -40,7 +38,7 @@ | |||
*/ | |||
public final class JavaLogQuery { | |||
|
|||
public static final List<String> exampleApacheLogs = Lists.newArrayList( | |||
public static final List<String> exampleApacheLogs = Arrays.asList( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this isn't specific to Java 8, the existence of Arrays.asList should mean we don't need Guava's Lists.newArrayList, and, we should prefer examples that don't involve third party libraries.
@@ -32,9 +32,6 @@ | |||
/** | |||
* Java example demonstrating model selection using TrainValidationSplit. | |||
* | |||
* The example is based on {@link org.apache.spark.examples.ml.JavaSimpleParamsExample} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This was a javadoc error, and inaccurate anyway)
} | ||
}, Encoders.STRING()); | ||
Dataset<String> namesDS = namesDF.map( | ||
(MapFunction<Row, String>) row -> "Name: " + row.getString(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For those wondering why this lambda has to be cast, it's because it is otherwise ambiguous, as there are two methods with an eligible function interface as arg.
Retest this please |
+1 LGTM! |
Test build #73013 has finished for PR 16961 at commit
|
whoa, nice/ |
Merged to master |
…tures ## What changes were proposed in this pull request? Convert Java tests to use lambdas, Java 8 features. ## How was this patch tested? Jenkins tests. Author: Sean Owen <sowen@cloudera.com> Closes apache#16961 from srowen/SPARK-19533.
…tures ## What changes were proposed in this pull request? Convert Java tests to use lambdas, Java 8 features. ## How was this patch tested? Jenkins tests. Author: Sean Owen <sowen@cloudera.com> Closes apache#16961 from srowen/SPARK-19533.
What changes were proposed in this pull request?
Convert Java tests to use lambdas, Java 8 features.
How was this patch tested?
Jenkins tests.