tanclary commented on code in PR #3079:
URL: https://github.com/apache/calcite/pull/3079#discussion_r1116727520


##########
babel/src/test/resources/sql/big-query.iq:
##########
@@ -1798,21 +1811,20 @@ SELECT
 #
 # Returns INT64
 
-!if (false) {
 SELECT
   DATETIME "2010-07-07 10:20:00" as first_datetime,
   DATETIME "2008-12-25 15:30:00" as second_datetime,
   DATETIME_DIFF(DATETIME "2010-07-07 10:20:00",
     DATETIME "2008-12-25 15:30:00", DAY) as difference;
-+----------------------------+------------------------+------------------------+
-| first_datetime             | second_datetime        | difference             
|
-+----------------------------+------------------------+------------------------+
-| 2010-07-07T10:20:00        | 2008-12-25T15:30:00    | 559                    
|
-+----------------------------+------------------------+------------------------+
++---------------------+---------------------+------------+
+| first_datetime      | second_datetime     | difference |
++---------------------+---------------------+------------+
+| 2010-07-07 10:20:00 | 2008-12-25 15:30:00 |        558 |
++---------------------+---------------------+------------+
+(1 row)

Review Comment:
   So after doing some more research, I have realized that BigQuery truncates 
in every case except for hour. I modified the IF statement to account for this. 
They even have a test for this in their docs which you can find 
[here](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_diff).
 It seems odd that HOUR would be the only case where the result is based on the 
whole number rather than the number of part boundaries, but that seems to be 
the general rule. 



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to