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 2fea19456abaf4..8a294ebf10d429 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.getColumnName(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 uniqueSet = new HashSet<>() + Set 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> 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 41b7a7ae145694..48675d1ee001c9 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> result = sql """ select 1;""" - def futures = [] futures.add( thread { @@ -505,8 +502,9 @@ suite('test_manager_interface_1',"p0") { sleep(1500) 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}")