From ca6182e0fc80cd384a5c2e8bbf201a6b8e78d2a2 Mon Sep 17 00:00:00 2001 From: PengFei Li Date: Mon, 27 Jan 2025 14:59:47 +0800 Subject: [PATCH] Add test Signed-off-by: PengFei Li --- .../test_profile/R/test_load_channel_profile | 28 ++++++++++++++++++- .../test_profile/T/test_load_channel_profile | 9 +++++- .../T/test_load_channel_profile_analysis.sh | 5 +--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/test/sql/test_profile/R/test_load_channel_profile b/test/sql/test_profile/R/test_load_channel_profile index 3a5adf314fc791..c30c0e0d7c6597 100644 --- a/test/sql/test_profile/R/test_load_channel_profile +++ b/test/sql/test_profile/R/test_load_channel_profile @@ -44,7 +44,33 @@ INSERT INTO `t0` (v1, v2, v3) values (2, 4, 12); -- result: -- !result -shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh +SET enable_profile=true; +-- result: +-- !result +SET enable_async_profile=false; +-- result: +-- !result +INSERT INTO t0 WITH LABEL label_${uuid0} SELECT * FROM t0; +-- result: +-- !result +shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" label="label_${uuid0}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh +-- result: +0 +Analyze profile succeeded +Analyze profile succeeded +-- !result +alter table t0 set('enable_load_profile'='true'); +-- result: +-- !result +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "label: "label_${uuid1}"" -H "column_separator: ," -d '1,2,3' -X PUT ${url}/api/${db[0]}/t0/_stream_load +-- result: +0 +{ + "Status": "Success", + "Message": "OK" +} +-- !result +shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" label="label_${uuid1}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh -- result: 0 Analyze profile succeeded diff --git a/test/sql/test_profile/T/test_load_channel_profile b/test/sql/test_profile/T/test_load_channel_profile index 20085720a7290e..fe07e9c33a2d60 100644 --- a/test/sql/test_profile/T/test_load_channel_profile +++ b/test/sql/test_profile/T/test_load_channel_profile @@ -36,4 +36,11 @@ INSERT INTO `t0` (v1, v2, v3) values (2, 4, 11), (2, 4, 12); -shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh \ No newline at end of file +SET enable_profile=true; +SET enable_async_profile=false; +INSERT INTO t0 WITH LABEL label_${uuid0} SELECT * FROM t0; +shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" label="label_${uuid0}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh + +alter table t0 set('enable_load_profile'='true'); +shell: curl --location-trusted -u root: -H "Expect:100-continue" -H "label: "label_${uuid1}"" -H "column_separator: ," -d '1,2,3' -X PUT ${url}/api/${db[0]}/t0/_stream_load +shell: env mysql_cmd="${mysql_cmd} -D${db[0]}" label="label_${uuid1}" bash ${root_path}/sql/test_profile/T/test_load_channel_profile_analysis.sh \ No newline at end of file diff --git a/test/sql/test_profile/T/test_load_channel_profile_analysis.sh b/test/sql/test_profile/T/test_load_channel_profile_analysis.sh index 4112729cac80d4..b9ffcfaf44f803 100644 --- a/test/sql/test_profile/T/test_load_channel_profile_analysis.sh +++ b/test/sql/test_profile/T/test_load_channel_profile_analysis.sh @@ -31,10 +31,7 @@ function check_keywords() { } sql=$(cat << EOF -SET enable_profile=true; -SET enable_async_profile=false; -INSERT INTO t0 SELECT * FROM t0; -SELECT get_query_profile(last_query_id()); +SELECT get_query_profile(PROFILE_ID) AS result FROM information_schema.loads WHERE LABEL = '${label}'; EOF )