mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Added tool 'olap-query-converter' to help get rid of OLAP compatibility layer in server [#STATINFRA-7868].
This commit is contained in:
parent
7ef286cc88
commit
f1846d34d6
@ -43,3 +43,10 @@ INSTALL(
|
||||
|
||||
CREATE_INIT_SCRIPT(clickhouse-server clickhouse-server)
|
||||
|
||||
|
||||
add_executable(olap-query-converter
|
||||
olap-query-converter.cpp
|
||||
OLAPQueryParser.cpp
|
||||
OLAPQueryConverter.cpp)
|
||||
|
||||
target_link_libraries (olap-query-converter dbms)
|
||||
|
28
dbms/src/Server/olap-query-converter.cpp
Normal file
28
dbms/src/Server/olap-query-converter.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <DB/Common/Exception.h>
|
||||
#include "OLAPQueryParser.h"
|
||||
#include "OLAPQueryConverter.h"
|
||||
|
||||
/** Программа для преобразования запросов к OLAPServer к SQL запросам.
|
||||
*/
|
||||
|
||||
using namespace DB;
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
try
|
||||
{
|
||||
Context context;
|
||||
OLAP::QueryParser parser;
|
||||
OLAP::QueryConverter converter("visits_all", "visits_all");
|
||||
|
||||
OLAP::QueryParseResult olap_query = parser.parse(std::cin);
|
||||
std::string clickhouse_query;
|
||||
|
||||
converter.OLAPServerQueryToClickHouse(olap_query, context, clickhouse_query);
|
||||
std::cout << clickhouse_query << "\n";
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << getCurrentExceptionMessage(false) << "\n";
|
||||
throw;
|
||||
}
|
Loading…
Reference in New Issue
Block a user