You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by zs...@apache.org on 2022/03/28 06:21:06 UTC

[ignite] branch ignite-2.13 updated: IGNITE-16742 Extend calcite module documentation - Fixes #9909.

This is an automated email from the ASF dual-hosted git repository.

zstan pushed a commit to branch ignite-2.13
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-2.13 by this push:
     new e66f1ce  IGNITE-16742 Extend calcite module documentation - Fixes #9909.
e66f1ce is described below

commit e66f1ce824986a105e90dd571ef4ed2dd6e40e19
Author: zstan <st...@gmail.com>
AuthorDate: Mon Mar 28 09:09:05 2022 +0300

    IGNITE-16742 Extend calcite module documentation - Fixes #9909.
    
    Signed-off-by: zstan <st...@gmail.com>
---
 examples/config/example-sql.xml | 47 ++++++++++++++++++++++++++++++++
 modules/calcite/README.txt      | 60 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/examples/config/example-sql.xml b/examples/config/example-sql.xml
new file mode 100644
index 0000000..840fc62
--- /dev/null
+++ b/examples/config/example-sql.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <import resource="example-default.xml"/>
+
+    <bean id="queries.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="sqlConfiguration">
+            <bean class="org.apache.ignite.configuration.SqlConfiguration">
+                <property name="queryEnginesConfiguration">
+                    <list>
+                        <bean class="org.apache.ignite.indexing.IndexingQueryEngineConfiguration">
+                            <property name="default" value="true"/>
+                        </bean>
+                        <bean class="org.apache.ignite.calcite.CalciteQueryEngineConfiguration">
+                            <property name="default" value="false"/>
+                        </bean>
+                    </list>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>
diff --git a/modules/calcite/README.txt b/modules/calcite/README.txt
index 8316403..025298c 100644
--- a/modules/calcite/README.txt
+++ b/modules/calcite/README.txt
@@ -4,7 +4,36 @@ Apache Ignite Calcite Module
 Apache Ignite Calcite module provides experimental Apache Calcite based query engine.
 
 To enable Calcite based engine explicit `CalciteQueryEngineConfiguration` instance should be added to
-`SqlConfiguration.QueryEnginesConfiguration` property (see `SqlConfiguration.setQueryEnginesConfiguration()`).
+`SqlConfiguration.QueryEnginesConfiguration` property (see `SqlConfiguration.setQueryEnginesConfiguration()`) or ./examples/config/example-sql.xml.
+Config example:
+
+<bean id="queries.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+    <property name="clientConnectorConfiguration">
+        <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
+            <property name="host" value="127.0.0.1"/>
+            <property name="port" value="10800"/>
+            <property name="portRange" value="10"/>
+        </bean>
+    </property>
+    ...
+    <property name="sqlConfiguration">
+        <bean class="org.apache.ignite.configuration.SqlConfiguration">
+            <property name="queryEnginesConfiguration">
+                <list>
+                    <bean class="org.apache.ignite.indexing.IndexingQueryEngineConfiguration">
+                        <property name="default" value="true"/>
+                    </bean>
+                    <bean class="org.apache.ignite.calcite.CalciteQueryEngineConfiguration">
+                        <property name="default" value="false"/>
+                    </bean>
+                </list>
+            </property>
+        </bean>
+    </property>
+    ...
+</bean>
+
+
 Also, Calcite module libraries should be in a classpath.
 
 When starting a standalone node, move 'optional/ignite-calcite' folder to 'libs' folder before running
@@ -13,6 +42,35 @@ When starting a standalone node, move 'optional/ignite-calcite' folder to 'libs'
 Note: At now some logic from ignite-indexing module is reused, this means ignite-indexing module also
 has to be present at classpath.
 
+If more than one engine configured throught "queryEnginesConfiguration" it`s possible to use exact engine:
+1. JDBC:
+  By passing "queryEngine" param.
+  Connection url via JDBC with Calcite engine: jdbc:ignite:thin://127.0.0.1:10800?queryEngine=calcite
+  and with H2 engine: jdbc:ignite:thin://127.0.0.1:10800?queryEngine=h2
+
+2. ODBC, connection string samples:
+  [IGNITE_H2]
+  DRIVER=Apache Ignite
+  SERVER=127.0.0.1
+  PORT=11110
+  SCHEMA=PUBLIC
+  QUERY_ENGINE=H2
+
+  [IGNITE_CALCITE]
+  DRIVER=Apache Ignite
+  SERVER=127.0.0.1
+  PORT=11110
+  SCHEMA=PUBLIC
+  QUERY_ENGINE=CALCITE
+
+  More extended info can be found here https://ignite.apache.org/docs/latest//SQL/ODBC/connection-string-dsn
+
+3. From code or 3-rd party tools:
+  By using hints:
+    SELECT /*+ QUERY_ENGINE('h2') */ fld FROM table;
+    or
+    SELECT /*+ QUERY_ENGINE('calcite') */ fld FROM table;
+
 Importing Calcite Module In Maven Project
 ---------------------------------------