ozancicek commented on a change in pull request #24939: [SPARK-18569][ML][R]
Support RFormula arithmetic, I() and spark functions
URL: https://github.com/apache/spark/pull/24939#discussion_r320783880
##########
File path:
mllib/src/main/scala/org/apache/spark/ml/feature/RFormulaParser.scala
##########
@@ -247,9 +273,24 @@ private[ml] case class Terms(terms: Seq[Term]) extends
Term {
/**
* Limited implementation of R formula parsing. Currently supports: '~', '+',
'-', '.', ':',
- * '*', '^'.
+ * '*', '^', 'I()'.
*/
-private[ml] object RFormulaParser extends RegexParsers {
+private[ml] object RFormulaParser extends RegexParsers with EvalExprParser {
+
+ /**
+ * Whether to skip whitespace in literals and regex is currently only
achived with
+ * a global switch, and by default it's skipped. We'd like it to be skipped
for most parsers,
Review comment:
Oh, when I re-read that comment I realized I didn't make much sense, sorry
about that! Let me try to rephrase.
From the perspective of RFormulaParser, it shouldn't be configurable. That
switch refers to whitespace skipping behaviour of RegexParsers. RegexParsers
don't provide a way to enable-disable whitespace skipping for individual
parsers defined inside RegexParsers. There is only a class-wide skipWhitespace
flag which disables or enables whitespace skipping for all parsers, and default
behaviour is to skip all whitespace. So to be able to parse whitespace for
selected parsers, the default behaviour is disabled and whitespace is skipped
on the remaining parsers.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]