You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/03/01 14:34:14 UTC

[GitHub] [ignite] ivandasch opened a new pull request #9860: IGNITE-16631 ODBC: Add ability to set query engine

ivandasch opened a new pull request #9860:
URL: https://github.com/apache/ignite/pull/9860


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch merged pull request #9860: IGNITE-16631 ODBC: Add ability to set query engine

Posted by GitBox <gi...@apache.org>.
ivandasch merged pull request #9860:
URL: https://github.com/apache/ignite/pull/9860


   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #9860: IGNITE-16631 ODBC: Add ability to set query engine

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #9860:
URL: https://github.com/apache/ignite/pull/9860#discussion_r822905546



##########
File path: modules/platforms/cpp/odbc-test/src/cross_engine_test.cpp
##########
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#ifdef _WIN32
+#   include <windows.h>
+#endif
+
+#include <sql.h>
+
+#include <vector>
+#include <string>
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/odbc/engine_mode.h"
+#include "ignite/ignition.h"
+#include "ignite/impl/binary/binary_utils.h"
+
+#include "test_utils.h"
+#include "odbc_test_suite.h"
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::common;
+using namespace ignite_test;
+using namespace ignite::binary;
+using namespace ignite::impl::binary;
+using namespace ignite::impl::interop;
+using namespace ignite::odbc;
+
+using namespace boost::unit_test;
+
+struct CrossEngineTestSuiteFixture : public odbc::OdbcTestSuite
+{
+    CrossEngineTestSuiteFixture() : odbc::OdbcTestSuite()
+    {
+        grid = StartPlatformNode("queries-test.xml", "NodeMain");
+    }
+
+    template<EngineMode::Type EType>
+    void TestEngine() {
+        Connect(ConnectionString<EType>());
+
+        std::string currQryEngine = GetQueryEngine<EType>();
+
+        BOOST_CHECK_EQUAL(currQryEngine, EType != EngineMode::DEFAULT ? EngineMode::ToString(EType)
+                                                                      : EngineMode::ToString(EngineMode::H2));
+
+        InsertTestStrings(10, false);
+
+        // Batching is not supported for CALCITE
+        if (EType != EngineMode::CALCITE)
+            InsertTestBatch(11, 2000, 1989);
+    }
+
+    template<EngineMode::Type EType>
+    std::string ConnectionString() const {
+        std::ostringstream oss;
+
+        oss << "DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache;";
+
+        oss << "QUERY_ENGINE=" << EngineMode::ToString(EType);
+
+        return oss.str();
+    }
+
+    template<EngineMode::Type EType>
+    std::string GetQueryEngine() {
+        SQLRETURN ret = ExecQuery(EType == EngineMode::CALCITE ? "select query_engine()"
+                                                               : "select public.query_engine()");

Review comment:
       Unfortunately, this is the case of current implementation of this function in `sql-calcite` branch. 
   I suppose that this quirk should be a topic of other issue. WDYT? 




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ivandasch commented on a change in pull request #9860: IGNITE-16631 ODBC: Add ability to set query engine

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #9860:
URL: https://github.com/apache/ignite/pull/9860#discussion_r822906232



##########
File path: modules/platforms/cpp/odbc/src/config/configuration.cpp
##########
@@ -513,6 +529,14 @@ namespace ignite
                 if (value.IsSet())
                     map[key] = NestedTxMode::ToString(value.GetValue());
             }
+
+            template<>
+            void Configuration::AddToMap(ArgumentMap& map, const std::string& key,
+                                         const SettableValue<EngineMode::Type>& value)

Review comment:
       Could you remind what is the formatting rule for arguments? 




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9860: IGNITE-16631 ODBC: Add ability to set query engine

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9860:
URL: https://github.com/apache/ignite/pull/9860#discussion_r822894982



##########
File path: modules/platforms/cpp/odbc/src/message.cpp
##########
@@ -88,6 +88,16 @@ namespace ignite
 
             if (version >= ProtocolVersion::VERSION_2_7_0)
                 writer.WriteInt8(config.GetNestedTxMode());
+
+            if (version >= ProtocolVersion::VERSION_2_13_0)
+            {
+                EngineMode::Type mode = config.GetEngineMode();
+
+                if (mode == EngineMode::DEFAULT)
+                    writer.WriteString(0, 0);

Review comment:
       Maybe write null here?

##########
File path: modules/platforms/cpp/odbc-test/src/cross_engine_test.cpp
##########
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#ifdef _WIN32
+#   include <windows.h>
+#endif
+
+#include <sql.h>
+
+#include <vector>
+#include <string>
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/odbc/engine_mode.h"
+#include "ignite/ignition.h"
+#include "ignite/impl/binary/binary_utils.h"
+
+#include "test_utils.h"
+#include "odbc_test_suite.h"
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::common;
+using namespace ignite_test;
+using namespace ignite::binary;
+using namespace ignite::impl::binary;
+using namespace ignite::impl::interop;
+using namespace ignite::odbc;
+
+using namespace boost::unit_test;
+
+struct CrossEngineTestSuiteFixture : public odbc::OdbcTestSuite
+{
+    CrossEngineTestSuiteFixture() : odbc::OdbcTestSuite()
+    {
+        grid = StartPlatformNode("queries-test.xml", "NodeMain");
+    }
+
+    template<EngineMode::Type EType>
+    void TestEngine() {
+        Connect(ConnectionString<EType>());
+
+        std::string currQryEngine = GetQueryEngine<EType>();
+
+        BOOST_CHECK_EQUAL(currQryEngine, EType != EngineMode::DEFAULT ? EngineMode::ToString(EType)
+                                                                      : EngineMode::ToString(EngineMode::H2));
+
+        InsertTestStrings(10, false);
+
+        // Batching is not supported for CALCITE
+        if (EType != EngineMode::CALCITE)
+            InsertTestBatch(11, 2000, 1989);
+    }
+
+    template<EngineMode::Type EType>
+    std::string ConnectionString() const {
+        std::ostringstream oss;
+
+        oss << "DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache;";
+
+        oss << "QUERY_ENGINE=" << EngineMode::ToString(EType);
+
+        return oss.str();
+    }
+
+    template<EngineMode::Type EType>
+    std::string GetQueryEngine() {
+        SQLRETURN ret = ExecQuery(EType == EngineMode::CALCITE ? "select query_engine()"
+                                                               : "select public.query_engine()");

Review comment:
       Why for H2 there should be a schema? Should not this function be global?

##########
File path: modules/platforms/cpp/odbc/src/config/configuration.cpp
##########
@@ -513,6 +529,14 @@ namespace ignite
                 if (value.IsSet())
                     map[key] = NestedTxMode::ToString(value.GetValue());
             }
+
+            template<>
+            void Configuration::AddToMap(ArgumentMap& map, const std::string& key,
+                                         const SettableValue<EngineMode::Type>& value)

Review comment:
       Formatting

##########
File path: modules/platforms/cpp/odbc-test/src/cross_engine_test.cpp
##########
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+#ifdef _WIN32
+#   include <windows.h>
+#endif
+
+#include <sql.h>
+
+#include <vector>
+#include <string>
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/odbc/engine_mode.h"
+#include "ignite/ignition.h"
+#include "ignite/impl/binary/binary_utils.h"
+
+#include "test_utils.h"
+#include "odbc_test_suite.h"
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::common;
+using namespace ignite_test;
+using namespace ignite::binary;
+using namespace ignite::impl::binary;
+using namespace ignite::impl::interop;
+using namespace ignite::odbc;
+
+using namespace boost::unit_test;
+
+struct CrossEngineTestSuiteFixture : public odbc::OdbcTestSuite
+{
+    CrossEngineTestSuiteFixture() : odbc::OdbcTestSuite()
+    {
+        grid = StartPlatformNode("queries-test.xml", "NodeMain");
+    }
+
+    template<EngineMode::Type EType>
+    void TestEngine() {
+        Connect(ConnectionString<EType>());
+
+        std::string currQryEngine = GetQueryEngine<EType>();
+
+        BOOST_CHECK_EQUAL(currQryEngine, EType != EngineMode::DEFAULT ? EngineMode::ToString(EType)
+                                                                      : EngineMode::ToString(EngineMode::H2));
+
+        InsertTestStrings(10, false);
+
+        // Batching is not supported for CALCITE
+        if (EType != EngineMode::CALCITE)
+            InsertTestBatch(11, 2000, 1989);
+    }
+
+    template<EngineMode::Type EType>
+    std::string ConnectionString() const {
+        std::ostringstream oss;
+
+        oss << "DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache;";
+
+        oss << "QUERY_ENGINE=" << EngineMode::ToString(EType);
+
+        return oss.str();
+    }
+
+    template<EngineMode::Type EType>
+    std::string GetQueryEngine() {
+        SQLRETURN ret = ExecQuery(EType == EngineMode::CALCITE ? "select query_engine()"
+                                                               : "select public.query_engine()");
+
+        ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+        SQLCHAR strBuf[1024];
+        SQLLEN strLen;
+
+        SQLBindCol(stmt, 1, SQL_CHAR, strBuf, sizeof(strBuf), &strLen);
+
+        ret = SQLFetch(stmt);
+
+        if (!SQL_SUCCEEDED(ret))
+            BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+        ret = SQLFreeStmt(stmt, SQL_CLOSE);
+        ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_STMT, stmt);
+
+        return ToString(strBuf, strLen);

Review comment:
       `utility::SqlStringToString()`?




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org