ygerzhedovich commented on a change in pull request #9476:
URL: https://github.com/apache/ignite/pull/9476#discussion_r724250920
##########
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:
why we cache only one-statement queries?
--
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]