zhiqiang-hhhh commented on code in PR #32746: URL: https://github.com/apache/doris/pull/32746#discussion_r1546250928
########## regression-test/suites/query_p0/sql_functions/math_functions/test_function_truncate.groovy: ########## @@ -0,0 +1,117 @@ +// 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_function_truncate") { + qt_sql """ + SELECT number, truncate(123.345 , 1) FROM numbers("number"="10"); + """ + qt_sql """ + SELECT number, truncate(123.123, -1) FROM numbers("number"="10"); + """ + qt_sql """ + SELECT number, truncate(123.123, 0) FROM numbers("number"="10"); + """ + + sql """DROP TABLE IF EXISTS test_function_truncate;""" + sql """DROP TABLE IF EXISTS test_function_truncate_dec128;""" + sql """ + CREATE TABLE test_function_truncate ( + rid int, flo float, dou double, + dec90 decimal(9, 0), dec91 decimal(9, 1), dec99 decimal(9, 9), + dec100 decimal(10,0), dec109 decimal(10,9), dec1010 decimal(10,10), + number int DEFAULT 1) + DISTRIBUTED BY HASH(rid) + PROPERTIES("replication_num" = "1" ); + """ + + sql """ + INSERT INTO test_function_truncate + VALUES + (1, 12345.123, 123456789.123456789, Review Comment: done -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org