Skip to content

changed scala example from java "style" to scala - #20458

Closed
mantovani wants to merge 2 commits into
apache:masterfrom
mantovani:master
Closed

changed scala example from java "style" to scala#20458
mantovani wants to merge 2 commits into
apache:masterfrom
mantovani:master

Conversation

@mantovani

Copy link
Copy Markdown

What changes were proposed in this pull request?

I changed an example wrote in Scala using Java "style" to Scala "style".

How was this patch tested?

It's not necessary test, the language documentation should be enough. For the documentation propose.

http://www.scala-lang.org/api/2.9.2/scala/App.html
Please review http://spark.apache.org/contributing.html before opening a pull request.

@mgaido91

Copy link
Copy Markdown
Contributor

the example is written in Java, not in Scala. I think you can close this PR, thanks.

Comment threaddocs/quick-start.md Outdated
String logFile = "YOUR_SPARK_HOME/README.md"; // Should be some file on your system
SparkSession spark = SparkSession.builder().appName("Simple Application").getOrCreate();
Dataset<String> logData = spark.read().textFile(logFile).cache();
public class SimpleApp extends App {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this isn't valid Java, and it's supposed to be Java. It was correct before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I updated the wrong section.

updated the right section, Scala.
@mantovani

Copy link
Copy Markdown
Author

I just changed to the right section.

@srowen

Copy link
Copy Markdown
Member

IIRC extending App won't work, or didn't. The example is already correct.

@mantovani

Copy link
Copy Markdown
Author

It's not just "will" work, it's working. I never said that it wasn't working, the Scala example was wrote using Java "style" not Scala "style" which . Which you don't create a main method but extends App.

@vanzin

Copy link
Copy Markdown
Contributor

It's not just "will" work, it's working.

https://issues.apache.org/jira/browse/SPARK-4170

@mantovani

mantovani commented Jan 31, 2018 via email

Copy link
Copy Markdown
Author

@vanzin

Copy link
Copy Markdown
Contributor

Did you try it with Scala 2.10? That's still supported by Spark.

@mantovani

mantovani commented Jan 31, 2018 via email

Copy link
Copy Markdown
Author

@srowen

Copy link
Copy Markdown
Member

Yeah, that's what I was thinking of. Subclasses of App don't necessarily work in Spark (not just Scala). I don't know if that has changed as Spark and Scala moved forward. While that's an interesting item to investigate, here the question is changing one example to use App, while none of the others do and there's a reason not to. We don't want to do that.

@mantovani

mantovani commented Feb 1, 2018 via email

Copy link
Copy Markdown
Author

@srowen

Copy link
Copy Markdown
Member

The point is that it won't always work in Spark, so, certainly not unless you test them. I just don't think it's worth it, especially as it's setting an expectation as an example that it is the best way to do it.

@mantovani

mantovani commented Feb 1, 2018 via email

Copy link
Copy Markdown
Author

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@srowensrowen mentioned this pull request May 11, 2018
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
Closesapache#20458Closesapache#20530Closesapache#20557Closesapache#20966Closesapache#20857Closesapache#19694Closesapache#18227Closesapache#20683Closesapache#20881Closesapache#20347Closesapache#20825Closesapache#20078Closesapache#21281Closesapache#19951Closesapache#20905Closesapache#20635
Author: Sean Owen <srowen@gmail.com>
Closesapache#21303 from srowen/ClosePRs.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mantovani@mgaido91@srowen@vanzin@AmplabJenkins