Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/8830#discussion_r40292247
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/feature/RFormulaParserSuite.scala ---
@@ -79,4 +87,79 @@ class RFormulaParserSuite extends SparkFunSuite {
assert(!RFormulaParser.parse("a ~ b - 1").hasIntercept)
assert(!RFormulaParser.parse("a ~ b + 1 - 1").hasIntercept)
}
+
+ test("parse interactions") {
+ checkParse("y ~ a:b", "y", Seq("a:b"))
+ checkParse("y ~ ._a:._x", "y", Seq("._a:._x"))
+ checkParse("y ~ foo:bar", "y", Seq("foo:bar"))
+ checkParse("y ~ a : b : c", "y", Seq("a:b:c"))
+ checkParse("y ~ q + a:b:c + b:c + c:d + z", "y", Seq("q", "a:b:c",
"b:c", "c:d", "z"))
+ }
+
+ test("parse basic interactions with dot") {
+ val schema = (new StructType)
+ .add("a", "int", true)
+ .add("b", "long", false)
+ .add("c", "string", true)
+ checkParse("y ~ .:x", "y", Seq("a:x", "b:x", "c:x"), schema)
--- End diff --
This is a little confusing because `x` and `y` do not appear in the schema.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]