Skip to content

Conversation

@wangmiao1981
Copy link
Contributor

What changes were proposed in this pull request?

In spark.ml document, the LogisticRegression scala example uses sqlCtx. It is inconsistent with java and python examples which use sqlContext. In addition, a user can't copy & paste to run the example in spark-shell as sqlCtx doesn't exist in spark-shell while sqlContext exists.

Change the scala example referred by the spark.ml example.

How was this patch tested?

Compile the example scala file and it passes compilation.

@SparkQA
Copy link

SparkQA commented Apr 26, 2016

Test build #57047 has finished for PR 12717 at commit dff3b2a.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@wangmiao1981
Copy link
Contributor Author

retest this please.

@SparkQA
Copy link

SparkQA commented Apr 26, 2016

Test build #57051 has finished for PR 12717 at commit a7e3cd5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 26, 2016

Test build #57053 has finished for PR 12717 at commit a7e3cd5.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@wangmiao1981
Copy link
Contributor Author

@yanboliang Can you take a look ? It is a simple fix. Thanks!

val sqlCtx = new SQLContext(sc)
import sqlCtx.implicits._
val sqlContext = new SQLContext(sc)
import sqlContext.implicits._
Copy link
Member

Choose a reason for hiding this comment

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

Is this import still needed? (I forget.) It's weird to use a variable name in the import isn't it? (I know it was already like that.) Otherwise this does look like all instances of sqlCtx in examples, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's necessary, otherwise compiler will complains when use DataFrame methods.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this import is needed anymore. It used to be there to use the toDF() method back when there was no libsvm data source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me try to fix it in this PR. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jkbradley
69: val bestThreshold = fMeasure.where($"F-Measure" === maxFMeasure)
70: .select("threshold").head().getDouble(0)

Still needs the import. Otherwise, it won't be compiled.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, OK, I guess it's the dollar sign notation

@yanboliang
Copy link
Contributor

This looks good to me. Thanks!

@jkbradley
Copy link
Member

LGTM too, thanks all!
Merging with master now

@asfgit asfgit closed this in c74fd1e Apr 27, 2016
Sign up for free to 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