diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java index 3846c35c1c..cc18d5e468 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java @@ -81,6 +81,11 @@ public class SqlTask extends AbstractTaskExecutor { */ private static final String CREATE_FUNCTION_FORMAT = "create temporary function {0} as ''{1}''"; + /** + * default query sql limit + */ + private static final int LIMIT = 10000; + /** * Abstract Yarn Task * @@ -234,8 +239,9 @@ public class SqlTask extends AbstractTaskExecutor { int num = md.getColumnCount(); int rowCount = 0; + int limit = sqlParameters.getLimit() == 0 ? LIMIT : sqlParameters.getLimit(); - while (rowCount < sqlParameters.getLimit() && resultSet.next()) { + while (rowCount < limit && resultSet.next()) { ObjectNode mapOfColValues = JSONUtils.createObjectNode(); for (int i = 1; i <= num; i++) { mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i)));