korlov42 commented on code in PR #843:
URL: https://github.com/apache/ignite-3/pull/843#discussion_r888953405
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -302,6 +322,110 @@ private CompletableFuture<AsyncSqlCursor<List<Object>>>
querySingle0(
return stage;
}
+ @SuppressWarnings("checkstyle:Indentation")
+ private CompletableFuture<long[]> batch0(
+ QueryContext context,
+ String schemaName,
+ String sql,
+ List<List<Object>> batchArgs) {
+ if (CollectionUtils.nullOrEmpty(batchArgs)) {
+ return CompletableFuture.failedFuture(new IgniteException("Batch
is empty"));
+ }
+
+ SchemaPlus schema = schemaManager.schema(schemaName);
+
+ if (schema == null) {
+ return CompletableFuture.failedFuture(new
IgniteInternalException(format("Schema not found [schemaName={}]",
schemaName)));
+ }
+
+ final BaseQueryContext ctx = BaseQueryContext.builder()
+ .cancel(new QueryCancel())
+ .frameworkConfig(
+ Frameworks.newConfigBuilder(FRAMEWORK_CONFIG)
+ .defaultSchema(schema)
+ .build()
+ )
+ .logger(LOG)
+ .parameters(batchArgs.get(0).toArray())
+ .build();
+
+ CompletableFuture<Void> start = new CompletableFuture<>();
+
+ CompletableFuture<QueryPlan> planning = start.thenApply(
+ (v) -> Commons.parse(sql,
FRAMEWORK_CONFIG.getParserConfig())
+ )
+ .thenApply(nodes -> {
+ if (nodes.size() > 1) {
+ throw new SqlException("Multiple statements aren't
allowed.");
+ }
+
+ return nodes.get(0);
+ })
+ .thenCompose(sqlNode -> prepareSvc.prepareAsync(sqlNode, ctx))
+ .thenApply(plan -> {
+ if (plan.type() != Type.DML) {
Review Comment:
let's pass it as QueryValidator
--
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]