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/04/02 08:10:35 UTC

[GitHub] [dolphinscheduler] lenboo commented on a change in pull request #9317: [Fix-9316] [Task] Configure DB2 data source SQL script execution report ResultSet has been closed exception in SQL task

lenboo commented on a change in pull request #9317:
URL: https://github.com/apache/dolphinscheduler/pull/9317#discussion_r841039348



##########
File path: dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
##########
@@ -252,16 +252,14 @@ private String resultProcess(ResultSet resultSet) throws Exception {
                 rowCount++;
             }
             int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS;
-            displayRows = Math.min(displayRows, resultJSONArray.size());
+            displayRows = Math.min(displayRows, rowCount);
             logger.info("display sql result {} rows as follows:", displayRows);
             for (int i = 0; i < displayRows; i++) {
                 String row = JSONUtils.toJsonString(resultJSONArray.get(i));
                 logger.info("row {} : {}", i + 1, row);
             }
-            if (resultSet.next()) {
+            if (rowCount >= limit) {

Review comment:
       'rowCount' is already limited by 'limit' in the while loop.




-- 
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