Skip to content

Commit af1b276

Browse files
committed
Revert "Make the first call go through pickle as well."
This reverts commit 4f4ae1a.
1 parent 4f4ae1a commit af1b276

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

python/pyspark/sql/connect/dataframe.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,15 +1848,13 @@ def _schema(self) -> StructType:
18481848

18491849
@property
18501850
def schema(self) -> StructType:
1851-
# self._schema call will cache the schema and serialize it if it is not cached yet.
1852-
_schema = self._schema
18531851
if self._cached_schema_serialized is not None:
18541852
try:
18551853
return CPickleSerializer().loads(self._cached_schema_serialized)
18561854
except Exception as e:
18571855
logger.warn(f"DataFrame schema pickle loads failed with exception: {e}.")
18581856
# In case of pickle ser/de failure, fallback to deepcopy approach.
1859-
return copy.deepcopy(_schema)
1857+
return copy.deepcopy(self._schema)
18601858

18611859
@functools.cache
18621860
def isLocal(self) -> bool:

python/pyspark/sql/tests/connect/test_connect_dataframe_property.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ def test_cached_property_is_copied(self):
7474

7575
cdf = self.connect.createDataFrame(data, schema)
7676
cdf_schema = cdf.schema
77-
assert len(cdf._cached_schema_serialized) > 0
7877
assert cdf_schema.jsonValue() == cdf._cached_schema.jsonValue()
7978
assert len(cdf_schema.fields) == 4
8079
cdf_schema.fields.pop(0)
81-
assert cdf.schema.jsonValue() == cdf._cached_schema.jsonValue()
8280
assert len(cdf.schema.fields) == 4
8381

8482
def test_cached_schema_to(self):

0 commit comments

Comments
 (0)