-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Changes from all commits
6c26b2d
67cbc0b
dab110c
5661918
eb19da4
7214398
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 |
---|---|---|
|
@@ -286,6 +286,7 @@ private[ml] object RFormulaParser extends RegexParsers { | |
|
||
private val pow: Parser[Term] = term ~ "^" ~ "^[1-9]\\d*".r ^^ { | ||
case base ~ "^" ~ degree => power(base, degree.toInt) | ||
case t => throw new IllegalArgumentException(s"Invalid term: $t") | ||
} | term | ||
|
||
private val interaction: Parser[Term] = pow * (":" ^^^ { interact _ }) | ||
|
@@ -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 commentThe 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 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. Feel free to make a PR, @retronym . :) |
||
case t => throw new IllegalArgumentException(s"Invalid term: $t") | ||
} | ||
|
||
def parse(value: String): ParsedRFormula = parseAll(formula, value) match { | ||
case Success(result, _) => result | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,7 +322,9 @@ case class Literal (value: Any, dataType: DataType) extends LeafExpression { | |
case (a: Array[Byte], b: Array[Byte]) => util.Arrays.equals(a, b) | ||
case (a: ArrayBasedMapData, b: ArrayBasedMapData) => | ||
a.keyArray == b.keyArray && a.valueArray == b.valueArray | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It's a compilation error. We cannot use 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. Oh, I see. |
||
} | ||
case _ => false | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. nit: for readability, how about leaving a comment like this?
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. 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 commentThe 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. |
||
ExpressionSet() | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We cannot use scala> Float.NaN == Float.NaN
val res2: Boolean = false
scala> Float.NaN.equals(Float.NaN)
val res3: Boolean = true |
||
return false | ||
} | ||
} | ||
|
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.