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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to