ueshin commented on a change in pull request #33876:
URL: https://github.com/apache/spark/pull/33876#discussion_r699570070
##########
File path: python/pyspark/sql/pandas/conversion.py
##########
@@ -336,10 +338,12 @@ def createDataFrame(self, data, schema=None,
samplingRatio=None, verifySchema=Tr
"has been set to false.\n %s" % str(e))
warnings.warn(msg)
raise
- data = self._convert_from_pandas(data, schema, timezone)
+
+ should_localize = self._wrapped._conf.timestampType().typeName() ==
"timestamp"
Review comment:
We should have a util method or function for this?
##########
File path: python/pyspark/sql/tests/test_dataframe.py
##########
@@ -710,9 +718,10 @@ def test_to_pandas_from_mixed_dataframe(self):
CAST(col6 AS DOUBLE) AS double,
CAST(col7 AS BOOLEAN) AS boolean,
CAST(col8 AS STRING) AS string,
- timestamp_seconds(col9) AS timestamp
- FROM VALUES (1, 1, 1, 1, 1, 1, 1, 1, 1),
- (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
+ timestamp_seconds(col9) AS timestamp,
+ timestamp_seconds(col9) AS timestamp_ntz
Review comment:
nit: `col10` instead of `col9`? or you can use `col9` without adding
values in `VALUES` clause?
##########
File path: python/pyspark/sql/pandas/conversion.py
##########
@@ -336,10 +338,12 @@ def createDataFrame(self, data, schema=None,
samplingRatio=None, verifySchema=Tr
"has been set to false.\n %s" % str(e))
warnings.warn(msg)
raise
- data = self._convert_from_pandas(data, schema, timezone)
+
+ should_localize = not self._is_timestamp_ntz_preferred()
Review comment:
I mean, I'm just wondering why it's called here.
It can be called earlier to reuse the result, or it can be called later in
each function.
##########
File path: python/pyspark/sql/pandas/conversion.py
##########
@@ -336,10 +338,12 @@ def createDataFrame(self, data, schema=None,
samplingRatio=None, verifySchema=Tr
"has been set to false.\n %s" % str(e))
warnings.warn(msg)
raise
- data = self._convert_from_pandas(data, schema, timezone)
+
+ should_localize = not self._is_timestamp_ntz_preferred()
Review comment:
nit: we should pass the result of `self._is_timestamp_ntz_preferred()`
to `self._create_from_pandas_with_arrow(...)` at line 321 as well to avoid
multiple calls?
Otherwise, we can call it in `self._convert_from_pandas(...)` instead?
--
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]