Skip to content

Commit 0567dcd

Browse files
committed
[SPARK-54885][PYTHON] Remove unreachable code after upgrading pyarrow minimum version to 18.0.0
### What changes were proposed in this pull request? Remove unreachable code after upgrading pyarrow minimum version to 18.0.0 ### Why are the changes needed? Code clean up ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No Closes #53663 from zhengruifeng/del_old_path. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
1 parent 5da9d2a commit 0567dcd

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

python/pyspark/sql/pandas/types.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from typing import Any, Callable, Iterable, List, Optional, Union, TYPE_CHECKING
2727

2828
from pyspark.errors import PySparkTypeError, UnsupportedOperationException, PySparkValueError
29-
from pyspark.loose_version import LooseVersion
3029
from pyspark.sql.types import (
3130
cast,
3231
BooleanType,
@@ -539,9 +538,7 @@ def _check_arrow_array_timestamps_localize(
539538
a.items, mt.valueType, truncate, timezone
540539
),
541540
}
542-
# SPARK-48302: PyArrow added support for mask argument to pa.MapArray.from_arrays in
543-
# version 17.0.0
544-
if a.null_count and LooseVersion(pa.__version__) >= LooseVersion("17.0.0"):
541+
if a.null_count:
545542
params["mask"] = a.is_null()
546543

547544
return pa.MapArray.from_arrays(**params)

python/pyspark/sql/tests/arrow/test_arrow.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
pyarrow_requirement_message,
6060
)
6161
from pyspark.errors import ArithmeticException, PySparkTypeError, UnsupportedOperationException
62-
from pyspark.loose_version import LooseVersion
6362
from pyspark.util import is_remote_only
6463

6564
if have_pandas:
@@ -1658,18 +1657,7 @@ def test_arrow_map_timestamp_nulls_round_trip(self):
16581657
)
16591658
df = self.spark.createDataFrame(origin)
16601659
t = df.toArrow()
1661-
1662-
# SPARK-48302: PyArrow versions before 17.0.0 replaced nulls with empty lists when
1663-
# reconstructing MapArray columns to localize timestamps
1664-
if LooseVersion(pa.__version__) >= LooseVersion("17.0.0"):
1665-
expected = origin
1666-
else:
1667-
expected = pa.table(
1668-
[[dict(ts=datetime.datetime(2023, 1, 1, 8, 0, 0)), []]],
1669-
schema=origin_schema,
1670-
)
1671-
1672-
self.assertTrue(t.equals(expected))
1660+
self.assertTrue(t.equals(origin))
16731661

16741662
def test_createDataFrame_udt(self):
16751663
for arrow_enabled in [True, False]:

0 commit comments

Comments
 (0)