-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-24213][ML] Fix for Int id type for PowerIterationClustering in spark.ml #21274
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -231,8 +231,12 @@ class PowerIterationClustering private[clustering] ( | |
| dataset.schema($(idCol)).dataType match { | ||
| case _: LongType => | ||
| uncastPredictions | ||
| case _: IntegerType => | ||
| uncastPredictions.withColumn($(idCol), col($(idCol)).cast(LongType)) | ||
| case otherType => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not directly use |
||
| uncastPredictions.select(col($(idCol)).cast(otherType).alias($(idCol))) | ||
| throw new IllegalArgumentException(s"PowerIterationClustering had an unexpected error: " + | ||
| s"ID col was found to be of type $otherType, despite initial schema checks. Please " + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
| s"report this bug.") | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Shouldn't it be
case _: IntegerType => uncastPredictions.withColumn($(idCol), col($(idCol)).cast(IntegerType))Otherwise it is not necessary for casting. right? Because prediction already has id as Long type and dataset has id as IntegerType. So, we need to cast prediction.id to IntegerType. right?
Correct me if I am wrong.