github-actions[bot] commented on code in PR #67238: URL: https://github.com/apache/doris/pull/67238#discussion_r4667218066
########## regression-test/suites/datatype_p0/timestamptz/test_timestamptz_diff_string_binding.groovy: ########## @@ -0,0 +1,112 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_timestamptz_diff_string_binding") { + // Which overload a *_diff call binds on string input (apache/doris#66120). The session zones + // below are chosen so that the instant (TIMESTAMPTZ) and civil (DATETIMEV2) differences + // disagree, so each result pins the binding. + def originalZone = sql("select @@time_zone")[0][0] + def originalStrict = sql("select @@enable_strict_cast")[0][0] + try { + sql "set time_zone = 'America/Los_Angeles'" + + // Literals with an explicit zone bind TIMESTAMPTZ whether the offset is written -0700 or + // -07:00: 2021-03-15 07:00:00 UTC minus 2021-03-14 08:00:00 UTC is 23 elapsed hours, not + // the 24 civil hours between the wall-clock values. + assertEquals([[23L]], sql("select hours_diff('2021-03-15 00:00:00-0700', '2021-03-14 00:00:00-08:00')")) + assertEquals([[-23L]], sql("select hours_diff('2021-03-14 00:00:00-08:00', '2021-03-15 00:00:00-0700')")) + assertEquals([[23L]], sql("select hours_diff('2021-03-15 00:00:00-07:00', '2021-03-14 00:00:00-08:00')")) + assertEquals([[23L]], sql(""" + select hours_diff(cast('2021-03-15 00:00:00-0700' as timestamptz(6)), Review Comment: [P2] Use generated regression outputs and preserve the fixture table These fixed expected results are all encoded with assertEquals (lines 30-45, 61, 66-78, and 96-105), and the finally block deletes the table at line 110. The repository testing contract requires named qt_*/order_qt_* queries with generated .out results and says to drop tables before use rather than after, so failures cannot leave the fixture available for debugging. Convert the deterministic checks to qt queries and remove the post-test DROP while retaining the pre-create cleanup. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
