Repository: spark Updated Branches: refs/heads/master 46776234a -> 0c8fca460
[SPARK-22811][PYSPARK][ML] Fix pyspark.ml.tests failure when Hive is not available. ## What changes were proposed in this pull request? pyspark.ml.tests is missing a py4j import. I've added the import and fixed the test that uses it. This test was only failing when testing without Hive. ## How was this patch tested? Existing tests. Please review http://spark.apache.org/contributing.html before opening a pull request. Author: Bago Amirbekian <b...@databricks.com> Closes #19997 from MrBago/fix-ImageReaderTest2. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/0c8fca46 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/0c8fca46 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/0c8fca46 Branch: refs/heads/master Commit: 0c8fca4608643ed9e1eb3ae8620e6f4f6a017a87 Parents: 4677623 Author: Bago Amirbekian <b...@databricks.com> Authored: Sat Dec 16 10:57:35 2017 +0900 Committer: hyukjinkwon <gurwls...@gmail.com> Committed: Sat Dec 16 10:57:35 2017 +0900 ---------------------------------------------------------------------- python/pyspark/ml/tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/0c8fca46/python/pyspark/ml/tests.py ---------------------------------------------------------------------- diff --git a/python/pyspark/ml/tests.py b/python/pyspark/ml/tests.py index 3a0b816..be15211 100755 --- a/python/pyspark/ml/tests.py +++ b/python/pyspark/ml/tests.py @@ -44,6 +44,7 @@ import array as pyarray import numpy as np from numpy import abs, all, arange, array, array_equal, inf, ones, tile, zeros import inspect +import py4j from pyspark import keyword_only, SparkContext from pyspark.ml import Estimator, Model, Pipeline, PipelineModel, Transformer, UnaryTransformer @@ -1859,8 +1860,9 @@ class ImageReaderTest2(PySparkTestCase): @classmethod def setUpClass(cls): - PySparkTestCase.setUpClass() + super(ImageReaderTest2, cls).setUpClass() # Note that here we enable Hive's support. + cls.spark = None try: cls.sc._jvm.org.apache.hadoop.hive.conf.HiveConf() except py4j.protocol.Py4JError: @@ -1873,8 +1875,10 @@ class ImageReaderTest2(PySparkTestCase): @classmethod def tearDownClass(cls): - PySparkTestCase.tearDownClass() - cls.spark.sparkSession.stop() + super(ImageReaderTest2, cls).tearDownClass() + if cls.spark is not None: + cls.spark.sparkSession.stop() + cls.spark = None def test_read_images_multiple_times(self): # This test case is to check if `ImageSchema.readImages` tries to --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org