File tree Expand file tree Collapse file tree 2 files changed +1
-5
lines changed Expand file tree Collapse file tree 2 files changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -1848,15 +1848,13 @@ def _schema(self) -> StructType:
1848
1848
1849
1849
@property
1850
1850
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
1853
1851
if self ._cached_schema_serialized is not None :
1854
1852
try :
1855
1853
return CPickleSerializer ().loads (self ._cached_schema_serialized )
1856
1854
except Exception as e :
1857
1855
logger .warn (f"DataFrame schema pickle loads failed with exception: { e } ." )
1858
1856
# In case of pickle ser/de failure, fallback to deepcopy approach.
1859
- return copy .deepcopy (_schema )
1857
+ return copy .deepcopy (self . _schema )
1860
1858
1861
1859
@functools .cache
1862
1860
def isLocal (self ) -> bool :
Original file line number Diff line number Diff line change @@ -74,11 +74,9 @@ def test_cached_property_is_copied(self):
74
74
75
75
cdf = self .connect .createDataFrame (data , schema )
76
76
cdf_schema = cdf .schema
77
- assert len (cdf ._cached_schema_serialized ) > 0
78
77
assert cdf_schema .jsonValue () == cdf ._cached_schema .jsonValue ()
79
78
assert len (cdf_schema .fields ) == 4
80
79
cdf_schema .fields .pop (0 )
81
- assert cdf .schema .jsonValue () == cdf ._cached_schema .jsonValue ()
82
80
assert len (cdf .schema .fields ) == 4
83
81
84
82
def test_cached_schema_to (self ):
You can’t perform that action at this time.
0 commit comments