pavlukhin commented on a change in pull request #6490: IGNITE-7285 Add default
query timeout
URL: https://github.com/apache/ignite/pull/6490#discussion_r327557853
##########
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:
I meant that on that code line we have a _narrowing_ conversion from long to
int, which can lead to using a timeout value during query execution different
from one specified in configuration. I suggest to validate that an argument of
`IgniteConfiguration.setDefaultQueryTimeout` is in a non-negative **int** range
(0 <= x <= Integer.MAX_VALUE).
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services