25 #include "gen-cpp/calciteserver_types.h"
26 #include "gen-cpp/extension_functions_types.h"
36 using namespace apache::thrift::transport;
43 class CalciteServerClient;
45 namespace Catalog_Namespace {
49 namespace query_state {
58 class TFilterPushDownInfo;
60 class TCompletionHint;
66 const std::string& data_dir,
67 const size_t calcite_max_mem,
68 const size_t service_timeout,
69 const bool service_keepalive,
70 const std::string& udf_filename =
"");
72 const std::string& data_dir,
73 const std::string& udf_filename =
"");
77 std::string sql_string,
78 const TQueryParsingOption& query_parsing_option,
79 const TOptimizationOption& optimization_option,
80 const std::string& calcite_session_id =
"");
82 TPlanResult plan)
const;
83 std::vector<TCompletionHint> getCompletionHints(
85 const std::vector<std::string>& visible_tables,
86 const std::string sql_string,
88 std::string getExtensionFunctionWhitelist();
89 std::string getUserDefinedFunctionWhitelist();
90 virtual void updateMetadata(std::string catalog, std::string table);
91 void close_calcite_server(
bool log =
true);
93 std::string getRuntimeExtensionFunctionWhitelist();
94 void setRuntimeExtensionFunctions(
const std::vector<TUserDefinedFunction>& udfs,
95 const std::vector<TUserDefinedTableFunction>& udtfs,
96 bool isruntime =
true);
101 TQueryParsingOption getCalciteQueryParsingOption(
bool legacy_syntax,
103 bool check_privileges,
104 bool is_explain_detail);
105 TOptimizationOption getCalciteOptimizationOption(
106 bool is_view_optimize,
107 bool enable_watchdog,
108 const std::vector<TFilterPushDownInfo>& filter_push_down_info,
109 bool distributed_mode);
112 void init(
const int db_port,
114 const std::string& data_dir,
115 const size_t calcite_max_mem,
116 const std::string& udf_filename);
117 void runServer(
const int db_port,
119 const std::string& data_dir,
120 const size_t calcite_max_mem,
121 const std::string& udf_filename);
123 std::string sql_string,
124 const TQueryParsingOption& query_parsing_option,
125 const TOptimizationOption& optimization_option,
126 const std::string& calcite_session_id);
127 std::vector<std::string> get_db_objects(
const std::string ra);
128 void inner_close_calcite_server(
bool log);
129 std::pair<std::shared_ptr<CalciteServerClient>, std::shared_ptr<TTransport>> getClient(
132 int ping(
int retry_num = 0,
int max_retry = 50);
137 bool service_keepalive_ =
true;
138 int remote_calcite_port_ = -1;
std::string db_config_file_
std::once_flag shutdown_once_flag_
std::string ssl_key_file_
std::string ssl_keystore_
static std::string const getInternalSessionProxyUserName()
static std::string const getInternalSessionProxyPassword()
std::string ssl_keystore_password_
std::shared_ptr< ThriftClientConnection > connMgr_
std::string ssl_trust_store_
void init(LogOptions const &log_opts)
constexpr char const * kCalciteUserPassword
std::string ssl_trust_password_
constexpr char const * kCalciteUserName