You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/20 11:32:02 UTC

[GitHub] [dolphinscheduler] githublaohu commented on a diff in pull request #12059: [Bug-#12057][task-plugin] fix when the sql query result is empty, the email fails to send the attachment, and an exception will be reported

githublaohu commented on code in PR #12059:
URL: https://github.com/apache/dolphinscheduler/pull/12059#discussion_r975227303


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java:
##########
@@ -255,6 +255,15 @@ private String resultProcess(ResultSet resultSet) throws Exception {
                 resultJSONArray.add(mapOfColValues);
                 rowCount++;
             }
+            // result is null,output table metadata
+            if (resultJSONArray.isEmpty()) {

Review Comment:
   1. int num = md.getColumnCount(); 如果num为零,怎么办?
   2. 如果resultJSONArray的数据里全是填充的, 267行的代码就没有意义了
   
   



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java:
##########
@@ -255,6 +255,15 @@ private String resultProcess(ResultSet resultSet) throws Exception {
                 resultJSONArray.add(mapOfColValues);
                 rowCount++;
             }
+            // result is null,output table metadata
+            if (resultJSONArray.isEmpty()) {
+                ObjectNode emptyOfColValues = JSONUtils.createObjectNode();
+                for (int i = 1; i <= num; i++) {

Review Comment:
   是否只需要填充一行就行了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org