[ 
https://issues.apache.org/jira/browse/FLINK-21624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonard Xu updated FLINK-21624:
-------------------------------
    Description: 
While using a simple query such as this
 
SELECT
   `ts`,
   FLOOR(`ts` TO WEEK) as `week_start`,
   CEIL(`ts` TO WEEK) as `week_end`
FROM some_table
 
I get some weird results like these:
 
2021-03-01T00:00|    2021-02-25T00:00|    2021-03-04T00:00
 
Which is obviously wrong since March 1st is on Monday, February 25th is 
Thursday as well as March 04th.
 
I've tried different combinations of timezone configurations and with both 
timestamps and dates, with the same results.
 
Is there anything obviously wrong in that query? Is there any configuration to 
keep in mind for the start of week day?
 
from user ML: 
http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Flink-SQL-FLOORing-OR-CEILing-a-DATE-or-TIMESTAMP-to-WEEK-uses-Thursdays-as-week-start-td41838.html

> Correct FLOOR/CEIL (TIMESTAMP/TIMESTAMP_LTZ/DATE TO WEEK) functions
> -------------------------------------------------------------------
>
>                 Key: FLINK-21624
>                 URL: https://issues.apache.org/jira/browse/FLINK-21624
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API, Table SQL / Planner
>            Reporter: Leonard Xu
>            Priority: Major
>
> While using a simple query such as this
>  
> SELECT
>    `ts`,
>    FLOOR(`ts` TO WEEK) as `week_start`,
>    CEIL(`ts` TO WEEK) as `week_end`
> FROM some_table
>  
> I get some weird results like these:
>  
> 2021-03-01T00:00|    2021-02-25T00:00|    2021-03-04T00:00
>  
> Which is obviously wrong since March 1st is on Monday, February 25th is 
> Thursday as well as March 04th.
>  
> I've tried different combinations of timezone configurations and with both 
> timestamps and dates, with the same results.
>  
> Is there anything obviously wrong in that query? Is there any configuration 
> to keep in mind for the start of week day?
>  
> from user ML: 
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Flink-SQL-FLOORing-OR-CEILing-a-DATE-or-TIMESTAMP-to-WEEK-uses-Thursdays-as-week-start-td41838.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to