mllu opened a new pull request #17:
URL: https://github.com/apache/flink-playgrounds/pull/17


   I was following and playing around [Real Time Reporting with the Table 
API](https://ci.apache.org/projects/flink/flink-docs-release-1.11/try-flink/table_api.html#real-time-reporting-with-the-table-api)
 and observed that it didn't produce and store per-hour data correctly as shown 
below. I think it's caused by datetime formatter conversion between 12-hour and 
24-hour clock.
   
   ## Before
   ```
   mysql> select * from spend_report;
   +------------+-------------------------+--------+
   | account_id | log_ts                  | amount |
   +------------+-------------------------+--------+
   |          1 | 2000-01-06 09:00:00.000 |    414 |
   |          1 | 2000-01-06 10:00:00.000 |   1808 |
   |          1 | 2000-01-06 11:00:00.000 |   1916 |
   |          1 | 2000-01-07 12:00:00.000 |   2713 |
   |          1 | 2000-01-08 12:00:00.000 |   2141 |
   |          1 | 2000-01-09 12:00:00.000 |   2334 |
   |          1 | 2000-01-10 12:00:00.000 |   3485 |
   |          2 | 2000-01-06 09:00:00.000 |    952 |
   |          2 | 2000-01-06 10:00:00.000 |   1084 |
   |          2 | 2000-01-06 11:00:00.000 |   1179 |
   |          2 | 2000-01-07 12:00:00.000 |   2759 |
   |          2 | 2000-01-08 12:00:00.000 |   2362 |
   |          2 | 2000-01-09 12:00:00.000 |   1649 |
   |          2 | 2000-01-10 12:00:00.000 |   2718 |
   |          3 | 2000-01-06 09:00:00.000 |    143 |
   |          3 | 2000-01-06 10:00:00.000 |    469 |
   |          3 | 2000-01-06 11:00:00.000 |    644 |
   |          3 | 2000-01-07 12:00:00.000 |   2889 |
   |          3 | 2000-01-08 12:00:00.000 |   2314 |
   |          3 | 2000-01-09 12:00:00.000 |   3199 |
   |          3 | 2000-01-10 12:00:00.000 |   1918 |
   |          4 | 2000-01-06 09:00:00.000 |    918 |
   |          4 | 2000-01-06 10:00:00.000 |   1297 |
   |          4 | 2000-01-06 11:00:00.000 |   1176 |
   |          4 | 2000-01-07 12:00:00.000 |   1913 |
   |          4 | 2000-01-08 12:00:00.000 |   2009 |
   |          4 | 2000-01-09 12:00:00.000 |   2331 |
   |          4 | 2000-01-10 12:00:00.000 |   1593 |
   |          5 | 2000-01-06 09:00:00.000 |    151 |
   |          5 | 2000-01-06 10:00:00.000 |   1090 |
   |          5 | 2000-01-06 11:00:00.000 |   1825 |
   |          5 | 2000-01-07 12:00:00.000 |   2120 |
   |          5 | 2000-01-08 12:00:00.000 |   3406 |
   |          5 | 2000-01-09 12:00:00.000 |   2271 |
   |          5 | 2000-01-10 12:00:00.000 |   2223 |
   +------------+-------------------------+--------+
   35 rows in set (0.00 sec)
   ```
   
   ## After
   ```
   mysql> select * from spend_report;
   +------------+-------------------------+--------+
   | account_id | log_ts                  | amount |
   +------------+-------------------------+--------+
   |          1 | 2000-01-06 19:00:00.000 |    862 |
   |          1 | 2000-01-06 20:00:00.000 |   1701 |
   |          1 | 2000-01-06 21:00:00.000 |   1907 |
   |          1 | 2000-01-06 22:00:00.000 |   1786 |
   |          1 | 2000-01-06 23:00:00.000 |    848 |
   |          1 | 2000-01-07 00:00:00.000 |   1098 |
   |          1 | 2000-01-07 01:00:00.000 |   1733 |
   |          1 | 2000-01-07 02:00:00.000 |   1717 |
   |          1 | 2000-01-07 03:00:00.000 |   1076 |
   |          1 | 2000-01-07 04:00:00.000 |    955 |
   |          1 | 2000-01-07 05:00:00.000 |    809 |
   |          1 | 2000-01-07 06:00:00.000 |    762 |
   |          1 | 2000-01-07 07:00:00.000 |   1342 |
   |          1 | 2000-01-07 08:00:00.000 |    979 |
   |          2 | 2000-01-06 19:00:00.000 |    564 |
   |          2 | 2000-01-06 20:00:00.000 |    779 |
   |          2 | 2000-01-06 21:00:00.000 |   1351 |
   |          2 | 2000-01-06 22:00:00.000 |   1114 |
   |          2 | 2000-01-06 23:00:00.000 |   1310 |
   |          2 | 2000-01-07 00:00:00.000 |   1774 |
   |          2 | 2000-01-07 01:00:00.000 |   1476 |
   |          2 | 2000-01-07 02:00:00.000 |   1238 |
   |          2 | 2000-01-07 03:00:00.000 |   2405 |
   |          2 | 2000-01-07 04:00:00.000 |    579 |
   |          2 | 2000-01-07 05:00:00.000 |    653 |
   |          2 | 2000-01-07 06:00:00.000 |    636 |
   |          2 | 2000-01-07 07:00:00.000 |    581 |
   |          2 | 2000-01-07 08:00:00.000 |   1336 |
   |          3 | 2000-01-06 19:00:00.000 |   1150 |
   |          3 | 2000-01-06 20:00:00.000 |   1562 |
   |          3 | 2000-01-06 21:00:00.000 |   1457 |
   |          3 | 2000-01-06 22:00:00.000 |    554 |
   |          3 | 2000-01-06 23:00:00.000 |   2178 |
   |          3 | 2000-01-07 00:00:00.000 |    646 |
   |          3 | 2000-01-07 01:00:00.000 |    970 |
   |          3 | 2000-01-07 02:00:00.000 |   1542 |
   |          3 | 2000-01-07 03:00:00.000 |   1002 |
   |          3 | 2000-01-07 04:00:00.000 |   1723 |
   |          3 | 2000-01-07 05:00:00.000 |    893 |
   |          3 | 2000-01-07 06:00:00.000 |   1806 |
   |          3 | 2000-01-07 07:00:00.000 |    852 |
   |          3 | 2000-01-07 08:00:00.000 |    933 |
   |          4 | 2000-01-06 19:00:00.000 |   1116 |
   |          4 | 2000-01-06 20:00:00.000 |    529 |
   |          4 | 2000-01-06 21:00:00.000 |    563 |
   |          4 | 2000-01-06 22:00:00.000 |   1266 |
   |          4 | 2000-01-06 23:00:00.000 |    878 |
   |          4 | 2000-01-07 00:00:00.000 |    737 |
   |          4 | 2000-01-07 01:00:00.000 |    838 |
   |          4 | 2000-01-07 02:00:00.000 |    740 |
   |          4 | 2000-01-07 03:00:00.000 |   1382 |
   |          4 | 2000-01-07 04:00:00.000 |   1362 |
   |          4 | 2000-01-07 05:00:00.000 |   2028 |
   |          4 | 2000-01-07 06:00:00.000 |    488 |
   |          4 | 2000-01-07 07:00:00.000 |   1337 |
   |          4 | 2000-01-07 08:00:00.000 |    989 |
   |          5 | 2000-01-06 19:00:00.000 |   1019 |
   |          5 | 2000-01-06 20:00:00.000 |   1280 |
   |          5 | 2000-01-06 21:00:00.000 |    962 |
   |          5 | 2000-01-06 22:00:00.000 |    973 |
   |          5 | 2000-01-06 23:00:00.000 |    687 |
   |          5 | 2000-01-07 00:00:00.000 |   1275 |
   |          5 | 2000-01-07 01:00:00.000 |    994 |
   |          5 | 2000-01-07 02:00:00.000 |    742 |
   |          5 | 2000-01-07 03:00:00.000 |   1479 |
   |          5 | 2000-01-07 04:00:00.000 |    955 |
   |          5 | 2000-01-07 05:00:00.000 |    905 |
   |          5 | 2000-01-07 06:00:00.000 |    674 |
   |          5 | 2000-01-07 07:00:00.000 |    833 |
   |          5 | 2000-01-07 08:00:00.000 |    616 |
   +------------+-------------------------+--------+
   70 rows in set (0.00 sec)
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to