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/09 17:29:51 UTC

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

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