This is an automated email from the ASF dual-hosted git repository. lingmiao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new 498f50a837 [regression-test] update test case dir which divided by basic functions (#9084) 498f50a837 is described below commit 498f50a837f83b5a0a0f8b54b47f41fd269b06a7 Author: zhangy5 <zhangy0...@126.com> AuthorDate: Thu Apr 21 11:55:41 2022 +0800 [regression-test] update test case dir which divided by basic functions (#9084) 1. Add test case dir. 2. Add some test suites. --- .../test_create_table_with_bloom_filter.out | 36 +++++++++ .../data_model/aggregate/test_aggregate_table.out | 32 ++++++++ .../data_model/duplicate/test_duplicate_table.out | 23 ++++++ .../data/data_model/unique/test_unique_table.out | 10 +++ .../data/datatype/bitmap/test_bitmap_int.out | Bin 0 -> 239 bytes .../complex_types/basic_agg_test.out | 0 .../hll/test_hll_int.out} | 4 +- .../data/{ => query}/aggregate/aggregate.out | 0 .../data/{ => query}/aggregate/datetype.csv | 0 regression-test/data/query/baseall.txt | 16 ++++ .../{ => query}/empty_table/sql/avg_decimal.out | 0 .../except/test_query_except.out} | 14 +++- .../explain/test_pushdown_explain.out} | 4 +- .../query/grouping_sets/test_grouping_sets.out | 12 +++ .../intersect/test_intersect.out} | 6 +- .../agg_output_as_right_tale_left_outer_order.out | 0 .../{ => query}/join/sql/bucket_shuffle_join.out | 0 .../lateral_view/test_issue_8850.out} | 10 ++- .../test_approx_count_distinct.out} | 4 +- .../bitmap_functions/test_btimap_count.out} | 19 ++++- .../conditional_functions/test_nullif.out} | 4 +- .../datetime_functions/test_dayofweek.out} | 21 +++-- .../encryption_digest_functions/test_md5.out | 6 ++ .../sql_functions/math_functions/test_conv.out} | 4 +- .../spatial_functions/test_st_astext.out} | 4 +- .../string_functions/test_reverse.out} | 6 +- .../table_function/explode_json_array.out | 0 .../table_function/explode_split.out | 0 .../test_select_stddev_variance_window.out | 0 .../test_stddev_variance_window.csv | 0 .../sql_functions/window_functions/test_sum.out} | 6 +- .../subquery/test_subquery.out} | 6 +- .../test_char_implicit_cast.out | 0 .../test_select_constant.out | 0 .../test_select_with_predicate_like.out | 0 regression-test/data/query/union/test_union.out | 22 ++++++ .../avg_decimal.out => query/with/test_with.out} | 19 ++++- .../test_account.groovy} | 7 +- regression-test/suites/account/test_role.groovy | 47 +++++++++++ .../test_backup_restore.groovy} | 6 +- .../test_bloom_filter.groovy} | 7 +- .../test_create_table_with_bloom_filter.groovy | 85 ++++++++++++++++++++ .../aggregate/test_aggregate_table.groovy | 87 +++++++++++++++++++++ .../duplicate/test_duplicate_table.groovy | 64 +++++++++++++++ .../data_model/unique/test_unique_table.groovy | 45 +++++++++++ .../bitmap/test_bitmap_int.groovy} | 24 +++--- .../complex_types/basic_agg_test.groovy | 0 .../hll/test_hll_int.groovy} | 25 +++--- .../datatype/string/test_string_basic.groovy | 48 ++++++++++++ .../test_delete.groovy} | 6 +- .../test_export.groovy} | 6 +- .../test_index.groovy} | 10 ++- .../broker_load/test_broker_load.groovy} | 6 +- .../insert/test_insert.groovy} | 6 +- .../routine_load/test_routine_load.groovy} | 6 +- .../stream_load/test_stream_load.groovy} | 6 +- .../sync_job/test_sync_job.groovy} | 6 +- .../test_dynamic_partition.groovy | 39 +++++++++ .../list_partition/test_list_partition.groovy | 48 ++++++++++++ .../suites/{ => query}/aggregate/aggregate.groovy | 0 .../suites/{ => query}/empty_table/ddl/empty.sql | 0 .../suites/{ => query}/empty_table/load.groovy | 0 .../{ => query}/empty_table/sql/avg_decimal.sql | 0 .../except/test_query_except.groovy} | 10 ++- .../explain/test_pushdown_explain.groovy} | 11 ++- .../grouping_sets/test_grouping_sets.groovy} | 8 +- .../intersect/test_intersect.groovy} | 8 +- .../join/ddl/test_bucket_shuffle_join.sql | 0 .../suites/{ => query}/join/ddl/test_join.sql | 0 .../suites/{ => query}/join/load.groovy | 0 .../agg_output_as_right_tale_left_outer_order.sql | 0 .../{ => query}/join/sql/bucket_shuffle_join.sql | 0 .../suites/query/lateral_view/test_issue_8850.sql | 9 +++ regression-test/suites/query/load.groovy | 75 ++++++++++++++++++ .../test_approx_count_distinct.groovy} | 5 +- .../bitmap_functions/test_btimap_count.groovy} | 5 +- .../conditional_functions/test_nullif.groovy} | 5 +- .../datetime_functions/test_dayofweek.groovy} | 5 +- .../encryption_digest_functions/test_md5.groovy} | 5 +- .../json_functions/test_get_json_double.groovy} | 7 +- .../sql_functions/math_functions/test_conv.groovy} | 6 +- .../spatial_functions/test_st_astext.groovy} | 5 +- .../string_functions/test_reverse.groovy} | 6 +- .../table_function/explode_json_array.groovy | 2 +- .../table_function/explode_split.groovy | 0 .../test_select_stddev_variance_window.groovy | 0 .../window_functions/test_sum.groovy} | 10 ++- .../subquery/test_subquery.groovy} | 25 +++--- .../test_char_implicit_cast.groovy | 0 .../test_select_constant.groovy | 0 .../test_select_with_predicate_like.groovy | 0 .../union/test_union.groovy} | 5 +- .../with/test_with.groovy} | 9 ++- .../test_rollup.groovy} | 7 +- .../test_schema_change.groovy} | 6 +- .../test_update.groovy} | 7 +- 96 files changed, 946 insertions(+), 167 deletions(-) diff --git a/regression-test/data/bloom_filter/test_create_table_with_bloom_filter.out b/regression-test/data/bloom_filter/test_create_table_with_bloom_filter.out new file mode 100644 index 0000000000..be2d93bcd8 --- /dev/null +++ b/regression-test/data/bloom_filter/test_create_table_with_bloom_filter.out @@ -0,0 +1,36 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_tb -- +1 2 4 8 50string 500varchar c 65535varchar 0.000000 123456789012345678.123456789 2013-12-01 1900-01-01T00:00 1 2 4 8 50string 500varchar_replace c 65535varchar 12345678901234.123456 123456789012345678.123456789 1900-01-01 1900-01-01 1900-01-01 1900-01-01T00:00 1900-01-01T00:00 1900-01-01T00:00 0.4 0.8 + +-- !desc_tb -- +tinyint_key TINYINT No true \N +smallint_key SMALLINT No true \N BLOOM_FILTER +int_key INT No true \N BLOOM_FILTER +bigint_key BIGINT No true \N BLOOM_FILTER +char_50_key CHAR(50) No true \N BLOOM_FILTER +character_key VARCHAR(500) No true \N BLOOM_FILTER +char_key CHAR(1) No true \N BLOOM_FILTER +character_most_key VARCHAR(65533) No true \N BLOOM_FILTER +decimal_key DECIMAL(20,6) No true \N BLOOM_FILTER +decimal_most_key DECIMAL(27,9) No true \N BLOOM_FILTER +date_key DATE No true \N BLOOM_FILTER +datetime_key DATETIME No true \N BLOOM_FILTER +tinyint_value TINYINT No false \N SUM +smallint_value SMALLINT No false \N SUM +int_value INT No false \N SUM +bigint_value BIGINT No false \N SUM +char_50_value CHAR(50) No false \N REPLACE +character_value VARCHAR(500) No false \N REPLACE +char_value CHAR(1) No false \N REPLACE +character_most_value VARCHAR(65533) No false \N REPLACE +decimal_value DECIMAL(20,6) No false \N SUM +decimal_most_value DECIMAL(27,9) No false \N SUM +date_value_max DATE No false \N MAX +date_value_replace DATE No false \N REPLACE +date_value_min DATE No false \N MIN +datetime_value_max DATETIME No false \N MAX +datetime_value_replace DATETIME No false \N REPLACE +datetime_value_min DATETIME No false \N MIN +float_value FLOAT No false \N SUM +double_value DOUBLE No false \N SUM + diff --git a/regression-test/data/data_model/aggregate/test_aggregate_table.out b/regression-test/data/data_model/aggregate/test_aggregate_table.out new file mode 100644 index 0000000000..17f881a050 --- /dev/null +++ b/regression-test/data/data_model/aggregate/test_aggregate_table.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !int_agg_table -- +0 3 2 1 \N 2 + +-- !desc_date_table -- +k INT Yes true \N +int_value_sum INT Yes false \N SUM +int_value_max INT Yes false \N MAX +int_value_min INT Yes false \N MIN +int_value_replace INT Yes false \N REPLACE +int_value_replace_if_not_null INT Yes false \N REPLACE_IF_NOT_NULL + +-- !string_agg_table -- +0 2 \N + +-- !desc_string_table -- +k INT Yes true \N +char_value_max CHAR(10) Yes false \N MAX +char_value_min CHAR(10) Yes false \N MIN +char_value_replace CHAR(10) Yes false \N REPLACE +char_value_replace_if_not_null CHAR(10) Yes false \N REPLACE_IF_NOT_NULL + +-- !date_agg_table -- +0 2000-12-31 2000-01-01 \N 2000-12-31 + +-- !desc_date_table -- +k INT Yes true \N +date_value_max DATE Yes false \N MAX +date_value_min DATE Yes false \N MIN +date_value_replace DATE Yes false \N REPLACE +date_value_replace_if_not_null DATE Yes false \N REPLACE_IF_NOT_NULL + diff --git a/regression-test/data/data_model/duplicate/test_duplicate_table.out b/regression-test/data/data_model/duplicate/test_duplicate_table.out new file mode 100644 index 0000000000..e8deb8eb4b --- /dev/null +++ b/regression-test/data/data_model/duplicate/test_duplicate_table.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_dup_table -- +0 \N \N \N +0 1 test char 2000-01-01 +0 2 test int 2000-02-02 + +-- !desc_dup_table -- +k INT Yes true \N +int_value INT Yes false \N NONE +char_value CHAR(10) Yes false \N NONE +date_value DATE Yes false \N NONE + +-- !select_dup_table -- +0 1 2 3 +0 1 2 4 +0 1 2 5 + +-- !desc_dup_table -- +k1 INT Yes true \N +k2 INT Yes true \N +k3 INT Yes true \N +int_value INT Yes false \N NONE + diff --git a/regression-test/data/data_model/unique/test_unique_table.out b/regression-test/data/data_model/unique/test_unique_table.out new file mode 100644 index 0000000000..ccc1edc356 --- /dev/null +++ b/regression-test/data/data_model/unique/test_unique_table.out @@ -0,0 +1,10 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_uniq_table -- +0 \N \N \N + +-- !desc_uniq_table -- +k INT Yes true \N +int_value INT Yes false \N REPLACE +char_value CHAR(10) Yes false \N REPLACE +date_value DATE Yes false \N REPLACE + diff --git a/regression-test/data/datatype/bitmap/test_bitmap_int.out b/regression-test/data/datatype/bitmap/test_bitmap_int.out new file mode 100644 index 0000000000..a814d07eaf Binary files /dev/null and b/regression-test/data/datatype/bitmap/test_bitmap_int.out differ diff --git a/regression-test/data/types/complex_types/basic_agg_test.out b/regression-test/data/datatype/complex_types/basic_agg_test.out similarity index 100% rename from regression-test/data/types/complex_types/basic_agg_test.out rename to regression-test/data/datatype/complex_types/basic_agg_test.out diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/datatype/hll/test_hll_int.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/datatype/hll/test_hll_int.out index 1a9a561cf0..2472c99a58 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/datatype/hll/test_hll_int.out @@ -1,4 +1,4 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !sql1 -- +3 3 diff --git a/regression-test/data/aggregate/aggregate.out b/regression-test/data/query/aggregate/aggregate.out similarity index 100% rename from regression-test/data/aggregate/aggregate.out rename to regression-test/data/query/aggregate/aggregate.out diff --git a/regression-test/data/aggregate/datetype.csv b/regression-test/data/query/aggregate/datetype.csv similarity index 100% rename from regression-test/data/aggregate/datetype.csv rename to regression-test/data/query/aggregate/datetype.csv diff --git a/regression-test/data/query/baseall.txt b/regression-test/data/query/baseall.txt new file mode 100644 index 0000000000..72bbfe98aa --- /dev/null +++ b/regression-test/data/query/baseall.txt @@ -0,0 +1,16 @@ +0,1,1989,1001,11011902,123.123,true,1989-03-21,1989-03-21 13:00:00,wangjuoo4,0.1,6.333,string12345,170141183460469231731687303715884105727 +0,2,1986,1001,11011903,1243.5,false,1901-12-31,1989-03-21 13:00:00,wangynnsf,20.268,789.25,string12345,-170141183460469231731687303715884105727 +0,3,1989,1002,11011905,24453.325,false,2012-03-14,2000-01-01 00:00:00,yunlj8@nk,78945,3654.0,string12345,0 +0,4,1991,3021,-11011907,243243.325,false,3124-10-10,2015-03-13 10:30:00,yanvjldjlll,2.06,-0.001,string12345,20220101 +0,5,1985,5014,-11011903,243.325,true,2015-01-01,2015-03-13 12:36:38,du3lnvl,-0.000,-365,string12345,20220102 +0,6,32767,3021,123456,604587.000,true,2014-11-11,2015-03-13 12:36:38,yanavnd,0.1,80699,string12345,20220104 +0,7,-32767,1002,7210457,3.141,false,1988-03-21,1901-01-01 00:00:00,jiw3n4,0.0,6058,string12345,-20220101 +1,8,255,2147483647,11011920,-0.123,true,1989-03-21,9999-11-11 12:12:00,wangjuoo5,987456.123,12.14,string12345,-2022 +1,9,1991,-2147483647,11011902,-654.654,true,1991-08-11,1989-03-21 13:11:00,wangjuoo4,0.000,69.123,string12345,11011903 +1,10,1991,5014,9223372036854775807,-258.369,false,2015-04-02,2013-04-02 15:16:52,wangynnsf,-123456.54,0.235,string12345,-11011903 +1,11,1989,25699,-9223372036854775807,0.666,true,2015-04-02,1989-03-21 13:11:00,yunlj8@nk,-987.001,4.336,string12345,1701411834604692317316873037158 +1,12,32767,-2147483647,9223372036854775807,243.325,false,1991-08-11,2013-04-02 15:16:52,lifsno,-564.898,3.141592654,string12345,1701604692317316873037158 +1,13,-32767,2147483647,-9223372036854775807,100.001,false,2015-04-02,2015-04-02 00:00:00,wenlsfnl,123.456,3.141592653,string12345,701411834604692317316873037158 +1,14,255,103,11011902,-0.000,false,2015-04-02,2015-04-02 00:00:00, ,3.141592654,2.036,string12345,701411834604692317316873 +1,15,1992,3021,11011920,0.00,true,9999-12-12,2015-04-02 00:00:00,,3.141592653,20.456,string12345,701411834604692317 +\N,\N,\N,\N,\N,\N,\N,\N,\N,\N,\N,\N,\N,\N diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/empty_table/sql/avg_decimal.out similarity index 100% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/empty_table/sql/avg_decimal.out diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/except/test_query_except.out similarity index 65% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/except/test_query_except.out index 1a9a561cf0..7aea45fde1 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/except/test_query_except.out @@ -1,4 +1,16 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- +-- !select_except1 -- \N +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/explain/test_pushdown_explain.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/explain/test_pushdown_explain.out index 1a9a561cf0..72d126351a 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/explain/test_pushdown_explain.out @@ -1,4 +1,4 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +1 diff --git a/regression-test/data/query/grouping_sets/test_grouping_sets.out b/regression-test/data/query/grouping_sets/test_grouping_sets.out new file mode 100644 index 0000000000..71b1d5b44c --- /dev/null +++ b/regression-test/data/query/grouping_sets/test_grouping_sets.out @@ -0,0 +1,12 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +\N \N 3004 +\N 1986 1001 +\N 1989 2003 +1 \N 1001 +1 1989 1001 +2 \N 1001 +2 1986 1001 +3 \N 1002 +3 1989 1002 + diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/intersect/test_intersect.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/intersect/test_intersect.out index 1a9a561cf0..4c443b8493 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/intersect/test_intersect.out @@ -1,4 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +1 +2 +3 diff --git a/regression-test/data/join/sql/agg_output_as_right_tale_left_outer_order.out b/regression-test/data/query/join/sql/agg_output_as_right_tale_left_outer_order.out similarity index 100% copy from regression-test/data/join/sql/agg_output_as_right_tale_left_outer_order.out copy to regression-test/data/query/join/sql/agg_output_as_right_tale_left_outer_order.out diff --git a/regression-test/data/join/sql/bucket_shuffle_join.out b/regression-test/data/query/join/sql/bucket_shuffle_join.out similarity index 100% copy from regression-test/data/join/sql/bucket_shuffle_join.out copy to regression-test/data/query/join/sql/bucket_shuffle_join.out diff --git a/regression-test/data/join/sql/bucket_shuffle_join.out b/regression-test/data/query/lateral_view/test_issue_8850.out similarity index 54% rename from regression-test/data/join/sql/bucket_shuffle_join.out rename to regression-test/data/query/lateral_view/test_issue_8850.out index 87f57761ba..ccf419113a 100644 --- a/regression-test/data/join/sql/bucket_shuffle_join.out +++ b/regression-test/data/query/lateral_view/test_issue_8850.out @@ -1,5 +1,9 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !bucket_shuffle_join -- -1 2021-12-01T00:00 -2 2021-12-01T00:00 +-- !test_issue_8850 -- +0 + +-- !test_issue_8850_2 -- +0 + +-- !test_issue_8850_3 -- diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/aggregate_functions/test_approx_count_distinct.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/aggregate_functions/test_approx_count_distinct.out index 1a9a561cf0..3c35d5b230 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/aggregate_functions/test_approx_count_distinct.out @@ -1,4 +1,4 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +15 diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/bitmap_functions/test_btimap_count.out similarity index 67% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/bitmap_functions/test_btimap_count.out index 1a9a561cf0..92acc478bb 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/bitmap_functions/test_btimap_count.out @@ -1,4 +1,19 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +0 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/conditional_functions/test_nullif.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/conditional_functions/test_nullif.out index 1a9a561cf0..43f0bfd3dd 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/conditional_functions/test_nullif.out @@ -1,4 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- +-- !select -- +true +\N \N diff --git a/regression-test/data/join/sql/agg_output_as_right_tale_left_outer_order.out b/regression-test/data/query/sql_functions/datetime_functions/test_dayofweek.out similarity index 54% rename from regression-test/data/join/sql/agg_output_as_right_tale_left_outer_order.out rename to regression-test/data/query/sql_functions/datetime_functions/test_dayofweek.out index 67878579f0..0763c22178 100644 --- a/regression-test/data/join/sql/agg_output_as_right_tale_left_outer_order.out +++ b/regression-test/data/query/sql_functions/datetime_functions/test_dayofweek.out @@ -1,8 +1,19 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !agg_output_as_right_tale_left_outer_order -- -1 1 -2 2 -3 3 -4 4 +-- !select -- +\N \N +1 3 +2 3 +3 4 +4 6 5 5 +6 3 +7 2 +8 3 +9 1 +10 5 +11 5 +12 1 +13 5 +14 5 +15 1 diff --git a/regression-test/data/query/sql_functions/encryption_digest_functions/test_md5.out b/regression-test/data/query/sql_functions/encryption_digest_functions/test_md5.out new file mode 100644 index 0000000000..9bfed7153f --- /dev/null +++ b/regression-test/data/query/sql_functions/encryption_digest_functions/test_md5.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +68934a3e9455fa72420237eb05902327 +68934a3e9455fa72420237eb05902327 +b326b5062b2f0e69046810717534cb09 + diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/math_functions/test_conv.out similarity index 81% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/math_functions/test_conv.out index 1a9a561cf0..cb2f1e9d4a 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/math_functions/test_conv.out @@ -1,4 +1,4 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +1111 diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/spatial_functions/test_st_astext.out similarity index 75% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/spatial_functions/test_st_astext.out index 1a9a561cf0..4e1a98a961 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/spatial_functions/test_st_astext.out @@ -1,4 +1,4 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +POINT (24.7 56.7) diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/string_functions/test_reverse.out similarity index 68% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/string_functions/test_reverse.out index 1a9a561cf0..57cb8f128e 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/string_functions/test_reverse.out @@ -1,4 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +4ooujgnaw +fsnnygnaw +kn@8jlnuy diff --git a/regression-test/data/table_function/explode_json_array.out b/regression-test/data/query/sql_functions/table_function/explode_json_array.out similarity index 100% rename from regression-test/data/table_function/explode_json_array.out rename to regression-test/data/query/sql_functions/table_function/explode_json_array.out diff --git a/regression-test/data/table_function/explode_split.out b/regression-test/data/query/sql_functions/table_function/explode_split.out similarity index 100% rename from regression-test/data/table_function/explode_split.out rename to regression-test/data/query/sql_functions/table_function/explode_split.out diff --git a/regression-test/data/correctness/test_select_stddev_variance_window.out b/regression-test/data/query/sql_functions/window_functions/test_select_stddev_variance_window.out similarity index 100% rename from regression-test/data/correctness/test_select_stddev_variance_window.out rename to regression-test/data/query/sql_functions/window_functions/test_select_stddev_variance_window.out diff --git a/regression-test/data/correctness/test_stddev_variance_window.csv b/regression-test/data/query/sql_functions/window_functions/test_stddev_variance_window.csv similarity index 100% rename from regression-test/data/correctness/test_stddev_variance_window.csv rename to regression-test/data/query/sql_functions/window_functions/test_stddev_variance_window.csv diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/sql_functions/window_functions/test_sum.out similarity index 68% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/sql_functions/window_functions/test_sum.out index 1a9a561cf0..356de233f2 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/sql_functions/window_functions/test_sum.out @@ -1,4 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +1 123.123 +2 1243.5 +3 24453.325 diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/subquery/test_subquery.out similarity index 66% copy from regression-test/data/empty_table/sql/avg_decimal.out copy to regression-test/data/query/subquery/test_subquery.out index 1a9a561cf0..1ab1f93610 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/subquery/test_subquery.out @@ -1,4 +1,6 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !sql1 -- +1001 1 1989 +1001 2 1986 +1002 3 1989 diff --git a/regression-test/data/correctness/test_char_implicit_cast.out b/regression-test/data/query/test_char_implicit_cast.out similarity index 100% rename from regression-test/data/correctness/test_char_implicit_cast.out rename to regression-test/data/query/test_char_implicit_cast.out diff --git a/regression-test/data/correctness/test_select_constant.out b/regression-test/data/query/test_select_constant.out similarity index 100% rename from regression-test/data/correctness/test_select_constant.out rename to regression-test/data/query/test_select_constant.out diff --git a/regression-test/data/correctness/test_select_with_predicate_like.out b/regression-test/data/query/test_select_with_predicate_like.out similarity index 100% rename from regression-test/data/correctness/test_select_with_predicate_like.out rename to regression-test/data/query/test_select_with_predicate_like.out diff --git a/regression-test/data/query/union/test_union.out b/regression-test/data/query/union/test_union.out new file mode 100644 index 0000000000..56538122b0 --- /dev/null +++ b/regression-test/data/query/union/test_union.out @@ -0,0 +1,22 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +\N \N +1 1989 +10 1991 +11 1989 +12 32767 +13 -32767 +14 255 +15 1992 +1986 1001 +1989 1001 +1989 1002 +2 1986 +3 1989 +4 1991 +5 1985 +6 32767 +7 -32767 +8 255 +9 1991 + diff --git a/regression-test/data/empty_table/sql/avg_decimal.out b/regression-test/data/query/with/test_with.out similarity index 67% rename from regression-test/data/empty_table/sql/avg_decimal.out rename to regression-test/data/query/with/test_with.out index 1a9a561cf0..fc5c32bfbf 100644 --- a/regression-test/data/empty_table/sql/avg_decimal.out +++ b/regression-test/data/query/with/test_with.out @@ -1,4 +1,19 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !avg_decimal -- -\N +-- !select -- +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/account/test_account.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/account/test_account.groovy index 6015e19576..d830a2027d 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/account/test_account.groovy @@ -14,8 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_account", "account") { + // todo: test account management, such as role, user, grant, revoke ... + sql "show user" } diff --git a/regression-test/suites/account/test_role.groovy b/regression-test/suites/account/test_role.groovy new file mode 100644 index 0000000000..10a13744f3 --- /dev/null +++ b/regression-test/suites/account/test_role.groovy @@ -0,0 +1,47 @@ +// 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_role", "account") { + def role= 'account_role_test' + def user = 'acount_role_user_test' + def dbName = 'account_role_test_db' + + try_sql("DROP ROLE ${role}") + try_sql("DROP USER ${user}") + sql """DROP DATABASE IF EXISTS ${dbName}""" + sql """CREATE DATABASE ${dbName}""" + + sql """CREATE ROLE ${role}""" + sql """GRANT SELECT_PRIV ON ${context.config.defaultDb} TO ROLE '${role}'""" + sql """GRANT SELECT_PRIV ON ${dbName} TO ROLE '${role}'""" + sql """CREATE USER '${user}' IDENTIFIED BY '123456' DEFAULT ROLE '${role}'""" + def result1 = connect(user=user, password='123456', url=context.config.jdbcUrl) { + sql "show databases like '${dbName}'" + } + assertEquals(result1.size(), 1) + + sql """REVOKE SELECT_PRIV ON ${dbName} FROM ROLE '${role}'""" + def result2 = connect(user=user, password='123456', url=context.config.jdbcUrl) { + sql "show databases like '${dbName}'" + } + assertEquals(result2.size(), 0) + + sql """DROP USER ${user}""" + sql """DROP ROLE ${role}""" + sql """DROP DATABASE ${dbName}""" +} + diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/backup_restore/test_backup_restore.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/backup_restore/test_backup_restore.groovy index 6015e19576..7eba03260a 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/backup_restore/test_backup_restore.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_backup_restore", "backup_restore") { + // todo: test repository/backup/restore/cancel backup ... + sql "SHOW REPOSITORIES" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/bloom_filter/test_bloom_filter.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/bloom_filter/test_bloom_filter.groovy index 6015e19576..641a0a1fb0 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/bloom_filter/test_bloom_filter.groovy @@ -14,8 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_bloom_filter", "bloom_filter") { + // todo: test bloom filter, such alter table bloom filter, create table with bloom filter + sql "SHOW ALTER TABLE COLUMN" } diff --git a/regression-test/suites/bloom_filter/test_create_table_with_bloom_filter.groovy b/regression-test/suites/bloom_filter/test_create_table_with_bloom_filter.groovy new file mode 100644 index 0000000000..2c982bea68 --- /dev/null +++ b/regression-test/suites/bloom_filter/test_create_table_with_bloom_filter.groovy @@ -0,0 +1,85 @@ +// 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_create_table_with_bloom_filter", "bloom_filter") { + sql """DROP TABLE IF EXISTS test_bloom_filter""" + sql """ + CREATE TABLE test_bloom_filter( + tinyint_key TINYINT NOT NULL, + smallint_key SMALLINT NOT NULL, + int_key INT NOT NULL, + bigint_key BIGINT NOT NULL, + char_50_key CHAR(50) NOT NULL, + character_key VARCHAR(500) NOT NULL, + char_key CHAR NOT NULL, + character_most_key VARCHAR(65533) NOT NULL, + decimal_key DECIMAL(20, 6) NOT NULL, + decimal_most_key DECIMAL(27, 9) NOT NULL, + date_key DATE NOT NULL, + datetime_key DATETIME NOT NULL, + tinyint_value TINYINT SUM NOT NULL, + smallint_value SMALLINT SUM NOT NULL, + int_value int SUM NOT NULL, + bigint_value BIGINT SUM NOT NULL, + char_50_value CHAR(50) REPLACE NOT NULL, + character_value VARCHAR(500) REPLACE NOT NULL, + char_value CHAR REPLACE NOT NULL, + character_most_value VARCHAR(65533) REPLACE NOT NULL, + decimal_value DECIMAL(20, 6) SUM NOT NULL, + decimal_most_value DECIMAL(27, 9) SUM NOT NULL, + date_value_max DATE MAX NOT NULL, + date_value_replace DATE REPLACE NOT NULL, + date_value_min DATE MIN NOT NULL, + datetime_value_max DATETIME MAX NOT NULL, + datetime_value_replace DATETIME REPLACE NOT NULL, + datetime_value_min DATETIME MIN NOT NULL, + float_value FLOAT SUM NOT NULL, + double_value DOUBLE SUM NOT NULL ) + AGGREGATE KEY( + tinyint_key, + smallint_key, + int_key, + bigint_key, + char_50_key, + character_key, + char_key, + character_most_key, + decimal_key, + decimal_most_key, + date_key, + datetime_key) + DISTRIBUTED BY HASH(tinyint_key) BUCKETS 5 + PROPERTIES ( + "bloom_filter_columns"="smallint_key,int_key,bigint_key,char_50_key,character_key, + char_key,character_most_key,decimal_key,decimal_most_key, + date_key,datetime_key" + ) + """ + sql """ + INSERT INTO test_bloom_filter VALUES + ('1', '2', '4', '8', '50string', '500varchar', 'c', '65535varchar', + '0', '123456789012345678.123456789', '2013-12-01', '1900-01-01 00:00:00', + '1', '2', '4', '8', '50string', '500varchar_replace', 'c', '65535varchar', + '12345678901234.123456', '123456789012345678.123456789', '1900-01-01', + '1900-01-01', '1900-01-01', '1900-01-01 00:00:00', '1900-01-01 00:00:00', + '1900-01-01 00:00:00', '0.4', '0.8') + """ + qt_select_tb "SELECT * FROM test_bloom_filter" + qt_desc_tb "DESC test_bloom_filter" + sql "DROP TABLE test_bloom_filter" +} + diff --git a/regression-test/suites/data_model/aggregate/test_aggregate_table.groovy b/regression-test/suites/data_model/aggregate/test_aggregate_table.groovy new file mode 100644 index 0000000000..695f6c8374 --- /dev/null +++ b/regression-test/suites/data_model/aggregate/test_aggregate_table.groovy @@ -0,0 +1,87 @@ +// 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_aggregate_table", "data_model") { + def dbName = "test_aggregate_db" + List<List<Object>> db = sql """show databases like '${dbName}'""" + if (db.size() == 0) { + sql """CREATE DATABASE ${dbName}""" + } + + sql """use ${dbName}""" + + sql """DROP TABLE IF EXISTS int_agg""" + sql """ + CREATE TABLE IF NOT EXISTS int_agg ( + k int, + int_value_sum int sum, + int_value_max int max, + int_value_min int min, + int_value_replace int replace, + int_value_replace_if_not_null int replace_if_not_null + ) + AGGREGATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 5 + """ + sql """insert into int_agg values(0, 1, 1, 1, 1, 1)""" + sql """insert into int_agg values(0, 2, 2, 2, 2, 2)""" + sql """insert into int_agg values(0, null, null, null, null, null)""" + qt_int_agg_table """select * from int_agg""" + qt_desc_date_table """desc int_agg""" + sql """DROP TABLE int_agg""" + + sql """DROP TABLE IF EXISTS string_agg""" + sql """ + CREATE TABLE IF NOT EXISTS string_agg ( + k int, + char_value_max char(10) max, + char_value_min char(10) min, + char_value_replace char(10) replace, + char_value_replace_if_not_null char(10) replace_if_not_null + ) + AGGREGATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 5 + """ + sql """insert into string_agg values(0, '1', '1', '1', '1')""" + sql """insert into string_agg values(0, '2', '2', '2', '2')""" + sql """insert into string_agg values(0, '', '', '', '')""" + sql """insert into string_agg values(0, null, null, null, null)""" + qt_string_agg_table """select * from string_agg""" + qt_desc_string_table """desc string_agg""" + sql """DROP TABLE string_agg""" + + sql """DROP TABLE IF EXISTS date_agg""" + sql """ + CREATE TABLE IF NOT EXISTS date_agg ( + k int, + date_value_max date max, + date_value_min date min, + date_value_replace date replace, + date_value_replace_if_not_null date replace_if_not_null + ) + AGGREGATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 5 + """ + sql """insert into date_agg values(0, '2000-01-01', '2000-01-01', '2000-01-01', '2000-01-01')""" + sql """insert into date_agg values(0, '2000-12-31', '2000-12-31', '2000-12-31', '2000-12-31')""" + sql """insert into date_agg values(0, null, null, null, null)""" + qt_date_agg_table """select * from date_agg""" + qt_desc_date_table """desc date_agg""" + sql """DROP TABLE date_agg""" + + // sql "drop database ${dbName}" +} diff --git a/regression-test/suites/data_model/duplicate/test_duplicate_table.groovy b/regression-test/suites/data_model/duplicate/test_duplicate_table.groovy new file mode 100644 index 0000000000..2cded9954c --- /dev/null +++ b/regression-test/suites/data_model/duplicate/test_duplicate_table.groovy @@ -0,0 +1,64 @@ +// 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_duplicate_table", "data_model") { + def dbName = "test_duplicate_db" + List<List<Object>> db = sql "show databases like '${dbName}'" + if (db.size() == 0) { + sql "CREATE DATABASE ${dbName}" + } + sql "use ${dbName}" + + // test duplicate table + def tbName = "test_dup" + sql "DROP TABLE IF EXISTS ${tbName}" + sql """ + CREATE TABLE IF NOT EXISTS ${tbName} ( + k int, + int_value int, + char_value char(10), + date_value date + ) + DUPLICATE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 5 + """ + sql "insert into ${tbName} values(0, 1, 'test char', '2000-01-01')" + sql "insert into ${tbName} values(0, 2, 'test int', '2000-02-02')" + sql "insert into ${tbName} values(0, null, null, null)" + order_qt_select_dup_table "select * from ${tbName}" + qt_desc_dup_table "desc ${tbName}" + sql "DROP TABLE ${tbName}" + + // test default data model is duplicate + def tbName1 = "test_default_data_model" + sql "DROP TABLE IF EXISTS ${tbName1}" + sql """ + CREATE TABLE IF NOT EXISTS ${tbName1} ( + k1 int, + k2 int, + k3 int, + int_value int + ) + DISTRIBUTED BY HASH(k1) BUCKETS 5 + """ + sql "insert into ${tbName1} values(0, 1, 2, 4)" + sql "insert into ${tbName1} values(0, 1, 2, 5)" + sql "insert into ${tbName1} values(0, 1, 2, 3)" + order_qt_select_dup_table "select * from ${tbName1}" + qt_desc_dup_table "desc ${tbName1}" + sql "DROP TABLE ${tbName1}" +} diff --git a/regression-test/suites/data_model/unique/test_unique_table.groovy b/regression-test/suites/data_model/unique/test_unique_table.groovy new file mode 100644 index 0000000000..cc3fb7f6ab --- /dev/null +++ b/regression-test/suites/data_model/unique/test_unique_table.groovy @@ -0,0 +1,45 @@ +// 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_unique_table", "data_model") { + def dbName = "test_unique_db" + List<List<Object>> db = sql "show databases like '${dbName}'" + if (db.size() == 0) { + sql "CREATE DATABASE ${dbName}" + } + sql "use ${dbName}" + + // test duplicate table + def tbName = "test_uniq" + sql "DROP TABLE IF EXISTS ${tbName}" + sql """ + CREATE TABLE IF NOT EXISTS ${tbName} ( + k int, + int_value int, + char_value char(10), + date_value date + ) + UNIQUE KEY(k) + DISTRIBUTED BY HASH(k) BUCKETS 5 + """ + sql "insert into ${tbName} values(0, 1, 'test char', '2000-01-01')" + sql "insert into ${tbName} values(0, 2, 'test int', '2000-02-02')" + sql "insert into ${tbName} values(0, null, null, null)" + order_qt_select_uniq_table "select * from ${tbName}" + qt_desc_uniq_table "desc ${tbName}" + sql "DROP TABLE ${tbName}" +} diff --git a/regression-test/suites/types/complex_types/basic_agg_test.groovy b/regression-test/suites/datatype/bitmap/test_bitmap_int.groovy similarity index 55% copy from regression-test/suites/types/complex_types/basic_agg_test.groovy copy to regression-test/suites/datatype/bitmap/test_bitmap_int.groovy index 6314f76dab..631c2562dc 100644 --- a/regression-test/suites/types/complex_types/basic_agg_test.groovy +++ b/regression-test/suites/datatype/bitmap/test_bitmap_int.groovy @@ -15,18 +15,20 @@ // specific language governing permissions and limitations // under the License. -suite("basic_agg_test") { - def tables=["bitmap_basic_agg","hll_basic_agg"] +suite("test_bitmap_int", "datatype") { + sql "DROP TABLE IF EXISTS test_int_bitmap" + sql """ + CREATE TABLE test_int_bitmap (`id` int, `bitmap_set` bitmap bitmap_union) + ENGINE=OLAP DISTRIBUTED BY HASH(`id`) BUCKETS 5 + """ + sql "insert into test_int_bitmap values(1, bitmap_hash(1)), (2, bitmap_hash(2)), (3, bitmap_hash(3))" - for (String table in tables) { - sql """drop table if exists ${table};""" - sql new File("""regression-test/common/table/${table}.sql""").text - sql new File("""regression-test/common/load/${table}.sql""").text - } + qt_sql1 "select bitmap_union_count(bitmap_set) from test_int_bitmap" + qt_sql2 "select id,bitmap_union_count(bitmap_set) from test_int_bitmap group by id order by id" + order_qt_sql3 "select * from test_int_bitmap" + qt_desc "desc test_int_bitmap" - qt_sql_bitmap """select * from bitmap_basic_agg;""" + sql "DROP TABLE test_int_bitmap" +} - qt_sql_hll """select * from hll_basic_agg;""" - qt_sql_hll_cardinality """select k1, hll_cardinality(hll_union(k2)) from hll_basic_agg group by k1 order by k1;""" -} diff --git a/regression-test/suites/types/complex_types/basic_agg_test.groovy b/regression-test/suites/datatype/complex_types/basic_agg_test.groovy similarity index 100% rename from regression-test/suites/types/complex_types/basic_agg_test.groovy rename to regression-test/suites/datatype/complex_types/basic_agg_test.groovy diff --git a/regression-test/suites/empty_table/load.groovy b/regression-test/suites/datatype/hll/test_hll_int.groovy similarity index 60% copy from regression-test/suites/empty_table/load.groovy copy to regression-test/suites/datatype/hll/test_hll_int.groovy index 76d184e3d7..5d06e17134 100644 --- a/regression-test/suites/empty_table/load.groovy +++ b/regression-test/suites/datatype/hll/test_hll_int.groovy @@ -15,18 +15,15 @@ // specific language governing permissions and limitations // under the License. -// The cases is copied from https://github.com/trinodb/trino/tree/master -// /testing/trino-product-tests/src/main/resources/sql-tests/testcases -// and modified by Doris. - -suite("load") { - def tables=["empty"] - - for (String table in tables) { - sql """ DROP TABLE IF EXISTS $table """ - } - - for (String table in tables) { - sql new File("""${context.file.parent}/ddl/${table}.sql""").text - } +suite("test_hll_int", "datatype") { + sql "DROP TABLE IF EXISTS test_int_hll" + sql """ + CREATE TABLE test_int_hll (`id` int COMMENT "", `hll_set` hll hll_union COMMENT "") + ENGINE=OLAP DISTRIBUTED BY HASH(`id`) BUCKETS 5 + """ + sql "insert into test_int_hll values(1, hll_hash(1)), (2, hll_hash(2)), (3, hll_hash(3))" + qt_sql1 "select hll_union_agg(hll_set), count(*) from test_int_hll" + // qt_sql2 "select id, hll_candinality(hll_set) from test_int_hll" + sql "DROP TABLE test_int_hll" } + diff --git a/regression-test/suites/datatype/string/test_string_basic.groovy b/regression-test/suites/datatype/string/test_string_basic.groovy new file mode 100644 index 0000000000..40211b8aed --- /dev/null +++ b/regression-test/suites/datatype/string/test_string_basic.groovy @@ -0,0 +1,48 @@ +// 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_string_basic", "datatype") { + sql "drop table if exists fail_tb1" + // first column could not be string + test { + sql """CREATE TABLE fail_tb1 (k1 STRING NOT NULL, v1 STRING NOT NULL) DISTRIBUTED BY HASH(k1) BUCKETS 5""" + exception "The olap table first column could not be float, double, string use decimal or varchar instead." + } + // string type should could not be key + test { + sql """ + CREATE TABLE fail_tb1 ( k1 INT NOT NULL, k2 STRING NOT NULL) + DUPLICATE KEY(k1,k2) DISTRIBUTED BY HASH(k1) BUCKETS 5 + """ + exception "String Type should not be used in key column[k2]" + } + // create table with string column, insert and select ok + def tbName = "str_tb" + sql """ + CREATE TABLE ${tbName} (k1 VARCHAR(10) NULL, v1 STRING NULL) + UNIQUE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 5 + """ + sql """ + INSERT INTO ${tbName} VALUES + ("", ""), + (NULL, NULL), + (1, repeat("test1111", 8192)), + (2, repeat("test1111", 131072)) + """ + order_qt_select_str_tb "select k1, md5(v1), length(v1) from test_sys_string_basic_test_insert_load_tb" +} + diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/delete/test_delete.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/delete/test_delete.groovy index 6015e19576..7fd9bc6f4b 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/delete/test_delete.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_delete", "delete") { + // todo: test delete + sql "show delete" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/export/test_export.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/export/test_export.groovy index 6015e19576..f7165b3313 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/export/test_export.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_export", "export") { + // todo: test export, select into outfile + sql "show export" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/index/test_index.groovy similarity index 77% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/index/test_index.groovy index 6015e19576..7f43480f6f 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/index/test_index.groovy @@ -14,8 +14,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_index", "index") { + // todo: test bitmap index, such as create, drop, alter table index + def tables = sql "show tables" + def tb = tables[0][0] + logger.info("$tb") + sql "show index from ${tables[0][0]}" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/load/broker_load/test_broker_load.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/load/broker_load/test_broker_load.groovy index 6015e19576..46e5675459 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/load/broker_load/test_broker_load.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_broker_load", "load") { + // todo: test broker load/cancel, need broker & hdfs or others + sql "show load" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/load/insert/test_insert.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/load/insert/test_insert.groovy index 6015e19576..d84cb9458f 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/load/insert/test_insert.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_insert", "load") { + // todo: test insert, such as insert values, insert select, insert txn + sql "show load" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/load/routine_load/test_routine_load.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/load/routine_load/test_routine_load.groovy index 6015e19576..6f584c3074 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/load/routine_load/test_routine_load.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_routine_load", "load") { + // todo: test routine load, need kafka + sql "show routine load" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/load/stream_load/test_stream_load.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/load/stream_load/test_stream_load.groovy index 6015e19576..f3f9e4c352 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/load/stream_load/test_stream_load.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_stream_load", "load") { + // todo: test stream load + sql "show tables" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/load/sync_job/test_sync_job.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/load/sync_job/test_sync_job.groovy index 6015e19576..3dba8b60e8 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/load/sync_job/test_sync_job.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_sync_job", "load") { + // todo: test sync job, such as create/stop/pause/resume/show. Need mysql & canal + sql "show sync job" } diff --git a/regression-test/suites/partition/dynamic_partition/test_dynamic_partition.groovy b/regression-test/suites/partition/dynamic_partition/test_dynamic_partition.groovy new file mode 100644 index 0000000000..ac4cfd2c40 --- /dev/null +++ b/regression-test/suites/partition/dynamic_partition/test_dynamic_partition.groovy @@ -0,0 +1,39 @@ +// 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_dynamic_partition", "partition") { + // todo: test dynamic partition + sql "drop table if exists dy_par" + sql """ + CREATE TABLE dy_par ( k1 date NOT NULL, k2 varchar(20) NOT NULL, k3 int sum NOT NULL ) + AGGREGATE KEY(k1,k2) + PARTITION BY RANGE(k1) ( ) + DISTRIBUTED BY HASH(k1) BUCKETS 3 + PROPERTIES ( + "dynamic_partition.enable"="true", + "dynamic_partition.end"="3", + "dynamic_partition.buckets"="10", + "dynamic_partition.start"="-3", + "dynamic_partition.prefix"="p", + "dynamic_partition.time_unit"="DAY", + "dynamic_partition.create_history_partition"="true" ) + """ + List<List<Object>> result = sql "show tables like 'dy_par'" + logger.info("${result}") + assertEquals(result.size(), 1) + sql "drop table dy_par" +} diff --git a/regression-test/suites/partition/list_partition/test_list_partition.groovy b/regression-test/suites/partition/list_partition/test_list_partition.groovy new file mode 100644 index 0000000000..dc737bb527 --- /dev/null +++ b/regression-test/suites/partition/list_partition/test_list_partition.groovy @@ -0,0 +1,48 @@ +// 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_list_partition", "partition") { + // todo: test list partitions, such as: create, alter table partition ... + sql "drop table if exists list_par" + sql """ + CREATE TABLE list_par ( + k1 tinyint NOT NULL, + k2 smallint NOT NULL, + k3 int NOT NULL, + k4 bigint NOT NULL, + k5 decimal(9, 3) NOT NULL, + k6 char(5) NOT NULL, + k10 date NOT NULL, + k11 datetime NOT NULL, + k7 varchar(20) NOT NULL, + k8 double max NOT NULL, + k9 float sum NOT NULL ) + AGGREGATE KEY(k1,k2,k3,k4,k5,k6,k10,k11,k7) + PARTITION BY LIST(k1) ( + PARTITION p1 VALUES IN ("1","2","3","4"), + PARTITION p2 VALUES IN ("5","6","7","8","9","10","11","12","13","14"), + PARTITION p3 VALUES IN ("15") ) + DISTRIBUTED BY HASH(k1) BUCKETS 5 + """ + List<List<Object>> result1 = sql "show tables like 'list_par'" + logger.info("${result1}") + assertEquals(result1.size(), 1) + List<List<Object>> result2 = sql "show partitions from list_par" + logger.info("${result2}") + assertEquals(result2.size(), 3) + sql "drop table list_par" +} diff --git a/regression-test/suites/aggregate/aggregate.groovy b/regression-test/suites/query/aggregate/aggregate.groovy similarity index 100% rename from regression-test/suites/aggregate/aggregate.groovy rename to regression-test/suites/query/aggregate/aggregate.groovy diff --git a/regression-test/suites/empty_table/ddl/empty.sql b/regression-test/suites/query/empty_table/ddl/empty.sql similarity index 100% rename from regression-test/suites/empty_table/ddl/empty.sql rename to regression-test/suites/query/empty_table/ddl/empty.sql diff --git a/regression-test/suites/empty_table/load.groovy b/regression-test/suites/query/empty_table/load.groovy similarity index 100% copy from regression-test/suites/empty_table/load.groovy copy to regression-test/suites/query/empty_table/load.groovy diff --git a/regression-test/suites/empty_table/sql/avg_decimal.sql b/regression-test/suites/query/empty_table/sql/avg_decimal.sql similarity index 100% rename from regression-test/suites/empty_table/sql/avg_decimal.sql rename to regression-test/suites/query/empty_table/sql/avg_decimal.sql diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/except/test_query_except.groovy similarity index 69% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/except/test_query_except.groovy index 6015e19576..90cca3cf24 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/except/test_query_except.groovy @@ -15,7 +15,11 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_query_except", "query") { + // test query except, depend on query_test_data_load.groovy + sql "use test_query_db" + qt_select_except1 """ + SELECT * FROM (SELECT k1 FROM test_query_db.baseall + EXCEPT SELECT k1 FROM test_query_db.test) a ORDER BY k1 + """ } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/explain/test_pushdown_explain.groovy similarity index 77% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/explain/test_pushdown_explain.groovy index 6015e19576..6bb38a3389 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/explain/test_pushdown_explain.groovy @@ -15,7 +15,12 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_pushdown_explain", "query") { + sql "use test_query_db" + + explain { + sql("select k1 from baseall where k1 = 1") + contains "PREDICATES: `k1` = 1" + } + qt_select "select k1 from baseall where k1 = 1" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/grouping_sets/test_grouping_sets.groovy similarity index 78% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/grouping_sets/test_grouping_sets.groovy index 6015e19576..a157836e59 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/grouping_sets/test_grouping_sets.groovy @@ -15,7 +15,9 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_grouping_sets", "query") { + qt_select """ + SELECT k1, k2, SUM(k3) FROM test_query_db.test + GROUP BY GROUPING SETS ((k1, k2), (k1), (k2), ( ) ) order by k1, k2 + """ } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/intersect/test_intersect.groovy similarity index 78% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/intersect/test_intersect.groovy index 6015e19576..04ac64dc35 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/intersect/test_intersect.groovy @@ -15,7 +15,9 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_intersect", "query") { + qt_select """ + SELECT * FROM (SELECT k1 FROM test_query_db.baseall + INTERSECT SELECT k1 FROM test_query_db.test) a ORDER BY k1 + """ } diff --git a/regression-test/suites/join/ddl/test_bucket_shuffle_join.sql b/regression-test/suites/query/join/ddl/test_bucket_shuffle_join.sql similarity index 100% rename from regression-test/suites/join/ddl/test_bucket_shuffle_join.sql rename to regression-test/suites/query/join/ddl/test_bucket_shuffle_join.sql diff --git a/regression-test/suites/join/ddl/test_join.sql b/regression-test/suites/query/join/ddl/test_join.sql similarity index 100% rename from regression-test/suites/join/ddl/test_join.sql rename to regression-test/suites/query/join/ddl/test_join.sql diff --git a/regression-test/suites/join/load.groovy b/regression-test/suites/query/join/load.groovy similarity index 100% rename from regression-test/suites/join/load.groovy rename to regression-test/suites/query/join/load.groovy diff --git a/regression-test/suites/join/sql/agg_output_as_right_tale_left_outer_order.sql b/regression-test/suites/query/join/sql/agg_output_as_right_tale_left_outer_order.sql similarity index 100% rename from regression-test/suites/join/sql/agg_output_as_right_tale_left_outer_order.sql rename to regression-test/suites/query/join/sql/agg_output_as_right_tale_left_outer_order.sql diff --git a/regression-test/suites/join/sql/bucket_shuffle_join.sql b/regression-test/suites/query/join/sql/bucket_shuffle_join.sql similarity index 100% rename from regression-test/suites/join/sql/bucket_shuffle_join.sql rename to regression-test/suites/query/join/sql/bucket_shuffle_join.sql diff --git a/regression-test/suites/query/lateral_view/test_issue_8850.sql b/regression-test/suites/query/lateral_view/test_issue_8850.sql new file mode 100644 index 0000000000..65b98511d1 --- /dev/null +++ b/regression-test/suites/query/lateral_view/test_issue_8850.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS tag_map; + +CREATE TABLE `tag_map` ( `tag_group` bigint(20) NULL COMMENT "标签组", `tag_value_id` varchar(64) NULL COMMENT "标签值", `tag_range` int(11) NOT NULL DEFAULT "0" COMMENT "", `partition_sign` varchar(32) NOT NULL COMMENT "分区标识", `bucket` int(11) NOT NULL COMMENT "分桶字段", `confidence` tinyint(4) NULL DEFAULT "100" COMMENT "置信度", `members` bitmap BITMAP_UNION NULL COMMENT "人群") ENGINE=OLAP AGGREGATE KEY(`tag_group`, `tag_value_id`, `tag_range`, `partition_sign`, `bucket`, `confidence`) COMMENT "dm [...] + +set enable_lateral_view=true; + +with d as (select f1.bucket, bitmap_and(f1.members, f2.members) as members from (select f1.bucket, bitmap_and(f1.members, f2.members) as members from (select bucket, bitmap_union(members) as members from tag_map where partition_sign='2022-03-31-1' and tag_group=810004 and tag_value_id in (5524627,5524628,5524629) group by bucket) f1,(select bucket, bitmap_union(members) as members from tag_map where partition_sign='2022-03-31-1' and tag_group=810007 and tag_value_id in ('5525013_1735712 [...] + +DROP TABLE test_map; diff --git a/regression-test/suites/query/load.groovy b/regression-test/suites/query/load.groovy new file mode 100644 index 0000000000..8a707165ca --- /dev/null +++ b/regression-test/suites/query/load.groovy @@ -0,0 +1,75 @@ +// 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("load") { + // init query case data + def dbName = "test_query_db" + sql "DROP DATABASE IF EXISTS ${dbName}" + sql "CREATE DATABASE ${dbName}" + sql "USE $dbName" + sql """ + CREATE TABLE `baseall` ( + `k0` boolean null comment "", + `k1` tinyint(4) null comment "", + `k2` smallint(6) null comment "", + `k3` int(11) null comment "", + `k4` bigint(20) null comment "", + `k5` decimal(9, 3) null comment "", + `k6` char(5) null comment "", + `k10` date null comment "", + `k11` datetime null comment "", + `k7` varchar(20) null comment "", + `k8` double max null comment "", + `k9` float sum null comment "", + `k12` string replace null comment "", + `k13` largeint(40) replace null comment "" + ) engine=olap + DISTRIBUTED BY HASH(`k1`) BUCKETS 5 + """ + sql """ + CREATE TABLE `test` ( + `k0` boolean null comment "", + `k1` tinyint(4) null comment "", + `k2` smallint(6) null comment "", + `k3` int(11) null comment "", + `k4` bigint(20) null comment "", + `k5` decimal(9, 3) null comment "", + `k6` char(5) null comment "", + `k10` date null comment "", + `k11` datetime null comment "", + `k7` varchar(20) null comment "", + `k8` double max null comment "", + `k9` float sum null comment "", + `k12` string replace_if_not_null null comment "", + `k13` largeint(40) replace null comment "" + ) engine=olap + DISTRIBUTED BY HASH(`k1`) BUCKETS 5 + """ + streamLoad { + table "baseall" + db dbName + set 'column_separator', ',' + file "baseall.txt" + } + sql "insert into ${dbName}.test select * from ${dbName}.baseall where k1 <= 3" + + def baseall_count = sql "select count(*) from ${dbName}.baseall" + assertEquals(16, baseall_count[0][0]) + def test_count = sql "select count(*) from ${dbName}.test" + assertEquals(3, test_count[0][0]) +} + diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/aggregate_functions/test_approx_count_distinct.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/aggregate_functions/test_approx_count_distinct.groovy index 6015e19576..d941574e4c 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/aggregate_functions/test_approx_count_distinct.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_approx_count_distinct", "query") { + qt_select "select approx_count_distinct(k1) from test_query_db.baseall" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/bitmap_functions/test_btimap_count.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/bitmap_functions/test_btimap_count.groovy index 6015e19576..9276d35815 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/bitmap_functions/test_btimap_count.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_btimap_count", "query") { + order_qt_select "select bitmap_count(bitmap_hash(k2)) from test_query_db.baseall" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/conditional_functions/test_nullif.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/conditional_functions/test_nullif.groovy index 6015e19576..91defc52ba 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/conditional_functions/test_nullif.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_nullif", "query") { + qt_select "select nullif(k6, \"false\") k from test_query_db.test order by k1" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/datetime_functions/test_dayofweek.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/datetime_functions/test_dayofweek.groovy index 6015e19576..7c6504def7 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/datetime_functions/test_dayofweek.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_dayofweek", "query") { + qt_select "select k1, dayofweek(k10) from test_query_db.baseall order by k1" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/encryption_digest_functions/test_md5.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/encryption_digest_functions/test_md5.groovy index 6015e19576..00f9ca7c2d 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/encryption_digest_functions/test_md5.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_md5", "query") { + qt_select "select md5(k6) from test_query_db.test order by k6" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/json_functions/test_get_json_double.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/json_functions/test_get_json_double.groovy index 6015e19576..e5fa4c7267 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/json_functions/test_get_json_double.groovy @@ -15,7 +15,8 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_get_json_double", "query") { + // todo: token recognition error at: '.' @ line 21, column 67. + + // qt_select """select get_json_double('{"k1":1.3, "k2":"2"}', "$.k1")""" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/math_functions/test_conv.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/math_functions/test_conv.groovy index 6015e19576..2c85c525db 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/math_functions/test_conv.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_conv", "query") { + qt_select "SELECT CONV(15,10,2)" } + diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/spatial_functions/test_st_astext.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/spatial_functions/test_st_astext.groovy index 6015e19576..5e0a5984bf 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/spatial_functions/test_st_astext.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_st_astext", "query") { + qt_select "SELECT ST_AsText(ST_Point(24.7, 56.7))" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/string_functions/test_reverse.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/string_functions/test_reverse.groovy index 6015e19576..46381ecee0 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/string_functions/test_reverse.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_reverse", "query") { + qt_select "select reverse(k7) from test_query_db.test order by k1" } + diff --git a/regression-test/suites/table_function/explode_json_array.groovy b/regression-test/suites/query/sql_functions/table_function/explode_json_array.groovy similarity index 99% rename from regression-test/suites/table_function/explode_json_array.groovy rename to regression-test/suites/query/sql_functions/table_function/explode_json_array.groovy index 3aacc1ee46..6a2ab296e7 100644 --- a/regression-test/suites/table_function/explode_json_array.groovy +++ b/regression-test/suites/query/sql_functions/table_function/explode_json_array.groovy @@ -85,4 +85,4 @@ suite("explode_json_array") { LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE('[1.23, 22.214, 214.1]') t2 as d ORDER BY id, c, d """ -} \ No newline at end of file +} diff --git a/regression-test/suites/table_function/explode_split.groovy b/regression-test/suites/query/sql_functions/table_function/explode_split.groovy similarity index 100% rename from regression-test/suites/table_function/explode_split.groovy rename to regression-test/suites/query/sql_functions/table_function/explode_split.groovy diff --git a/regression-test/suites/correctness/test_select_stddev_variance_window.groovy b/regression-test/suites/query/sql_functions/window_functions/test_select_stddev_variance_window.groovy similarity index 100% rename from regression-test/suites/correctness/test_select_stddev_variance_window.groovy rename to regression-test/suites/query/sql_functions/window_functions/test_select_stddev_variance_window.groovy diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/sql_functions/window_functions/test_sum.groovy similarity index 74% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/sql_functions/window_functions/test_sum.groovy index 6015e19576..3d9b3f3669 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/sql_functions/window_functions/test_sum.groovy @@ -15,7 +15,11 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_sum", "query") { + qt_select """ + select k1, sum(k5) over + (partition by k1 order by k3 range between current row and unbounded following) as w + from test_query_db.test order by k1, w + """ } + diff --git a/regression-test/suites/empty_table/load.groovy b/regression-test/suites/query/subquery/test_subquery.groovy similarity index 62% rename from regression-test/suites/empty_table/load.groovy rename to regression-test/suites/query/subquery/test_subquery.groovy index 76d184e3d7..a34bd96c26 100644 --- a/regression-test/suites/empty_table/load.groovy +++ b/regression-test/suites/query/subquery/test_subquery.groovy @@ -15,18 +15,15 @@ // specific language governing permissions and limitations // under the License. -// The cases is copied from https://github.com/trinodb/trino/tree/master -// /testing/trino-product-tests/src/main/resources/sql-tests/testcases -// and modified by Doris. - -suite("load") { - def tables=["empty"] - - for (String table in tables) { - sql """ DROP TABLE IF EXISTS $table """ - } - - for (String table in tables) { - sql new File("""${context.file.parent}/ddl/${table}.sql""").text - } +suite("test_subquery", "query") { + qt_sql1 """ + select c1, c3, m2 from + (select c1, c3, max(c2) m2 from + (select c1, c2, c3 from + (select k3 c1, k2 c2, max(k1) c3 from test_query_db.test + group by 1, 2 order by 1 desc, 2 desc limit 5) x + ) x2 group by c1, c3 limit 10 + ) t + where c1>0 order by 2 , 1 limit 3 + """ } diff --git a/regression-test/suites/correctness/test_char_implicit_cast.groovy b/regression-test/suites/query/test_char_implicit_cast.groovy similarity index 100% rename from regression-test/suites/correctness/test_char_implicit_cast.groovy rename to regression-test/suites/query/test_char_implicit_cast.groovy diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/test_select_constant.groovy similarity index 100% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/test_select_constant.groovy diff --git a/regression-test/suites/correctness/test_select_with_predicate_like.groovy b/regression-test/suites/query/test_select_with_predicate_like.groovy similarity index 100% rename from regression-test/suites/correctness/test_select_with_predicate_like.groovy rename to regression-test/suites/query/test_select_with_predicate_like.groovy diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/union/test_union.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/union/test_union.groovy index 6015e19576..52ea4c3127 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/union/test_union.groovy @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_union", "query") { + order_qt_select "select k1, k2 from test_query_db.baseall union select k2, k3 from test_query_db.test" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/query/with/test_with.groovy similarity index 77% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/query/with/test_with.groovy index 6015e19576..b959bbaa4c 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/query/with/test_with.groovy @@ -15,7 +15,10 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_with", "query") { + sql "use test_query_db" + qt_select """ + select 1 from (with w as (select 1 from baseall + where exists (select 1 from baseall)) select 1 from w ) tt + """ } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/rollup/test_rollup.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/rollup/test_rollup.groovy index 6015e19576..162acbf1b7 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/rollup/test_rollup.groovy @@ -14,8 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_rollup", "rollup") { + // todo: test rollup, such as: alter table rollup, materialized view, explain + sql "show alter table rollup" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/schema_change/test_schema_change.groovy similarity index 81% copy from regression-test/suites/correctness/test_select_constant.groovy copy to regression-test/suites/schema_change/test_schema_change.groovy index 6015e19576..fe0954f65b 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/schema_change/test_schema_change.groovy @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_schema_change", "schema_change") { + // todo: test alter table schema change, such as add/drop/modify/order column + sql "show alter table column" } diff --git a/regression-test/suites/correctness/test_select_constant.groovy b/regression-test/suites/update/test_update.groovy similarity index 81% rename from regression-test/suites/correctness/test_select_constant.groovy rename to regression-test/suites/update/test_update.groovy index 6015e19576..93f0a7a5bf 100644 --- a/regression-test/suites/correctness/test_select_constant.groovy +++ b/regression-test/suites/update/test_update.groovy @@ -14,8 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - -suite("test_select_constant") { - qt_select1 'select 100, "test", date("2021-01-02");' - qt_select_geo1 'SELECT ST_AsText(ST_Point(123.12345678901234567890,89.1234567890));' +suite("test_update", "update") { + // todo:test update + sql "show tables" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org