nizhikov commented on code in PR #13668:
URL: https://github.com/apache/ignite/pull/13668#discussion_r4246679388


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java:
##########
@@ -562,9 +566,12 @@ private void initQueryEngines() throws 
IgniteCheckedException {
             // If indexing is disabled, try to find any query engine in 
components.
             if (!indexingEnabled()) {
                 for (GridComponent cmp : ctx.components()) {
-                    if (cmp instanceof QueryEngine) {
-                        qryEngines = new QueryEngine[] {(QueryEngine)cmp};
-                        dfltQryEngine = (QueryEngine)cmp;
+                    if (cmp instanceof QueryEngine && 
((QueryEngine)cmp).config() != null) {
+                        QueryEngine qryEngine = (QueryEngine)cmp;
+
+                        qryEngines = new QueryEngine[] {qryEngine};
+                        this.qryEnginesCfg = new QueryEngineConfigurationEx[] 
{qryEngine.config()};
+                        dfltQryEngine = qryEngine;

Review Comment:
   Fixed in 0a554e6.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java:
##########
@@ -891,10 +891,16 @@ private void validate(Query qry) {
             throw new CacheException("Indexing is disabled for cache: " + 
cacheName +
                     ". Use setIndexedTypes or setTypeMetadata methods on 
CacheConfiguration to enable.");
 
-        if (!ctx.kernalContext().query().moduleEnabled() &&
-            (qry instanceof SqlQuery || qry instanceof SqlFieldsQuery || qry 
instanceof TextQuery))
+        if (!ctx.kernalContext().query().moduleEnabled() && qry instanceof 
SqlFieldsQuery) {
             throw new CacheException("Failed to execute query. Add module 
'ignite-indexing' to the classpath " +
-                    "of all Ignite nodes or configure any query engine.");
+                "of all Ignite nodes or configure any query engine.");
+        }
+
+        if ((qry instanceof SqlQuery || qry instanceof TextQuery) && 
!ctx.kernalContext().query().indexingEnabled()) {
+            throw new CacheException("Failed to execute query. " + 
qry.getClass().getSimpleName() + " is supported " +
+                "by the H2 query engine only, add module 'ignite-indexing' to 
the classpath of all Ignite nodes" +
+                (qry instanceof SqlQuery ? " or use SqlFieldsQuery instead." : 
"."));

Review Comment:
   Fixed in 0a554e6: the `or use SqlFieldsQuery instead` tail is appended only 
when `moduleEnabled()` is true, so a node without any query engine gets the 
plain message.



##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CalciteOnlyNodeIntegrationTest.java:
##########
@@ -0,0 +1,362 @@
+/*
+ * 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.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cache.query.TextQuery;
+import org.apache.ignite.calcite.CalciteQueryEngineConfiguration;
+import org.apache.ignite.client.ClientCache;
+import org.apache.ignite.client.ClientException;
+import org.apache.ignite.client.Config;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.configuration.ClientConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.ThinClientConfiguration;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
+import 
org.apache.ignite.internal.processors.query.calcite.GridCommonAbstractWrapperTest;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.testframework.CallbackExecutorLogListener;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.ListeningTestLogger;
+import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
+import static 
org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
+
+/**
+ * Checks behaviour of a node that has the Calcite engine on the classpath but 
<b>not</b> the H2 engine

Review Comment:
   Fixed in 0a554e6.



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