vajaw commented on code in PR #67397: URL: https://github.com/apache/doris/pull/67397#discussion_r3949709338
########## regression-test/suites/query_p0/sql_functions/array_functions/test_trim_array.groovy: ########## @@ -0,0 +1,79 @@ +// 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_trim_array") { + testFoldConst("select trim_array([1, 2, 3, 4], 2)") + + qt_trim_two "select trim_array([1, 2, 3, 4], 2)" + qt_trim_zero "select trim_array([1, 2, 3, 4], 0)" + qt_trim_one "select trim_array([1, 2, 3, 4], 1)" + qt_trim_all "select trim_array([1, 2, 3, 4], 4)" + qt_trim_string "select trim_array(['a', 'b', 'c', 'd'], 1)" + qt_trim_null_element "select trim_array(['a', 'b', null, 'd'], 1)" + qt_trim_nested "select trim_array([[1, 2, 3], [4, 5, 6]], 1)" + qt_trim_empty "select trim_array(cast([] as array<int>), 0)" + qt_trim_boolean "select trim_array(cast([true, false, true] as array<boolean>), 1)" + qt_trim_tinyint "select trim_array(cast([-128, 0, 127] as array<tinyint>), 1)" + qt_trim_bigint "select trim_array(cast([-9223372036854775808, 0, 9223372036854775807] as array<bigint>), 1)" + qt_trim_double "select trim_array(cast([-1.7976931348623157E308, 0.0, 1.7976931348623157E308] as array<double>), 1)" + qt_trim_decimal "select trim_array(cast([-99999999.99, 0.00, 99999999.99] as array<decimal(10, 2)>), 1)" + qt_trim_date "select trim_array(cast(['0000-01-01', '2024-02-29', '9999-12-31'] as array<date>), 1)" + qt_trim_null_array "select trim_array(cast(null as array<int>), 0)" + qt_trim_null_array_invalid_size "select trim_array(cast(null as array<int>), 9223372036854775807)" + qt_trim_null_size "select trim_array([1, 2, 3], cast(null as bigint))" Review Comment: 感谢您的审查!两个评论已在11f8aa5c中得到处理,能否请您再看一遍?谢谢。 1、BE实现目前会在第一遍遍历中验证修剪大小并计算输出偏移量,同时进行溢出检查。随后在第二遍遍历中预留总保留元素数量,并批量复制保留的范围。 2、目前,所有17个成功的常量输入案例均采用testFoldConst来验证前端常量折叠与后端执行的一致性,涵盖NULL值、可空元素、嵌套数组、空数组及不同元素类型。 -- 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]
