You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/20 10:07:23 UTC

[GitHub] [incubator-doris] zhengshengjun opened a new issue, #9711: [Bug] time_round function calculated wrong timestamp

zhengshengjun opened a new issue, #9711:
URL: https://github.com/apache/incubator-doris/issues/9711

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   1.0.0
   
   ### What's Wrong?
   
   I'm trying to replace Apache Druid with Doris in our business, but failed in time_around functions documented in 
   https://doris.apache.org/zh-CN/sql-manual/sql-functions/date-time-functions/time_round.html#time-round
   
   Seems there are some bugs
   
   ![middle_img_v2_a9652338-e418-4fc1-b822-4f768475587g](https://user-images.githubusercontent.com/74281684/169504619-77b7e1c3-590e-4d32-950d-989c32a600c0.png)
   
   
   
   ### What You Expected?
   
   1. select day_floor('2022-05-03 13:09:20', 1) from test.flink_doris_druid limit 1;  
            expect:            2022-05-04 00:00:00   
            turn out to be:  2022-05-03 00:00:00 
   2.  select day_ceil('2022-05-03 13:09:20', 1) from test.flink_doris_druid limit 1;
            expect:            2022-05-05 00:00:00   
            turn out to be:  2022-05-04 00:00:00 
   3. select day_ceil('2022-05-03 13:09:20', 4) from test.flink_doris_druid limit 1;  
           expect:              2022-05-09 00:00:00
           turn out to be     2022-05-04 00:00:00
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: commits-unsubscribe@doris.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] dataalive commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
dataalive commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1132965216

   
   > why q1 expect result is `2022-05-04 00:00:00`?
   
   In accordance with rounding, divided by 12 o'clock ? 


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] dataalive commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
dataalive commented on issue #9711:
URL: https://github.com/apache/doris/issues/9711#issuecomment-1179645002

   这个关联的PR: https://github.com/apache/doris/pull/9712 已经合入,这个Issue可以关闭了。


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] zhengshengjun commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1133605961

   > > 
   > 
   > Isn't the floor rounded down? like floor(0.6)=0
   
   @BiteTheDDDDt Yes, floor meas rounded down, and the second parameter in `day_floor('2022-05-03 13:09:20', 1)` meas add 1 more day


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] zhengshengjun commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1132736964

   PR:   https://github.com/apache/incubator-doris/pull/9712


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] zhengshengjun commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1134113894

   @BiteTheDDDDt 
   Thanks for pointing out this mistake, I'd thought the second parameter was something like "time shift". 
   So the above cases are all right. And I looked though the code, there is a trivial error in Hour case. 
   
   SQL:    `select hour_ceil('1970-01-01 01:01:10', 1, '1970-01-01 00:01:10') from test.flink_doris_sink limit 1`
   Apache Druid's result:  1970-01-01 01:01:10
   Apache Doris's result:  1970-01-01 02:01:10 
   
   the query means  time are divided into pieces by hour started from  `1970-01-01 00:01:10`
   ( `1970-01-01 00:01:10`, `1970-01-01 01:01:10`, `1970-01-01 02:01:10`)
   
   and 1970-01-01 01:01:10 belongs to  [`1970-01-01 01:01:10`, `1970-01-01 02:01:10`],  its rounded ceil will be 1970-01-01 01:01:10
   
   


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] BiteTheDDDDt commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
BiteTheDDDDt commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1132818052

   why q1 expect result is `2022-05-04 00:00:00`? 


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] BiteTheDDDDt commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
BiteTheDDDDt commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1132967917

   > 
   
   Isn't the floor rounded down? like floor(0.6)=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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] dataalive closed issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
dataalive closed issue #9711: [Bug] time_round function calculated wrong timestamp
URL: https://github.com/apache/doris/issues/9711


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] BiteTheDDDDt commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
BiteTheDDDDt commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1133607520

   > > > 
   > > 
   > > 
   > > Isn't the floor rounded down? like floor(0.6)=0
   > 
   > @BiteTheDDDDt Yes, floor meas rounded down, and the second parameter in `day_floor('2022-05-03 13:09:20', 1)` meas add 1 more day
   
   why we should add the second param `period`? period looks like it's just the unit. formulately, `floor(x,period)=floor(x/period)*period`


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] zhengshengjun commented on issue #9711: [Bug] time_round function calculated wrong timestamp

Posted by GitBox <gi...@apache.org>.
zhengshengjun commented on issue #9711:
URL: https://github.com/apache/incubator-doris/issues/9711#issuecomment-1140476092

   Other error cases:
   
   select hour_ceil('1970-01-01 01:00:10', 1, '1970-01-01 00:00:30')
   expect: '1970-01-01T01:00:30' 
   
   select hour_floor('1970-01-01 01:00:10', 1, '1970-01-01 00:00:30')"
   expect: '1970-01-01T00:00:30'
   
   select day_ceil('2022-05-25')"
   expect: '2022-05-25'
    
   select month_ceil('2022-05-01')"
   expect: '2022-05-01'
   


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org