This is an automated email from the ASF dual-hosted git repository. hellostephen pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 5d70ee54c70 branch-3.0: [regression-test](framework) fix bug when sql returns two column with same name #47087 (#47135) 5d70ee54c70 is described below commit 5d70ee54c70315faa9ab9e30cc1319e2b85e1a0f Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Thu Jan 23 17:42:23 2025 +0800 branch-3.0: [regression-test](framework) fix bug when sql returns two column with same name #47087 (#47135) 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 | 8 +++----- 2 files changed, 21 insertions(+), 5 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 f4afbf3060d..0327dd436dc 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 @@ -462,6 +462,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 2758e0ebe7a..ec57261b147 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 { @@ -511,8 +508,9 @@ suite('test_manager_interface_1',"p0") { 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