[GitHub] spark pull request #19835: [SPARK-21866][ML][PYTHON][FOLLOWUP] Few cleanups ...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/19835 --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19835: [SPARK-21866][ML][PYTHON][FOLLOWUP] Few cleanups ...
Github user imatiach-msft commented on a diff in the pull request: https://github.com/apache/spark/pull/19835#discussion_r153689403 --- Diff: python/pyspark/ml/image.py --- @@ -146,7 +163,12 @@ def toImage(self, array, origin=""): mode = ocvTypes["CV_8UC4"] else: raise ValueError("Invalid number of channels") -data = bytearray(array.astype(dtype=np.uint8).ravel()) + +# Running `bytearray(numpy.array([1]))` fails in specific Python versions +# with a specific Numpy version, for example in Python 3.6.0 and NumPy 1.13.3. +# Here, it avoids it by converting it to bytes. +data = bytearray(array.astype(dtype=np.uint8).ravel().tobytes()) --- End diff -- strange, but the comment explains the issue well and I think this is a good workaround --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #19835: [SPARK-21866][ML][PYTHON][FOLLOWUP] Few cleanups ...
Github user imatiach-msft commented on a diff in the pull request: https://github.com/apache/spark/pull/19835#discussion_r153689356 --- Diff: python/pyspark/ml/tests.py --- @@ -1836,6 +1836,24 @@ def test_read_images(self): self.assertEqual(ImageSchema.imageFields, expected) self.assertEqual(ImageSchema.undefinedImageType, "Undefined") +with QuietTest(self.sc): --- End diff -- nice tests! --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org