Skip to content

Commit 8c1adc0

Browse files
committed
[SPARK-54194][PYTHON][FOLLOWUP] Fix connectutils.py to import pb2 conditionally
### What changes were proposed in this pull request? This PR is a follow-up of the following to fix `connectutils.py` to import `pb2` conditionally. - #52894 ### Why are the changes needed? Currently, Python CIs are broken like the following. - https://github.com/apache/spark/actions/workflows/build_python_3.11_classic_only.yml - https://github.com/apache/spark/actions/runs/19316448951/job/55248810741 - https://github.com/apache/spark/actions/workflows/build_python_3.12.yml - https://github.com/apache/spark/actions/runs/19275741458/job/55212353468 ``` File "/__w/spark/spark/python/pyspark/testing/connectutils.py", line 26, in <module> import pyspark.sql.connect.proto as pb2 File "/__w/spark/spark/python/pyspark/sql/connect/proto/__init__.py", line 18, in <module> from pyspark.sql.connect.proto.base_pb2_grpc import * File "/__w/spark/spark/python/pyspark/sql/connect/proto/base_pb2_grpc.py", line 19, in <module> import grpc ModuleNotFoundError: No module named 'grpc' ``` ### Does this PR introduce _any_ user-facing change? No behavior change. We has been importing `pyspark.sql.connect` conditionally before #52894 . ### How was this patch tested? Pass the CIs and manual test. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53037 from dongjoon-hyun/SPARK-54194. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit 63bcc87) Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 6320540 commit 8c1adc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/pyspark/testing/connectutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import uuid
2424
import contextlib
2525

26-
import pyspark.sql.connect.proto as pb2
2726
from pyspark import Row, SparkConf
2827
from pyspark.util import is_remote_only
2928
from pyspark.testing.utils import PySparkErrorTestUtils
@@ -53,6 +52,7 @@
5352
from pyspark.sql.connect.dataframe import DataFrame
5453
from pyspark.sql.connect.plan import Read, Range, SQL, LogicalPlan
5554
from pyspark.sql.connect.session import SparkSession
55+
import pyspark.sql.connect.proto as pb2
5656

5757

5858
class MockRemoteSession:

0 commit comments

Comments
 (0)