You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/10 03:34:23 UTC

[incubator-iotdb] 01/01: check fetch size in query

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch check_fetch_size
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 86e97648ddacd3b27f268165f98447a8b71f972b
Author: qiaojialin <64...@qq.com>
AuthorDate: Fri Jul 10 11:33:59 2020 +0800

    check fetch size in query
---
 server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index dcbbc36..3721d5a 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -142,6 +142,7 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
   private static final int MAX_SIZE =
       IoTDBDescriptor.getInstance().getConfig().getQueryCacheSizeInMetric();
   private static final int DELETE_SIZE = 20;
+  private static final int FETCH_SIZE = 10000;
   private static final String ERROR_PARSING_SQL =
       "meet error while parsing SQL to physical plan: {}";
   private static final List<SqlArgument> sqlArgumentList = new ArrayList<>(MAX_SIZE);
@@ -553,6 +554,11 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
     try {
       TSExecuteStatementResp resp = getQueryResp(plan, username); // column headers
 
+      // In case users forget to set this field in query, use the default value
+      if (fetchSize == 0) {
+        fetchSize = FETCH_SIZE;
+      }
+
       if (plan instanceof ShowTimeSeriesPlan) {
         //If the user does not pass the limit, then set limit = fetchSize and haslimit=false,else set haslimit = true
         if (((ShowTimeSeriesPlan) plan).getLimit() == 0) {