Skip to content

Commit

Permalink
[test](case) add test case to improve code coverage (apache#25516)
Browse files Browse the repository at this point in the history
[test](case) add test case to improve code coverage (apache#25516)
  • Loading branch information
zhangstar333 committed Nov 3, 2023
1 parent 6f05f16 commit eff04eb
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 10 deletions.
8 changes: 0 additions & 8 deletions be/src/runtime/user_function_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
45 changes: 45 additions & 0 deletions regression-test/data/delete_p0/fold_constant/fold_constant.out
Original file line number Diff line number Diff line change
Expand Up @@ -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]

7 changes: 7 additions & 0 deletions regression-test/data/query_p0/aggregate/bitmap_agg.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@
5 5
5 5

-- !sql5 --
5 5
5 5
5 5
5 5
5 5

7 changes: 7 additions & 0 deletions regression-test/data/query_p0/aggregate/map_agg.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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);"
}
3 changes: 3 additions & 0 deletions regression-test/suites/query_p0/aggregate/bitmap_agg.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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`;"
}
4 changes: 4 additions & 0 deletions regression-test/suites/query_p0/aggregate/map_agg.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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['政治'] 政治
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
"""
}


Expand Down

0 comments on commit eff04eb

Please sign in to comment.