alex-plekhanov commented on a change in pull request #9084:
URL: https://github.com/apache/ignite/pull/9084#discussion_r633405294
##########
File path:
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java
##########
@@ -128,19 +133,55 @@ public void
testInsertAsSelectWithConcurrentDataModification() throws IgniteChec
});
for (int i = 8; i < 18; i++) {
- int off = (int)Math.pow(2, i - 1);
+ int off = (int)pow(2, i - 1);
Review comment:
`(int)pow(2, i - 1)` -> `1 << (i - 1)` ?
##########
File path:
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDmlIntegrationTest.java
##########
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.query.calcite.integration;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObjectBuilder;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.SqlConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.QueryEngine;
+import
org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor;
+import
org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessorTest;
+import org.apache.ignite.internal.processors.query.calcite.util.Commons;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static java.lang.Math.pow;
+
+/** */
+public class TableDmlIntegrationTest extends GridCommonAbstractTest {
+ /** */
+ private static final String CLIENT_NODE_NAME = "client";
+
+ /** */
+ private static final String DATA_REGION_NAME = "test_data_region";
+
+ /** */
+ private IgniteEx client;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrids(2);
+
+ client = startClientGrid(CLIENT_NODE_NAME);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName)
+ .setSqlConfiguration(
+ new SqlConfiguration().setSqlSchemas("MY_SCHEMA")
+ )
+ .setDataStorageConfiguration(
Review comment:
Looks like this is redundant
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
##########
@@ -674,16 +686,20 @@ private IgniteRel optimize(SqlNode sqlNode, IgnitePlanner
planner) {
}
/** */
+ // TODO: prepareExplain should reuse prepare* methods for different query
types
private QueryPlan prepareExplain(SqlNode explain, PlanningContext ctx)
throws ValidationException {
IgnitePlanner planner = ctx.planner();
SqlNode sql = ((SqlExplain)explain).getExplicandum();
// Validate
- explain = planner.validate(sql);
+ sql = planner.validate(sql);
// Convert to Relational operators graph
- IgniteRel igniteRel = optimize(explain, planner);
+ IgniteRel igniteRel = optimize(sql, planner);
+
+ if (sql.isA(ImmutableSet.of(SqlKind.INSERT, SqlKind.UPDATE)))
Review comment:
Why logic here is differ from `prepareDml`? If we can't use physical
plan, perhaps we can check top-level node of AST for `prepareDml` as it used
here?
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
##########
@@ -1149,4 +1165,80 @@ private void onError(Throwable error) {
tryClose();
}
}
+
+ /** */
+ private static class FixDependentInsertNodeShuttle extends
IgniteRelShuttle {
Review comment:
Let's rename the class (and update javadocs), since it's already not
only for insert node
--
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]