-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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-33513][BUILD] Upgrade to Scala 2.13.4 to improve exhaustivity #30455
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This PR is ready for review finally. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Kubernetes integration test status success |
Test build #131573 has finished for PR 30455 at commit
|
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.
I left minor comments (& question) and the other parts look fine.
case (a, b) => a != null && a.equals(b) | ||
case (a: Double, b: Double) if a.isNaN && b.isNaN => true | ||
case (a: Float, b: Float) if a.isNaN && b.isNaN => true | ||
case (a, b) => a != null && a == b |
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.
(Just a question) Are the changes above related to this PR?
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.
Yes. It's a compilation error. We cannot use .equals
for Any
type.
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.
Oh, I see.
@@ -362,7 +362,7 @@ case class Join( | |||
left.constraints | |||
case RightOuter => | |||
right.constraints | |||
case FullOuter => | |||
case _ => |
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.
nit: for readability, how about leaving a comment like this?
case _ => // FullOuter
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.
Ya. I thought like that, but actually, there are many missing patterns.
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.
It was difficult to track one-by-one. Logically, this is the rest of the previous patterns. So, I decided to skip that comment.
@@ -120,7 +120,7 @@ class GenericArrayData(val array: Array[Any]) extends ArrayData { | |||
if (!o2.isInstanceOf[Double] || ! java.lang.Double.isNaN(o2.asInstanceOf[Double])) { | |||
return false | |||
} | |||
case _ => if (!o1.equals(o2)) { | |||
case _ => if (o1.getClass != o2.getClass || o1 != o2) { |
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.
ditto: Is this change above related to this PR?
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.
Yes. We cannot use equals
and we cannot use !=
here due to the following.
scala> Float.NaN == Float.NaN
val res2: Boolean = false
scala> Float.NaN.equals(Float.NaN)
val res3: Boolean = true
@@ -293,7 +293,7 @@ private[streaming] object FileBasedWriteAheadLog { | |||
val startTime = startTimeStr.toLong | |||
val stopTime = stopTimeStr.toLong | |||
Some(LogInfo(startTime, stopTime, file.toString)) | |||
case None => | |||
case None | Some(_) => |
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.
We cannot write it like case _ =>
here?
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.
We can use like that~
@@ -757,15 +757,15 @@ private[spark] object JsonProtocol { | |||
|
|||
def taskResourceRequestMapFromJson(json: JValue): Map[String, TaskResourceRequest] = { | |||
val jsonFields = json.asInstanceOf[JObject].obj | |||
jsonFields.map { case JField(k, v) => | |||
jsonFields.collect { case JField(k, v) => |
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.
Ah, I see. The compilation of map
in this case fails in v2.13.4?
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.
Yes.
The new pattern match is strict and the |
Thank you always, @maropu ! |
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.
Late LGTM
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.
LGTM
Thank you, @srowen and @HyukjinKwon . |
Test build #131590 has finished for PR 30455 at commit
|
@@ -298,7 +299,10 @@ private[ml] object RFormulaParser extends RegexParsers { | |||
private val expr = (sum | term) | |||
|
|||
private val formula: Parser[ParsedRFormula] = | |||
(label ~ "~" ~ expr) ^^ { case r ~ "~" ~ t => ParsedRFormula(r, t.asTerms.terms) } | |||
(label ~ "~" ~ expr) ^^ { | |||
case r ~ "~" ~ t => ParsedRFormula(r, t.asTerms.terms) |
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 future reference, a slightly cleaner way to express this in a warning free way is:
((label <~ "~") ~ expr ) ^^ {
case r ~ t => ParsedRFormula(r, t.asTerms.terms)
}
It also avoids duplicating the "~"
token in the parser and the action.
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.
Feel free to make a PR, @retronym . :)
### What changes were proposed in this pull request? Migrate the following errors in QueryParsingErrors onto use error classes: 1. joinCriteriaUnimplementedError => throw IllegalStateException instead, since it should never happen and not visible to users, introduced by improving exhaustivity in [PR](#30455) 2. naturalCrossJoinUnsupportedError => UNSUPPORTED_FEATURE ### Why are the changes needed? Porting join parsing errors to new error framework. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? UT added. Closes #35405 from ivoson/SPARK-38105. Authored-by: Tengfei Huang <tengfei.h@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
This PR aims the followings.
Why are the changes needed?
Scala 2.13.4 is a maintenance release for 2.13 line and improves JDK 15 support.
Also, it improves exhaustivity check.
Does this PR introduce any user-facing change?
Yep. Although it's a maintenance version change, it's a Scala version change.
How was this patch tested?
Pass the CIs and do the manual testing.