Skip to content

[SPARK-23152][ML] - Correctly guard against empty datasets #20321

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

Closed
wants to merge 2 commits into from
Closed

[SPARK-23152][ML] - Correctly guard against empty datasets #20321

wants to merge 2 commits into from

Conversation

tovbinm
Copy link
Member

@tovbinm tovbinm commented Jan 18, 2018

What changes were proposed in this pull request?

Correctly guard against empty datasets in org.apache.spark.ml.classification.Classifier

How was this patch tested?

existing tests

@@ -109,7 +109,7 @@ abstract class Classifier[
case None =>
// Get number of classes from dataset itself.
val maxLabelRow: Array[Row] = dataset.select(max($(labelCol))).take(1)
if (maxLabelRow.isEmpty) {
if (maxLabelRow.isEmpty || maxLabelRow(0).get(0) == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Hi, @tovbinm .
If this is a correctness issue, could you add a new test case for your new contribution?

Copy link
Member Author

Choose a reason for hiding this comment

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

@tovbinm
Copy link
Member Author

tovbinm commented Jan 23, 2018

anyone?

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

Looks close enough to me.

@HyukjinKwon
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Jan 24, 2018

Test build #86586 has finished for PR 20321 at commit 68b3584.

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

@srowen
Copy link
Member

srowen commented Jan 24, 2018

Merged to master

@asfgit asfgit closed this in 840dea6 Jan 24, 2018
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