tledkov-gridgain commented on a change in pull request #9476:
URL: https://github.com/apache/ignite/pull/9476#discussion_r733516027
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java
##########
@@ -267,13 +293,71 @@ public FailureProcessor failureProcessor() {
qryPlanCache,
exchangeSvc
);
+
+ runningQrys.clear();
}
/** {@inheritDoc} */
@Override public List<FieldsQueryCursor<List<?>>> query(@Nullable
QueryContext qryCtx, @Nullable String schemaName,
- String qry, Object... params) throws IgniteSQLException {
+ String sql, Object... params) throws IgniteSQLException {
+ QueryPlan plan = queryPlanCache().queryPlan(new
CacheKey(schemaHolder.getDefaultSchema(schemaName).getName(), sql));
+
+ if (plan != null) {
+ RootQuery<Object[]> qry = new RootQuery<>(
+ sql,
+ schemaHolder.getDefaultSchema(schemaName),
+ params,
+ qryCtx,
+ exchangeSvc,
+ (q) -> unregister(q.id()),
+ log
+ );
+
+ register(qry);
- return executionSvc.executeQuery(qryCtx, schemaName, qry, params);
+ return Collections.singletonList(executionSvc.executePlan(
+ qry,
+ plan
+ ));
+ }
+
+ SqlNodeList qryList = Commons.parse(sql,
FRAMEWORK_CONFIG.getParserConfig());
+ List<FieldsQueryCursor<List<?>>> cursors = new
ArrayList<>(qryList.size());
+
+ for (final SqlNode sqlNode: qryList) {
+ RootQuery<Object[]> qry = new RootQuery<>(
+ sqlNode.toString(),
+ schemaHolder.getDefaultSchema(schemaName),
+ params,
+ qryCtx,
+ exchangeSvc,
+ (q) -> unregister(q.id()),
+ log
+ );
+
+ register(qry);
+ try {
+ if (qryList.size() == 1) {
Review comment:
I guess it is out of the scope of this patch. The main goal of the patch
is refactoring query registration (introduce query registry) and query
cancellation.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]