[test](case) add test case to improve code coverage (#25516)

[test](case) add test case to improve code coverage (#25516)
This commit is contained in:
zhangstar333
2023-11-01 12:51:12 +08:00
committed by GitHub
parent b94e6d6c05
commit 8f15f9adf6
12 changed files with 202 additions and 11 deletions

View File

@ -200,14 +200,6 @@ Status UserFunctionCache::_load_cached_lib() {
return Status::OK();
}
std::string get_real_symbol(const std::string& symbol) {
static std::regex rx1("8palo_udf");
std::string str1 = std::regex_replace(symbol, rx1, "9doris_udf");
static std::regex rx2("4palo");
std::string str2 = std::regex_replace(str1, rx2, "5doris");
return str2;
}
Status UserFunctionCache::_get_cache_entry(int64_t fid, const std::string& url,
const std::string& checksum,
std::shared_ptr<UserFunctionCacheEntry>& output_entry,

View File

@ -50,8 +50,6 @@ class IAggregateFunctionCombinator {
public:
virtual String get_name() const = 0;
virtual bool is_for_internal_usage_only() const { return false; }
/** From the arguments for combined function (ex: UInt64, UInt8 for sumIf),
* get the arguments for nested function (ex: UInt64 for sum).
* If arguments are not suitable for combined function, throw an exception.

View File

@ -22,3 +22,48 @@
-- !select --
\N 0.00000
-- !select_coalesce_bool --
true
-- !select_coalesce_tinyint --
1
-- !select_coalesce_smallint --
1
-- !select_coalesce_int --
1
-- !select_coalesce_bigint --
1
-- !select_coalesce_largeint --
1
-- !select_coalesce_float --
1.0
-- !select_coalesce_double --
1.0
-- !select_coalesce_datetime --
2022-10-17T11:16:50
-- !select_coalesce_date --
2022-10-17
-- !select_coalesce_decimal --
1
-- !select_coalesce_decimalv2 --
1
-- !select_abs1 --
3
-- !select_abs2 --
3.2
-- !select_array --
[1]

View File

@ -1,4 +1,67 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !non_pipeline --
\N \N
\N 1
\N 2
\N 3
\N 4
\N 5
\N 6
\N 7
\N 8
\N 9
\N 10
\N 11
\N 12
\N 13
\N 14
\N 15
\N 16
\N 17
\N 18
\N 19
\N 20
1 \N
1 2
2 \N
2 13
3 \N
3 7
4 \N
4 15
5 \N
5 10
6 \N
6 20
7 \N
7 18
8 \N
8 12
9 \N
9 4
10 \N
10 1
11 \N
11 17
12 \N
12 9
13 \N
13 11
14 \N
14 5
15 \N
15 19
16 \N
16 3
17 \N
17 14
18 \N
18 8
19 \N
19 6
20 \N
20 16
-- !pipeline --
\N \N
\N 1
@ -287,4 +350,5 @@
19 \N \N
19 6 4
20 \N \N
20 16 20
20 16 20

View File

@ -15,3 +15,10 @@
5 5
5 5
-- !sql5 --
5 5
5 5
5 5
5 5
5 5

View File

@ -28,6 +28,13 @@
2 2.4567 3.3300 4.5500
3 188.9980 998.9960 1024.1024
-- !sql6 --
\N
\N
V2_3
V3_3
V5_3
-- !garbled_characters --
001 90.0 92.0 80.0 \N
002 88.0 90.0 75.5 \N

View File

@ -1087,3 +1087,37 @@
1 1992 true
1 32767 false
-- !sql_row_number2 --
1 -32767 false
1 255 false
1 1985 true
1 1986 false
1 1989 false
1 1991 false
1 1992 true
1 32767 false
-- !sql_rank2 --
1 -32767 false
1 -32767 false
1 255 false
1 1985 true
1 1986 false
1 1989 false
1 1991 false
1 1991 false
1 1992 true
1 32767 false
-- !sql_dense_rank2 --
1 -32767 false
1 -32767 false
1 255 false
1 1985 true
1 1986 false
1 1989 false
1 1991 false
1 1991 false
1 1992 true
1 32767 false

View File

@ -61,4 +61,21 @@ suite("fold_constant") {
qt_select "select * from d_table2 order by 1;"
qt_select "select 10.0/0, 0.0/10"
sql """ set enable_fold_constant_by_be = true; """
sql """ set experimental_enable_nereids_planner = false; """
qt_select_coalesce_bool "select coalesce(true);"
qt_select_coalesce_tinyint "select coalesce(cast(1 as tinyint));"
qt_select_coalesce_smallint "select coalesce(cast(1 as smallint))"
qt_select_coalesce_int "select coalesce(cast(1 as int));"
qt_select_coalesce_bigint "select coalesce(cast(1 as bigint));"
qt_select_coalesce_largeint "select coalesce(cast(1 as largeint));"
qt_select_coalesce_float "select coalesce(cast(1 as float));"
qt_select_coalesce_double "select coalesce(cast(1 as double));"
qt_select_coalesce_datetime "select coalesce(cast(\"2022:10:17 11:16:50\" as datetime));"
qt_select_coalesce_date "select coalesce(cast(\"2022:10:17 11:16:50\" as date));"
qt_select_coalesce_decimal "select coalesce(cast(1.123 as decimal));"
qt_select_coalesce_decimalv2 "select coalesce(cast(1.123456789 as decimal));"
qt_select_abs1 "select abs(-3);"
qt_select_abs2 "select abs(-3.2);"
qt_select_array "select array(true);"
}

View File

@ -54,6 +54,14 @@ suite("test_repeat_operator") {
(17, 14, 17),
(20, 16, 20);
"""
sql"""set enable_pipeline_engine = false; """
qt_non_pipeline """
SELECT k1, k2
FROM REPEATNODE
GROUP BY GROUPING SETS ((k1, k2), (k2), (k1), ())
ORDER BY k1, k2;
"""
sql"""set enable_pipeline_engine = true; """

View File

@ -118,5 +118,8 @@ suite("bitmap_agg") {
qt_sql4 """
select count(`n_nationkey`), bitmap_count(bitmap_agg(`n_nationkey`)) from `test_bitmap_agg_nation` group by `n_regionkey`;
"""
qt_sql5 """
select count(`n_nationkey`), bitmap_count(bitmap_agg(`n_nationkey`)) from `test_bitmap_agg_nation` group by `N_REGIONKEY` order by 1;
"""
sql "DROP TABLE IF EXISTS `test_bitmap_agg_nation`;"
}

View File

@ -268,6 +268,10 @@ suite("map_agg") {
ORDER BY `id`;
"""
qt_sql6 """
select m['LC'] from (SELECT `id`, map_agg(`label_name`, `value_field`) m FROM test_map_agg_nullable GROUP BY `id`)t order by 1;
"""
qt_garbled_characters """
select
userid, map['语文'] 语文, map['数学'] 数学, map['英语'] 英语, map['政治'] 政治

View File

@ -171,6 +171,18 @@ suite("test_select_stddev_variance_window") {
qt_sql_dense_rank """
select * from (select dense_rank() over(partition by k2 order by k6) as rk,k2,k6 from ${tableName}) as t where rk = 1 order by 1,2,3;
"""
sql "set experimental_enable_pipeline_engine = false;"
qt_sql_row_number2 """
select * from (select row_number() over(partition by k2 order by k6) as rk,k2,k6 from ${tableName}) as t where rk = 1 order by 1,2,3;
"""
qt_sql_rank2 """
select * from (select rank() over(partition by k2 order by k6) as rk,k2,k6 from ${tableName}) as t where rk = 1 order by 1,2,3;
"""
qt_sql_dense_rank2 """
select * from (select dense_rank() over(partition by k2 order by k6) as rk,k2,k6 from ${tableName}) as t where rk = 1 order by 1,2,3;
"""
}