This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new df020058a7a branch-2.1: [regression-test](framework) fix bug when sql returns two column with same name #47087 (#47137) df020058a7a is described below commit df020058a7a00b72dbc61051716a0df591215dce Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Fri Jan 17 20:45:16 2025 +0800 branch-2.1: [regression-test](framework) fix bug when sql returns two column with same name #47087 (#47137) Cherry-picked from #47087 Co-authored-by: shuke <sh...@selectdb.com> --- .../org/apache/doris/regression/suite/Suite.groovy | 18 ++++++++++++++++++ .../suites/manager/test_manager_interface_1.groovy | 14 +++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy index 427cd5d516d..3a702caa509 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy @@ -433,6 +433,24 @@ class Suite implements GroovyInterceptable { columnNames.add(meta.getColumnLabel(i + 1)) } + // Check if there are duplicates column names. + // SQL may return multiple columns with the same name. + // which cannot be handled by maps and will result in an error directly. + Set<String> uniqueSet = new HashSet<>() + Set<String> duplicates = new HashSet<>() + + for (String str : columnNames) { + if (uniqueSet.contains(str)) { + duplicates.add(str) + } else { + uniqueSet.add(str) + } + } + if (!duplicates.isEmpty()) { + def errorMessage = "${sqlStr} returns duplicates headers: ${duplicates}" + throw new Exception(errorMessage) + } + // add result to res map list, each row is a map with key is column name List<Map<String, Object>> res = new ArrayList<>() for (int i = 0; i < result.size(); i++) { diff --git a/regression-test/suites/manager/test_manager_interface_1.groovy b/regression-test/suites/manager/test_manager_interface_1.groovy index e65ec2e5da3..494ec40908a 100644 --- a/regression-test/suites/manager/test_manager_interface_1.groovy +++ b/regression-test/suites/manager/test_manager_interface_1.groovy @@ -485,13 +485,10 @@ suite('test_manager_interface_1',"p0") { } test_table_index() - -//select a.*, b.*, c.NAME as WORKLOAD_GROUP_NAME from information_schema.active_queries a left join information_schema.backend_active_tasks b on a.QUERY_ID = b.QUERY_ID left join information_schema.workload_groups c on a.WORKLOAD_GROUP_ID = c.ID def test_active_query = { List<List<Object>> result = sql """ select 1;""" - def futures = [] futures.add( thread { @@ -504,15 +501,10 @@ suite('test_manager_interface_1',"p0") { futures.add( thread { sleep(1500) - result = sql """ - select a.*, b.*, c.NAME as WORKLOAD_GROUP_NAME from information_schema.active_queries a left join - information_schema.backend_active_tasks b on a.QUERY_ID = b.QUERY_ID left join information_schema.workload_groups c on a.WORKLOAD_GROUP_ID = c.ID - """ - logger.info("result = ${result}") - result = sql_return_maparray """ - select a.*, b.*, c.NAME as WORKLOAD_GROUP_NAME from information_schema.active_queries a left join - information_schema.backend_active_tasks b on a.QUERY_ID = b.QUERY_ID left join information_schema.workload_groups c on a.WORKLOAD_GROUP_ID = c.ID + select a.*, b.TASK_CPU_TIME_MS, b.SCAN_ROWS, b.SCAN_BYTES, b.SHUFFLE_SEND_BYTES, b.SHUFFLE_SEND_ROWS, b.CURRENT_USED_MEMORY_BYTES, c.NAME as WORKLOAD_GROUP_NAME + from information_schema.active_queries a left join + information_schema.backend_active_tasks b on a.QUERY_ID = b.QUERY_ID left join information_schema.workload_groups c on a.WORKLOAD_GROUP_ID = c.ID """ logger.info("result = ${result}") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org