OmniSciDB  04ee39c94c
CalciteOptimizeTest.cpp File Reference
#include <gtest/gtest.h>
#include <boost/filesystem/operations.hpp>
#include <csignal>
#include <thread>
#include <tuple>
#include "../Catalog/Catalog.h"
#include "../Catalog/DBObject.h"
#include "../DataMgr/DataMgr.h"
#include "../Parser/parser.h"
#include "../QueryRunner/QueryRunner.h"
#include "Shared/MapDParameters.h"
#include "TestHelpers.h"
#include "gen-cpp/CalciteServer.h"
+ Include dependency graph for CalciteOptimizeTest.cpp:

Go to the source code of this file.

Classes

struct  ViewObject
 

Namespaces

 anonymous_namespace{CalciteOptimizeTest.cpp}
 

Typedefs

using QR = QueryRunner::QueryRunner
 

Functions

void anonymous_namespace{CalciteOptimizeTest.cpp}::run_ddl_statement (const std::string &query)
 
 TEST_F (ViewObject, BasicTest)
 
int main (int argc, char *argv[])
 

Variables

std::shared_ptr< Calciteanonymous_namespace{CalciteOptimizeTest.cpp}::g_calcite
 

Typedef Documentation

◆ QR

Definition at line 15 of file CalciteOptimizeTest.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 92 of file CalciteOptimizeTest.cpp.

References BASE_PATH, logger::ERROR, anonymous_namespace{CalciteOptimizeTest.cpp}::g_calcite, QueryRunner::QueryRunner::get(), QueryRunner::QueryRunner::getCatalog(), QueryRunner::QueryRunner::init(), TestHelpers::init_logger_stderr_only(), LOG, and QueryRunner::QueryRunner::reset().

92  {
94  testing::InitGoogleTest(&argc, argv);
95 
97  g_calcite = QR::get()->getCatalog()->getCalciteMgr();
98 
99  int err{0};
100  try {
101  err = RUN_ALL_TESTS();
102  } catch (const std::exception& e) {
103  LOG(ERROR) << e.what();
104  }
105  QR::reset();
106  return err;
107 }
#define LOG(tag)
Definition: Logger.h:182
static QueryRunner * init(const char *db_path, const std::string &udf_filename="", const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20)
Definition: QueryRunner.h:70
std::shared_ptr< Catalog_Namespace::Catalog > getCatalog() const
static QueryRunner * get()
Definition: QueryRunner.h:115
void init_logger_stderr_only(int argc, char const *const *argv)
Definition: TestHelpers.h:194
#define BASE_PATH
+ Here is the call graph for this function:

◆ TEST_F()

TEST_F ( ViewObject  ,
BasicTest   
)

Definition at line 56 of file CalciteOptimizeTest.cpp.

References CHECK, anonymous_namespace{CalciteOptimizeTest.cpp}::g_calcite, QueryRunner::QueryRunner::get(), QueryRunner::QueryRunner::getSession(), and session.

56  {
57  auto session = QR::get()->getSession();
58  CHECK(session);
59 
60  TPlanResult tresult =
61  g_calcite->process(*session, "select i1 from table1", {}, true, false, false);
62 
63  TPlanResult vresult = g_calcite->process(
64  *session, "select i1 from view_view_table1", {}, true, false, false);
65 
66  EXPECT_EQ(vresult.plan_result, tresult.plan_result);
67 
68  TPlanResult ovresult = g_calcite->process(
69  *session, "select i1 from view_view_table1", {}, true, false, true);
70 
71  EXPECT_EQ(ovresult.plan_result, tresult.plan_result);
72 
73  TPlanResult tab_result = g_calcite->process(
74  *session,
75  "SELECT shape_table.rowid FROM shape_table, attribute_table WHERE "
76  "shape_table.block_group_id = attribute_table.block_group_id",
77  {},
78  true,
79  false,
80  true);
81  TPlanResult view_result =
82  g_calcite->process(*session,
83  "SELECT shape_view.rowid FROM shape_view, attribute_view WHERE "
84  "shape_view.block_group_id = attribute_view.block_group_id",
85  {},
86  true,
87  false,
88  true);
89  EXPECT_EQ(tab_result.plan_result, view_result.plan_result);
90 }
static QueryRunner * get()
Definition: QueryRunner.h:115
#define CHECK(condition)
Definition: Logger.h:187
TSessionId session
Catalog_Namespace::SessionInfo * getSession() const
Definition: QueryRunner.h:124
+ Here is the call graph for this function: