You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "itholic (via GitHub)" <gi...@apache.org> on 2024/01/26 08:57:05 UTC

[PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

itholic opened a new pull request, #44899:
URL: https://github.com/apache/spark/pull/44899

   
   
   ### What changes were proposed in this pull request?
   
   This PR proposes to remove `pyspark.pandas` dependency from `assertDataFrameEqual`
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   To allow `assertDataFrameEqual` when pandas is not installed.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   CI should pass.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   No.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1469022955


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   At present, this changes is okay, and I have already tested it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #44899: [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual`
URL: https://github.com/apache/spark/pull/44899


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1467380438


##########
python/pyspark/testing/utils.py:
##########
@@ -758,11 +758,14 @@ def assertDataFrameEqual(
     has_pandas = False
     try:
         # If pandas dependencies are available, allow pandas or pandas-on-Spark DataFrame
-        import pyspark.pandas as ps
         import pandas as pd
         from pyspark.testing.pandasutils import PandasOnSparkTestUtils
 
         has_pandas = True
+        if has_pandas:
+            # Only import pyspark.pandas when Pandas is available to prevent test stopping
+            # when Pandas is not installed.
+            import pyspark.pandas as ps

Review Comment:
   ps reference below will fail. Can we work around



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "itholic (via GitHub)" <gi...@apache.org>.
itholic commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1468984306


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   Just fixed it.
   
   BTW, your test environment appears to have `pandas` installed, only `pyarrow` is not installed. Am I understand correctly?? I thought it does not have both `pandas` and `pyarrow`.



##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   Just fixed it.
   
   @panbingkun BTW, your test environment appears to have `pandas` installed, only `pyarrow` is not installed. Am I understand correctly?? I thought it does not have both `pandas` and `pyarrow`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1468839050


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   I have applied the above modifications to the testing(https://github.com/apache/spark/pull/44778), and from the test results, there may still be some issues:
   https://github.com/panbingkun/spark/actions/runs/7684778955/job/20941679265#step:12:4327
   <img width="1001" alt="image" src="https://github.com/apache/spark/assets/15246973/f85c97de-1e80-4962-bd47-515fe7138500">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "itholic (via GitHub)" <gi...@apache.org>.
itholic commented on PR #44899:
URL: https://github.com/apache/spark/pull/44899#issuecomment-1914098733

   Thanks for the review @HyukjinKwon @dongjoon-hyun @panbingkun !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "itholic (via GitHub)" <gi...@apache.org>.
itholic commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1467391496


##########
python/pyspark/testing/utils.py:
##########
@@ -758,11 +758,14 @@ def assertDataFrameEqual(
     has_pandas = False
     try:
         # If pandas dependencies are available, allow pandas or pandas-on-Spark DataFrame
-        import pyspark.pandas as ps
         import pandas as pd
         from pyspark.testing.pandasutils import PandasOnSparkTestUtils
 
         has_pandas = True
+        if has_pandas:
+            # Only import pyspark.pandas when Pandas is available to prevent test stopping
+            # when Pandas is not installed.
+            import pyspark.pandas as ps

Review Comment:
   relocated the import



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44899:
URL: https://github.com/apache/spark/pull/44899#issuecomment-1913880081

   Merged to master for Apache Spark 4.0.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1469021597


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   I made some slight improvements, and the test was okay.
   https://github.com/apache/spark/pull/44778/files#diff-89e8f0a4413730d86ed98f11e10e3dfe259aa80378a2734eee659ea08bfff8b4R773-R784
   ![Uploading image.png…]()
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1468965227


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   I think it is not, but would be great to fix it here because essentially the issue still persists.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1468930011


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   Thank you for reporting, @panbingkun .
   
   To @itholic , is the above failure newly introduced by this PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1468839050


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   From the verification results, there may still be issues:
   https://github.com/panbingkun/spark/actions/runs/7684778955/job/20941679265#step:12:4327
   <img width="1001" alt="image" src="https://github.com/apache/spark/assets/15246973/f85c97de-1e80-4962-bd47-515fe7138500">
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #44899:
URL: https://github.com/apache/spark/pull/44899#issuecomment-1913886021

   > Thank you, @itholic and all. Then, let's merge this.
   
   In https://github.com/apache/spark/pull/44778, I have merged this PR and let me to verify it again on GA.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46874][PYTHON] Remove `pyspark.pandas` dependency from `assertDataFrameEqual` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #44899:
URL: https://github.com/apache/spark/pull/44899#discussion_r1469021597


##########
python/pyspark/testing/utils.py:
##########
@@ -768,6 +767,8 @@ def assertDataFrameEqual(
         pass
 
     if has_pandas:
+        import pyspark.pandas as ps
+

Review Comment:
   I made some slight improvements, and the test was okay.
   https://github.com/apache/spark/pull/44778/files#diff-89e8f0a4413730d86ed98f11e10e3dfe259aa80378a2734eee659ea08bfff8b4R773-R784
   <img width="1061" alt="image" src="https://github.com/apache/spark/assets/15246973/6cc3a412-9e2f-412a-a2e3-fc966f17a334">
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org