samaitra commented on a change in pull request #6490: IGNITE-7285 Add default 
query timeout
URL: https://github.com/apache/ignite/pull/6490#discussion_r326871383
 
 

 ##########
 File path: 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/QueryParser.java
 ##########
 @@ -134,6 +135,49 @@ public QueryParserResult parse(String schemaName, 
SqlFieldsQuery qry, boolean re
         return res;
     }
 
+    /**
+     * Create parameters from query.
+     *
+     * @param qry Query.
+     * @return Parameters.
+     */
+    public QueryParameters fromQuery(SqlFieldsQuery qry) {
+        NestedTxMode nestedTxMode = NestedTxMode.DEFAULT;
+        boolean autoCommit = true;
+        List<Object[]> batchedArgs = null;
+
+        if (qry instanceof SqlFieldsQueryEx) {
+            SqlFieldsQueryEx qry0 = (SqlFieldsQueryEx)qry;
+
+            if (qry0.getNestedTxMode() != null)
+                nestedTxMode = qry0.getNestedTxMode();
+
+            autoCommit = qry0.isAutoCommit();
+
+            batchedArgs = qry0.batchedArguments();
+        }
+
+        int timeout = 0;
+
+        if (qry.getTimeout() > 0)
+            timeout = qry.getTimeout();
+        else
+            timeout = 
(int)idx.kernalContext().config().getDefaultQueryTimeout();
 
 Review comment:
   yes, we validate timeout in `QueryUtils.validateTimeout` which is invoked 
inside `SqlFieldsQuery.setTimeout`.
   
   I think `int` is mainly used since we check remaining timeout in 
IgniteH2Indexing.operationTimeout using Math.min/Math.max methods

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to