aytrack commented on code in PR #45233: URL: https://github.com/apache/doris/pull/45233#discussion_r1897152965
########## regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy: ########## @@ -16,763 +16,646 @@ // under the License. suite("fold_constant_string_arithmatic") { - def db = "fold_constant_string_arithmatic" - sql "create database if not exists ${db}" - sql "set enable_nereids_planner=true" sql "set enable_fallback_to_original_planner=false" sql "set enable_fold_constant_by_be=false" - - testFoldConst("SELECT Concat('Hello', ' ', 'World')") - testFoldConst("SELECT Substring('Hello World', 1, 5)") - testFoldConst("SELECT Substring('1', 1, 1)") - testFoldConst("select 100, 'abc', substring('abc', 1, 2), substring(substring('abcdefg', 4, 3), 1, 2), null") - testFoldConst("SELECT Length('Hello World')") - testFoldConst("SELECT Lower('Hello World')") - testFoldConst("SELECT Upper('Hello World')") - testFoldConst("SELECT Trim(' Hello World ')") - testFoldConst("SELECT Trim('11111', 11)") - testFoldConst("SELECT Ltrim(' Hello World ')") - testFoldConst("SELECT LTrim(' 11111', 11)") - testFoldConst("SELECT LTrim('11111 ', 11)") - testFoldConst("SELECT Rtrim(' Hello World ')") - testFoldConst("SELECT RTrim('11111 ', 11)") - testFoldConst("SELECT RTrim(' 11111', 11)") - testFoldConst("SELECT Replace('Hello World', 'World', 'Everyone')") - testFoldConst("SELECT Left('Hello World', 5)") - testFoldConst("SELECT Right('Hello World', 5)") - testFoldConst("SELECT Locate('World', 'Hello World')") - testFoldConst("SELECT Instr('Hello World', 'World')") - testFoldConst("SELECT Ascii('A')") - testFoldConst("SELECT Bin(5)") - testFoldConst("SELECT Hex(255)") - testFoldConst("SELECT Unhex('FF')") - testFoldConst("SELECT Concat_Ws('-', '2024', '09', '02')") - testFoldConst("SELECT Char(65)") - testFoldConst("SELECT Character_Length('Hello World')") - testFoldConst("SELECT Length('你')") - testFoldConst("SELECT Initcap('hello world')") - testFoldConst("SELECT Md5('Hello World')") - testFoldConst("SELECT Md5Sum('Hello World')") -// testFoldConst("SELECT JsonExtract('{"key": "value"}', '$.key')") -// testFoldConst("SELECT JsonbExtractString('{"key": "value"}', '$.key')") -// testFoldConst("SELECT JsonContains('{"key": "value"}', '"key"')") -// testFoldConst("SELECT JsonLength('{"key1": "value1", "key2": "value2"}')") -// testFoldConst("SELECT JsonObject('key', 'value')") -// testFoldConst("SELECT JsonArray('value1', 'value2')") -// testFoldConst("SELECT JsonKeys('{"key1": "value1", "key2": "value2"}')") -// testFoldConst("SELECT JsonInsert('{"key1": "value1"}', '$.key2', 'value2')") -// testFoldConst("SELECT JsonReplace('{"key1": "value1"}', '$.key1', 'new_value')") -// testFoldConst("SELECT JsonSet('{"key1": "value1"}', '$.key2', 'value2')") -// testFoldConst("SELECT Json_Quote('Hello World')") -// testFoldConst("SELECT Json_UnQuote('"Hello World"')") - testFoldConst("SELECT Field('b', 'a', 'b', 'c')") - testFoldConst("SELECT Find_In_Set('b', 'a,b,c')") - testFoldConst("SELECT Repeat('Hello', 3)") - testFoldConst("SELECT Reverse('Hello')") - testFoldConst("SELECT length(Space(10))") -// testFoldConst("SELECT Split_By_Char('a,b,c',',')") has bug in be execution - testFoldConst("SELECT Split_By_String('a::b::c', '::')") - testFoldConst("SELECT Split_Part('a,b,c', ',', 2)") - testFoldConst("SELECT Substring_Index('a,b,c', ',', 2)") - testFoldConst("SELECT Strcmp('abc', 'abd')") - testFoldConst("SELECT StrLeft('Hello World', 5)") - testFoldConst("SELECT StrRight('Hello World', 5)") - testFoldConst("SELECT Overlay('abcdef', '123', 3, 2)") - testFoldConst("SELECT Parse_Url('http://www.example.com/path?query=abc', 'HOST')") - testFoldConst("SELECT Url_Decode('+Hello+World+')") - testFoldConst("SELECT Url_Encode(' Hello World ')") - - // Substring with negative start index - // Expected behavior: Depending on the SQL engine, might return an empty string or error. - testFoldConst("SELECT Substring('Hello World', -1, 5)") - - // Substring with length exceeding the string length - // Expected behavior: Return 'Hello' as the length exceeds the string length. - testFoldConst("SELECT Substring('Hello', 1, 10)") - - // Left with length greater than string length - // Expected behavior: Return 'Hello'. - testFoldConst("SELECT Left('Hello', 10)") - - // Right with length greater than string length - // Expected behavior: Return 'Hello'. - testFoldConst("SELECT Right('Hello', 10)") - - // SplitPart with part number greater than the number of parts - // Expected behavior: Return an empty string or error. - testFoldConst("SELECT Split_Part('a,b,c', ',', 5)") - - // SplitPart with negative part number - // Expected behavior: Return an empty string or error. - testFoldConst("SELECT Split_Part('a,b,c', ',', -1)") - - // Locate with the substring not present - // Expected behavior: Return 0 as 'World' is not found. - testFoldConst("SELECT Locate('World', 'Hello')") - - // Instr with the substring not present - // Expected behavior: Return 0 as 'World' is not found. - testFoldConst("SELECT Instr('Hello', 'World')") - - // Replace with an empty search string - // Expected behavior: Some SQL engines may treat this as a no-op, others might throw an error. - testFoldConst("SELECT Replace('Hello World', '', 'Everyone')") - - // Replace with an empty replacement string - // Expected behavior: Return 'Hello '. - testFoldConst("SELECT Replace('Hello World', 'World', '')") - - // Concat with NULL values - // Expected behavior: Depending on the SQL engine, may return 'HelloWorld' or NULL. - testFoldConst("SELECT Concat('Hello', NULL, 'World')") - - // Ltrim with a string that has no leading spaces - // Expected behavior: Return 'Hello'. - testFoldConst("SELECT Ltrim('Hello')") - - // Rtrim with a string that has no trailing spaces - // Expected behavior: Return 'Hello'. - testFoldConst("SELECT Rtrim('Hello')") - - // JsonExtract with an invalid JSON path - // Expected behavior: Return NULL or an empty string. -// testFoldConst("SELECT Json_Extract('{"key": "value"}', '$.invalid')") - - // JsonLength with a non-JSON string - // Expected behavior: Return NULL or error. - testFoldConst("SELECT Json_Length('Hello World')") - - // Field with a value not present in the list - // Expected behavior: Return 0 as 'd' is not found. - testFoldConst("SELECT Field('d', 'a', 'b', 'c')") - - // FindInSet with a value not present in the set - // Expected behavior: Return 0 as 'd' is not found. - testFoldConst("SELECT Find_In_Set('d', 'a,b,c')") - - // Repeat with a negative repeat count - // Expected behavior: Return an empty string or error. - testFoldConst("SELECT Repeat('Hello', -3)") - - // Space with a negative number of spaces - // Expected behavior: Return an empty string or error. - testFoldConst("SELECT Space(-5)") - - // SplitByChar with a delimiter not present in the string - // Expected behavior: Return the original string in a single element array. -// testFoldConst("SELECT Split_By_Char('abc', ',')") - - // SplitByString with a delimiter not present in the string - // Expected behavior: Return the original string in a single element array. - testFoldConst("SELECT Split_By_String('::', 'abc')") - - // Strcmp with two identical strings - // Expected behavior: Return 0 as the strings are equal. - testFoldConst("SELECT Strcmp('abc', 'abc')") - - // Strcmp with a null string - // Expected behavior: Return NULL or -1 depending on the SQL engine. - testFoldConst("SELECT Strcmp('abc', NULL)") - - // Hex with a negative number - // Expected behavior: Return the hexadecimal representation of the two's complement, or an error depending on the SQL engine. - testFoldConst("SELECT Hex(-255)") - - // Unhex with an invalid hexadecimal string - // Expected behavior: Return NULL or error as 'GHIJ' is not a valid hex string. - testFoldConst("SELECT Unhex('GHIJ')") - - // JsonReplace with a path that does not exist - // Expected behavior: Depending on the engine, might return the original JSON or an error. -// testFoldConst("SELECT Json_Replace('{"key": "value"}', '$.nonexistent', 'new_value')") - - // UrlDecode with an invalid percent-encoded string - // Expected behavior: Return NULL or error due to invalid encoding. - // testFoldConst("SELECT Url_Decode('%ZZHello%20World')") - - testFoldConst("select elt(0, \"hello\", \"doris\")") - testFoldConst("select elt(1, \"hello\", \"doris\")") - testFoldConst("select elt(2, \"hello\", \"doris\")") - testFoldConst("select elt(3, \"hello\", \"doris\")") - testFoldConst("select c1, c2, elt(c1, c2) from (select number as c1, 'varchar' as c2 from numbers('number'='5') where number > 0) a") - + + // append_trailing_char_if_absent + testFoldConst("select append_trailing_char_if_absent('', '!')") + testFoldConst("select append_trailing_char_if_absent(12345, '!')") + testFoldConst("select append_trailing_char_if_absent(12345, '!')") testFoldConst("select append_trailing_char_if_absent('a','c')") testFoldConst("select append_trailing_char_if_absent('ac','c')") + testFoldConst("select append_trailing_char_if_absent(cast('a' as string), cast('c' as string))") + testFoldConst("select append_trailing_char_if_absent(cast('ac' as string), cast('c' as string))") + testFoldConst("select append_trailing_char_if_absent('h', '!')") + testFoldConst("select append_trailing_char_if_absent('hello!', '!')") + testFoldConst("select append_trailing_char_if_absent('hello', '😊')") + testFoldConst("select append_trailing_char_if_absent('hello', ' ')") + testFoldConst("select append_trailing_char_if_absent('hello', ' ')") + testFoldConst("select append_trailing_char_if_absent('hello', '!')") + testFoldConst("select append_trailing_char_if_absent('hello', '')") + testFoldConst("select append_trailing_char_if_absent('hello', '?')") + testFoldConst("select append_trailing_char_if_absent('hello?', '!')") + testFoldConst("select append_trailing_char_if_absent('hello', '1')") + testFoldConst("select append_trailing_char_if_absent('hello', 1)") + testFoldConst("select append_trailing_char_if_absent('hello', 'ab')") + testFoldConst("select append_trailing_char_if_absent('hello', NULL)") testFoldConst("select append_trailing_char_if_absent('it','a')") - + testFoldConst("select append_trailing_char_if_absent(NULL, '!')") + testFoldConst("select append_trailing_char_if_absent('This is a very long string', '.')") + testFoldConst("select append_trailing_char_if_absent('Привет', '!')") + testFoldConst("select append_trailing_char_if_absent('こんにちは', '!')") + + // ascii + testFoldConst("select ascii('!')") testFoldConst("select ascii('1')") testFoldConst("select ascii('a')") testFoldConst("select ascii('A')") - testFoldConst("select ascii('!')") - + testFoldConst("select ascii('こ')") + testFoldConst("select ascii('안')") + testFoldConst("select ascii('中')") + testFoldConst("select ascii(cast('1' as string))") + testFoldConst("select ascii(cast('a' as string))") + testFoldConst("select ascii(cast('A' as string))") + testFoldConst("select ascii(cast('!' as string))") + testFoldConst("select ascii(cast('こ' as string))") + testFoldConst("select ascii(cast('안' as string))") + testFoldConst("select ascii(cast('中' as string))") + + // bin + testFoldConst("select bin(5)") + testFoldConst("select bin(-5)") + testFoldConst("select bin(9223372036854775807)") + testFoldConst("select bin(9223372036854775808)") + testFoldConst("select bin(-9223372036854775809)") + + // bit_length testFoldConst("select bit_length(\"abc\")") + testFoldConst("select bit_length(cast('abc' as string))") + testFoldConst("select bit_length('こんにちは世界')") + testFoldConst("select bit_length('안녕하세요 세계!')") + + testFoldConst("select c1, c2, elt(c1, c2) from (select number as c1, 'varchar' as c2 from numbers('number'='5') where number > 0) a") + + // char + testFoldConst("select char(65)") + testFoldConst("select char(-1)") + testFoldConst("select char(65535)") + + // character_length + testFoldConst("select character_length(cast('Hello World' as string))") + testFoldConst("select character_length('Hello World')") + testFoldConst("select character_length('你好 世界')") testFoldConst("select char_length(\"abc\")") + testFoldConst("select char_length(cast('abc' as string))") + testFoldConst("select char_length('你好 世界')") + // concat testFoldConst("select concat(\"a\", \"b\")") testFoldConst("select concat(\"a\", \"b\", \"c\")") testFoldConst("select concat(\"a\", null, \"c\")") - - testFoldConst("select concat_ws(\"or\", \"d\", \"is\")") + testFoldConst("select concat(cast('a' as string), cast('b' as string))") + testFoldConst("select concat(cast('a' as string), cast('b' as string), cast('c' as string))") + testFoldConst("select concat(cast('a' as string), NULL, cast('c' as string))") + testFoldConst("select concat(cast('Hello' as string), cast(' ' as string), cast('World' as string))") + testFoldConst("select concat(CAST('Hello' AS STRING), CAST(' ' AS STRING), CAST('World' AS STRING))") + testFoldConst("select concat(CAST('Hello' AS STRING), CAST(NULL AS STRING))") + testFoldConst("select concat(cast('Hello' as string), NULL, cast('World' as string))") + testFoldConst("select concat(CAST(NULL AS STRING), CAST('World' AS STRING))") + testFoldConst("select concat('Hello', NULL, 'World')") + testFoldConst("select concat('Hello', ' ', 'World')") + testFoldConst("select concat('你好', ' ', '世界')") + + // concat_ws + testFoldConst("select concat_ws('-', '2024', '09', '02')") + testFoldConst("select concat_ws(NULL, [\"d\", \"is\"])") testFoldConst("select concat_ws(NULL, \"d\", \"is\")") - testFoldConst("select concat_ws(\"or\", \"d\", NULL,\"is\")") + testFoldConst("select concat_ws(\"or\", [\"d\", \"\",\"is\"])") testFoldConst("select concat_ws(\"or\", [\"d\", \"is\"])") - testFoldConst("select concat_ws(NULL, [\"d\", \"is\"])") + testFoldConst("select concat_ws(\"or\", \"d\", \"is\")") testFoldConst("select concat_ws(\"or\", [\"d\", NULL,\"is\"])") - testFoldConst("select concat_ws(\"or\", [\"d\", \"\",\"is\"])") + testFoldConst("select concat_ws(\"or\", \"d\", NULL,\"is\")") + testFoldConst("select concat_ws(' ', '你好', '世界')") + + // elt + testFoldConst("select elt(0, cast('hello' as string), cast('doris' as string))") + testFoldConst("select elt(0, \"hello\", \"doris\")") + testFoldConst("select elt(1, cast('hello' as string), cast('doris' as string))") + testFoldConst("select elt(1, \"hello\", \"doris\")") + testFoldConst("select elt(2, cast('hello' as string), cast('doris' as string))") + testFoldConst("select elt(2, \"hello\", \"doris\")") + testFoldConst("select elt(3, cast('hello' as string), cast('doris' as string))") + testFoldConst("select elt(3, \"hello\", \"doris\")") + // ends_with + testFoldConst("select ends_with(cast('Hello doris' as string), cast('doris' as string))") testFoldConst("select ends_with(\"Hello doris\", \"doris\")") - testFoldConst("select ends_with(\"Hello doris\", \"Hello\")") - + testFoldConst("select ends_with(\"こんにちは世界!안녕하세요 세계\", \"안녕하세요 세계\")") + testFoldConst("select ends_with(\"안녕하세요 세계こんにちは世界!\", \"こんにちは世界!\")") + testFoldConst("select ends_with(\"안녕하세요 세계こんにちは世界\", \"こんにちは世界\")") + + // field + testFoldConst("select field('b', 'a', 'b', 'c')") + testFoldConst("select field('d', 'a', 'b', 'c')") + testFoldConst("select field('こ', 'ん', 'に', 'ち', 'こ')") + testFoldConst("select field('=', '+', '=', '=', 'こ')") + testFoldConst("select field('==', '+', '=', '==', 'こ')") + testFoldConst("select field('=', '+', '==', '==', 'こ')") + + // find_in_set + testFoldConst("select find_in_set(\"a\", null)") + testFoldConst("select find_in_set('b', 'a,b,c')") testFoldConst("select find_in_set(\"b\", \"a,b,c\")") + testFoldConst("select find_in_set(cast('a' as string), NULL)") + testFoldConst("select find_in_set(cast('b' as string), cast('a,b,c' as string))") + testFoldConst("select find_in_set(cast('b' as string), cast('a,b,c' as string))") + testFoldConst("select find_in_set(cast('d' as string), cast('a,b,c' as string))") + testFoldConst("select find_in_set(cast('d' as string), cast('a,b,c' as string))") + testFoldConst("select find_in_set('d', 'a,b,c')") testFoldConst("select find_in_set(\"d\", \"a,b,c\")") testFoldConst("select find_in_set(null, \"a,b,c\")") - testFoldConst("select find_in_set(\"a\", null)") - + testFoldConst("select find_in_set(NULL, cast('a,b,c' as string))") + testFoldConst("SELECT find_in_set('A', '哈哈哈AAA')") + testFoldConst("SELECT find_in_set('哈','哈哈哈AAA')") + testFoldConst("SELECT find_in_set(' ','哈哈哈AAA')") + testFoldConst("SELECT find_in_set('','哈哈哈AAA')") + testFoldConst("SELECT find_in_set(',','a,')") + + // hex + testFoldConst("select hex('@')") testFoldConst("select hex('1')") + testFoldConst("select hex(-1)") + testFoldConst("select hex(-1)") testFoldConst("select hex('12')") - testFoldConst("select hex('@')") - testFoldConst("select hex('A')") testFoldConst("select hex(12)") - testFoldConst("select hex(-1)") + testFoldConst("select hex(12)") + testFoldConst("select hex(-255)") + testFoldConst("select hex(-255)") + testFoldConst("select hex(255)") + testFoldConst("select hex(255)") + testFoldConst("select hex('A')") + testFoldConst("select hex(cast('12' as string))") + testFoldConst("select hex(cast('1' as string))") + testFoldConst("select hex(cast('A' as string))") + testFoldConst("select hex(cast('@' as string))") + testFoldConst("select hex(cast('hello,doris' as string))") testFoldConst("select hex('hello,doris')") - - testFoldConst("select unhex('@')") - testFoldConst("select unhex('68656C6C6F2C646F726973')") - testFoldConst("select unhex('41')") - testFoldConst("select unhex('4142')") - testFoldConst("select unhex('')") - testFoldConst("select unhex(NULL)") - + + // ifnull + testFoldConst("select ifnull(date_format(CONCAT_WS('', '9999-07', '-00'), '%Y-%m'),3)") + testFoldConst("select ifnull(null,3)") + testFoldConst("select ifnull(3,null)") + testFoldConst("select ifnull(null,null)") + + // initcap + testFoldConst("select initcap(\"AbC123abc abc.abc,?|abc\")") + testFoldConst("select initcap(cast('AbC123abc abc.abc,?|abc' as string))") + testFoldConst("select initcap(cast('hello world' as string))") + testFoldConst("select initcap('hello world')") + testFoldConst("select initcap('こんにちは')") + testFoldConst("select initcap('上海天津北京杭州')") + + // instr + testFoldConst("select instr('上海天津北京杭州', '北京')") testFoldConst("select instr(\"abc\", \"b\")") testFoldConst("select instr(\"abc\", \"d\")") testFoldConst("select instr(\"abc\", null)") + testFoldConst("select instr(cast('abc' as string), cast('b' as string))") + testFoldConst("select instr(cast('abc' as string), cast('d' as string))") + testFoldConst("select instr(cast('abc' as string), NULL)") + testFoldConst("select instr(cast('Hello' as string), cast('World' as string))") + testFoldConst("select instr(cast('Hello World' as string), cast('World' as string))") + testFoldConst("select instr('foobar', '')") + testFoldConst("select instr('Hello', 'World')") + testFoldConst("select instr('Hello World', 'World')") testFoldConst("select instr(null, \"a\")") - testFoldConst("SELECT instr('foobar', '')") - testFoldConst("SELECT instr('上海天津北京杭州', '北京')") - - testFoldConst("SELECT lcase(\"AbC123\")") - testFoldConst("SELECT lower(\"AbC123\")") - - testFoldConst("SELECT initcap(\"AbC123abc abc.abc,?|abc\")") - + testFoldConst("select instr(NULL, cast('a' as string))") + + // lcase + testFoldConst("select lcase(\"AbC123\")") + testFoldConst("select lcase(cast('AbC123' as string))") + testFoldConst("select lcase('上海天津北京杭州')") + testFoldConst("select lcase('こんにちは')") + + // left + testFoldConst("select left(CAST('good morning' AS STRING), 120)") + testFoldConst("select left(CAST('good morning' AS STRING), -5)") + testFoldConst("select left(CAST('good morning' AS STRING), NULL)") + testFoldConst("select left(cast('Hello' as string), 10)") + testFoldConst("select left(cast('Hello doris' as string), 5)") + testFoldConst("select left(CAST('Hello doris' AS STRING), 5)") + testFoldConst("select left(cast('Hello World' as string), 5)") + testFoldConst("select left(CAST(NULL AS STRING), 1)") + testFoldConst("select left(\"good morning\", 120)") + testFoldConst("select left(\"good morning\", -5)") + testFoldConst("select left(\"good morning\", NULL)") + testFoldConst("select left('Hello', 10)") + testFoldConst("select left(\"Hello doris\", 5)") testFoldConst("select left(\"Hello doris\",5)") - testFoldConst("select right(\"Hello doris\",5)") - + testFoldConst("select left('Hello World', 5)") + testFoldConst("select left(NULL, 1)") + testFoldConst("select left('上海天津北京杭州', 5)") + testFoldConst("select left('上海天津北京杭州', -5)") + + // length + testFoldConst("select length('你')") testFoldConst("select length(\"abc\")") - - testFoldConst("SELECT LOCATE('bar', 'foobarbar')") - testFoldConst("SELECT LOCATE('xbar', 'foobar')") - testFoldConst("SELECT LOCATE('', 'foobar')") - testFoldConst("SELECT LOCATE('北京', '上海天津北京杭州')") - - testFoldConst("SELECT lpad(\"hi\", 5, \"xy\")") - testFoldConst("SELECT lpad(\"hi\", 1, \"xy\")") - testFoldConst("SELECT rpad(\"hi\", 5, \"xy\")") - testFoldConst("SELECT rpad(\"hi\", 1, \"xy\")") - - testFoldConst("SELECT ltrim(' ab d')") - - testFoldConst("select money_format(17014116)") - testFoldConst("select money_format(1123.456)") + testFoldConst("select length(cast('abc' as string))") + testFoldConst("select length(cast('Hello World' as string))") + testFoldConst("select length('Hello World')") + testFoldConst("select length(space(10))") + testFoldConst("select length(space(10))") + + // locate + testFoldConst("select locate('北京', '上海天津北京杭州')") + testFoldConst("select locate('bar', 'foobarbar')") + testFoldConst("select locate(cast('北京' as string), cast('上海天津北京杭州' as string))") + testFoldConst("select locate(cast('' as string), cast('foobar' as string))") + testFoldConst("select locate(cast('bar' as string), cast('foobarbar' as string))") + testFoldConst("select locate(cast('World' as string), cast('Hello' as string))") + testFoldConst("select locate(cast('World' as string), cast('Hello World' as string))") + testFoldConst("select locate(cast('xbar' as string), cast('foobar' as string))") + testFoldConst("select locate('', 'foobar')") + testFoldConst("select locate('World', 'Hello')") + testFoldConst("select locate('World', 'Hello World')") + testFoldConst("select locate('xbar', 'foobar')") + testFoldConst("select locate('北京', '上海天津北京杭州', 4)") + testFoldConst("select locate('北京', '上海天津北京杭州', 5)") + testFoldConst("select locate('北京', '上海天津北京杭州', -4)") + testFoldConst("select locate('北京', '上海天津北京杭州', -5)") + + // lower + testFoldConst("select lower(\"AbC123\")") + testFoldConst("select lower(cast('AbC123' as string))") + testFoldConst("select lower(cast('Hello World' as string))") + testFoldConst("select lower('Hello World')") + + // lpad + testFoldConst("select lpad(cast('hi' as string), 1, cast('xy' as string))") + testFoldConst("select lpad(cast('hi' as string), 5, cast('xy' as string))") + testFoldConst("select lpad(\"hi\", 1, \"xy\")") + testFoldConst("select lpad(\"hi\", 5, \"xy\")") + testFoldConst("select lpad(cast('北京' as string), 1, cast('杭州' as string))") + testFoldConst("select lpad(cast('北京' as string), 5, cast('杭州' as string))") + + // ltrim + testFoldConst("select ltrim(' 11111', 11)") + testFoldConst("select ltrim('11111 ', 11)") + testFoldConst("select ltrim(' ab d')") + testFoldConst("select ltrim(cast(' 11111' as string), cast(11 as string))") + testFoldConst("select ltrim(cast('11111 ' as string), cast(11 as string))") + testFoldConst("select ltrim(cast(' ab d' as string))") + testFoldConst("select ltrim(cast('Hello' as string))") + testFoldConst("select ltrim(cast(' Hello World ' as string))") + testFoldConst("select ltrim('Hello')") + testFoldConst("select ltrim(' Hello World ')") + testFoldConst("select ltrim(' 上海天津北京杭州 ')") + + // md5 + testFoldConst("select md5(cast('Hello World' as string))") + testFoldConst("select md5('Hello World')") + testFoldConst("select md5('こんにちは')") + testFoldConst("select md5sum('Hello World')") + testFoldConst("select md5sum('こんにちは')") + testFoldConst("select md5sum('===*+-')") + + // money_format testFoldConst("select money_format(1123.4)") + testFoldConst("select money_format(1123.456)") + testFoldConst("select money_format(17014116)") testFoldConst("select money_format(truncate(1000,10))") - - testFoldConst("select null_or_empty(null)") - testFoldConst("select null_or_empty(\"\")") - testFoldConst("select null_or_empty(\"a\")") - - testFoldConst("select not_null_or_empty(null)") + testFoldConst("select money_format(-1123.4)") + testFoldConst("select money_format(-1123.456)") + testFoldConst("select money_format(-17014116)") + testFoldConst("select money_format(-truncate(1000,10))") + + // not_null_or_empty testFoldConst("select not_null_or_empty(\"\")") testFoldConst("select not_null_or_empty(\"a\")") - - testFoldConst("SELECT repeat(\"a\", 3)") - testFoldConst("SELECT repeat(\"a\", -1)") - testFoldConst("SELECT repeat(\"a\", 0)") - testFoldConst("SELECT repeat(\"a\",null)") - testFoldConst("SELECT repeat(null,1)") - + testFoldConst("select not_null_or_empty(cast('a' as string))") + testFoldConst("select not_null_or_empty(cast('' as string))") + testFoldConst("select not_null_or_empty(null)") + testFoldConst("select not_null_or_empty(NULL)") + testFoldConst("select not_null_or_empty('\b')") + testFoldConst("select not_null_or_empty(' \b')") + + // null_or_empty + testFoldConst("select null_or_empty(\"\")") + testFoldConst("select null_or_empty(\"a\")") + testFoldConst("select null_or_empty(cast('a' as string))") + testFoldConst("select null_or_empty(cast('' as string))") + testFoldConst("select null_or_empty(null)") + testFoldConst("select null_or_empty(NULL)") + testFoldConst("select null_or_empty('\b')") + testFoldConst("select null_or_empty(' \b')") + + // overlay + testFoldConst("select overlay('abcdef', '123', 3, 2)") Review Comment: the `overlay` syntax is `VARCHAR Overlay (VARCHAR str, INT pos, INT len, VARCHAR newstr)`, the test case set the run parameter for it -- 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