You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "AngersZhuuuu (via GitHub)" <gi...@apache.org> on 2024/05/27 02:50:54 UTC
[PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
AngersZhuuuu opened a new pull request, #46750:
URL: https://github.com/apache/spark/pull/46750
### What changes were proposed in this pull request?
Add UT
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Added UT
### Was this patch authored or co-authored using generative AI tooling?
No
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #46750:
URL: https://github.com/apache/spark/pull/46750#discussion_r1615476610
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [(
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )]
+ df = self.spark.createDataFrame(data)
Review Comment:
```suggestion
data = [
(
datetime.datetime(1970, 1, 1, 0, 0),
Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
)
]
```
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [(
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )]
+ df = self.spark.createDataFrame(data)
self.assertEqual(list(df.schema)[0].dataType.simpleString(), "timestamp_ntz")
self.assertEqual(df.first()[0], datetime.datetime(1970, 1, 1, 0, 0))
+ self.assertEqual(
+ list(df.schema)[1].dataType.simpleString(),
+ "struct<a:struct<a:timestamp_ntz>>"
Review Comment:
```suggestion
list(df.schema)[1].dataType.simpleString(), "struct<a:struct<a:timestamp_ntz>>"
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #46750: [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz
URL: https://github.com/apache/spark/pull/46750
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #46750:
URL: https://github.com/apache/spark/pull/46750#discussion_r1615599422
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [
+ (
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )
+ ]
Review Comment:
```suggestion
]
df = self.spark.createDataFrame(data)
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #46750:
URL: https://github.com/apache/spark/pull/46750#discussion_r1615599422
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [
+ (
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )
+ ]
Review Comment:
```suggestion
]
df = self.spark.createDataFrame(data)
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #46750:
URL: https://github.com/apache/spark/pull/46750#issuecomment-2132950767
Merged to master.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "AngersZhuuuu (via GitHub)" <gi...@apache.org>.
AngersZhuuuu commented on PR #46750:
URL: https://github.com/apache/spark/pull/46750#issuecomment-2132555084
ping @HyukjinKwon
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-48340][PYTHON][FOLLOWUP] Support TimestampNTZ infer schema miss prefer_timestamp_ntz [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #46750:
URL: https://github.com/apache/spark/pull/46750#discussion_r1615476879
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [(
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )]
+ df = self.spark.createDataFrame(data)
self.assertEqual(list(df.schema)[0].dataType.simpleString(), "timestamp_ntz")
self.assertEqual(df.first()[0], datetime.datetime(1970, 1, 1, 0, 0))
+ self.assertEqual(
+ list(df.schema)[1].dataType.simpleString(),
+ "struct<a:struct<a:timestamp_ntz>>"
Review Comment:
```suggestion
list(df.schema)[1].dataType.simpleString(), "struct<a:struct<a:timestamp_ntz>>"
```
##########
python/pyspark/sql/tests/test_types.py:
##########
@@ -236,14 +238,24 @@ def __init__(self):
Row(a=1),
Row(a=1),
Row(a=1),
+ Row(b=Row(c=datetime.datetime(1970, 1, 1, 0, 0))),
]
self.assertEqual(actual, expected)
with self.sql_conf({"spark.sql.timestampType": "TIMESTAMP_NTZ"}):
with self.sql_conf({"spark.sql.session.timeZone": "America/Sao_Paulo"}):
- df = self.spark.createDataFrame([(datetime.datetime(1970, 1, 1, 0, 0),)])
+ data = [(
+ datetime.datetime(1970, 1, 1, 0, 0),
+ Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
+ )]
+ df = self.spark.createDataFrame(data)
Review Comment:
```suggestion
data = [
(
datetime.datetime(1970, 1, 1, 0, 0),
Row(a=Row(a=datetime.datetime(1970, 1, 1, 0, 0))),
)
]
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org