You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/12 03:04:12 UTC

[GitHub] [flink] WeiZhong94 commented on a change in pull request #14607: [FLINK-20921][python] Support SqlTimeTypeInfo in Python DataStream

WeiZhong94 commented on a change in pull request #14607:
URL: https://github.com/apache/flink/pull/14607#discussion_r555480466



##########
File path: flink-python/pyflink/datastream/tests/test_data_stream.py
##########
@@ -650,6 +650,25 @@ def test_basic_array_type_info(self):
         expected.sort()
         self.assertEqual(expected, results)
 
+    def test_sql_timestamp_type_info(self):
+        ds = self.env.from_collection([(datetime.date(2021, 1, 9),
+                                        datetime.time(12, 0, 0),
+                                        datetime.datetime(2021, 1, 9, 12, 0, 0, 11000))],
+                                      type_info=Types.ROW([Types.SQL_DATE(),
+                                                           Types.SQL_TIME(),
+                                                           Types.SQL_TIMESTAMP()]))
+
+        ds.map(lambda x: x, output_type=Types.ROW([Types.SQL_DATE(),
+                                                   Types.SQL_TIME(),
+                                                   Types.SQL_TIMESTAMP()]))\
+            .add_sink(self.test_sink)
+        self.env.execute("test sql timestamp type info")
+        results = self.test_sink.get_results()
+        expected = ['+I[2021-01-09, 12:00:00, 2021-01-09 12:00:00.011]']
+        results.sort()

Review comment:
       The sorts is unnecessary.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org