zhengruifeng commented on code in PR #49749:
URL: https://github.com/apache/spark/pull/49749#discussion_r1938801631
##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -1988,6 +1988,11 @@ def registerTempTable(self, name: str) -> None:
warnings.warn("Deprecated in 2.0, use createOrReplaceTempView
instead.", FutureWarning)
self.createOrReplaceTempView(name)
+ def _original_schema(self) -> StructType:
+ if self._cached_schema:
+ return self._cached_schema
+ return self.schema
Review Comment:
I think it should be a `property`
And since this is only for internal usage, I think we can avoid calling
`self.schema` which has `deepcopy`.
e.g.
````
@property
def _schema(self) -> StructType:
if self._cached_schema is None:
query = self._plan.to_proto(self._session.client)
self._cached_schema = self._session.client.schema(query)
return self._cached_schema
@property
def schema(self) -> StructType:
return copy.deepcopy(self._schema)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]