HyukjinKwon commented on code in PR #41537:
URL: https://github.com/apache/spark/pull/41537#discussion_r1224447904
##########
python/pyspark/sql/connect/session.py:
##########
@@ -643,6 +656,13 @@ def addArtifacts(
addArtifact = addArtifacts
+ def _cacheLocalRelation(self, localRelation: LocalRelation) -> str:
Review Comment:
I would name it as below:
```suggestion
def _cache_local_relation(self, localRelation: LocalRelation) -> str:
```
##########
python/pyspark/sql/connect/session.py:
##########
@@ -466,10 +473,16 @@ def createDataFrame(
)
if _schema is not None:
- df = DataFrame.withPlan(LocalRelation(_table,
schema=_schema.json()), self)
+ localRelation = LocalRelation(_table, schema=_schema.json())
else:
- df = DataFrame.withPlan(LocalRelation(_table), self)
+ localRelation = LocalRelation(_table)
+
+ cacheThreshold =
self._client.get_configs("spark.sql.session.localRelationCacheThreshold")
+ plan: LogicalPlan = localRelation
+ if cacheThreshold[0] is not None and int(cacheThreshold[0]) <=
_table.nbytes:
+ plan = CachedLocalRelation(self._cacheLocalRelation(localRelation))
Review Comment:
```suggestion
plan =
CachedLocalRelation(self._cache_local_relation(localRelation))
```
--
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]