caishunfeng commented on code in PR #12059:
URL: https://github.com/apache/dolphinscheduler/pull/12059#discussion_r975311000
##########
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++) {
+ emptyOfColValues.set(md.getColumnLabel(i),
JSONUtils.toJsonNode(""));
+ }
+ resultJSONArray.add(emptyOfColValues);
Review Comment:
Yes, I get your point, but what I mean is that the log will show the
incorrect empty result. It's better to set empty value before sendAttachment.
see
https://github.com/apache/dolphinscheduler/pull/12059/files#diff-f54c9e235dbb7e6ab2bd181aaad09f19330e680b8573840d64386401abb47203R269-R273
BTW, I think you can split this code as a function, like `generateEmptyRow`,
WDYT?
--
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]