You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/03 02:59:12 UTC

[GitHub] [spark] retronym commented on a change in pull request #30455: [SPARK-33513][BUILD] Upgrade to Scala 2.13.4 to improve exhaustivity

retronym commented on a change in pull request #30455:
URL: https://github.com/apache/spark/pull/30455#discussion_r534630859



##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/RFormulaParser.scala
##########
@@ -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)

Review comment:
       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.

##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/RFormulaParser.scala
##########
@@ -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)

Review comment:
       For future reference, a slightly cleaner way to express this in a warning free way is:
   
   ```scala
   ((label <~ "~") ~ expr ) ^^ {
     case r ~ t => ParsedRFormula(r, t.asTerms.terms)
   }
   ```
   
   It also avoids duplicating the `"~"` token in the parser and the action.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org