This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 9407a990139 [chore](suite) Add target_sql_return_maparray (#37422)
9407a990139 is described below
commit 9407a99013968b9a63e2827a1241f86f9c5083fe
Author: walter <[email protected]>
AuthorDate: Mon Jul 8 18:59:29 2024 +0800
[chore](suite) Add target_sql_return_maparray (#37422)
Cherry-pick #37303
---
.../org/apache/doris/regression/suite/Suite.groovy | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
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 9a9b5a779a6..160df699805 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
@@ -368,6 +368,31 @@ class Suite implements GroovyInterceptable {
return result
}
+ def target_sql_return_maparray(String sqlStr, boolean isOrder = false) {
+ logger.info("Execute ${isOrder ? "order_" : ""}target_sql:
${sqlStr}".toString())
+ def (result, meta) =
JdbcUtils.executeToList(context.getTargetConnection(this), sqlStr)
+ if (isOrder) {
+ result = DataUtils.sortByToString(result)
+ }
+
+ // get all column names as list
+ List<String> columnNames = new ArrayList<>()
+ for (int i = 0; i < meta.getColumnCount(); i++) {
+ columnNames.add(meta.getColumnName(i + 1))
+ }
+
+ // 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++) {
+ Map<String, Object> row = new HashMap<>()
+ for (int j = 0; j < columnNames.size(); j++) {
+ row.put(columnNames.get(j), result.get(i).get(j))
+ }
+ res.add(row)
+ }
+ return res
+ }
+
List<List<String>> sql_meta(String sqlStr, boolean isOrder = false) {
logger.info("Execute ${isOrder ? "order_" : ""}sql:
${sqlStr}".toString())
def (tmp, rsmd) = JdbcUtils.executeToList(context.getConnection(),
sqlStr)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]