You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by jkbradley <gi...@git.apache.org> on 2018/04/02 23:39:21 UTC
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
GitHub user jkbradley opened a pull request:
https://github.com/apache/spark/pull/20964
[SPARK-22883] ML test for StructuredStreaming: spark.ml.feature, I-M
## What changes were proposed in this pull request?
Adds structured streaming tests using testTransformer for these suites:
* IDF
* Imputer
* Interaction
* MaxAbsScaler
* MinHashLSH
* MinMaxScaler
* NGram
## How was this patch tested?
It is a bunch of tests!
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jkbradley/spark SPARK-22883-part2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/20964.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #20964
----
commit c74cd89c220ea6a679a927c3d3caf1c4f3e24c0b
Author: Joseph K. Bradley <jo...@...>
Date: 2018-03-30T17:44:31Z
partly done
commit 26f7519e31853b2abc8807e32eacd015164dd44d
Author: Joseph K. Bradley <jo...@...>
Date: 2018-04-02T23:34:28Z
remaining tests
commit 778e822ad6ef8e029dc074981ae396feafed2962
Author: Joseph K. Bradley <jo...@...>
Date: 2018-04-02T23:39:10Z
reverted MLTest change
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/20964
I rebased off of master because of the merge warning in the last tests.
I did not have to resolve any conflicts.
I'll merge this once tests pass.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89174/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178784053
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/MinMaxScalerSuite.scala ---
@@ -48,8 +46,8 @@ class MinMaxScalerSuite extends SparkFunSuite with MLlibTestSparkContext with De
.setMax(5)
val model = scaler.fit(df)
- model.transform(df).select("expected", "scaled").collect()
- .foreach { case Row(vector1: Vector, vector2: Vector) =>
+ testTransformer[(Vector, Vector)](df, model, "expected", "scaled") {
+ case Row(vector1: Vector, vector2: Vector) =>
assert(vector1.equals(vector2), "Transformed vector is different with expected.")
--- End diff --
`vector1 === vector2`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178893936
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/NGramSuite.scala ---
@@ -84,7 +84,7 @@ class NGramSuite extends MLTest with DefaultReadWriteTest {
def testNGram(t: NGram, dataFrame: DataFrame): Unit = {
testTransformer[(Seq[String], Seq[String])](dataFrame, t, "nGrams", "wantedNGrams") {
- case Row(actualNGrams : Seq[String], wantedNGrams: Seq[String]) =>
+ case Row(actualNGrams : Seq[_], wantedNGrams: Seq[_]) =>
--- End diff --
String is not actually checked because of erasure, so IntelliJ complained with a style warning before this change.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178780101
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/MaxAbsScalerSuite.scala ---
@@ -45,9 +44,9 @@ class MaxAbsScalerSuite extends SparkFunSuite with MLlibTestSparkContext with De
.setOutputCol("scaled")
val model = scaler.fit(df)
- model.transform(df).select("expected", "scaled").collect()
- .foreach { case Row(vector1: Vector, vector2: Vector) =>
- assert(vector1.equals(vector2), s"MaxAbsScaler ut error: $vector2 should be $vector1")
+ testTransformer[(Vector, Vector)](df, model, "expected", "scaled") {
+ case Row(vector1: Vector, vector2: Vector) =>
+ assert(vector1.equals(vector2), s"MaxAbsScaler error: $vector2 should be $vector1")
--- End diff --
`vector1 === vector2`
and the error message looks strange. ==> s"scaled value $vector2 do not equal expected value "$vector1" ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/20964
Thanks! I'll rerun tests since they are stale and merge after they pass.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on the issue:
https://github.com/apache/spark/pull/20964
Merging with master
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test FAILed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #88851 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88851/testReport)** for PR 20964 at commit [`6dff94e`](https://github.com/apache/spark/commit/6dff94e87ea77b971c97ca64ea7a06eacfbc7110).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on the issue:
https://github.com/apache/spark/pull/20964
LGTM. 👍
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178894229
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/MinMaxScalerSuite.scala ---
@@ -48,8 +46,8 @@ class MinMaxScalerSuite extends SparkFunSuite with MLlibTestSparkContext with De
.setMax(5)
val model = scaler.fit(df)
- model.transform(df).select("expected", "scaled").collect()
- .foreach { case Row(vector1: Vector, vector2: Vector) =>
+ testTransformer[(Vector, Vector)](df, model, "expected", "scaled") {
+ case Row(vector1: Vector, vector2: Vector) =>
assert(vector1.equals(vector2), "Transformed vector is different with expected.")
--- End diff --
True, === is more standard
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88851/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2194/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Merged build finished. Test FAILed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178896432
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/ImputerSuite.scala ---
@@ -76,6 +75,28 @@ class ImputerSuite extends SparkFunSuite with MLlibTestSparkContext with Default
ImputerSuite.iterateStrategyTest(imputer, df)
}
+ test("Imputer should work with Structured Streaming") {
+ val localSpark = spark
+ import localSpark.implicits._
+ val df = Seq[(java.lang.Double, Double)](
+ (4.0, 4.0),
+ (10.0, 10.0),
+ (10.0, 10.0),
+ (Double.NaN, 8.0),
+ (null, 8.0)
+ ).toDF("value", "expected_mean_value")
--- End diff --
since it's nullable
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #89174 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89174/testReport)** for PR 20964 at commit [`592670c`](https://github.com/apache/spark/commit/592670c90975d904605864f3168eff00c2befa5d).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #4151 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/4151/testReport)** for PR 20964 at commit [`6dff94e`](https://github.com/apache/spark/commit/6dff94e87ea77b971c97ca64ea7a06eacfbc7110).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1924/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178778285
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/ImputerSuite.scala ---
@@ -76,6 +75,28 @@ class ImputerSuite extends SparkFunSuite with MLlibTestSparkContext with Default
ImputerSuite.iterateStrategyTest(imputer, df)
}
+ test("Imputer should work with Structured Streaming") {
+ val localSpark = spark
+ import localSpark.implicits._
+ val df = Seq[(java.lang.Double, Double)](
+ (4.0, 4.0),
+ (10.0, 10.0),
+ (10.0, 10.0),
+ (Double.NaN, 8.0),
+ (null, 8.0)
+ ).toDF("value", "expected_mean_value")
--- End diff --
Why the "value" column use `java.lang.Double` type ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #4151 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/4151/testReport)** for PR 20964 at commit [`6dff94e`](https://github.com/apache/spark/commit/6dff94e87ea77b971c97ca64ea7a06eacfbc7110).
* This patch passes all tests.
* This patch **does not merge cleanly**.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #88851 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88851/testReport)** for PR 20964 at commit [`6dff94e`](https://github.com/apache/spark/commit/6dff94e87ea77b971c97ca64ea7a06eacfbc7110).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178784391
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/NGramSuite.scala ---
@@ -84,7 +84,7 @@ class NGramSuite extends MLTest with DefaultReadWriteTest {
def testNGram(t: NGram, dataFrame: DataFrame): Unit = {
testTransformer[(Seq[String], Seq[String])](dataFrame, t, "nGrams", "wantedNGrams") {
- case Row(actualNGrams : Seq[String], wantedNGrams: Seq[String]) =>
+ case Row(actualNGrams : Seq[_], wantedNGrams: Seq[_]) =>
--- End diff --
Just curious, why change `Seq[String]` to `Seq[_]`, is it for fixing some potential issue ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/20964
**[Test build #89174 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89174/testReport)** for PR 20964 at commit [`592670c`](https://github.com/apache/spark/commit/592670c90975d904605864f3168eff00c2befa5d).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by jkbradley <gi...@git.apache.org>.
Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178896682
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/MinHashLSHSuite.scala ---
@@ -167,4 +166,20 @@ class MinHashLSHSuite extends SparkFunSuite with MLlibTestSparkContext with Defa
assert(precision == 1.0)
assert(recall >= 0.7)
}
+
+ test("MinHashLSHModel.transform should work with Structured Streaming") {
+ val localSpark = spark
+ import localSpark.implicits._
+
+ val model = new MinHashLSHModel("mh", randCoefficients = Array((1, 0)))
+ model.set(model.inputCol, "keys")
+ testTransformer[Tuple1[Vector]](dataset.toDF(), model, "keys", model.getOutputCol) {
+ case Row(_: Vector, output: Seq[_]) =>
+ assert(output.length === model.randCoefficients.length)
+ // no AND-amplification yet: SPARK-18450, so each hash output is of length 1
+ output.foreach {
+ case hashOutput: Vector => assert(hashOutput.size === 1)
+ }
+ }
--- End diff --
I don't think that's necessary for testing that this works with structured streaming. (I can't see how streaming would mess up the correctness of the algorithm.)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1913/
Test FAILed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/20964
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #20964: [SPARK-22883] ML test for StructuredStreaming: spark.ml....
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/20964
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88838/
Test FAILed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #20964: [SPARK-22883] ML test for StructuredStreaming: sp...
Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20964#discussion_r178783980
--- Diff: mllib/src/test/scala/org/apache/spark/ml/feature/MinHashLSHSuite.scala ---
@@ -167,4 +166,20 @@ class MinHashLSHSuite extends SparkFunSuite with MLlibTestSparkContext with Defa
assert(precision == 1.0)
assert(recall >= 0.7)
}
+
+ test("MinHashLSHModel.transform should work with Structured Streaming") {
+ val localSpark = spark
+ import localSpark.implicits._
+
+ val model = new MinHashLSHModel("mh", randCoefficients = Array((1, 0)))
+ model.set(model.inputCol, "keys")
+ testTransformer[Tuple1[Vector]](dataset.toDF(), model, "keys", model.getOutputCol) {
+ case Row(_: Vector, output: Seq[_]) =>
+ assert(output.length === model.randCoefficients.length)
+ // no AND-amplification yet: SPARK-18450, so each hash output is of length 1
+ output.foreach {
+ case hashOutput: Vector => assert(hashOutput.size === 1)
+ }
+ }
--- End diff --
Why not have "expected" column" here to compare with ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org