Github user jkbradley commented on a diff in the pull request: https://github.com/apache/spark/pull/18746#discussion_r131258120 --- Diff: python/pyspark/ml/tests.py --- @@ -1957,6 +1987,24 @@ def test_chisquaretest(self): self.assertTrue(all(field in fieldNames for field in expectedFields)) +class UnaryTransformerTests(SparkSessionTestCase): + + def test_unary_transformer_transform(self): + shiftVal = 3 + transformer = MockUnaryTransformer(shiftVal=shiftVal)\ + .setInputCol("input").setOutputCol("output") + + df = self.spark.range(0, 10).toDF('input') + df = df.withColumn("input", df.input.cast(dataType="double")) + + transformed_df = transformer.transform(df) + output = transformed_df.select("output").collect() --- End diff -- It's better practice to select both input & output and collect both for comparison, rather than relying on DataFrame rows maintaining their order.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org