Skip to content

Commit

Permalink
thrift: rename service to OmniSci from MapD
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseidl committed Apr 7, 2020
1 parent 2526787 commit 541d2ad
Show file tree
Hide file tree
Showing 32 changed files with 93 additions and 93 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ add_custom_command(
DEPENDS ${CMAKE_SOURCE_DIR}/QueryEngine/serialized_result_set.thrift
DEPENDS ${CMAKE_SOURCE_DIR}/QueryEngine/extension_functions.thrift
OUTPUT
${CMAKE_BINARY_DIR}/gen-cpp/MapD.cpp
${CMAKE_BINARY_DIR}/gen-cpp/MapD.h
${CMAKE_BINARY_DIR}/gen-cpp/mapd_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/mapd_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/OmniSci.cpp
${CMAKE_BINARY_DIR}/gen-cpp/OmniSci.h
${CMAKE_BINARY_DIR}/gen-cpp/omnisci_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/omnisci_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/completion_hints_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/completion_hints_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/serialized_result_set_constants.cpp
Expand All @@ -421,10 +421,10 @@ add_custom_command(
list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/gen-cpp/)

add_library(mapd_thrift
${CMAKE_BINARY_DIR}/gen-cpp/MapD.cpp
${CMAKE_BINARY_DIR}/gen-cpp/MapD.h
${CMAKE_BINARY_DIR}/gen-cpp/mapd_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/mapd_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/OmniSci.cpp
${CMAKE_BINARY_DIR}/gen-cpp/OmniSci.h
${CMAKE_BINARY_DIR}/gen-cpp/omnisci_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/omnisci_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/completion_hints_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/completion_hints_types.cpp
${CMAKE_BINARY_DIR}/gen-cpp/serialized_result_set_constants.cpp
Expand Down
4 changes: 2 additions & 2 deletions Catalog/DdlCommandExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include "rapidjson/document.h"

#include "Catalog/SessionInfo.h"
#include "gen-cpp/mapd_types.h"
#include "gen-cpp/omnisci_types.h"

#include "Catalog/ColumnDescriptor.h"
#include "Catalog/SessionInfo.h"
#include "Catalog/TableDescriptor.h"
#include "Utils/DdlUtils.h"
#include "gen-cpp/mapd_types.h"
#include "gen-cpp/omnisci_types.h"

class DdlCommand {
public:
Expand Down
2 changes: 1 addition & 1 deletion Distributed/os/LeafAggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "LeafHostInfo.h"
#include "QueryEngine/CompilationOptions.h"
#include "QueryEngine/TargetMetaInfo.h"
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

#include "Shared/Logger.h"

Expand Down
2 changes: 1 addition & 1 deletion Import/Importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#include "Shared/thread_count.h"
#include "Utils/ChunkAccessorTable.h"

#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

size_t g_archive_read_buf_size = 1 << 20;

Expand Down
2 changes: 1 addition & 1 deletion Import/RowToColumnLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ RowToColumnLoader::~RowToColumnLoader() {
}

void RowToColumnLoader::createConnection(const ThriftClientConnection& con) {
client_.reset(new MapDClient(conn_details_.get_protocol()));
client_.reset(new OmniSciClient(conn_details_.get_protocol()));

try {
client_->connect(session_, user_name_, passwd_, db_name_);
Expand Down
6 changes: 3 additions & 3 deletions Import/RowToColumnLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
#include <thrift/transport/THttpClient.h>
#include <thrift/transport/TSocket.h>
#include "CopyParams.h"
#include "gen-cpp/MapD.h"
#include "gen-cpp/mapd_types.h"
#include "gen-cpp/OmniSci.h"
#include "gen-cpp/omnisci_types.h"

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
Expand Down Expand Up @@ -87,7 +87,7 @@ class RowToColumnLoader {

TRowDescriptor row_desc_;

mapd::shared_ptr<MapDClient> client_;
mapd::shared_ptr<OmniSciClient> client_;
TSessionId session_;

void createConnection(const ThriftClientConnection& con);
Expand Down
2 changes: 1 addition & 1 deletion SQLFrontend/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "MetaClientContext.h"

using ClientContext = MetaClientContext<MapDClient&, TTransport&>;
using ClientContext = MetaClientContext<OmniSciClient&, TTransport&>;

#endif
2 changes: 1 addition & 1 deletion SQLFrontend/CommandFunctors.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "CommandResolutionChain.h"
#include "ThriftOps.h"

#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

#include "ClientContext.h" // Provides us with default class
#include "RegexSupport.h"
Expand Down
2 changes: 1 addition & 1 deletion SQLFrontend/MetaClientContext.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef METACLIENTCONTEXT_H
#define METACLIENTCONTEXT_H

#include "gen-cpp/mapd_types.h"
#include "gen-cpp/omnisci_types.h"

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
Expand Down
2 changes: 1 addition & 1 deletion SQLFrontend/ThriftWithRetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <cmath>
#include <iostream>
#include "gen-cpp/mapd_types.h"
#include "gen-cpp/omnisci_types.h"

template <typename SERVICE_ENUM, typename CLIENT_CONTEXT>
bool thrift_with_retry(SERVICE_ENUM which_service,
Expand Down
6 changes: 3 additions & 3 deletions SQLFrontend/omnisql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include "Shared/base64.h"
#include "Shared/checked_alloc.h"
#include "Shared/mapd_shared_ptr.h"
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

#include "linenoise.h"

Expand Down Expand Up @@ -607,7 +607,7 @@ bool backchannel(int action, ClientContext* cc, const std::string& ccn = "") {
context->server_host, context->port, ca_cert_name);
protocol2 = mapd::shared_ptr<TProtocol>(new TBinaryProtocol(transport2));
}
MapDClient c2(protocol2);
OmniSciClient c2(protocol2);
ClientContext context2(*transport2, c2);

context2.db_name = context->db_name;
Expand Down Expand Up @@ -1225,7 +1225,7 @@ int main(int argc, char** argv) {
transport = connMgr->open_buffered_client_transport(server_host, port, ca_cert_name);
protocol = mapd::shared_ptr<TProtocol>(new TBinaryProtocol(transport));
}
MapDClient c(protocol);
OmniSciClient c(protocol);
ClientContext context(*transport, c);
g_client_context_ptr = &context;

Expand Down
12 changes: 6 additions & 6 deletions SampleCode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ add_custom_command(
DEPENDS ${CMAKE_SOURCE_DIR}/omnisci.thrift ${CMAKE_SOURCE_DIR}/completion_hints.thrift
DEPENDS ${CMAKE_SOURCE_DIR}/QueryEngine/extension_functions.thrift
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/MapD.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/mapd_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/mapd_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/OmniSci.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/omnisci_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/omnisci_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/completion_hints_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/completion_hints_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/serialized_result_set_constants.cpp
Expand All @@ -36,9 +36,9 @@ add_custom_command(
COMMAND ${Thrift_EXECUTABLE}
ARGS -gen cpp -r -I ${CMAKE_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/omnisci.thrift)
add_library(mapd_sample_thrift
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/MapD.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/mapd_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/mapd_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/OmniSci.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/omnisci_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/omnisci_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/completion_hints_constants.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/completion_hints_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/gen-cpp/serialized_result_set_constants.cpp
Expand Down
4 changes: 2 additions & 2 deletions SampleCode/DataGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/TSocket.h>
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
Expand Down Expand Up @@ -214,7 +214,7 @@ int main(int argc, char** argv) {
mapd::shared_ptr<TTransport> socket(new TSocket(server_host, port));
mapd::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
mapd::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
MapDClient client(protocol);
OmniSciClient client(protocol);
TSessionId session;
try {
transport->open(); // open transport
Expand Down
6 changes: 3 additions & 3 deletions SampleCode/StreamInsert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/TSocket.h>
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
Expand Down Expand Up @@ -95,7 +95,7 @@ struct ConnectionDetails {
bool print_error_data = false;
bool print_transformation = false;

mapd::shared_ptr<MapDClient> client;
mapd::shared_ptr<OmniSciClient> client;
TSessionId session;
mapd::shared_ptr<apache::thrift::transport::TTransport> mytransport;

Expand All @@ -108,7 +108,7 @@ void createConnection(ConnectionDetails con) {
mapd::shared_ptr<TTransport> socket(new TSocket(con.server_host, con.port));
mytransport.reset(new TBufferedTransport(socket));
mapd::shared_ptr<TProtocol> protocol(new TBinaryProtocol(mytransport));
client.reset(new MapDClient(protocol));
client.reset(new OmniSciClient(protocol));
try {
mytransport->open(); // open transport
client->connect(
Expand Down
6 changes: 3 additions & 3 deletions SampleCode/StreamInsertSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/TSocket.h>
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
Expand All @@ -58,7 +58,7 @@ const size_t INSERT_BATCH_SIZE = 10000;

// reads tab-delimited rows from std::cin and load them to
// table_name in batches of size INSERT_BATCH_SIZE until done
void stream_insert(MapDClient& client,
void stream_insert(OmniSciClient& client,
const TSessionId session,
const std::string& table_name,
const TRowDescriptor& row_desc,
Expand Down Expand Up @@ -125,7 +125,7 @@ int main(int argc, char** argv) {
mapd::shared_ptr<TTransport> socket(new TSocket(server_host, port));
mapd::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
mapd::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
MapDClient client(protocol);
OmniSciClient client(protocol);
TSessionId session;
try {
transport->open(); // open transport
Expand Down
2 changes: 1 addition & 1 deletion Shared/ThriftTypesConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef THRIFT_TYPE_CONVERT_H
#define THRIFT_TYPE_CONVERT_H

#include "gen-cpp/mapd_types.h"
#include "gen-cpp/omnisci_types.h"

#include "Logger.h"

Expand Down
6 changes: 3 additions & 3 deletions Tests/ArrowIpcIntegrationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ using namespace ::apache::thrift::transport;
#include "Shared/Logger.h"
#include "Shared/ThriftClient.h"

#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

TSessionId g_session_id;
std::shared_ptr<MapDClient> g_client;
std::shared_ptr<OmniSciClient> g_client;

bool g_cpu_only{false};

Expand Down Expand Up @@ -413,7 +413,7 @@ int main(int argc, char* argv[]) {
auto transport = conn_mgr->open_buffered_client_transport(host, port, cert);
transport->open();
auto protocol = std::make_shared<TBinaryProtocol>(transport);
g_client = std::make_shared<MapDClient>(protocol);
g_client = std::make_shared<OmniSciClient>(protocol);

g_client->connect(g_session_id, user, pwd, db);

Expand Down
6 changes: 3 additions & 3 deletions Tests/CtasIntegrationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace ::apache::thrift::transport;
#include "Shared/ThriftClient.h"
#include "Shared/sqltypes.h"
#include "TestHelpers.h"
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

#include <algorithm>
#include <ctime>
Expand All @@ -44,7 +44,7 @@ using namespace ::apache::thrift::transport;
// #define RUN_ALL_TEST

TSessionId g_session_id;
std::shared_ptr<MapDClient> g_client;
std::shared_ptr<OmniSciClient> g_client;

template <typename RETURN_TYPE, typename SOURCE_TYPE>
bool checked_get(size_t row,
Expand Down Expand Up @@ -1246,7 +1246,7 @@ int main(int argc, char* argv[]) {
auto transport = connMgr->open_buffered_client_transport(host, port, cert);
transport->open();
auto protocol = std::make_shared<TBinaryProtocol>(transport);
g_client = std::make_shared<MapDClient>(protocol);
g_client = std::make_shared<OmniSciClient>(protocol);

g_client->connect(g_session_id, user, pwd, db);

Expand Down
2 changes: 1 addition & 1 deletion Tests/OmniSQLCommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "../SQLFrontend/CommandResolutionChain.h"
#include "../SQLFrontend/MetaClientContext.h"
#include "../SQLFrontend/ThriftOps.h"
#include "../gen-cpp/mapd_types.h"
#include "../gen-cpp/omnisci_types.h"
#include "gtest/gtest.h"

#include <boost/interprocess/sync/file_lock.hpp>
Expand Down
10 changes: 5 additions & 5 deletions ThriftHandler/DBHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
#include <typeinfo>
#include <unordered_map>

#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"
#include "gen-cpp/extension_functions_types.h"

using namespace std::string_literals;
Expand All @@ -113,9 +113,9 @@ using TableMap = std::map<std::string, bool>;
using OptionalTableMap = boost::optional<TableMap&>;
using query_state::QueryStateProxy;

class TrackingProcessor : public MapDProcessor {
class TrackingProcessor : public OmniSciProcessor {
public:
TrackingProcessor(mapd::shared_ptr<MapDIf> handler) : MapDProcessor(handler) {}
TrackingProcessor(mapd::shared_ptr<OmniSciIf> handler) : OmniSciProcessor(handler) {}

bool process(mapd::shared_ptr<::apache::thrift::protocol::TProtocol> in,
mapd::shared_ptr<::apache::thrift::protocol::TProtocol> out,
Expand Down Expand Up @@ -149,14 +149,14 @@ class TrackingProcessor : public MapDProcessor {
TrackingProcessor::client_address = "";
}

return MapDProcessor::process(in, out, connectionContext);
return OmniSciProcessor::process(in, out, connectionContext);
}

static thread_local std::string client_address;
static thread_local ClientProtocol client_protocol;
};

class DBHandler : public MapDIf {
class DBHandler : public OmniSciIf {
public:
DBHandler(const std::vector<LeafHostInfo>& db_leaves,
const std::vector<LeafHostInfo>& string_leaves,
Expand Down
2 changes: 1 addition & 1 deletion ThriftHandler/RenderHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#pragma once

#include "Shared/SystemParameters.h"
#include "gen-cpp/MapD.h"
#include "gen-cpp/OmniSci.h"

class DBHandler;

Expand Down
10 changes: 5 additions & 5 deletions docs/source/data_model/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
External API
==================================

OmniSciDB uses Apache's Thrift software framework for all external client communication. The open source clients shipped with the repository include OmniSci's `omnisql` command line process, JDBC driver and SQLImporter utility. For a full list of Thrift enabled clients supported by OmniSci see Table :ref:`omnisci-open-source-clients` below. The full list of thrift API methods can be found in the `mapd.thrift` file in the root of the OmniSciDB source directory.
OmniSciDB uses Apache's Thrift software framework for all external client communication. The open source clients shipped with the repository include OmniSci's `omnisql` command line process, JDBC driver and SQLImporter utility. For a full list of Thrift enabled clients supported by OmniSci see Table :ref:`omnisci-open-source-clients` below. The full list of thrift API methods can be found in the `omnisci.thrift` file in the root of the OmniSciDB source directory.

All internal communication between the discrete processes within OmniSciDB also use the Thrift communication framework. For example, communications between OmniSciDB and Apache Calcite are facilitated via Thrift.

Expand All @@ -13,13 +13,13 @@ All internal communication between the discrete processes within OmniSciDB also
Design
#######

OmniSci has developed a rich set of Thrift based API calls. The bindings for the these calls can be found in the file `mapd.thrift` in the open source repository.
OmniSci has developed a rich set of Thrift based API calls. The bindings for the these calls can be found in the file `omnisci.thrift` in the open source repository.

The classes generated from the Thrift bindings include `MapDProcessor`, `MapDClient` and `MapDIf`. The OmniSci code sitting 'behind' these classes can be found in the class `DBHandler`, in the file `ThriftHandler/DBhandler.(cpp/h)`.
The classes generated from the Thrift bindings include `OmniSciProcessor`, `OmniSciClient` and `OmniSciIf`. The OmniSci code sitting 'behind' these classes can be found in the class `DBHandler`, in the file `ThriftHandler/DBhandler.(cpp/h)`.

The class OmniSci class `MapDHander` implements the generated interface `MapDIf`. The OmniSci server (in `MapDServer.cpp`) create an instance of `DBHandler`, using this object to initialize two instances of `apache::ThreadedServer` objects - one per Thrift protocol supported by the server (see section below for protocol details).
The class OmniSci class `DBHandler` implements the generated interface `OmniSciIf`. The OmniSci server (in `MapDServer.cpp`) create an instance of `DBHandler`, using this object to initialize two instances of `apache::ThreadedServer` objects - one per Thrift protocol supported by the server (see section below for protocol details).

OmniSci clients such as the JDBC driver use the generated MapDClient class to make calls through to the server. To maintain state across client calls to the Thrift bindings, an initial connection/validation process returns a session identifier as a `TSessionId` to the connecting client; subsequent calls need to include the session identifier as part of the serialised data structure.
OmniSci clients such as the JDBC driver use the generated OmniSciClient class to make calls through to the server. To maintain state across client calls to the Thrift bindings, an initial connection/validation process returns a session identifier as a `TSessionId` to the connecting client; subsequent calls need to include the session identifier as part of the serialised data structure.

In the case of Thrift communication with the `Calcite` server, Calcite acts as the communication server and the database acts as the client. The `Calcite` Thrift bindings can be found in `java/thrift/calciteserver.thrift` in the repository. The `DBHandler` class (called from `MapdServer.cpp`) creates an instance of the Calcite class, a class generated by Thrift from the `calciteserver.thrift` binding which implements the client portion of the framework. The Java Calcite server creates an apache::TThreadPoolServer to handle API calls. The OmniSci code written to process the API calls can be found in the file `CalciteServerHandler.java` under `java/calcite` in the repository.

Expand Down
Loading

0 comments on commit 541d2ad

Please sign in to comment.