OmniSciDB  04ee39c94c
Calcite.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * File: Calcite.cpp
19  * Author: michael
20  *
21  * Created on November 23, 2015, 9:33 AM
22  */
23 
24 #include "Calcite.h"
25 #include <thread>
26 #include <utility>
27 #include "Catalog/Catalog.h"
28 #include "Shared/ConfigResolve.h"
29 #include "Shared/Logger.h"
30 #include "Shared/ThriftClient.h"
31 #include "Shared/mapd_shared_ptr.h"
32 #include "Shared/mapdpath.h"
33 #include "Shared/measure.h"
34 
35 #include "Shared/fixautotools.h"
36 
37 #include <thrift/protocol/TBinaryProtocol.h>
38 #include <thrift/transport/TSocket.h>
39 #include <thrift/transport/TTransportUtils.h>
40 
41 #include "Shared/fixautotools.h"
42 
43 #include "gen-cpp/CalciteServer.h"
44 
45 using namespace rapidjson;
46 using namespace apache::thrift;
47 using namespace apache::thrift::protocol;
48 using namespace apache::thrift::transport;
49 
50 namespace {
51 template <typename XDEBUG_OPTION,
52  typename REMOTE_DEBUG_OPTION,
53  typename... REMAINING_ARGS>
54 int wrapped_execlp(char const* path,
55  XDEBUG_OPTION&& x_debug,
56  REMOTE_DEBUG_OPTION&& remote_debug,
57  REMAINING_ARGS&&... standard_args) {
58  if (std::is_same<JVMRemoteDebugSelector, PreprocessorTrue>::value) {
59  return execlp(
60  path, x_debug, remote_debug, std::forward<REMAINING_ARGS>(standard_args)...);
61  }
62  return execlp(path, std::forward<REMAINING_ARGS>(standard_args)...);
63 }
64 } // namespace
65 
66 static void start_calcite_server_as_daemon(const int mapd_port,
67  const int port,
68  const std::string& data_dir,
69  const size_t calcite_max_mem,
70  const std::string& ssl_trust_store,
71  const std::string& ssl_trust_password,
72  const std::string& ssl_keystore,
73  const std::string& ssl_keystore_password,
74  const std::string& ssl_key_file,
75  const std::string& ssl_cert_file,
76  const std::string& udf_filename) {
77  std::string const xDebug = "-Xdebug";
78  std::string const remoteDebug =
79  "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005";
80  std::string xmxP = "-Xmx" + std::to_string(calcite_max_mem) + "m";
81  std::string jarP = "-jar";
82  std::string jarD =
83  mapd_root_abs_path() + "/bin/calcite-1.0-SNAPSHOT-jar-with-dependencies.jar";
84  std::string extensionsP = "-e";
85  std::string extensionsD = mapd_root_abs_path() + "/QueryEngine/";
86  std::string dataP = "-d";
87  std::string dataD = data_dir;
88  std::string localPortP = "-p";
89  std::string localPortD = std::to_string(port);
90  std::string mapdPortP = "-m";
91  std::string mapdPortD = std::to_string(mapd_port);
92  std::string mapdTrustStoreP = "-T";
93  std::string mapdTrustPasswdP = "-P";
94  std::string mapdKeyStoreP = "-Y";
95  std::string mapdKeyStorePasswdP = "-Z";
96  std::string mapdLogDirectory = "-DMAPD_LOG_DIR=" + data_dir;
97  std::string userDefinedFunctionsP = "";
98  std::string userDefinedFunctionsD = "";
99 
100  if (!udf_filename.empty()) {
101  userDefinedFunctionsP += "-u";
102  userDefinedFunctionsD += udf_filename;
103  }
104 
105  int pid = fork();
106  if (pid == 0) {
107  int i;
108 
109  if (udf_filename.empty()) {
110  i = wrapped_execlp("java",
111  xDebug.c_str(),
112  remoteDebug.c_str(),
113  xmxP.c_str(),
114  mapdLogDirectory.c_str(),
115  jarP.c_str(),
116  jarD.c_str(),
117  extensionsP.c_str(),
118  extensionsD.c_str(),
119  dataP.c_str(),
120  dataD.c_str(),
121  localPortP.c_str(),
122  localPortD.c_str(),
123  mapdPortP.c_str(),
124  mapdPortD.c_str(),
125  mapdTrustStoreP.c_str(),
126  ssl_trust_store.c_str(),
127  mapdTrustPasswdP.c_str(),
128  ssl_trust_password.c_str(),
129  mapdKeyStoreP.c_str(),
130  ssl_keystore.c_str(),
131  mapdKeyStorePasswdP.c_str(),
132  ssl_keystore_password.c_str(),
133  (char*)0);
134  } else {
135  i = wrapped_execlp("java",
136  xDebug.c_str(),
137  remoteDebug.c_str(),
138  xmxP.c_str(),
139  mapdLogDirectory.c_str(),
140  jarP.c_str(),
141  jarD.c_str(),
142  extensionsP.c_str(),
143  extensionsD.c_str(),
144  dataP.c_str(),
145  dataD.c_str(),
146  localPortP.c_str(),
147  localPortD.c_str(),
148  mapdPortP.c_str(),
149  mapdPortD.c_str(),
150  mapdTrustStoreP.c_str(),
151  ssl_trust_store.c_str(),
152  mapdTrustPasswdP.c_str(),
153  ssl_trust_password.c_str(),
154  mapdKeyStoreP.c_str(),
155  ssl_keystore.c_str(),
156  mapdKeyStorePasswdP.c_str(),
157  ssl_keystore_password.c_str(),
158  userDefinedFunctionsP.c_str(),
159  userDefinedFunctionsD.c_str(),
160  (char*)0);
161  }
162 
163  if (i) {
164  int errsv = errno;
165  LOG(FATAL) << "Failed to start Calcite server [errno=" << errsv
166  << "]: " << strerror(errsv);
167  } else {
168  LOG(INFO) << "Successfully started Calcite server";
169  }
170  }
171 }
172 
173 std::pair<mapd::shared_ptr<CalciteServerClient>, mapd::shared_ptr<TTransport>>
175  const auto transport = connMgr_->open_buffered_client_transport(
176  "localhost", port, ssl_cert_file_, true, 2000, 5000, 5000);
177 
178  try {
179  transport->open();
180 
181  } catch (TException& tx) {
182  throw tx;
183  } catch (std::exception& ex) {
184  throw ex;
185  }
186  mapd::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
187  mapd::shared_ptr<CalciteServerClient> client;
188  client.reset(new CalciteServerClient(protocol));
189  std::pair<mapd::shared_ptr<CalciteServerClient>, mapd::shared_ptr<TTransport>> ret;
190  return std::make_pair(client, transport);
191 }
192 
193 void Calcite::runServer(const int mapd_port,
194  const int port,
195  const std::string& data_dir,
196  const size_t calcite_max_mem,
197  const std::string& udf_filename) {
198  LOG(INFO) << "Running calcite server as a daemon";
199 
200  // ping server to see if for any reason there is an orphaned one
201  int ping_time = ping();
202  if (ping_time > -1) {
203  // we have an orphaned server shut it down
204  LOG(ERROR)
205  << "Appears to be orphaned Calcite serve already running, shutting it down";
206  LOG(ERROR) << "Please check that you are not trying to run two servers on same port";
207  LOG(ERROR) << "Attempting to shutdown orphaned Calcite server";
208  try {
209  auto clientP = getClient(remote_calcite_port_);
210  clientP.first->shutdown();
211  clientP.second->close();
212  LOG(ERROR) << "orphaned Calcite server shutdown";
213 
214  } catch (TException& tx) {
215  LOG(ERROR) << "Failed to shutdown orphaned Calcite server, reason: " << tx.what();
216  }
217  }
218 
219  // start the calcite server as a seperate process
221  port,
222  data_dir,
223  calcite_max_mem,
224  ssl_trust_store_,
225  ssl_trust_password_,
226  ssl_keystore_,
227  ssl_keystore_password_,
228  ssl_key_file_,
229  ssl_cert_file_,
230  udf_filename);
231 
232  // check for new server for 5 seconds max
233  std::this_thread::sleep_for(std::chrono::milliseconds(200));
234  for (int i = 2; i < 50; i++) {
235  int ping_time = ping();
236  if (ping_time > -1) {
237  LOG(INFO) << "Calcite server start took " << i * 100 << " ms ";
238  LOG(INFO) << "ping took " << ping_time << " ms ";
239  server_available_ = true;
240  return;
241  } else {
242  // wait 100 ms
243  std::this_thread::sleep_for(std::chrono::milliseconds(100));
244  }
245  }
246  server_available_ = false;
247  LOG(FATAL) << "Could not connect to calcite remote server running on port " << port;
248 }
249 
250 // ping existing server
251 // return -1 if no ping response
253  try {
254  auto ms = measure<>::execution([&]() {
255  auto clientP = getClient(remote_calcite_port_);
256  clientP.first->ping();
257  clientP.second->close();
258  });
259  return ms;
260 
261  } catch (TException& tx) {
262  return -1;
263  }
264 }
265 
266 Calcite::Calcite(const int mapd_port,
267  const int calcite_port,
268  const std::string& data_dir,
269  const size_t calcite_max_mem,
270  const std::string& session_prefix,
271  const std::string& udf_filename)
272  : server_available_(false), session_prefix_(session_prefix) {
273  init(mapd_port, calcite_port, data_dir, calcite_max_mem, udf_filename);
274 }
275 
276 void Calcite::init(const int mapd_port,
277  const int calcite_port,
278  const std::string& data_dir,
279  const size_t calcite_max_mem,
280  const std::string& udf_filename) {
281  LOG(INFO) << "Creating Calcite Handler, Calcite Port is " << calcite_port
282  << " base data dir is " << data_dir;
283  connMgr_ = std::make_shared<ThriftClientConnection>();
284  if (calcite_port < 0) {
285  CHECK(false) << "JNI mode no longer supported.";
286  }
287  if (calcite_port == 0) {
288  // dummy process for initdb
289  remote_calcite_port_ = calcite_port;
290  server_available_ = false;
291  } else {
292  remote_calcite_port_ = calcite_port;
293  runServer(mapd_port, calcite_port, data_dir, calcite_max_mem, udf_filename);
294  server_available_ = true;
295  }
296 }
297 
298 Calcite::Calcite(const MapDParameters& mapd_parameter,
299  const std::string& data_dir,
300  const std::string& session_prefix,
301  const std::string& udf_filename)
302  : ssl_trust_store_(mapd_parameter.ssl_trust_store)
303  , ssl_trust_password_(mapd_parameter.ssl_trust_password)
304  , ssl_key_file_(mapd_parameter.ssl_key_file)
305  , ssl_keystore_(mapd_parameter.ssl_keystore)
306  , ssl_keystore_password_(mapd_parameter.ssl_keystore_password)
307  , ssl_cert_file_(mapd_parameter.ssl_cert_file)
308  , session_prefix_(session_prefix) {
309  init(mapd_parameter.omnisci_server_port,
310  mapd_parameter.calcite_port,
311  data_dir,
312  mapd_parameter.calcite_max_mem,
313  udf_filename);
314 }
315 
316 void Calcite::updateMetadata(std::string catalog, std::string table) {
317  if (server_available_) {
318  auto ms = measure<>::execution([&]() {
319  auto clientP = getClient(remote_calcite_port_);
320  clientP.first->updateMetadata(catalog, table);
321  clientP.second->close();
322  });
323  LOG(INFO) << "Time to updateMetadata " << ms << " (ms)";
324  } else {
325  LOG(INFO) << "Not routing to Calcite, server is not up";
326  }
327 }
328 
330  std::vector<std::string> tableOrViewNames,
331  AccessPrivileges tablePrivs,
332  AccessPrivileges viewPrivs) {
333  Catalog_Namespace::Catalog& catalog = session_info.getCatalog();
334 
335  for (auto tableOrViewName : tableOrViewNames) {
336  const TableDescriptor* tableMeta =
337  catalog.getMetadataForTable(tableOrViewName, false);
338 
339  if (!tableMeta) {
340  throw std::runtime_error("unknown table of view: " + tableOrViewName);
341  }
342 
343  DBObjectKey key;
344  key.dbId = catalog.getCurrentDB().dbId;
347  key.objectId = tableMeta->tableId;
348  AccessPrivileges privs = tableMeta->isView ? viewPrivs : tablePrivs;
349  DBObject dbobject(key, privs, tableMeta->userId);
350  std::vector<DBObject> privObjects{dbobject};
351 
352  if (!privs.hasAny()) {
353  throw std::runtime_error("Operation not supported for object " + tableOrViewName);
354  }
355 
356  if (!Catalog_Namespace::SysCatalog::instance().checkPrivileges(
357  session_info.get_currentUser(), privObjects)) {
358  throw std::runtime_error("Violation of access privileges: user " +
359  session_info.get_currentUser().userName +
360  " has no proper privileges for object " + tableOrViewName);
361  }
362  }
363 }
364 
365 TPlanResult Calcite::process(
366  const Catalog_Namespace::SessionInfo& session_info,
367  const std::string sql_string,
368  const std::vector<TFilterPushDownInfo>& filter_push_down_info,
369  const bool legacy_syntax,
370  const bool is_explain,
371  const bool is_view_optimize) {
372  TPlanResult result = processImpl(session_info,
373  sql_string,
374  filter_push_down_info,
375  legacy_syntax,
376  is_explain,
377  is_view_optimize);
378 
379  AccessPrivileges NOOP;
380 
381  if (!is_explain) {
382  // check the individual tables
383  checkPermissionForTables(session_info,
384  result.primary_accessed_objects.tables_selected_from,
387  checkPermissionForTables(session_info,
388  result.primary_accessed_objects.tables_inserted_into,
390  NOOP);
391  checkPermissionForTables(session_info,
392  result.primary_accessed_objects.tables_updated_in,
394  NOOP);
395  checkPermissionForTables(session_info,
396  result.primary_accessed_objects.tables_deleted_from,
398  NOOP);
399  }
400 
401  return result;
402 }
403 
404 std::vector<TCompletionHint> Calcite::getCompletionHints(
405  const Catalog_Namespace::SessionInfo& session_info,
406  const std::vector<std::string>& visible_tables,
407  const std::string sql_string,
408  const int cursor) {
409  std::vector<TCompletionHint> hints;
410  auto& cat = session_info.getCatalog();
411  const auto user = session_info.get_currentUser().userName;
412  const auto session = session_info.get_session_id();
413  const auto catalog = cat.getCurrentDB().dbName;
415  client.first->getCompletionHints(
416  hints, user, session, catalog, visible_tables, sql_string, cursor);
417  return hints;
418 }
419 
420 std::vector<std::string> Calcite::get_db_objects(const std::string ra) {
421  std::vector<std::string> v_db_obj;
422  Document document;
423  document.Parse(ra.c_str());
424  const Value& rels = document["rels"];
425  CHECK(rels.IsArray());
426  for (auto& v : rels.GetArray()) {
427  std::string relOp(v["relOp"].GetString());
428  if (!relOp.compare("EnumerableTableScan")) {
429  std::string x;
430  auto t = v["table"].GetArray();
431  x = t[1].GetString();
432  v_db_obj.push_back(x);
433  }
434  }
435 
436  return v_db_obj;
437 }
438 
440  const Catalog_Namespace::SessionInfo& session_info,
441  const std::string sql_string,
442  const std::vector<TFilterPushDownInfo>& filter_push_down_info,
443  const bool legacy_syntax,
444  const bool is_explain,
445  const bool is_view_optimize) {
446  auto& cat = session_info.getCatalog();
447  std::string user = session_info.get_currentUser().userName;
448  std::string session = session_info.get_session_id();
449  if (!session_prefix_.empty()) {
450  // preprend session prefix, if present
451  session = session_prefix_ + "/" + session;
452  }
453  std::string catalog = cat.getCurrentDB().dbName;
454 
455  LOG(INFO) << "User " << user << " catalog " << catalog << " sql '" << sql_string << "'";
456  LOG(IR) << "SQL query\n" << sql_string << "\nEnd of SQL query";
457  LOG(PTX) << "SQL query\n" << sql_string << "\nEnd of SQL query";
458 
459  TPlanResult ret;
460  if (server_available_) {
461  try {
462  auto ms = measure<>::execution([&]() {
463  auto clientP = getClient(remote_calcite_port_);
464  clientP.first->process(ret,
465  user,
466  session,
467  catalog,
468  sql_string,
469  filter_push_down_info,
470  legacy_syntax,
471  is_explain,
472  is_view_optimize);
473  clientP.second->close();
474  });
475 
476  // LOG(INFO) << ret.plan_result;
477  LOG(INFO) << "Time in Thrift "
478  << (ms > ret.execution_time_ms ? ms - ret.execution_time_ms : 0)
479  << " (ms), Time in Java Calcite server " << ret.execution_time_ms
480  << " (ms)";
481  } catch (InvalidParseRequest& e) {
482  throw std::invalid_argument(e.whyUp);
483  } catch (const std::exception& ex) {
484  LOG(FATAL)
485  << "Error occurred trying to communicate with calcite server, the error was: '"
486  << ex.what() << "', omnisci_server restart will be required";
487  return ret; // satisfy return-type warning
488  }
489  } else {
490  LOG(INFO) << "Not routing to Calcite, server is not up";
491  ret.plan_result = "";
492  }
493  return ret;
494 }
495 
497  if (server_available_) {
498  TPlanResult ret;
499  std::string whitelist;
500 
501  auto clientP = getClient(remote_calcite_port_);
502  clientP.first->getExtensionFunctionWhitelist(whitelist);
503  clientP.second->close();
504  VLOG(1) << whitelist;
505  return whitelist;
506  } else {
507  LOG(FATAL) << "Not routing to Calcite, server is not up";
508  return "";
509  }
510  CHECK(false);
511  return "";
512 }
513 
515  if (server_available_) {
516  TPlanResult ret;
517  std::string whitelist;
518 
519  auto clientP = getClient(remote_calcite_port_);
520  clientP.first->getUserDefinedFunctionWhitelist(whitelist);
521  clientP.second->close();
522  VLOG(1) << "User defined functions whitelist loaded from Calcite: " << whitelist;
523  return whitelist;
524  } else {
525  LOG(FATAL) << "Not routing to Calcite, server is not up";
526  return "";
527  }
528  UNREACHABLE();
529  return "";
530 }
531 
533  std::call_once(shutdown_once_flag_,
534  [this, log]() { this->inner_close_calcite_server(log); });
535 }
536 
538  if (server_available_) {
539  LOG_IF(INFO, log) << "Shutting down Calcite server";
540  try {
541  auto clientP = getClient(remote_calcite_port_);
542  clientP.first->shutdown();
543  clientP.second->close();
544  } catch (const std::exception& e) {
545  if (std::string(e.what()) != "connect() failed: Connection refused" &&
546  std::string(e.what()) != "No more data to read.") {
547  std::cerr << "Error shutting down Calcite server: " << e.what() << std::endl;
548  } // else Calcite already shut down
549  }
550  LOG_IF(INFO, log) << "shut down Calcite";
551  server_available_ = false;
552  }
553 }
554 
556  close_calcite_server(false);
557 }
558 
560  if (server_available_) {
561  TPlanResult ret;
562  std::string whitelist;
563  auto clientP = getClient(remote_calcite_port_);
564  clientP.first->getRuntimeUserDefinedFunctionWhitelist(whitelist);
565  clientP.second->close();
566  VLOG(1) << "Runtime user defined functions whitelist loaded from Calcite: "
567  << whitelist;
568  return whitelist;
569  } else {
570  LOG(FATAL) << "Not routing to Calcite, server is not up";
571  return "";
572  }
573  UNREACHABLE();
574  return "";
575 }
576 
577 void Calcite::setRuntimeUserDefinedFunction(std::string udf_string) {
578  if (server_available_) {
579  auto clientP = getClient(remote_calcite_port_);
580  clientP.first->setRuntimeUserDefinedFunction(udf_string);
581  clientP.second->close();
582  } else {
583  LOG(FATAL) << "Not routing to Calcite, server is not up";
584  }
585 }
std::vector< std::string > get_db_objects(const std::string ra)
Definition: Calcite.cpp:420
std::once_flag shutdown_once_flag_
Definition: Calcite.h:124
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:81
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
std::string ssl_key_file_
Definition: Calcite.h:119
#define LOG(tag)
Definition: Logger.h:182
std::string ssl_keystore_
Definition: Calcite.h:120
mapd::shared_ptr< ThriftClientConnection > connMgr_
Definition: Calcite.h:114
std::string mapd_root_abs_path()
Definition: mapdpath.h:30
static const AccessPrivileges INSERT_INTO_TABLE
Definition: DBObject.h:154
std::string ssl_keystore_password_
Definition: Calcite.h:121
#define UNREACHABLE()
Definition: Logger.h:231
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:93
int32_t objectId
Definition: DBObject.h:56
std::string get_session_id() const
Definition: SessionInfo.h:98
static const AccessPrivileges SELECT_FROM_TABLE
Definition: DBObject.h:153
std::string ssl_trust_store_
Definition: Calcite.h:117
std::string to_string(char const *&&v)
#define LOG_IF(severity, condition)
Definition: Logger.h:273
void updateMetadata(std::string catalog, std::string table)
Definition: Calcite.cpp:316
static void start_calcite_server_as_daemon(const int mapd_port, const int port, const std::string &data_dir, const size_t calcite_max_mem, const std::string &ssl_trust_store, const std::string &ssl_trust_password, const std::string &ssl_keystore, const std::string &ssl_keystore_password, const std::string &ssl_key_file, const std::string &ssl_cert_file, const std::string &udf_filename)
Definition: Calcite.cpp:66
int ping()
Definition: Calcite.cpp:252
This file contains the class specification and related data structures for Catalog.
bool hasAny() const
Definition: DBObject.h:133
static SysCatalog & instance()
Definition: SysCatalog.h:240
T v(const TargetValue &r)
int wrapped_execlp(char const *path, XDEBUG_OPTION &&x_debug, REMOTE_DEBUG_OPTION &&remote_debug, REMAINING_ARGS &&... standard_args)
Definition: Calcite.cpp:54
std::vector< TCompletionHint > getCompletionHints(const Catalog_Namespace::SessionInfo &session_info, const std::vector< std::string > &visible_tables, const std::string sql_string, const int cursor)
Definition: Calcite.cpp:404
mapd::shared_ptr< MapDClient > client
Catalog & getCatalog() const
Definition: SessionInfo.h:90
TPlanResult processImpl(const Catalog_Namespace::SessionInfo &session_info, const std::string sql_string, const std::vector< TFilterPushDownInfo > &filter_push_down_info, const bool legacy_syntax, const bool is_explain, const bool is_view_optimize)
Definition: Calcite.cpp:439
TPlanResult process(const Catalog_Namespace::SessionInfo &session_info, const std::string sql_string, const std::vector< TFilterPushDownInfo > &filter_push_down_info, const bool legacy_syntax, const bool is_explain, const bool is_view_optimize)
Definition: Calcite.cpp:365
static const AccessPrivileges DELETE_FROM_TABLE
Definition: DBObject.h:156
void setRuntimeUserDefinedFunction(std::string udf_string)
Definition: Calcite.cpp:577
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:176
std::string session_prefix_
Definition: Calcite.h:123
std::string getUserDefinedFunctionWhitelist()
Definition: Calcite.cpp:514
size_t calcite_max_mem
Calcite(const int mapd_port, const int port, const std::string &data_dir, const size_t calcite_max_mem, const std::string &udf_filename="")
Definition: Calcite.h:53
static const AccessPrivileges SELECT_FROM_VIEW
Definition: DBObject.h:173
int remote_calcite_port_
Definition: Calcite.h:116
int32_t dbId
Definition: DBObject.h:55
void inner_close_calcite_server(bool log)
Definition: Calcite.cpp:537
std::string ssl_cert_file_
Definition: Calcite.h:122
bool server_available_
Definition: Calcite.h:115
#define CHECK(condition)
Definition: Logger.h:187
std::string getRuntimeUserDefinedFunctionWhitelist()
Definition: Calcite.cpp:559
static TimeT::rep execution(F func, Args &&... args)
Definition: sample.cpp:29
int32_t permissionType
Definition: DBObject.h:54
void runServer(const int mapd_port, const int port, const std::string &data_dir, const size_t calcite_max_mem, const std::string &udf_filename)
Definition: Calcite.cpp:193
specifies the content in-memory of a row in the table metadata table
void init(const int mapd_port, const int port, const std::string &data_dir, const size_t calcite_max_mem, const std::string &udf_filename)
Definition: Calcite.cpp:276
static const AccessPrivileges UPDATE_IN_TABLE
Definition: DBObject.h:155
std::string ssl_trust_password_
Definition: Calcite.h:118
TSessionId session
virtual ~Calcite()
Definition: Calcite.cpp:555
std::string getExtensionFunctionWhitelist()
Definition: Calcite.cpp:496
std::pair< mapd::shared_ptr< CalciteServerClient >, mapd::shared_ptr< TTransport > > getClient(int port)
Definition: Calcite.cpp:174
void checkPermissionForTables(const Catalog_Namespace::SessionInfo &session_info, std::vector< std::string > tableOrViewNames, AccessPrivileges tablePrivs, AccessPrivileges viewPrivs)
Definition: Calcite.cpp:329
#define VLOG(n)
Definition: Logger.h:277
void close_calcite_server(bool log=true)
Definition: Calcite.cpp:532