Added tool 'olap-query-converter' to help get rid of OLAP compatibility layer in server [#STATINFRA-7868].

This commit is contained in:
Alexey Milovidov 2016-06-02 21:25:20 +03:00
parent 7ef286cc88
commit f1846d34d6
2 changed files with 35 additions and 0 deletions

View File

@ -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)

View 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;
}