ianmcook commented on code in PR #46529:
URL: https://github.com/apache/spark/pull/46529#discussion_r1618161708
##########
python/pyspark/sql/pandas/conversion.py:
##########
@@ -360,12 +376,25 @@ def createDataFrame( # type: ignore[misc]
assert isinstance(self, SparkSession)
+ timezone = self._jconf.sessionLocalTimeZone()
+
+ if type(data).__name__ == "Table":
Review Comment:
I think this is the usual method that Python developers recommend for
checking the type of an object when you don't know if the module is loaded. It
looks like this method is used in many other places in the PySpark code.
One improvement would be to explicitly check the module also, like this:
```py
if (type(t).__module__, type(t).__name__) == ("pyarrow.lib", "Table"):
```
I am happy to use a different approach but I am not sure which approach
would be an improvement. I think the approach you suggest will not work because
`isinstance` expects the name the module was loaded as (usually `pa`) but the
method to check if PyArrow is loaded (`"pyarrow" in sys.modules`) needs the
library name.
--
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]