alex-plekhanov commented on code in PR #11394:
URL: https://github.com/apache/ignite/pull/11394#discussion_r1642845384


##########
modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java:
##########
@@ -135,6 +136,7 @@
     IndexWithSameNameCalciteTest.class,
     AuthorizationIntegrationTest.class,
     DdlTransactionCalciteSelfTest.class,
+    MultiLineQueryTest.class

Review Comment:
   Add comma before EOL



##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.thin;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.SqlConfiguration;
+import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests proper exception is thrown when multiline expressions are executed on 
thin client on both engines.
+ */
+@RunWith(Parameterized.class)
+public class MultiLineQueryTest extends GridCommonAbstractTest {
+    /** */
+    private static final String H2_ENGINE = 
IndexingQueryEngineConfiguration.ENGINE_NAME;
+
+    /** */
+    private static final String CALCITE_ENGINE = 
CalciteQueryEngineConfiguration.ENGINE_NAME;
+
+    /** */
+    private IgniteClient cli;
+
+    /** */
+    @Parameterized.Parameter
+    public String queryEngine;
+
+    /** */
+    @Parameterized.Parameters(name = "engine={0}")
+    public static List<Object> parameters() {
+        return Stream.of(H2_ENGINE, 
CALCITE_ENGINE).collect(Collectors.toList());

Review Comment:
   `F.asList` or `Arrays.asList`?



##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java:
##########
@@ -500,8 +501,15 @@ private <T> List<T> parseAndProcessQuery(
 
         parserMetrics.countCacheMiss();
 
+        QueryProperties qryProps = qryCtx != null ? 
qryCtx.unwrap(QueryProperties.class) : null;
+
         SqlNodeList qryList = Commons.parse(sql, 
FRAMEWORK_CONFIG.getParserConfig());
 
+        if (qryList.size() > 1 && qryProps != null && 
qryProps.isFailOnMultipleStmts()) {
+            throw new IgniteSQLException("Multiple statements queries are not 
supported.",
+                    IgniteQueryErrorCode.UNSUPPORTED_OPERATION);

Review Comment:
   Wrong indent



##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/thin/MultiLineQueryTest.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.thin;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.SqlConfiguration;
+import org.apache.ignite.indexing.IndexingQueryEngineConfiguration;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+
+/**
+ * Tests proper exception is thrown when multiline expressions are executed on 
thin client on both engines.
+ */
+@RunWith(Parameterized.class)
+public class MultiLineQueryTest extends GridCommonAbstractTest {
+    /** */
+    private static final String H2_ENGINE = 
IndexingQueryEngineConfiguration.ENGINE_NAME;
+
+    /** */
+    private static final String CALCITE_ENGINE = 
CalciteQueryEngineConfiguration.ENGINE_NAME;
+
+    /** */
+    private IgniteClient cli;
+
+    /** */
+    @Parameterized.Parameter
+    public String queryEngine;
+
+    /** */
+    @Parameterized.Parameters(name = "engine={0}")
+    public static List<Object> parameters() {
+        return Stream.of(H2_ENGINE, 
CALCITE_ENGINE).collect(Collectors.toList());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        return super.getConfiguration(igniteInstanceName).setSqlConfiguration(
+                new SqlConfiguration().setQueryEnginesConfiguration(
+                        new IndexingQueryEngineConfiguration(),
+                        new CalciteQueryEngineConfiguration()
+                )

Review Comment:
   Wrong indent



-- 
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]

Reply via email to