Commit 04125eb
[SPARK-41971][CONNECT][PYTHON][FOLLOWUP] Fix to_pandas to support the older Spark
### What changes were proposed in this pull request?
This is a follow-up of apache#40988.
Fix `to_pandas` to support the older Spark.
For the server:
```py
% ./sbin/start-connect-server.sh --packages org.apache.spark:spark-connect_2.12:3.4.0
```
with the client with the change here:
```py
>>> spark.sql("values (1, struct('x' as x)) as t(a, b)").toPandas()
a b
0 1 {'x': 'x'}
```
### Why are the changes needed?
The config `spark.sql.execution.pandas.structHandlingMode` introduced in apache#40988 does not exist in the older Spark, `<3.5`
```py
>>> spark.sql("values (1, struct('x' as x)) as t(a, b)").toPandas()
Traceback (most recent call last):
...
pyspark.errors.exceptions.connect.SparkConnectGrpcException: (java.util.NoSuchElementException) spark.sql.execution.pandas.structHandlingMode
```
### Does this PR introduce _any_ user-facing change?
The newer Spark Connect client will work with `Spark<3.5`.
### How was this patch tested?
Manually.
Closes apache#41390 from ueshin/issues/SPARK-41971/config_with_default.
Authored-by: Takuya UESHIN <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>1 parent 11390c5 commit 04125eb
1 file changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
729 | 732 | | |
730 | 733 | | |
731 | | - | |
732 | | - | |
733 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
734 | 737 | | |
735 | 738 | | |
736 | 739 | | |
| |||
1108 | 1111 | | |
1109 | 1112 | | |
1110 | 1113 | | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1111 | 1125 | | |
1112 | 1126 | | |
1113 | 1127 | | |
| |||
0 commit comments