From 9b6ab81e6034e248cc1c1588156b83ba074aa499 Mon Sep 17 00:00:00 2001 From: Rubik-W <39549317+Rubik-W@users.noreply.github.com> Date: Mon, 30 Mar 2020 16:22:44 +0800 Subject: [PATCH] fix #2334 (#2335) Co-authored-by: dailidong --- .../dolphinscheduler/server/worker/task/sql/SqlTask.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java index 34b87fff79..3001ea8e54 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java @@ -309,7 +309,11 @@ public class SqlTask extends AbstractTask { while (resultSet.next()) { JSONObject mapOfColValues = new JSONObject(true); for (int i = 1; i <= num; i++) { - mapOfColValues.put(md.getColumnName(i), resultSet.getObject(i)); + if (StringUtils.isNotEmpty(md.getColumnLabel(i))) { + mapOfColValues.put(md.getColumnLabel(i), resultSet.getObject(i)); + } else { + mapOfColValues.put(md.getColumnName(i), resultSet.getObject(i)); + } } resultJSONArray.add(mapOfColValues); }