From 6f5390cc70a14fdbf58615254629a3057c2342e6 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Tue, 17 Nov 2020 19:02:10 +0300 Subject: [PATCH 01/48] introduce zstd compression --- src/CMakeLists.txt | 2 + src/Common/ErrorCodes.cpp | 2 + src/IO/CompressionMethod.cpp | 13 +- src/IO/CompressionMethod.h | 3 + src/IO/ZstdDeflatingWriteBuffer.cpp | 92 ++++++ src/IO/ZstdDeflatingWriteBuffer.h | 39 +++ src/IO/ZstdInflatingReadBuffer.cpp | 64 ++++ src/IO/ZstdInflatingReadBuffer.h | 37 +++ src/IO/tests/CMakeLists.txt | 3 + src/IO/tests/zstd_buffers.cpp | 66 +++++ src/Server/HTTPHandler.cpp | 277 +++++++++--------- .../00302_http_compression.reference | 13 + .../0_stateless/00302_http_compression.sh | 4 + .../01059_storage_file_brotli.reference | 4 +- .../0_stateless/01059_storage_file_brotli.sql | 11 +- 15 files changed, 492 insertions(+), 138 deletions(-) create mode 100644 src/IO/ZstdDeflatingWriteBuffer.cpp create mode 100644 src/IO/ZstdDeflatingWriteBuffer.h create mode 100644 src/IO/ZstdInflatingReadBuffer.cpp create mode 100644 src/IO/ZstdInflatingReadBuffer.h create mode 100644 src/IO/tests/zstd_buffers.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fc8a62a066..d1bc49bd18a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -330,6 +330,8 @@ dbms_target_include_directories(SYSTEM BEFORE PUBLIC ${MINISELECT_INCLUDE_DIR}) if (ZSTD_LIBRARY) dbms_target_link_libraries(PRIVATE ${ZSTD_LIBRARY}) + target_link_libraries (clickhouse_common_io PUBLIC ${ZSTD_LIBRARY}) + target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${ZSTD_INCLUDE_DIR}) if (NOT USE_INTERNAL_ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR) dbms_target_include_directories(SYSTEM BEFORE PRIVATE ${ZSTD_INCLUDE_DIR}) endif () diff --git a/src/Common/ErrorCodes.cpp b/src/Common/ErrorCodes.cpp index 7f54b6bc50e..02fa3d63e09 100644 --- a/src/Common/ErrorCodes.cpp +++ b/src/Common/ErrorCodes.cpp @@ -523,6 +523,8 @@ M(554, LZMA_STREAM_DECODER_FAILED) \ M(555, ROCKSDB_ERROR) \ M(556, SYNC_MYSQL_USER_ACCESS_ERROR)\ + M(557, ZSTD_ENCODER_FAILED) \ + M(558, ZSTD_DECODER_FAILED) \ \ M(999, KEEPER_EXCEPTION) \ M(1000, POCO_EXCEPTION) \ diff --git a/src/IO/CompressionMethod.cpp b/src/IO/CompressionMethod.cpp index ec278b5d71f..d627fb03e77 100644 --- a/src/IO/CompressionMethod.cpp +++ b/src/IO/CompressionMethod.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #if !defined(ARCADIA_BUILD) # include @@ -34,6 +36,8 @@ std::string toContentEncodingName(CompressionMethod method) return "br"; case CompressionMethod::Xz: return "xz"; + case CompressionMethod::Zstd: + return "zstd"; case CompressionMethod::None: return ""; } @@ -61,11 +65,13 @@ CompressionMethod chooseCompressionMethod(const std::string & path, const std::s return CompressionMethod::Brotli; if (*method_str == "LZMA" || *method_str == "xz") return CompressionMethod::Xz; + if (*method_str == "zstd" || *method_str == "zst") + return CompressionMethod::Zstd; if (hint.empty() || hint == "auto" || hint == "none") return CompressionMethod::None; throw Exception( - "Unknown compression method " + hint + ". Only 'auto', 'none', 'gzip', 'br', 'xz' are supported as compression methods", + "Unknown compression method " + hint + ". Only 'auto', 'none', 'gzip', 'br', 'xz', 'zst' are supported as compression methods", ErrorCodes::NOT_IMPLEMENTED); } @@ -81,6 +87,8 @@ std::unique_ptr wrapReadBufferWithCompressionMethod( #endif if (method == CompressionMethod::Xz) return std::make_unique(std::move(nested), buf_size, existing_memory, alignment); + if (method == CompressionMethod::Zstd) + return std::make_unique(std::move(nested), buf_size, existing_memory, alignment); if (method == CompressionMethod::None) return nested; @@ -102,6 +110,9 @@ std::unique_ptr wrapWriteBufferWithCompressionMethod( if (method == CompressionMethod::Xz) return std::make_unique(std::move(nested), level, buf_size, existing_memory, alignment); + if (method == CompressionMethod::Zstd) + return std::make_unique(std::move(nested), level, buf_size, existing_memory, alignment); + if (method == CompressionMethod::None) return nested; diff --git a/src/IO/CompressionMethod.h b/src/IO/CompressionMethod.h index 5b0d4330011..6f2d87b45cf 100644 --- a/src/IO/CompressionMethod.h +++ b/src/IO/CompressionMethod.h @@ -28,6 +28,9 @@ enum class CompressionMethod /// LZMA2-based content compression /// This option corresponds to HTTP Content-Encoding: xz Xz, + /// Zstd compressor + /// This option corresponds to HTTP Content-Encoding: zstd + Zstd, Brotli }; diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp new file mode 100644 index 00000000000..cde27bd3f47 --- /dev/null +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -0,0 +1,92 @@ +#include + +namespace DB +{ +namespace ErrorCodes +{ + extern const int ZSTD_ENCODER_FAILED; +} + +ZstdDeflatingWriteBuffer::ZstdDeflatingWriteBuffer( + std::unique_ptr out_, int compression_level, size_t buf_size, char * existing_memory, size_t alignment) + : BufferWithOwnMemory(buf_size, existing_memory, alignment), out(std::move(out_)) +{ + cctx = ZSTD_createCCtx(); + if (cctx == nullptr) + throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder init failed: zstd version: {}", ZSTD_VERSION_STRING); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1); +} + + +ZstdDeflatingWriteBuffer::~ZstdDeflatingWriteBuffer() +{ + try + { + finish(); + + ZSTD_freeCCtx(cctx); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } +} + +void ZstdDeflatingWriteBuffer::nextImpl() +{ + if (!offset()) + return; + + bool last_chunk = hasPendingData(); + + ZSTD_EndDirective mode = last_chunk ? ZSTD_e_end : ZSTD_e_flush; + + input.src = reinterpret_cast(working_buffer.begin()); + input.size = offset(); + input.pos = 0; + + bool finished = false; + do + { + out->nextIfAtEnd(); + + output.dst = reinterpret_cast(out->buffer().begin()); + output.size = out->buffer().size(); + output.pos = out->offset(); + + + size_t remaining = ZSTD_compressStream2(cctx, &output, &input, mode); + out->position() = out->buffer().begin() + output.pos; + finished = last_chunk ? (remaining == 0) : (input.pos == input.size); + } while (!finished); + + if (last_chunk) + flushed = true; +} + +void ZstdDeflatingWriteBuffer::finish() +{ + if (flushed) + return; + + next(); + + out->nextIfAtEnd(); + + input.src = reinterpret_cast(working_buffer.begin()); + input.size = offset(); + input.pos = 0; + + output.dst = reinterpret_cast(out->buffer().begin()); + output.size = out->buffer().size(); + output.pos = out->offset(); + + size_t remaining = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_end); + if (ZSTD_isError(remaining)) + throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder end failed: zstd version: {}", ZSTD_VERSION_STRING); + out->position() = out->buffer().begin() + output.pos; + flushed = true; +} + +} \ No newline at end of file diff --git a/src/IO/ZstdDeflatingWriteBuffer.h b/src/IO/ZstdDeflatingWriteBuffer.h new file mode 100644 index 00000000000..6eb00a540b9 --- /dev/null +++ b/src/IO/ZstdDeflatingWriteBuffer.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include + +#include + +namespace DB +{ +/// Performs compression using zlib library and writes compressed data to out_ WriteBuffer. +class ZstdDeflatingWriteBuffer : public BufferWithOwnMemory +{ +public: + ZstdDeflatingWriteBuffer( + std::unique_ptr out_, + int compression_level, + size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, + char * existing_memory = nullptr, + size_t alignment = 0); + + /// Flush all pending data and write zlib footer to the underlying buffer. + /// After the first call to this function, subsequent calls will have no effect and + /// an attempt to write to this buffer will result in exception. + void finish(); + + ~ZstdDeflatingWriteBuffer() override; + +private: + void nextImpl() override; + + std::unique_ptr out; + ZSTD_CCtx * cctx; + ZSTD_inBuffer input; + ZSTD_outBuffer output; + bool flushed = false; +}; + +} \ No newline at end of file diff --git a/src/IO/ZstdInflatingReadBuffer.cpp b/src/IO/ZstdInflatingReadBuffer.cpp new file mode 100644 index 00000000000..5b536882b81 --- /dev/null +++ b/src/IO/ZstdInflatingReadBuffer.cpp @@ -0,0 +1,64 @@ +#include + + +namespace DB +{ +namespace ErrorCodes +{ + extern const int ZSTD_DECODER_FAILED; +} + +ZstdInflatingReadBuffer::ZstdInflatingReadBuffer(std::unique_ptr in_, size_t buf_size, char * existing_memory, size_t alignment) + : BufferWithOwnMemory(buf_size, existing_memory, alignment), in(std::move(in_)) +{ + dctx = ZSTD_createDCtx(); + input = {nullptr, 0, 0}; + output = {nullptr, 0, 0}; + + if (dctx == nullptr) + { + throw Exception(ErrorCodes::ZSTD_DECODER_FAILED, "zstd_stream_decoder init failed: zstd version: {}", ZSTD_VERSION_STRING); + } +} + +ZstdInflatingReadBuffer::~ZstdInflatingReadBuffer() +{ + ZSTD_freeDCtx(dctx); +} + +bool ZstdInflatingReadBuffer::nextImpl() +{ + if (eof) + return false; + + if (input.pos >= input.size) + { + in->nextIfAtEnd(); + input.src = reinterpret_cast(in->position()); + input.pos = 0; + input.size = in->buffer().end() - in->position(); + } + + output.dst = reinterpret_cast(internal_buffer.begin()); + output.size = internal_buffer.size(); + output.pos = 0; + + size_t ret = ZSTD_decompressStream(dctx, &output, &input); + if (ZSTD_isError(ret)) + throw Exception( + ErrorCodes::ZSTD_DECODER_FAILED, "zstd stream decoding failed: error code: {}; zstd version: {}", ret, ZSTD_VERSION_STRING); + + + in->position() = in->buffer().begin() + input.pos; + working_buffer.resize(output.pos); + + if (in->eof()) + { + eof = true; + return working_buffer.size() != 0; + } + + return true; +} + +} \ No newline at end of file diff --git a/src/IO/ZstdInflatingReadBuffer.h b/src/IO/ZstdInflatingReadBuffer.h new file mode 100644 index 00000000000..0105224d526 --- /dev/null +++ b/src/IO/ZstdInflatingReadBuffer.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include + +#include + + +namespace DB +{ +namespace ErrorCodes +{ +} + +class ZstdInflatingReadBuffer : public BufferWithOwnMemory +{ +public: + ZstdInflatingReadBuffer( + std::unique_ptr in_, + size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, + char * existing_memory = nullptr, + size_t alignment = 0); + + ~ZstdInflatingReadBuffer() override; + +private: + bool nextImpl() override; + + std::unique_ptr in; + ZSTD_DCtx * dctx; + ZSTD_inBuffer input; + ZSTD_outBuffer output; + bool eof = false; +}; + +} \ No newline at end of file diff --git a/src/IO/tests/CMakeLists.txt b/src/IO/tests/CMakeLists.txt index b54785bf370..77dfd5404c7 100644 --- a/src/IO/tests/CMakeLists.txt +++ b/src/IO/tests/CMakeLists.txt @@ -82,3 +82,6 @@ target_link_libraries (zlib_ng_bug PRIVATE ${ZLIB_LIBRARIES}) add_executable (ryu_test ryu_test.cpp) target_link_libraries (ryu_test PRIVATE ryu) + +add_executable (zstd_buffers zstd_buffers.cpp) +target_link_libraries (zstd_buffers PRIVATE clickhouse_common_io) diff --git a/src/IO/tests/zstd_buffers.cpp b/src/IO/tests/zstd_buffers.cpp new file mode 100644 index 00000000000..3ff7748d005 --- /dev/null +++ b/src/IO/tests/zstd_buffers.cpp @@ -0,0 +1,66 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +int main(int, char **) +try +{ + std::cout << std::fixed << std::setprecision(2); + + size_t n = 10000000; + Stopwatch stopwatch; + + + { + auto buf + = std::make_unique("test_zstd_buffers.zst", DBMS_DEFAULT_BUFFER_SIZE, O_WRONLY | O_CREAT | O_TRUNC); + DB::ZstdDeflatingWriteBuffer zstd_buf(std::move(buf), /*compression level*/ 3); + + stopwatch.restart(); + for (size_t i = 0; i < n; ++i) + { + DB::writeIntText(i, zstd_buf); + DB::writeChar('\t', zstd_buf); + } + zstd_buf.finish(); + + stopwatch.stop(); + + std::cout << "Writing done. Elapsed: " << stopwatch.elapsedSeconds() << " s." + << ", " << (zstd_buf.count() / stopwatch.elapsedSeconds() / 1000000) << " MB/s" << std::endl; + } + + { + auto buf = std::make_unique("test_zstd_buffers.zst"); + DB::ZstdInflatingReadBuffer zstd_buf(std::move(buf)); + + stopwatch.restart(); + for (size_t i = 0; i < n; ++i) + { + size_t x; + DB::readIntText(x, zstd_buf); + zstd_buf.ignore(); + + if (x != i) + throw DB::Exception("Failed!, read: " + std::to_string(x) + ", expected: " + std::to_string(i), 0); + } + stopwatch.stop(); + std::cout << "Reading done. Elapsed: " << stopwatch.elapsedSeconds() << " s." + << ", " << (zstd_buf.count() / stopwatch.elapsedSeconds() / 1000000) << " MB/s" << std::endl; + } + + return 0; +} +catch (const DB::Exception & e) +{ + std::cerr << e.what() << ", " << e.displayText() << std::endl; + return 1; +} \ No newline at end of file diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index 94d66d44af0..f2ca8b35b75 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -5,39 +5,39 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include #include #include -#include +#include #include -#include -#include +#include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include #if !defined(ARCADIA_BUILD) # include @@ -46,10 +46,8 @@ namespace DB { - namespace ErrorCodes { - extern const int LOGICAL_ERROR; extern const int CANNOT_PARSE_TEXT; extern const int CANNOT_PARSE_ESCAPE_SEQUENCE; @@ -109,36 +107,25 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti { return HTTPResponse::HTTP_UNAUTHORIZED; } - else if (exception_code == ErrorCodes::CANNOT_PARSE_TEXT || - exception_code == ErrorCodes::CANNOT_PARSE_ESCAPE_SEQUENCE || - exception_code == ErrorCodes::CANNOT_PARSE_QUOTED_STRING || - exception_code == ErrorCodes::CANNOT_PARSE_DATE || - exception_code == ErrorCodes::CANNOT_PARSE_DATETIME || - exception_code == ErrorCodes::CANNOT_PARSE_NUMBER || - exception_code == ErrorCodes::CANNOT_PARSE_INPUT_ASSERTION_FAILED || - exception_code == ErrorCodes::UNKNOWN_ELEMENT_IN_AST || - exception_code == ErrorCodes::UNKNOWN_TYPE_OF_AST_NODE || - exception_code == ErrorCodes::TOO_DEEP_AST || - exception_code == ErrorCodes::TOO_BIG_AST || - exception_code == ErrorCodes::UNEXPECTED_AST_STRUCTURE || - exception_code == ErrorCodes::SYNTAX_ERROR || - exception_code == ErrorCodes::INCORRECT_DATA || - exception_code == ErrorCodes::TYPE_MISMATCH) + else if ( + exception_code == ErrorCodes::CANNOT_PARSE_TEXT || exception_code == ErrorCodes::CANNOT_PARSE_ESCAPE_SEQUENCE + || exception_code == ErrorCodes::CANNOT_PARSE_QUOTED_STRING || exception_code == ErrorCodes::CANNOT_PARSE_DATE + || exception_code == ErrorCodes::CANNOT_PARSE_DATETIME || exception_code == ErrorCodes::CANNOT_PARSE_NUMBER + || exception_code == ErrorCodes::CANNOT_PARSE_INPUT_ASSERTION_FAILED || exception_code == ErrorCodes::UNKNOWN_ELEMENT_IN_AST + || exception_code == ErrorCodes::UNKNOWN_TYPE_OF_AST_NODE || exception_code == ErrorCodes::TOO_DEEP_AST + || exception_code == ErrorCodes::TOO_BIG_AST || exception_code == ErrorCodes::UNEXPECTED_AST_STRUCTURE + || exception_code == ErrorCodes::SYNTAX_ERROR || exception_code == ErrorCodes::INCORRECT_DATA + || exception_code == ErrorCodes::TYPE_MISMATCH) { return HTTPResponse::HTTP_BAD_REQUEST; } - else if (exception_code == ErrorCodes::UNKNOWN_TABLE || - exception_code == ErrorCodes::UNKNOWN_FUNCTION || - exception_code == ErrorCodes::UNKNOWN_IDENTIFIER || - exception_code == ErrorCodes::UNKNOWN_TYPE || - exception_code == ErrorCodes::UNKNOWN_STORAGE || - exception_code == ErrorCodes::UNKNOWN_DATABASE || - exception_code == ErrorCodes::UNKNOWN_SETTING || - exception_code == ErrorCodes::UNKNOWN_DIRECTION_OF_SORTING || - exception_code == ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION || - exception_code == ErrorCodes::UNKNOWN_FORMAT || - exception_code == ErrorCodes::UNKNOWN_DATABASE_ENGINE || - exception_code == ErrorCodes::UNKNOWN_TYPE_OF_QUERY) + else if ( + exception_code == ErrorCodes::UNKNOWN_TABLE || exception_code == ErrorCodes::UNKNOWN_FUNCTION + || exception_code == ErrorCodes::UNKNOWN_IDENTIFIER || exception_code == ErrorCodes::UNKNOWN_TYPE + || exception_code == ErrorCodes::UNKNOWN_STORAGE || exception_code == ErrorCodes::UNKNOWN_DATABASE + || exception_code == ErrorCodes::UNKNOWN_SETTING || exception_code == ErrorCodes::UNKNOWN_DIRECTION_OF_SORTING + || exception_code == ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION || exception_code == ErrorCodes::UNKNOWN_FORMAT + || exception_code == ErrorCodes::UNKNOWN_DATABASE_ENGINE || exception_code == ErrorCodes::UNKNOWN_TYPE_OF_QUERY) { return HTTPResponse::HTTP_NOT_FOUND; } @@ -150,8 +137,7 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti { return HTTPResponse::HTTP_NOT_IMPLEMENTED; } - else if (exception_code == ErrorCodes::SOCKET_TIMEOUT || - exception_code == ErrorCodes::CANNOT_OPEN_FILE) + else if (exception_code == ErrorCodes::SOCKET_TIMEOUT || exception_code == ErrorCodes::CANNOT_OPEN_FILE) { return HTTPResponse::HTTP_SERVICE_UNAVAILABLE; } @@ -164,9 +150,7 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti } -static std::chrono::steady_clock::duration parseSessionTimeout( - const Poco::Util::AbstractConfiguration & config, - const HTMLForm & params) +static std::chrono::steady_clock::duration parseSessionTimeout(const Poco::Util::AbstractConfiguration & config, const HTMLForm & params) { unsigned session_timeout = config.getInt("default_session_timeout", 60); @@ -180,8 +164,9 @@ static std::chrono::steady_clock::duration parseSessionTimeout( throw Exception("Invalid session timeout: '" + session_timeout_str + "'", ErrorCodes::INVALID_SESSION_TIMEOUT); if (session_timeout > max_session_timeout) - throw Exception("Session timeout '" + session_timeout_str + "' is larger than max_session_timeout: " + toString(max_session_timeout) - + ". Maximum session timeout could be modified in configuration file.", + throw Exception( + "Session timeout '" + session_timeout_str + "' is larger than max_session_timeout: " + toString(max_session_timeout) + + ". Maximum session timeout could be modified in configuration file.", ErrorCodes::INVALID_SESSION_TIMEOUT); } @@ -209,8 +194,7 @@ void HTTPHandler::pushDelayedResults(Output & used_output) IReadableWriteBuffer * write_buf_concrete; ReadBufferPtr reread_buf; - if (write_buf - && (write_buf_concrete = dynamic_cast(write_buf.get())) + if (write_buf && (write_buf_concrete = dynamic_cast(write_buf.get())) && (reread_buf = write_buf_concrete->tryGetReadBuffer())) { read_buffers.emplace_back(reread_buf); @@ -223,9 +207,7 @@ void HTTPHandler::pushDelayedResults(Output & used_output) } -HTTPHandler::HTTPHandler(IServer & server_, const std::string & name) - : server(server_) - , log(&Poco::Logger::get(name)) +HTTPHandler::HTTPHandler(IServer & server_, const std::string & name) : server(server_), log(&Poco::Logger::get(name)) { server_display_name = server.config().getString("display_name", getFQDNOrHostName()); } @@ -271,12 +253,12 @@ void HTTPHandler::processQuery( else { /// It is prohibited to mix different authorization schemes. - if (request.hasCredentials() - || params.has("user") - || params.has("password") - || params.has("quota_key")) + if (request.hasCredentials() || params.has("user") || params.has("password") || params.has("quota_key")) { - throw Exception("Invalid authentication: it is not allowed to use X-ClickHouse HTTP headers and other authentication methods simultaneously", ErrorCodes::REQUIRED_PASSWORD); + throw Exception( + "Invalid authentication: it is not allowed to use X-ClickHouse HTTP headers and other authentication methods " + "simultaneously", + ErrorCodes::REQUIRED_PASSWORD); } } @@ -318,12 +300,13 @@ void HTTPHandler::processQuery( { std::string opentelemetry_traceparent = request.get("traceparent"); std::string error; - if (!context.getClientInfo().parseTraceparentHeader( - opentelemetry_traceparent, error)) + if (!context.getClientInfo().parseTraceparentHeader(opentelemetry_traceparent, error)) { - throw Exception(ErrorCodes::BAD_REQUEST_PARAMETER, + throw Exception( + ErrorCodes::BAD_REQUEST_PARAMETER, "Failed to parse OpenTelemetry traceparent header '{}': {}", - opentelemetry_traceparent, error); + opentelemetry_traceparent, + error); } context.getClientInfo().opentelemetry_tracestate = request.get("tracestate", ""); @@ -332,8 +315,7 @@ void HTTPHandler::processQuery( // Set the query id supplied by the user, if any, and also update the // OpenTelemetry fields. - context.setCurrentQueryId(params.get("query_id", - request.get("X-ClickHouse-Query-Id", ""))); + context.setCurrentQueryId(params.get("query_id", request.get("X-ClickHouse-Query-Id", ""))); /// The client can pass a HTTP header indicating supported compression method (gzip or deflate). String http_response_compression_methods = request.get("Accept-Encoding", ""); @@ -353,6 +335,8 @@ void HTTPHandler::processQuery( http_response_compression_method = CompressionMethod::Zlib; else if (std::string::npos != http_response_compression_methods.find("xz")) http_response_compression_method = CompressionMethod::Xz; + else if (std::string::npos != http_response_compression_methods.find("zstd")) + http_response_compression_method = CompressionMethod::Zstd; } bool client_supports_http_compression = http_response_compression_method != CompressionMethod::None; @@ -362,8 +346,8 @@ void HTTPHandler::processQuery( bool internal_compression = params.getParsed("compress", false); /// At least, we should postpone sending of first buffer_size result bytes - size_t buffer_size_total = std::max( - params.getParsed("buffer_size", DBMS_DEFAULT_BUFFER_SIZE), static_cast(DBMS_DEFAULT_BUFFER_SIZE)); + size_t buffer_size_total + = std::max(params.getParsed("buffer_size", DBMS_DEFAULT_BUFFER_SIZE), static_cast(DBMS_DEFAULT_BUFFER_SIZE)); /// If it is specified, the whole result will be buffered. /// First ~buffer_size bytes will be buffered in memory, the remaining bytes will be stored in temporary file. @@ -395,23 +379,20 @@ void HTTPHandler::processQuery( const std::string tmp_path(context.getTemporaryVolume()->getDisk()->getPath()); const std::string tmp_path_template(tmp_path + "http_buffers/"); - auto create_tmp_disk_buffer = [tmp_path_template] (const WriteBufferPtr &) - { - return WriteBufferFromTemporaryFile::create(tmp_path_template); - }; + auto create_tmp_disk_buffer + = [tmp_path_template](const WriteBufferPtr &) { return WriteBufferFromTemporaryFile::create(tmp_path_template); }; cascade_buffer2.emplace_back(std::move(create_tmp_disk_buffer)); } else { - auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed] (const WriteBufferPtr & prev_buf) - { + auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed](const WriteBufferPtr & prev_buf) { auto * prev_memory_buffer = typeid_cast(prev_buf.get()); if (!prev_memory_buffer) throw Exception("Expected MemoryWriteBuffer", ErrorCodes::LOGICAL_ERROR); auto rdbuf = prev_memory_buffer->tryGetReadBuffer(); - copyData(*rdbuf , *next_buffer); + copyData(*rdbuf, *next_buffer); return next_buffer; }; @@ -419,8 +400,8 @@ void HTTPHandler::processQuery( cascade_buffer2.emplace_back(push_memory_buffer_and_continue); } - used_output.out_maybe_delayed_and_compressed = std::make_shared( - std::move(cascade_buffer1), std::move(cascade_buffer2)); + used_output.out_maybe_delayed_and_compressed + = std::make_shared(std::move(cascade_buffer1), std::move(cascade_buffer2)); } else { @@ -446,13 +427,23 @@ void HTTPHandler::processQuery( std::unique_ptr in; - static const NameSet reserved_param_names{"compress", "decompress", "user", "password", "quota_key", "query_id", "stacktrace", - "buffer_size", "wait_end_of_query", "session_id", "session_timeout", "session_check"}; + static const NameSet reserved_param_names{ + "compress", + "decompress", + "user", + "password", + "quota_key", + "query_id", + "stacktrace", + "buffer_size", + "wait_end_of_query", + "session_id", + "session_timeout", + "session_check"}; Names reserved_param_suffixes; - auto param_could_be_skipped = [&] (const String & name) - { + auto param_could_be_skipped = [&](const String & name) { /// Empty parameter appears when URL like ?&a=b or a=b&&c=d. Just skip them for user's convenience. if (name.empty()) return true; @@ -577,12 +568,10 @@ void HTTPHandler::processQuery( client_info.http_method = http_method; client_info.http_user_agent = request.get("User-Agent", ""); - auto append_callback = [&context] (ProgressCallback callback) - { + auto append_callback = [&context](ProgressCallback callback) { auto prev = context.getProgressCallback(); - context.setProgressCallback([prev, callback] (const Progress & progress) - { + context.setProgressCallback([prev, callback](const Progress & progress) { if (prev) prev(progress); @@ -592,14 +581,13 @@ void HTTPHandler::processQuery( /// While still no data has been sent, we will report about query execution progress by sending HTTP headers. if (settings.send_progress_in_http_headers) - append_callback([&used_output] (const Progress & progress) { used_output.out->onProgress(progress); }); + append_callback([&used_output](const Progress & progress) { used_output.out->onProgress(progress); }); if (settings.readonly > 0 && settings.cancel_http_readonly_queries_on_client_close) { Poco::Net::StreamSocket & socket = dynamic_cast(request).socket(); - append_callback([&context, &socket](const Progress &) - { + append_callback([&context, &socket](const Progress &) { /// Assume that at the point this method is called no one is reading data from the socket any more. /// True for read-only queries. try @@ -623,15 +611,17 @@ void HTTPHandler::processQuery( query_scope.emplace(context); - executeQuery(*in, *used_output.out_maybe_delayed_and_compressed, /* allow_into_outfile = */ false, context, - [&response] (const String & current_query_id, const String & content_type, const String & format, const String & timezone) - { + executeQuery( + *in, + *used_output.out_maybe_delayed_and_compressed, + /* allow_into_outfile = */ false, + context, + [&response](const String & current_query_id, const String & content_type, const String & format, const String & timezone) { response.setContentType(content_type); response.add("X-ClickHouse-Query-Id", current_query_id); response.add("X-ClickHouse-Format", format); response.add("X-ClickHouse-Timezone", timezone); - } - ); + }); if (used_output.hasDelayed()) { @@ -644,8 +634,11 @@ void HTTPHandler::processQuery( used_output.out->finalize(); } -void HTTPHandler::trySendExceptionToClient(const std::string & s, int exception_code, - Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, +void HTTPHandler::trySendExceptionToClient( + const std::string & s, + int exception_code, + Poco::Net::HTTPServerRequest & request, + Poco::Net::HTTPServerResponse & response, Output & used_output) { try @@ -654,17 +647,14 @@ void HTTPHandler::trySendExceptionToClient(const std::string & s, int exception_ /// If HTTP method is POST and Keep-Alive is turned on, we should read the whole request body /// to avoid reading part of the current request body in the next request. - if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST - && response.getKeepAlive() - && !request.stream().eof() + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && response.getKeepAlive() && !request.stream().eof() && exception_code != ErrorCodes::HTTP_LENGTH_REQUIRED) { request.stream().ignore(std::numeric_limits::max()); } - bool auth_fail = exception_code == ErrorCodes::UNKNOWN_USER || - exception_code == ErrorCodes::WRONG_PASSWORD || - exception_code == ErrorCodes::REQUIRED_PASSWORD; + bool auth_fail = exception_code == ErrorCodes::UNKNOWN_USER || exception_code == ErrorCodes::WRONG_PASSWORD + || exception_code == ErrorCodes::REQUIRED_PASSWORD; if (auth_fail) { @@ -742,10 +732,12 @@ void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne with_stacktrace = params.getParsed("stacktrace", false); /// Workaround. Poco does not detect 411 Length Required case. - if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && !request.getChunkedTransferEncoding() && - !request.hasContentLength()) + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && !request.getChunkedTransferEncoding() + && !request.hasContentLength()) { - throw Exception("The Transfer-Encoding is not chunked and there is no Content-Length header for POST request", ErrorCodes::HTTP_LENGTH_REQUIRED); + throw Exception( + "The Transfer-Encoding is not chunked and there is no Content-Length header for POST request", + ErrorCodes::HTTP_LENGTH_REQUIRED); } processQuery(context, request, params, response, used_output, query_scope); @@ -773,7 +765,7 @@ DynamicQueryHandler::DynamicQueryHandler(IServer & server_, const std::string & bool DynamicQueryHandler::customizeQueryParam(Context & context, const std::string & key, const std::string & value) { if (key == param_name) - return true; /// do nothing + return true; /// do nothing if (startsWith(key, "param_")) { @@ -788,7 +780,6 @@ bool DynamicQueryHandler::customizeQueryParam(Context & context, const std::stri std::string DynamicQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) { - if (likely(!startsWith(request.getContentType(), "multipart/form-data"))) { /// Part of the query can be passed in the 'query' parameter and the rest in the request body @@ -813,10 +804,16 @@ std::string DynamicQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request } PredefinedQueryHandler::PredefinedQueryHandler( - IServer & server_, const NameSet & receive_params_, const std::string & predefined_query_ - , const CompiledRegexPtr & url_regex_, const std::unordered_map & header_name_with_regex_) - : HTTPHandler(server_, "PredefinedQueryHandler"), receive_params(receive_params_), predefined_query(predefined_query_) - , url_regex(url_regex_), header_name_with_capture_regex(header_name_with_regex_) + IServer & server_, + const NameSet & receive_params_, + const std::string & predefined_query_, + const CompiledRegexPtr & url_regex_, + const std::unordered_map & header_name_with_regex_) + : HTTPHandler(server_, "PredefinedQueryHandler") + , receive_params(receive_params_) + , predefined_query(predefined_query_) + , url_regex(url_regex_) + , header_name_with_capture_regex(header_name_with_regex_) { } @@ -836,8 +833,7 @@ void PredefinedQueryHandler::customizeContext(Poco::Net::HTTPServerRequest & req /// If in the configuration file, the handler's header is regex and contains named capture group /// We will extract regex named capture groups as query parameters - const auto & set_query_params = [&](const char * begin, const char * end, const CompiledRegexPtr & compiled_regex) - { + const auto & set_query_params = [&](const char * begin, const char * end, const CompiledRegexPtr & compiled_regex) { int num_captures = compiled_regex->NumberOfCapturingGroups() + 1; re2::StringPiece matches[num_captures]; @@ -882,16 +878,16 @@ std::string PredefinedQueryHandler::getQuery(Poco::Net::HTTPServerRequest & requ Poco::Net::HTTPRequestHandlerFactory * createDynamicHandlerFactory(IServer & server, const std::string & config_prefix) { std::string query_param_name = server.config().getString(config_prefix + ".handler.query_param_name", "query"); - return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory(server, std::move(query_param_name)), server.config(), config_prefix); + return addFiltersFromConfig( + new HandlingRuleHTTPHandlerFactory(server, std::move(query_param_name)), server.config(), config_prefix); } static inline bool capturingNamedQueryParam(NameSet receive_params, const CompiledRegexPtr & compiled_regex) { const auto & capturing_names = compiled_regex->NamedCapturingGroups(); - return std::count_if(capturing_names.begin(), capturing_names.end(), [&](const auto & iterator) - { - return std::count_if(receive_params.begin(), receive_params.end(), - [&](const auto & param_name) { return param_name == iterator.first; }); + return std::count_if(capturing_names.begin(), capturing_names.end(), [&](const auto & iterator) { + return std::count_if( + receive_params.begin(), receive_params.end(), [&](const auto & param_name) { return param_name == iterator.first; }); }); } @@ -900,8 +896,10 @@ static inline CompiledRegexPtr getCompiledRegex(const std::string & expression) auto compiled_regex = std::make_shared(expression); if (!compiled_regex->ok()) - throw Exception("Cannot compile re2: " + expression + " for http handling rule, error: " + - compiled_regex->error() + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", ErrorCodes::CANNOT_COMPILE_REGEXP); + throw Exception( + "Cannot compile re2: " + expression + " for http handling rule, error: " + compiled_regex->error() + + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", + ErrorCodes::CANNOT_COMPILE_REGEXP); return compiled_regex; } @@ -911,7 +909,8 @@ Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & Poco::Util::AbstractConfiguration & configuration = server.config(); if (!configuration.has(config_prefix + ".handler.query")) - throw Exception("There is no path '" + config_prefix + ".handler.query" + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG); + throw Exception( + "There is no path '" + config_prefix + ".handler.query" + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG); std::string predefined_query = configuration.getString(config_prefix + ".handler.query"); NameSet analyze_receive_params = analyzeReceiveQueryParams(predefined_query); @@ -942,14 +941,22 @@ Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & auto regex = getCompiledRegex(url_expression); if (capturingNamedQueryParam(analyze_receive_params, regex)) - return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( - server, std::move(analyze_receive_params), std::move(predefined_query), std::move(regex), - std::move(headers_name_with_regex)), configuration, config_prefix); + return addFiltersFromConfig( + new HandlingRuleHTTPHandlerFactory( + server, + std::move(analyze_receive_params), + std::move(predefined_query), + std::move(regex), + std::move(headers_name_with_regex)), + configuration, + config_prefix); } - return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( - server, std::move(analyze_receive_params), std::move(predefined_query), CompiledRegexPtr{} ,std::move(headers_name_with_regex)), - configuration, config_prefix); + return addFiltersFromConfig( + new HandlingRuleHTTPHandlerFactory( + server, std::move(analyze_receive_params), std::move(predefined_query), CompiledRegexPtr{}, std::move(headers_name_with_regex)), + configuration, + config_prefix); } } diff --git a/tests/queries/0_stateless/00302_http_compression.reference b/tests/queries/0_stateless/00302_http_compression.reference index f3d28359515..909e30d2992 100644 --- a/tests/queries/0_stateless/00302_http_compression.reference +++ b/tests/queries/0_stateless/00302_http_compression.reference @@ -68,15 +68,28 @@ 7 8 9 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 < Content-Encoding: gzip < Content-Encoding: deflate < Content-Encoding: gzip < Content-Encoding: br < Content-Encoding: xz +< Content-Encoding: zstd 1 1 1 1 +1 +Hello, world Hello, world Hello, world Hello, world diff --git a/tests/queries/0_stateless/00302_http_compression.sh b/tests/queries/0_stateless/00302_http_compression.sh index 846a23a54c9..1727d5ab993 100755 --- a/tests/queries/0_stateless/00302_http_compression.sh +++ b/tests/queries/0_stateless/00302_http_compression.sh @@ -10,6 +10,7 @@ ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept- ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10'; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: br' -d 'SELECT number FROM system.numbers LIMIT 10' | brotli -d; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: xz' -d 'SELECT number FROM system.numbers LIMIT 10' | xz -d; +${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: zstd' -d 'SELECT number FROM system.numbers LIMIT 10' | zstd -d; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; @@ -18,16 +19,19 @@ ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: zip, eflate' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: br' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: xz' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; +${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: zstd' -d 'SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep --text '< Content-Encoding'; echo "SELECT 1" | ${CLICKHOUSE_CURL} -sS --data-binary @- "${CLICKHOUSE_URL}"; echo "SELECT 1" | gzip -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: gzip' "${CLICKHOUSE_URL}"; echo "SELECT 1" | brotli | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: br' "${CLICKHOUSE_URL}"; echo "SELECT 1" | xz -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: xz' "${CLICKHOUSE_URL}"; +echo "SELECT 1" | zstd -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: zstd' "${CLICKHOUSE_URL}"; echo "'Hello, world'" | ${CLICKHOUSE_CURL} -sS --data-binary @- "${CLICKHOUSE_URL}&query=SELECT"; echo "'Hello, world'" | gzip -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: gzip' "${CLICKHOUSE_URL}&query=SELECT"; echo "'Hello, world'" | brotli | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: br' "${CLICKHOUSE_URL}&query=SELECT"; echo "'Hello, world'" | xz -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: xz' "${CLICKHOUSE_URL}&query=SELECT"; +echo "'Hello, world'" | zstd -c | ${CLICKHOUSE_CURL} -sS --data-binary @- -H 'Content-Encoding: zstd' "${CLICKHOUSE_URL}&query=SELECT"; ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&enable_http_compression=1" -H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 0' | wc -c; diff --git a/tests/queries/0_stateless/01059_storage_file_brotli.reference b/tests/queries/0_stateless/01059_storage_file_brotli.reference index 266e67c1445..31fcdce6e12 100644 --- a/tests/queries/0_stateless/01059_storage_file_brotli.reference +++ b/tests/queries/0_stateless/01059_storage_file_brotli.reference @@ -1,7 +1,9 @@ 1000000 999999 1000000 999999 1000000 999999 -3000000 999999 +1000000 999999 +4000000 999999 +1 255 1 255 1 255 1 255 diff --git a/tests/queries/0_stateless/01059_storage_file_brotli.sql b/tests/queries/0_stateless/01059_storage_file_brotli.sql index eba61e4450f..ca20903d5ff 100644 --- a/tests/queries/0_stateless/01059_storage_file_brotli.sql +++ b/tests/queries/0_stateless/01059_storage_file_brotli.sql @@ -23,9 +23,18 @@ SELECT count(), max(x) FROM file; DROP TABLE file; -SELECT count(), max(x) FROM file('data{1,2,3}.tsv.{gz,br,xz}', TSV, 'x UInt64'); +CREATE TABLE file (x UInt64) ENGINE = File(TSV, 'data4.tsv.zst'); +TRUNCATE TABLE file; + +INSERT INTO file SELECT * FROM numbers(1000000); +SELECT count(), max(x) FROM file; + +DROP TABLE file; + +SELECT count(), max(x) FROM file('data{1,2,3,4}.tsv.{gz,br,xz,zst}', TSV, 'x UInt64'); -- check that they are compressed SELECT count() < 1000000, max(x) FROM file('data1.tsv.br', RowBinary, 'x UInt8', 'none'); SELECT count() < 3000000, max(x) FROM file('data2.tsv.gz', RowBinary, 'x UInt8', 'none'); SELECT count() < 1000000, max(x) FROM file('data3.tsv.xz', RowBinary, 'x UInt8', 'none'); +SELECT count() < 1000000, max(x) FROM file('data4.tsv.zst', RowBinary, 'x UInt8', 'none'); From b737a5ea9f764bd45b6946f2a83bd55892be126f Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Tue, 17 Nov 2020 21:36:18 +0300 Subject: [PATCH 02/48] added newlines, fixed formatting --- src/IO/ZstdDeflatingWriteBuffer.cpp | 2 +- src/IO/ZstdDeflatingWriteBuffer.h | 2 +- src/IO/ZstdInflatingReadBuffer.cpp | 2 +- src/IO/ZstdInflatingReadBuffer.h | 2 +- src/IO/ya.make | 2 + src/Server/HTTPHandler.cpp | 82 +++++++++++++++++------------ 6 files changed, 54 insertions(+), 38 deletions(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp index cde27bd3f47..ec5907292b1 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.cpp +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -89,4 +89,4 @@ void ZstdDeflatingWriteBuffer::finish() flushed = true; } -} \ No newline at end of file +} diff --git a/src/IO/ZstdDeflatingWriteBuffer.h b/src/IO/ZstdDeflatingWriteBuffer.h index 6eb00a540b9..1094380a3d7 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.h +++ b/src/IO/ZstdDeflatingWriteBuffer.h @@ -36,4 +36,4 @@ private: bool flushed = false; }; -} \ No newline at end of file +} diff --git a/src/IO/ZstdInflatingReadBuffer.cpp b/src/IO/ZstdInflatingReadBuffer.cpp index 5b536882b81..c386d9068d9 100644 --- a/src/IO/ZstdInflatingReadBuffer.cpp +++ b/src/IO/ZstdInflatingReadBuffer.cpp @@ -61,4 +61,4 @@ bool ZstdInflatingReadBuffer::nextImpl() return true; } -} \ No newline at end of file +} diff --git a/src/IO/ZstdInflatingReadBuffer.h b/src/IO/ZstdInflatingReadBuffer.h index 0105224d526..e6e2dad0ad5 100644 --- a/src/IO/ZstdInflatingReadBuffer.h +++ b/src/IO/ZstdInflatingReadBuffer.h @@ -34,4 +34,4 @@ private: bool eof = false; }; -} \ No newline at end of file +} diff --git a/src/IO/ya.make b/src/IO/ya.make index a4d406d73ce..8e6d3d835e9 100644 --- a/src/IO/ya.make +++ b/src/IO/ya.make @@ -56,6 +56,8 @@ SRCS( WriteHelpers.cpp ZlibDeflatingWriteBuffer.cpp ZlibInflatingReadBuffer.cpp + ZstdDeflatingWriteBuffer.cpp + ZstdInflatingReadBuffer.cpp copyData.cpp createReadBufferFromFileBase.cpp createWriteBufferFromFileBase.cpp diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index f2ca8b35b75..e08ca19deb6 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -287,10 +287,11 @@ void HTTPHandler::processQuery( context.setSessionContext(session->context); } - SCOPE_EXIT({ - if (session) - session->release(); - }); + SCOPE_EXIT( + { + if (session) + session->release(); + }); // Parse the OpenTelemetry traceparent header. // Disable in Arcadia -- it interferes with the @@ -386,7 +387,8 @@ void HTTPHandler::processQuery( } else { - auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed](const WriteBufferPtr & prev_buf) { + auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed](const WriteBufferPtr & prev_buf) + { auto * prev_memory_buffer = typeid_cast(prev_buf.get()); if (!prev_memory_buffer) throw Exception("Expected MemoryWriteBuffer", ErrorCodes::LOGICAL_ERROR); @@ -443,7 +445,8 @@ void HTTPHandler::processQuery( Names reserved_param_suffixes; - auto param_could_be_skipped = [&](const String & name) { + auto param_could_be_skipped = [&](const String & name) + { /// Empty parameter appears when URL like ?&a=b or a=b&&c=d. Just skip them for user's convenience. if (name.empty()) return true; @@ -568,15 +571,18 @@ void HTTPHandler::processQuery( client_info.http_method = http_method; client_info.http_user_agent = request.get("User-Agent", ""); - auto append_callback = [&context](ProgressCallback callback) { + auto append_callback = [&context](ProgressCallback callback) + { auto prev = context.getProgressCallback(); - context.setProgressCallback([prev, callback](const Progress & progress) { - if (prev) - prev(progress); + context.setProgressCallback( + [prev, callback](const Progress & progress) + { + if (prev) + prev(progress); - callback(progress); - }); + callback(progress); + }); }; /// While still no data has been sent, we will report about query execution progress by sending HTTP headers. @@ -587,24 +593,26 @@ void HTTPHandler::processQuery( { Poco::Net::StreamSocket & socket = dynamic_cast(request).socket(); - append_callback([&context, &socket](const Progress &) { - /// Assume that at the point this method is called no one is reading data from the socket any more. - /// True for read-only queries. - try + append_callback( + [&context, &socket](const Progress &) { - char b; - int status = socket.receiveBytes(&b, 1, MSG_DONTWAIT | MSG_PEEK); - if (status == 0) + /// Assume that at the point this method is called no one is reading data from the socket any more. + /// True for read-only queries. + try + { + char b; + int status = socket.receiveBytes(&b, 1, MSG_DONTWAIT | MSG_PEEK); + if (status == 0) + context.killCurrentQuery(); + } + catch (Poco::TimeoutException &) + { + } + catch (...) + { context.killCurrentQuery(); - } - catch (Poco::TimeoutException &) - { - } - catch (...) - { - context.killCurrentQuery(); - } - }); + } + }); } customizeContext(request, context); @@ -616,7 +624,8 @@ void HTTPHandler::processQuery( *used_output.out_maybe_delayed_and_compressed, /* allow_into_outfile = */ false, context, - [&response](const String & current_query_id, const String & content_type, const String & format, const String & timezone) { + [&response](const String & current_query_id, const String & content_type, const String & format, const String & timezone) + { response.setContentType(content_type); response.add("X-ClickHouse-Query-Id", current_query_id); response.add("X-ClickHouse-Format", format); @@ -833,7 +842,8 @@ void PredefinedQueryHandler::customizeContext(Poco::Net::HTTPServerRequest & req /// If in the configuration file, the handler's header is regex and contains named capture group /// We will extract regex named capture groups as query parameters - const auto & set_query_params = [&](const char * begin, const char * end, const CompiledRegexPtr & compiled_regex) { + const auto & set_query_params = [&](const char * begin, const char * end, const CompiledRegexPtr & compiled_regex) + { int num_captures = compiled_regex->NumberOfCapturingGroups() + 1; re2::StringPiece matches[num_captures]; @@ -885,10 +895,14 @@ Poco::Net::HTTPRequestHandlerFactory * createDynamicHandlerFactory(IServer & ser static inline bool capturingNamedQueryParam(NameSet receive_params, const CompiledRegexPtr & compiled_regex) { const auto & capturing_names = compiled_regex->NamedCapturingGroups(); - return std::count_if(capturing_names.begin(), capturing_names.end(), [&](const auto & iterator) { - return std::count_if( - receive_params.begin(), receive_params.end(), [&](const auto & param_name) { return param_name == iterator.first; }); - }); + return std::count_if( + capturing_names.begin(), + capturing_names.end(), + [&](const auto & iterator) + { + return std::count_if( + receive_params.begin(), receive_params.end(), [&](const auto & param_name) { return param_name == iterator.first; }); + }); } static inline CompiledRegexPtr getCompiledRegex(const std::string & expression) From 22f147ab0f536cf86b251c97be9c17c7fcf0573a Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Tue, 17 Nov 2020 23:14:22 +0300 Subject: [PATCH 03/48] added newline, fixed initialization in constructor --- src/IO/ZstdDeflatingWriteBuffer.cpp | 3 +++ src/IO/tests/zstd_buffers.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp index ec5907292b1..18bbcbba03e 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.cpp +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -16,6 +16,9 @@ ZstdDeflatingWriteBuffer::ZstdDeflatingWriteBuffer( throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder init failed: zstd version: {}", ZSTD_VERSION_STRING); ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level); ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1); + + input = {nullptr, 0, 0}; + output = {nullptr, 0, 0}; } diff --git a/src/IO/tests/zstd_buffers.cpp b/src/IO/tests/zstd_buffers.cpp index 3ff7748d005..f269c0b22fd 100644 --- a/src/IO/tests/zstd_buffers.cpp +++ b/src/IO/tests/zstd_buffers.cpp @@ -63,4 +63,4 @@ catch (const DB::Exception & e) { std::cerr << e.what() << ", " << e.displayText() << std::endl; return 1; -} \ No newline at end of file +} From 0c4acef5580bb162df3ff9ab8f60d6d985dd85cb Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Thu, 19 Nov 2020 12:23:05 +0300 Subject: [PATCH 04/48] added zstd to docker image --- docker/test/stateless/Dockerfile | 1 + docker/test/stateless_unbundled/Dockerfile | 1 + docker/test/stateless_with_coverage/Dockerfile | 1 + 3 files changed, 3 insertions(+) diff --git a/docker/test/stateless/Dockerfile b/docker/test/stateless/Dockerfile index 47c45e57508..b887e537e9a 100644 --- a/docker/test/stateless/Dockerfile +++ b/docker/test/stateless/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get update -y \ && env DEBIAN_FRONTEND=noninteractive \ apt-get install --yes --no-install-recommends \ brotli \ + zstd \ expect \ lsof \ ncdu \ diff --git a/docker/test/stateless_unbundled/Dockerfile b/docker/test/stateless_unbundled/Dockerfile index 1c9f9510d7e..d212290d553 100644 --- a/docker/test/stateless_unbundled/Dockerfile +++ b/docker/test/stateless_unbundled/Dockerfile @@ -8,6 +8,7 @@ RUN apt-get --allow-unauthenticated update -y \ apt-get --allow-unauthenticated install --yes --no-install-recommends \ alien \ brotli \ + zstd \ cmake \ devscripts \ expect \ diff --git a/docker/test/stateless_with_coverage/Dockerfile b/docker/test/stateless_with_coverage/Dockerfile index 1d6a85adf9e..5dd59f59ade 100644 --- a/docker/test/stateless_with_coverage/Dockerfile +++ b/docker/test/stateless_with_coverage/Dockerfile @@ -24,6 +24,7 @@ RUN apt-get update -y \ tree \ moreutils \ brotli \ + zstd \ gdb \ lsof \ unixodbc \ From 1d09a67e9f5926037c17a3f2b7591003d5825562 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Thu, 19 Nov 2020 23:06:41 +0300 Subject: [PATCH 05/48] empty commit for force run --- docker/test/stateless/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/test/stateless/Dockerfile b/docker/test/stateless/Dockerfile index b887e537e9a..b063f8d81f6 100644 --- a/docker/test/stateless/Dockerfile +++ b/docker/test/stateless/Dockerfile @@ -7,8 +7,8 @@ RUN apt-get update -y \ && env DEBIAN_FRONTEND=noninteractive \ apt-get install --yes --no-install-recommends \ brotli \ - zstd \ expect \ + zstd \ lsof \ ncdu \ netcat-openbsd \ From d47cf8c919c1453cd148c1d041bfaed31f0378b6 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 23 Nov 2020 07:11:52 +0300 Subject: [PATCH 06/48] Update ZstdInflatingReadBuffer.cpp --- src/IO/ZstdInflatingReadBuffer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/IO/ZstdInflatingReadBuffer.cpp b/src/IO/ZstdInflatingReadBuffer.cpp index c386d9068d9..94a0b56fc6d 100644 --- a/src/IO/ZstdInflatingReadBuffer.cpp +++ b/src/IO/ZstdInflatingReadBuffer.cpp @@ -46,8 +46,7 @@ bool ZstdInflatingReadBuffer::nextImpl() size_t ret = ZSTD_decompressStream(dctx, &output, &input); if (ZSTD_isError(ret)) throw Exception( - ErrorCodes::ZSTD_DECODER_FAILED, "zstd stream decoding failed: error code: {}; zstd version: {}", ret, ZSTD_VERSION_STRING); - + ErrorCodes::ZSTD_DECODER_FAILED, "Zstd stream decoding failed: error code: {}; zstd version: {}", ret, ZSTD_VERSION_STRING); in->position() = in->buffer().begin() + input.pos; working_buffer.resize(output.pos); From 945aa009addeae1dd83af68bc5255ea5c02c02e8 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 23 Nov 2020 07:13:02 +0300 Subject: [PATCH 07/48] Update ZstdDeflatingWriteBuffer.h --- src/IO/ZstdDeflatingWriteBuffer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.h b/src/IO/ZstdDeflatingWriteBuffer.h index 1094380a3d7..7b557b3ddba 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.h +++ b/src/IO/ZstdDeflatingWriteBuffer.h @@ -8,7 +8,8 @@ namespace DB { -/// Performs compression using zlib library and writes compressed data to out_ WriteBuffer. + +/// Performs compression using zstd library and writes compressed data to out_ WriteBuffer. class ZstdDeflatingWriteBuffer : public BufferWithOwnMemory { public: @@ -19,7 +20,7 @@ public: char * existing_memory = nullptr, size_t alignment = 0); - /// Flush all pending data and write zlib footer to the underlying buffer. + /// Flush all pending data and write footer to the underlying buffer. /// After the first call to this function, subsequent calls will have no effect and /// an attempt to write to this buffer will result in exception. void finish(); From 203db68250ea24856f01ed94428a57f037a713cc Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Mon, 23 Nov 2020 07:14:41 +0300 Subject: [PATCH 08/48] Update ZstdDeflatingWriteBuffer.cpp --- src/IO/ZstdDeflatingWriteBuffer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp index 18bbcbba03e..91c13fad588 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.cpp +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -58,7 +58,6 @@ void ZstdDeflatingWriteBuffer::nextImpl() output.size = out->buffer().size(); output.pos = out->offset(); - size_t remaining = ZSTD_compressStream2(cctx, &output, &input, mode); out->position() = out->buffer().begin() + output.pos; finished = last_chunk ? (remaining == 0) : (input.pos == input.size); From 3f4f1c76717a145b6c0bf24e5bbbb28ffe9a5bf7 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Thu, 26 Nov 2020 20:02:44 +0300 Subject: [PATCH 09/48] Update partition.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавил новый подраздел UPDATE | DELETE IN PARTITION. --- .../statements/alter/partition.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/en/sql-reference/statements/alter/partition.md b/docs/en/sql-reference/statements/alter/partition.md index d2dd1c638cc..219afe8705f 100644 --- a/docs/en/sql-reference/statements/alter/partition.md +++ b/docs/en/sql-reference/statements/alter/partition.md @@ -250,4 +250,24 @@ All the rules above are also true for the [OPTIMIZE](../../../sql-reference/stat OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ``` +## UPDATE\|DELETE IN PARTITION {#update-delete-in-partition} + +``` sql +ALTER TABLE table_name (UPDATE update_expr)|(DELETE) [IN PARTITION partition_id] WHERE where_expr +``` + +`IN PARTITION` specifies the partition to which the [UPDATE](../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. + +In this way, `IN PARTITION` helps reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. + +Examples: + +``` sql +ALTER TABLE mt UPDATE x = x + 1 IN PARTITION 2 WHERE p = 2; +``` + +``` sql +ALTER TABLE mt DELETE IN PARTITION 2 WHERE p = 2; +``` + The examples of `ALTER ... PARTITION` queries are demonstrated in the tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) and [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). From a0ea8a25f1bf6619dfe99517ca9e0db732fe4136 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Thu, 26 Nov 2020 20:47:34 +0300 Subject: [PATCH 10/48] Update partition.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Правлю битую ссылку. --- docs/en/sql-reference/statements/alter/partition.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/sql-reference/statements/alter/partition.md b/docs/en/sql-reference/statements/alter/partition.md index 219afe8705f..53a10c833e2 100644 --- a/docs/en/sql-reference/statements/alter/partition.md +++ b/docs/en/sql-reference/statements/alter/partition.md @@ -256,7 +256,7 @@ OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ALTER TABLE table_name (UPDATE update_expr)|(DELETE) [IN PARTITION partition_id] WHERE where_expr ``` -`IN PARTITION` specifies the partition to which the [UPDATE](../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. +`IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. In this way, `IN PARTITION` helps reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. From 3db2d4d0acb4463f28ae449f0767795d7da0a81d Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Sat, 28 Nov 2020 13:07:10 +0300 Subject: [PATCH 11/48] Update partition.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Внес поправки в общий вид запроса IN PARTITION. --- docs/en/sql-reference/statements/alter/partition.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/en/sql-reference/statements/alter/partition.md b/docs/en/sql-reference/statements/alter/partition.md index 53a10c833e2..3e59835333e 100644 --- a/docs/en/sql-reference/statements/alter/partition.md +++ b/docs/en/sql-reference/statements/alter/partition.md @@ -253,7 +253,11 @@ OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ## UPDATE\|DELETE IN PARTITION {#update-delete-in-partition} ``` sql -ALTER TABLE table_name (UPDATE update_expr)|(DELETE) [IN PARTITION partition_id] WHERE where_expr +ALTER TABLE table_name UPDATE update_expr [IN PARTITION partition_id] WHERE where_expr +``` + +``` sql +ALTER TABLE table_name DELETE [IN PARTITION partition_id] WHERE where_expr ``` `IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. From 7b886252acb574821c44f7fcfad345f4f211fda1 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Sun, 29 Nov 2020 15:08:28 +0300 Subject: [PATCH 12/48] added errors checking, removed redundant variables --- src/IO/ZstdDeflatingWriteBuffer.cpp | 18 +++++++++--------- src/IO/ZstdDeflatingWriteBuffer.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp index 18bbcbba03e..df28820e382 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.cpp +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -14,8 +14,12 @@ ZstdDeflatingWriteBuffer::ZstdDeflatingWriteBuffer( cctx = ZSTD_createCCtx(); if (cctx == nullptr) throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder init failed: zstd version: {}", ZSTD_VERSION_STRING); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1); + size_t ret = ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level); + if (ZSTD_isError(ret)) + throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder option setting failed: error code: {}; zstd version: {}", ret, ZSTD_VERSION_STRING); + ret = ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1); + if (ZSTD_isError(ret)) + throw Exception(ErrorCodes::ZSTD_ENCODER_FAILED, "zstd stream encoder option setting failed: error code: {}; zstd version: {}", ret, ZSTD_VERSION_STRING); input = {nullptr, 0, 0}; output = {nullptr, 0, 0}; @@ -41,9 +45,7 @@ void ZstdDeflatingWriteBuffer::nextImpl() if (!offset()) return; - bool last_chunk = hasPendingData(); - - ZSTD_EndDirective mode = last_chunk ? ZSTD_e_end : ZSTD_e_flush; + ZSTD_EndDirective mode = ZSTD_e_flush; input.src = reinterpret_cast(working_buffer.begin()); input.size = offset(); @@ -59,13 +61,11 @@ void ZstdDeflatingWriteBuffer::nextImpl() output.pos = out->offset(); - size_t remaining = ZSTD_compressStream2(cctx, &output, &input, mode); + ZSTD_compressStream2(cctx, &output, &input, mode); out->position() = out->buffer().begin() + output.pos; - finished = last_chunk ? (remaining == 0) : (input.pos == input.size); + finished = (input.pos == input.size); } while (!finished); - if (last_chunk) - flushed = true; } void ZstdDeflatingWriteBuffer::finish() diff --git a/src/IO/ZstdDeflatingWriteBuffer.h b/src/IO/ZstdDeflatingWriteBuffer.h index 1094380a3d7..3143d218834 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.h +++ b/src/IO/ZstdDeflatingWriteBuffer.h @@ -19,7 +19,7 @@ public: char * existing_memory = nullptr, size_t alignment = 0); - /// Flush all pending data and write zlib footer to the underlying buffer. + /// Flush all pending data and write zstd footer to the underlying buffer. /// After the first call to this function, subsequent calls will have no effect and /// an attempt to write to this buffer will result in exception. void finish(); From 9c5640f443bacf0636b92efaba8d8e7dd355710a Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Sun, 29 Nov 2020 15:19:19 +0300 Subject: [PATCH 13/48] merged --- src/IO/ZstdDeflatingWriteBuffer.cpp | 4 ---- src/IO/ZstdDeflatingWriteBuffer.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/IO/ZstdDeflatingWriteBuffer.cpp b/src/IO/ZstdDeflatingWriteBuffer.cpp index cc5fecda16e..df28820e382 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.cpp +++ b/src/IO/ZstdDeflatingWriteBuffer.cpp @@ -60,12 +60,8 @@ void ZstdDeflatingWriteBuffer::nextImpl() output.size = out->buffer().size(); output.pos = out->offset(); -<<<<<<< HEAD ZSTD_compressStream2(cctx, &output, &input, mode); -======= - size_t remaining = ZSTD_compressStream2(cctx, &output, &input, mode); ->>>>>>> 203db68250ea24856f01ed94428a57f037a713cc out->position() = out->buffer().begin() + output.pos; finished = (input.pos == input.size); } while (!finished); diff --git a/src/IO/ZstdDeflatingWriteBuffer.h b/src/IO/ZstdDeflatingWriteBuffer.h index 33d3c1b1509..2c7dd38dbb0 100644 --- a/src/IO/ZstdDeflatingWriteBuffer.h +++ b/src/IO/ZstdDeflatingWriteBuffer.h @@ -20,11 +20,7 @@ public: char * existing_memory = nullptr, size_t alignment = 0); -<<<<<<< HEAD /// Flush all pending data and write zstd footer to the underlying buffer. -======= - /// Flush all pending data and write footer to the underlying buffer. ->>>>>>> 203db68250ea24856f01ed94428a57f037a713cc /// After the first call to this function, subsequent calls will have no effect and /// an attempt to write to this buffer will result in exception. void finish(); From 98ee8e8d5ef8e0aa9aff437418b4aa582df5fb41 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Sun, 29 Nov 2020 15:48:30 +0300 Subject: [PATCH 14/48] resolved conflict in src/Server/HTTPHandler.cpp --- src/Server/HTTPHandler.cpp | 330 +++++++++++++++++-------------------- 1 file changed, 152 insertions(+), 178 deletions(-) diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index 5840dd34f63..e7cdcd62bfb 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -5,39 +5,39 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include #include -#include +#include #include -#include +#include +#include #include #include -#include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if !defined(ARCADIA_BUILD) # include @@ -46,8 +46,10 @@ namespace DB { + namespace ErrorCodes { + extern const int LOGICAL_ERROR; extern const int CANNOT_PARSE_TEXT; extern const int CANNOT_PARSE_ESCAPE_SEQUENCE; @@ -107,25 +109,36 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti { return HTTPResponse::HTTP_UNAUTHORIZED; } - else if ( - exception_code == ErrorCodes::CANNOT_PARSE_TEXT || exception_code == ErrorCodes::CANNOT_PARSE_ESCAPE_SEQUENCE - || exception_code == ErrorCodes::CANNOT_PARSE_QUOTED_STRING || exception_code == ErrorCodes::CANNOT_PARSE_DATE - || exception_code == ErrorCodes::CANNOT_PARSE_DATETIME || exception_code == ErrorCodes::CANNOT_PARSE_NUMBER - || exception_code == ErrorCodes::CANNOT_PARSE_INPUT_ASSERTION_FAILED || exception_code == ErrorCodes::UNKNOWN_ELEMENT_IN_AST - || exception_code == ErrorCodes::UNKNOWN_TYPE_OF_AST_NODE || exception_code == ErrorCodes::TOO_DEEP_AST - || exception_code == ErrorCodes::TOO_BIG_AST || exception_code == ErrorCodes::UNEXPECTED_AST_STRUCTURE - || exception_code == ErrorCodes::SYNTAX_ERROR || exception_code == ErrorCodes::INCORRECT_DATA - || exception_code == ErrorCodes::TYPE_MISMATCH) + else if (exception_code == ErrorCodes::CANNOT_PARSE_TEXT || + exception_code == ErrorCodes::CANNOT_PARSE_ESCAPE_SEQUENCE || + exception_code == ErrorCodes::CANNOT_PARSE_QUOTED_STRING || + exception_code == ErrorCodes::CANNOT_PARSE_DATE || + exception_code == ErrorCodes::CANNOT_PARSE_DATETIME || + exception_code == ErrorCodes::CANNOT_PARSE_NUMBER || + exception_code == ErrorCodes::CANNOT_PARSE_INPUT_ASSERTION_FAILED || + exception_code == ErrorCodes::UNKNOWN_ELEMENT_IN_AST || + exception_code == ErrorCodes::UNKNOWN_TYPE_OF_AST_NODE || + exception_code == ErrorCodes::TOO_DEEP_AST || + exception_code == ErrorCodes::TOO_BIG_AST || + exception_code == ErrorCodes::UNEXPECTED_AST_STRUCTURE || + exception_code == ErrorCodes::SYNTAX_ERROR || + exception_code == ErrorCodes::INCORRECT_DATA || + exception_code == ErrorCodes::TYPE_MISMATCH) { return HTTPResponse::HTTP_BAD_REQUEST; } - else if ( - exception_code == ErrorCodes::UNKNOWN_TABLE || exception_code == ErrorCodes::UNKNOWN_FUNCTION - || exception_code == ErrorCodes::UNKNOWN_IDENTIFIER || exception_code == ErrorCodes::UNKNOWN_TYPE - || exception_code == ErrorCodes::UNKNOWN_STORAGE || exception_code == ErrorCodes::UNKNOWN_DATABASE - || exception_code == ErrorCodes::UNKNOWN_SETTING || exception_code == ErrorCodes::UNKNOWN_DIRECTION_OF_SORTING - || exception_code == ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION || exception_code == ErrorCodes::UNKNOWN_FORMAT - || exception_code == ErrorCodes::UNKNOWN_DATABASE_ENGINE || exception_code == ErrorCodes::UNKNOWN_TYPE_OF_QUERY) + else if (exception_code == ErrorCodes::UNKNOWN_TABLE || + exception_code == ErrorCodes::UNKNOWN_FUNCTION || + exception_code == ErrorCodes::UNKNOWN_IDENTIFIER || + exception_code == ErrorCodes::UNKNOWN_TYPE || + exception_code == ErrorCodes::UNKNOWN_STORAGE || + exception_code == ErrorCodes::UNKNOWN_DATABASE || + exception_code == ErrorCodes::UNKNOWN_SETTING || + exception_code == ErrorCodes::UNKNOWN_DIRECTION_OF_SORTING || + exception_code == ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION || + exception_code == ErrorCodes::UNKNOWN_FORMAT || + exception_code == ErrorCodes::UNKNOWN_DATABASE_ENGINE || + exception_code == ErrorCodes::UNKNOWN_TYPE_OF_QUERY) { return HTTPResponse::HTTP_NOT_FOUND; } @@ -137,7 +150,8 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti { return HTTPResponse::HTTP_NOT_IMPLEMENTED; } - else if (exception_code == ErrorCodes::SOCKET_TIMEOUT || exception_code == ErrorCodes::CANNOT_OPEN_FILE) + else if (exception_code == ErrorCodes::SOCKET_TIMEOUT || + exception_code == ErrorCodes::CANNOT_OPEN_FILE) { return HTTPResponse::HTTP_SERVICE_UNAVAILABLE; } @@ -150,7 +164,9 @@ static Poco::Net::HTTPResponse::HTTPStatus exceptionCodeToHTTPStatus(int excepti } -static std::chrono::steady_clock::duration parseSessionTimeout(const Poco::Util::AbstractConfiguration & config, const HTMLForm & params) +static std::chrono::steady_clock::duration parseSessionTimeout( + const Poco::Util::AbstractConfiguration & config, + const HTMLForm & params) { unsigned session_timeout = config.getInt("default_session_timeout", 60); @@ -164,9 +180,8 @@ static std::chrono::steady_clock::duration parseSessionTimeout(const Poco::Util: throw Exception("Invalid session timeout: '" + session_timeout_str + "'", ErrorCodes::INVALID_SESSION_TIMEOUT); if (session_timeout > max_session_timeout) - throw Exception( - "Session timeout '" + session_timeout_str + "' is larger than max_session_timeout: " + toString(max_session_timeout) - + ". Maximum session timeout could be modified in configuration file.", + throw Exception("Session timeout '" + session_timeout_str + "' is larger than max_session_timeout: " + toString(max_session_timeout) + + ". Maximum session timeout could be modified in configuration file.", ErrorCodes::INVALID_SESSION_TIMEOUT); } @@ -194,7 +209,8 @@ void HTTPHandler::pushDelayedResults(Output & used_output) IReadableWriteBuffer * write_buf_concrete; ReadBufferPtr reread_buf; - if (write_buf && (write_buf_concrete = dynamic_cast(write_buf.get())) + if (write_buf + && (write_buf_concrete = dynamic_cast(write_buf.get())) && (reread_buf = write_buf_concrete->tryGetReadBuffer())) { read_buffers.emplace_back(reread_buf); @@ -207,7 +223,9 @@ void HTTPHandler::pushDelayedResults(Output & used_output) } -HTTPHandler::HTTPHandler(IServer & server_, const std::string & name) : server(server_), log(&Poco::Logger::get(name)) +HTTPHandler::HTTPHandler(IServer & server_, const std::string & name) + : server(server_) + , log(&Poco::Logger::get(name)) { server_display_name = server.config().getString("display_name", getFQDNOrHostName()); } @@ -253,12 +271,12 @@ void HTTPHandler::processQuery( else { /// It is prohibited to mix different authorization schemes. - if (request.hasCredentials() || params.has("user") || params.has("password") || params.has("quota_key")) + if (request.hasCredentials() + || params.has("user") + || params.has("password") + || params.has("quota_key")) { - throw Exception( - "Invalid authentication: it is not allowed to use X-ClickHouse HTTP headers and other authentication methods " - "simultaneously", - ErrorCodes::REQUIRED_PASSWORD); + throw Exception("Invalid authentication: it is not allowed to use X-ClickHouse HTTP headers and other authentication methods simultaneously", ErrorCodes::REQUIRED_PASSWORD); } } @@ -287,11 +305,10 @@ void HTTPHandler::processQuery( context.setSessionContext(session->context); } - SCOPE_EXIT( - { - if (session) - session->release(); - }); + SCOPE_EXIT({ + if (session) + session->release(); + }); // Parse the OpenTelemetry traceparent header. // Disable in Arcadia -- it interferes with the @@ -301,18 +318,12 @@ void HTTPHandler::processQuery( { std::string opentelemetry_traceparent = request.get("traceparent"); std::string error; -<<<<<<< HEAD - if (!context.getClientInfo().parseTraceparentHeader(opentelemetry_traceparent, error)) -======= if (!context.getClientInfo().client_trace_context.parseTraceparentHeader( opentelemetry_traceparent, error)) ->>>>>>> 00da5148a105f9306b6d15492090453e96988d39 { - throw Exception( - ErrorCodes::BAD_REQUEST_PARAMETER, + throw Exception(ErrorCodes::BAD_REQUEST_PARAMETER, "Failed to parse OpenTelemetry traceparent header '{}': {}", - opentelemetry_traceparent, - error); + opentelemetry_traceparent, error); } context.getClientInfo().client_trace_context.tracestate = request.get("tracestate", ""); @@ -321,7 +332,8 @@ void HTTPHandler::processQuery( // Set the query id supplied by the user, if any, and also update the // OpenTelemetry fields. - context.setCurrentQueryId(params.get("query_id", request.get("X-ClickHouse-Query-Id", ""))); + context.setCurrentQueryId(params.get("query_id", + request.get("X-ClickHouse-Query-Id", ""))); /// The client can pass a HTTP header indicating supported compression method (gzip or deflate). String http_response_compression_methods = request.get("Accept-Encoding", ""); @@ -341,8 +353,6 @@ void HTTPHandler::processQuery( http_response_compression_method = CompressionMethod::Zlib; else if (std::string::npos != http_response_compression_methods.find("xz")) http_response_compression_method = CompressionMethod::Xz; - else if (std::string::npos != http_response_compression_methods.find("zstd")) - http_response_compression_method = CompressionMethod::Zstd; } bool client_supports_http_compression = http_response_compression_method != CompressionMethod::None; @@ -352,8 +362,8 @@ void HTTPHandler::processQuery( bool internal_compression = params.getParsed("compress", false); /// At least, we should postpone sending of first buffer_size result bytes - size_t buffer_size_total - = std::max(params.getParsed("buffer_size", DBMS_DEFAULT_BUFFER_SIZE), static_cast(DBMS_DEFAULT_BUFFER_SIZE)); + size_t buffer_size_total = std::max( + params.getParsed("buffer_size", DBMS_DEFAULT_BUFFER_SIZE), static_cast(DBMS_DEFAULT_BUFFER_SIZE)); /// If it is specified, the whole result will be buffered. /// First ~buffer_size bytes will be buffered in memory, the remaining bytes will be stored in temporary file. @@ -385,21 +395,23 @@ void HTTPHandler::processQuery( const std::string tmp_path(context.getTemporaryVolume()->getDisk()->getPath()); const std::string tmp_path_template(tmp_path + "http_buffers/"); - auto create_tmp_disk_buffer - = [tmp_path_template](const WriteBufferPtr &) { return WriteBufferFromTemporaryFile::create(tmp_path_template); }; + auto create_tmp_disk_buffer = [tmp_path_template] (const WriteBufferPtr &) + { + return WriteBufferFromTemporaryFile::create(tmp_path_template); + }; cascade_buffer2.emplace_back(std::move(create_tmp_disk_buffer)); } else { - auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed](const WriteBufferPtr & prev_buf) + auto push_memory_buffer_and_continue = [next_buffer = used_output.out_maybe_compressed] (const WriteBufferPtr & prev_buf) { auto * prev_memory_buffer = typeid_cast(prev_buf.get()); if (!prev_memory_buffer) throw Exception("Expected MemoryWriteBuffer", ErrorCodes::LOGICAL_ERROR); auto rdbuf = prev_memory_buffer->tryGetReadBuffer(); - copyData(*rdbuf, *next_buffer); + copyData(*rdbuf , *next_buffer); return next_buffer; }; @@ -407,8 +419,8 @@ void HTTPHandler::processQuery( cascade_buffer2.emplace_back(push_memory_buffer_and_continue); } - used_output.out_maybe_delayed_and_compressed - = std::make_shared(std::move(cascade_buffer1), std::move(cascade_buffer2)); + used_output.out_maybe_delayed_and_compressed = std::make_shared( + std::move(cascade_buffer1), std::move(cascade_buffer2)); } else { @@ -434,23 +446,12 @@ void HTTPHandler::processQuery( std::unique_ptr in; - static const NameSet reserved_param_names{ - "compress", - "decompress", - "user", - "password", - "quota_key", - "query_id", - "stacktrace", - "buffer_size", - "wait_end_of_query", - "session_id", - "session_timeout", - "session_check"}; + static const NameSet reserved_param_names{"compress", "decompress", "user", "password", "quota_key", "query_id", "stacktrace", + "buffer_size", "wait_end_of_query", "session_id", "session_timeout", "session_check"}; Names reserved_param_suffixes; - auto param_could_be_skipped = [&](const String & name) + auto param_could_be_skipped = [&] (const String & name) { /// Empty parameter appears when URL like ?&a=b or a=b&&c=d. Just skip them for user's convenience. if (name.empty()) @@ -576,66 +577,61 @@ void HTTPHandler::processQuery( client_info.http_method = http_method; client_info.http_user_agent = request.get("User-Agent", ""); - auto append_callback = [&context](ProgressCallback callback) + auto append_callback = [&context] (ProgressCallback callback) { auto prev = context.getProgressCallback(); - context.setProgressCallback( - [prev, callback](const Progress & progress) - { - if (prev) - prev(progress); + context.setProgressCallback([prev, callback] (const Progress & progress) + { + if (prev) + prev(progress); - callback(progress); - }); + callback(progress); + }); }; /// While still no data has been sent, we will report about query execution progress by sending HTTP headers. if (settings.send_progress_in_http_headers) - append_callback([&used_output](const Progress & progress) { used_output.out->onProgress(progress); }); + append_callback([&used_output] (const Progress & progress) { used_output.out->onProgress(progress); }); if (settings.readonly > 0 && settings.cancel_http_readonly_queries_on_client_close) { Poco::Net::StreamSocket & socket = dynamic_cast(request).socket(); - append_callback( - [&context, &socket](const Progress &) + append_callback([&context, &socket](const Progress &) + { + /// Assume that at the point this method is called no one is reading data from the socket any more. + /// True for read-only queries. + try { - /// Assume that at the point this method is called no one is reading data from the socket any more. - /// True for read-only queries. - try - { - char b; - int status = socket.receiveBytes(&b, 1, MSG_DONTWAIT | MSG_PEEK); - if (status == 0) - context.killCurrentQuery(); - } - catch (Poco::TimeoutException &) - { - } - catch (...) - { + char b; + int status = socket.receiveBytes(&b, 1, MSG_DONTWAIT | MSG_PEEK); + if (status == 0) context.killCurrentQuery(); - } - }); + } + catch (Poco::TimeoutException &) + { + } + catch (...) + { + context.killCurrentQuery(); + } + }); } customizeContext(request, context); query_scope.emplace(context); - executeQuery( - *in, - *used_output.out_maybe_delayed_and_compressed, - /* allow_into_outfile = */ false, - context, - [&response](const String & current_query_id, const String & content_type, const String & format, const String & timezone) + executeQuery(*in, *used_output.out_maybe_delayed_and_compressed, /* allow_into_outfile = */ false, context, + [&response] (const String & current_query_id, const String & content_type, const String & format, const String & timezone) { response.setContentType(content_type); response.add("X-ClickHouse-Query-Id", current_query_id); response.add("X-ClickHouse-Format", format); response.add("X-ClickHouse-Timezone", timezone); - }); + } + ); if (used_output.hasDelayed()) { @@ -648,11 +644,8 @@ void HTTPHandler::processQuery( used_output.out->finalize(); } -void HTTPHandler::trySendExceptionToClient( - const std::string & s, - int exception_code, - Poco::Net::HTTPServerRequest & request, - Poco::Net::HTTPServerResponse & response, +void HTTPHandler::trySendExceptionToClient(const std::string & s, int exception_code, + Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, Output & used_output) { try @@ -661,14 +654,17 @@ void HTTPHandler::trySendExceptionToClient( /// If HTTP method is POST and Keep-Alive is turned on, we should read the whole request body /// to avoid reading part of the current request body in the next request. - if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && response.getKeepAlive() && !request.stream().eof() + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST + && response.getKeepAlive() + && !request.stream().eof() && exception_code != ErrorCodes::HTTP_LENGTH_REQUIRED) { request.stream().ignore(std::numeric_limits::max()); } - bool auth_fail = exception_code == ErrorCodes::UNKNOWN_USER || exception_code == ErrorCodes::WRONG_PASSWORD - || exception_code == ErrorCodes::REQUIRED_PASSWORD; + bool auth_fail = exception_code == ErrorCodes::UNKNOWN_USER || + exception_code == ErrorCodes::WRONG_PASSWORD || + exception_code == ErrorCodes::REQUIRED_PASSWORD; if (auth_fail) { @@ -746,12 +742,10 @@ void HTTPHandler::handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Ne with_stacktrace = params.getParsed("stacktrace", false); /// Workaround. Poco does not detect 411 Length Required case. - if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && !request.getChunkedTransferEncoding() - && !request.hasContentLength()) + if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST && !request.getChunkedTransferEncoding() && + !request.hasContentLength()) { - throw Exception( - "The Transfer-Encoding is not chunked and there is no Content-Length header for POST request", - ErrorCodes::HTTP_LENGTH_REQUIRED); + throw Exception("The Transfer-Encoding is not chunked and there is no Content-Length header for POST request", ErrorCodes::HTTP_LENGTH_REQUIRED); } processQuery(context, request, params, response, used_output, query_scope); @@ -779,7 +773,7 @@ DynamicQueryHandler::DynamicQueryHandler(IServer & server_, const std::string & bool DynamicQueryHandler::customizeQueryParam(Context & context, const std::string & key, const std::string & value) { if (key == param_name) - return true; /// do nothing + return true; /// do nothing if (startsWith(key, "param_")) { @@ -794,6 +788,7 @@ bool DynamicQueryHandler::customizeQueryParam(Context & context, const std::stri std::string DynamicQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request, HTMLForm & params, Context & context) { + if (likely(!startsWith(request.getContentType(), "multipart/form-data"))) { /// Part of the query can be passed in the 'query' parameter and the rest in the request body @@ -818,16 +813,10 @@ std::string DynamicQueryHandler::getQuery(Poco::Net::HTTPServerRequest & request } PredefinedQueryHandler::PredefinedQueryHandler( - IServer & server_, - const NameSet & receive_params_, - const std::string & predefined_query_, - const CompiledRegexPtr & url_regex_, - const std::unordered_map & header_name_with_regex_) - : HTTPHandler(server_, "PredefinedQueryHandler") - , receive_params(receive_params_) - , predefined_query(predefined_query_) - , url_regex(url_regex_) - , header_name_with_capture_regex(header_name_with_regex_) + IServer & server_, const NameSet & receive_params_, const std::string & predefined_query_ + , const CompiledRegexPtr & url_regex_, const std::unordered_map & header_name_with_regex_) + : HTTPHandler(server_, "PredefinedQueryHandler"), receive_params(receive_params_), predefined_query(predefined_query_) + , url_regex(url_regex_), header_name_with_capture_regex(header_name_with_regex_) { } @@ -893,21 +882,17 @@ std::string PredefinedQueryHandler::getQuery(Poco::Net::HTTPServerRequest & requ Poco::Net::HTTPRequestHandlerFactory * createDynamicHandlerFactory(IServer & server, const std::string & config_prefix) { std::string query_param_name = server.config().getString(config_prefix + ".handler.query_param_name", "query"); - return addFiltersFromConfig( - new HandlingRuleHTTPHandlerFactory(server, std::move(query_param_name)), server.config(), config_prefix); + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory(server, std::move(query_param_name)), server.config(), config_prefix); } static inline bool capturingNamedQueryParam(NameSet receive_params, const CompiledRegexPtr & compiled_regex) { const auto & capturing_names = compiled_regex->NamedCapturingGroups(); - return std::count_if( - capturing_names.begin(), - capturing_names.end(), - [&](const auto & iterator) - { - return std::count_if( - receive_params.begin(), receive_params.end(), [&](const auto & param_name) { return param_name == iterator.first; }); - }); + return std::count_if(capturing_names.begin(), capturing_names.end(), [&](const auto & iterator) + { + return std::count_if(receive_params.begin(), receive_params.end(), + [&](const auto & param_name) { return param_name == iterator.first; }); + }); } static inline CompiledRegexPtr getCompiledRegex(const std::string & expression) @@ -915,10 +900,8 @@ static inline CompiledRegexPtr getCompiledRegex(const std::string & expression) auto compiled_regex = std::make_shared(expression); if (!compiled_regex->ok()) - throw Exception( - "Cannot compile re2: " + expression + " for http handling rule, error: " + compiled_regex->error() - + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", - ErrorCodes::CANNOT_COMPILE_REGEXP); + throw Exception("Cannot compile re2: " + expression + " for http handling rule, error: " + + compiled_regex->error() + ". Look at https://github.com/google/re2/wiki/Syntax for reference.", ErrorCodes::CANNOT_COMPILE_REGEXP); return compiled_regex; } @@ -928,8 +911,7 @@ Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & Poco::Util::AbstractConfiguration & configuration = server.config(); if (!configuration.has(config_prefix + ".handler.query")) - throw Exception( - "There is no path '" + config_prefix + ".handler.query" + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG); + throw Exception("There is no path '" + config_prefix + ".handler.query" + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG); std::string predefined_query = configuration.getString(config_prefix + ".handler.query"); NameSet analyze_receive_params = analyzeReceiveQueryParams(predefined_query); @@ -960,22 +942,14 @@ Poco::Net::HTTPRequestHandlerFactory * createPredefinedHandlerFactory(IServer & auto regex = getCompiledRegex(url_expression); if (capturingNamedQueryParam(analyze_receive_params, regex)) - return addFiltersFromConfig( - new HandlingRuleHTTPHandlerFactory( - server, - std::move(analyze_receive_params), - std::move(predefined_query), - std::move(regex), - std::move(headers_name_with_regex)), - configuration, - config_prefix); + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( + server, std::move(analyze_receive_params), std::move(predefined_query), std::move(regex), + std::move(headers_name_with_regex)), configuration, config_prefix); } - return addFiltersFromConfig( - new HandlingRuleHTTPHandlerFactory( - server, std::move(analyze_receive_params), std::move(predefined_query), CompiledRegexPtr{}, std::move(headers_name_with_regex)), - configuration, - config_prefix); + return addFiltersFromConfig(new HandlingRuleHTTPHandlerFactory( + server, std::move(analyze_receive_params), std::move(predefined_query), CompiledRegexPtr{} ,std::move(headers_name_with_regex)), + configuration, config_prefix); } } From 08b8eb8fc244ccbfc06fdf53bd3c2d94a43a5b62 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Sun, 29 Nov 2020 15:59:56 +0300 Subject: [PATCH 15/48] resolved conflict, added new compression method in http --- src/Server/HTTPHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index e7cdcd62bfb..34d510e4cb2 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -353,6 +353,8 @@ void HTTPHandler::processQuery( http_response_compression_method = CompressionMethod::Zlib; else if (std::string::npos != http_response_compression_methods.find("xz")) http_response_compression_method = CompressionMethod::Xz; + else if (std::string::npos != http_response_compression_methods.find("zstd")) + http_response_compression_method = CompressionMethod::Zstd; } bool client_supports_http_compression = http_response_compression_method != CompressionMethod::None; From 1e7172514365cf125f3e4fff638c3c804b22a790 Mon Sep 17 00:00:00 2001 From: "a.palagashvili" Date: Sun, 29 Nov 2020 16:02:04 +0300 Subject: [PATCH 16/48] fix typo --- src/IO/CompressionMethod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IO/CompressionMethod.cpp b/src/IO/CompressionMethod.cpp index d627fb03e77..8c0c2744a0a 100644 --- a/src/IO/CompressionMethod.cpp +++ b/src/IO/CompressionMethod.cpp @@ -71,7 +71,7 @@ CompressionMethod chooseCompressionMethod(const std::string & path, const std::s return CompressionMethod::None; throw Exception( - "Unknown compression method " + hint + ". Only 'auto', 'none', 'gzip', 'br', 'xz', 'zst' are supported as compression methods", + "Unknown compression method " + hint + ". Only 'auto', 'none', 'gzip', 'br', 'xz', 'zstd' are supported as compression methods", ErrorCodes::NOT_IMPLEMENTED); } From 6d8cf30f5d8555d3c3be9c77f49c3d71742e5869 Mon Sep 17 00:00:00 2001 From: taichong Date: Mon, 30 Nov 2020 16:31:09 +0800 Subject: [PATCH 17/48] add integration test: MySQL killed while insert for MaterializeMySQL ENGINE --- .../materialize_with_ddl.py | 37 +++++++++++++++++++ .../test_materialize_mysql_database/test.py | 8 ++++ 2 files changed, 45 insertions(+) diff --git a/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py b/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py index 7e8688fab0a..3e50ff4ca1a 100644 --- a/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py +++ b/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py @@ -652,3 +652,40 @@ def mysql_kill_sync_thread_restore_test(clickhouse_node, mysql_node, service_nam mysql_node.query("DROP DATABASE test_database") +def mysql_killed_while_insert(clickhouse_node, mysql_node, service_name): + mysql_node.query("CREATE DATABASE kill_mysql_while_insert") + mysql_node.query("CREATE TABLE kill_mysql_while_insert.test ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB;") + clickhouse_node.query("CREATE DATABASE kill_mysql_while_insert ENGINE = MaterializeMySQL('{}:3306', 'kill_mysql_while_insert', 'root', 'clickhouse')".format(service_name)) + check_query(clickhouse_node, "SHOW TABLES FROM kill_mysql_while_insert FORMAT TSV", 'test\n') + try: + def insert(num): + for i in range(num): + query = "INSERT INTO kill_mysql_while_insert.test VALUES({v});".format( v = i + 1 ) + mysql_node.query(query) + + t = threading.Thread(target=insert, args=(10000,)) + t.start() + + subprocess.check_call( + ['docker-compose', '-p', mysql_node.project_name, '-f', mysql_node.docker_compose, 'stop']) + finally: + with pytest.raises(QueryRuntimeException) as execption: + time.sleep(5) + clickhouse_node.query("SELECT count() FROM kill_mysql_while_insert.test") + assert "Master maybe lost." in str(execption.value) + + subprocess.check_call( + ['docker-compose', '-p', mysql_node.project_name, '-f', mysql_node.docker_compose, 'start']) + mysql_node.wait_mysql_to_start(120) + + clickhouse_node.query("DETACH DATABASE kill_mysql_while_insert") + clickhouse_node.query("ATTACH DATABASE kill_mysql_while_insert") + + result = mysql_node.query_and_get_data("SELECT COUNT(1) FROM kill_mysql_while_insert.test") + for row in result: + res = str(row[0]) + '\n' + check_query(clickhouse_node, "SELECT count() FROM kill_mysql_while_insert.test", res) + + mysql_node.query("DROP DATABASE kill_mysql_while_insert") + clickhouse_node.query("DROP DATABASE kill_mysql_while_insert") + diff --git a/tests/integration/test_materialize_mysql_database/test.py b/tests/integration/test_materialize_mysql_database/test.py index 5d23cddcf69..053cd9243a9 100644 --- a/tests/integration/test_materialize_mysql_database/test.py +++ b/tests/integration/test_materialize_mysql_database/test.py @@ -210,3 +210,11 @@ def test_mysql_kill_sync_thread_restore_5_7(started_cluster, started_mysql_5_7): def test_mysql_kill_sync_thread_restore_8_0(started_cluster, started_mysql_8_0): materialize_with_ddl.mysql_kill_sync_thread_restore_test(clickhouse_node, started_mysql_8_0, "mysql8_0") + + +def test_mysql_killed_while_insert_5_7(started_cluster, started_mysql_5_7): + materialize_with_ddl.mysql_killed_while_insert(clickhouse_node, started_mysql_5_7, "mysql1") + +def test_mysql_killed_while_insert_8_0(started_cluster, started_mysql_8_0): + materialize_with_ddl.mysql_killed_while_insert(clickhouse_node, started_mysql_8_0, "mysql8_0") + From 5b505dd74941b9709fbc1509c9e993651635c10f Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Mon, 30 Nov 2020 23:33:30 +0300 Subject: [PATCH 18/48] Update partition.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Внес поправки в английскую версию. --- .../statements/alter/partition.md | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/docs/en/sql-reference/statements/alter/partition.md b/docs/en/sql-reference/statements/alter/partition.md index 3e59835333e..f0561485ea6 100644 --- a/docs/en/sql-reference/statements/alter/partition.md +++ b/docs/en/sql-reference/statements/alter/partition.md @@ -233,6 +233,46 @@ ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' ``` +## UPDATE IN PARTITION {#update-in-partition} + +Allows to manipulate data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). + +Syntax: + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] [IN PARTITION partition_id] WHERE filter_expr +``` + +### Example + +``` sql +ALTER TABLE mt UPDATE x = x + 1 IN PARTITION 2 WHERE p = 2; +``` + +### See Also + +- [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) + +## DELETE IN PARTITION {#delete-in-partition} + +Allows to delete data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). + +Syntax: + +``` sql +ALTER TABLE [db.]table DELETE [IN PARTITION partition_id] WHERE filter_expr +``` + +### Example + +``` sql +ALTER TABLE mt DELETE IN PARTITION 2 WHERE p = 2; +``` + +### See Also + +- [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) + ## How to Set Partition Expression {#alter-how-to-specify-part-expr} You can specify the partition expression in `ALTER ... PARTITION` queries in different ways: @@ -250,28 +290,6 @@ All the rules above are also true for the [OPTIMIZE](../../../sql-reference/stat OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ``` -## UPDATE\|DELETE IN PARTITION {#update-delete-in-partition} - -``` sql -ALTER TABLE table_name UPDATE update_expr [IN PARTITION partition_id] WHERE where_expr -``` - -``` sql -ALTER TABLE table_name DELETE [IN PARTITION partition_id] WHERE where_expr -``` - -`IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. - -In this way, `IN PARTITION` helps reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. - -Examples: - -``` sql -ALTER TABLE mt UPDATE x = x + 1 IN PARTITION 2 WHERE p = 2; -``` - -``` sql -ALTER TABLE mt DELETE IN PARTITION 2 WHERE p = 2; -``` +`IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. In this way, `IN PARTITION` helps reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. The examples of `ALTER ... PARTITION` queries are demonstrated in the tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) and [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). From 88133860d74ee5d664cac070b5e53c24cc1dbf45 Mon Sep 17 00:00:00 2001 From: tavplubix Date: Tue, 1 Dec 2020 13:22:29 +0300 Subject: [PATCH 19/48] Update renameat2.cpp --- src/Common/renameat2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Common/renameat2.cpp b/src/Common/renameat2.cpp index 24e414122dc..a735a9d72d4 100644 --- a/src/Common/renameat2.cpp +++ b/src/Common/renameat2.cpp @@ -67,6 +67,10 @@ static bool renameat2(const std::string & old_path, const std::string & new_path /// Other cases when EINVAL can be returned should never happen. if (errno == EINVAL) return false; + /// We should never get ENOSYS on Linux, because we check kernel version in supportsRenameat2Impl(). + /// However, we can get in on WSL. + if (errno == ENOSYS) + return false; if (errno == EEXIST) throwFromErrno("Cannot rename " + old_path + " to " + new_path + " because the second path already exists", ErrorCodes::ATOMIC_RENAME_FAIL); From 031ddaedd4efe016f291f191ab3ae41c4e41a375 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 1 Dec 2020 14:32:33 +0300 Subject: [PATCH 20/48] Update docker image in integration tests runner --- docker/test/integration/runner/Dockerfile | 39 ++++++++++------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/docker/test/integration/runner/Dockerfile b/docker/test/integration/runner/Dockerfile index 70b57b245d3..36188fc4a63 100644 --- a/docker/test/integration/runner/Dockerfile +++ b/docker/test/integration/runner/Dockerfile @@ -28,6 +28,7 @@ RUN apt-get update \ libssl-dev \ libcurl4-openssl-dev \ gdb \ + software-properties-common \ && rm -rf \ /var/lib/apt/lists/* \ /var/cache/debconf \ @@ -37,6 +38,22 @@ RUN apt-get update \ ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +ENV DOCKER_CHANNEL stable +ENV DOCKER_VERSION 5:19.03.13~3-0~ubuntu-bionic +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -c -s) ${DOCKER_CHANNEL}" + +RUN apt-get update \ + && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \ + docker-ce \ + && rm -rf \ + /var/lib/apt/lists/* \ + /var/cache/debconf \ + /tmp/* \ + && apt-get clean + +RUN dockerd --version; docker --version + RUN python3 -m pip install \ PyMySQL \ aerospike \ @@ -60,28 +77,6 @@ RUN python3 -m pip install \ tzlocal \ urllib3 -ENV DOCKER_CHANNEL stable -ENV DOCKER_VERSION 17.09.1-ce - -RUN set -eux; \ - \ -# this "case" statement is generated via "update.sh" - \ - if ! wget -nv -O docker.tgz "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz"; then \ - echo >&2 "error: failed to download 'docker-${DOCKER_VERSION}' from '${DOCKER_CHANNEL}' for '${x86_64}'"; \ - exit 1; \ - fi; \ - \ - tar --extract \ - --file docker.tgz \ - --strip-components 1 \ - --directory /usr/local/bin/ \ - ; \ - rm docker.tgz; \ - \ - dockerd --version; \ - docker --version - COPY modprobe.sh /usr/local/bin/modprobe COPY dockerd-entrypoint.sh /usr/local/bin/ COPY compose/ /compose/ From 51f49e3d4716b7cb3042c6e1d9859a1dd25257f4 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 1 Dec 2020 23:23:32 +0300 Subject: [PATCH 21/48] Check output of cluster start cmd --- tests/integration/helpers/cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py index b712bad756e..3967d016591 100644 --- a/tests/integration/helpers/cluster.py +++ b/tests/integration/helpers/cluster.py @@ -679,7 +679,7 @@ class ClickHouseCluster: clickhouse_start_cmd = self.base_cmd + ['up', '-d', '--no-recreate'] print(("Trying to create ClickHouse instance by command %s", ' '.join(map(str, clickhouse_start_cmd)))) - subprocess_check_call(clickhouse_start_cmd) + subprocess.check_output(clickhouse_start_cmd) print("ClickHouse instance created") start_deadline = time.time() + 20.0 # seconds From 9b72323594bf60e6991e4db1873b5bd41b69c8f6 Mon Sep 17 00:00:00 2001 From: Ilya Yatsishin <2159081+qoega@users.noreply.github.com> Date: Wed, 2 Dec 2020 17:54:52 +0300 Subject: [PATCH 22/48] Try fix arcadia build (#17720) * Try fix arcadia build * fix --- base/common/ya.make | 3 +-- base/common/ya.make.in | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/base/common/ya.make b/base/common/ya.make index adbbe17b486..9b38e3919be 100644 --- a/base/common/ya.make +++ b/base/common/ya.make @@ -5,7 +5,6 @@ LIBRARY() ADDINCL( GLOBAL clickhouse/base - GLOBAL contrib/libs/cctz/include ) CFLAGS (GLOBAL -DARCADIA_BUILD) @@ -24,7 +23,7 @@ ELSEIF (OS_LINUX) ENDIF () PEERDIR( - contrib/libs/cctz/src + contrib/libs/cctz contrib/libs/cxxsupp/libcxx-filesystem contrib/libs/poco/Net contrib/libs/poco/Util diff --git a/base/common/ya.make.in b/base/common/ya.make.in index bcac67c7923..b5c2bbc1717 100644 --- a/base/common/ya.make.in +++ b/base/common/ya.make.in @@ -4,7 +4,6 @@ LIBRARY() ADDINCL( GLOBAL clickhouse/base - GLOBAL contrib/libs/cctz/include ) CFLAGS (GLOBAL -DARCADIA_BUILD) @@ -23,7 +22,7 @@ ELSEIF (OS_LINUX) ENDIF () PEERDIR( - contrib/libs/cctz/src + contrib/libs/cctz contrib/libs/cxxsupp/libcxx-filesystem contrib/libs/poco/Net contrib/libs/poco/Util From 7e2f7ba623c4ea4e68e84437cb895c86188904a0 Mon Sep 17 00:00:00 2001 From: tavplubix Date: Wed, 2 Dec 2020 18:03:15 +0300 Subject: [PATCH 23/48] trigger CI --- .../test_materialize_mysql_database/materialize_with_ddl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py b/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py index ddfc9e20e8f..56b6d8b3a15 100644 --- a/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py +++ b/tests/integration/test_materialize_mysql_database/materialize_with_ddl.py @@ -657,6 +657,7 @@ def mysql_killed_while_insert(clickhouse_node, mysql_node, service_name): mysql_node.query("CREATE TABLE kill_mysql_while_insert.test ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB;") clickhouse_node.query("CREATE DATABASE kill_mysql_while_insert ENGINE = MaterializeMySQL('{}:3306', 'kill_mysql_while_insert', 'root', 'clickhouse')".format(service_name)) check_query(clickhouse_node, "SHOW TABLES FROM kill_mysql_while_insert FORMAT TSV", 'test\n') + try: def insert(num): for i in range(num): From 7f723eb7802b32e60c24bf7b7a6fb3d569ae6243 Mon Sep 17 00:00:00 2001 From: spongedc Date: Thu, 3 Dec 2020 00:45:17 +0800 Subject: [PATCH 24/48] add check for systemlog tables' engine definition --- src/Interpreters/SystemLog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index 97d5cbb8eab..c917716f018 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -74,6 +74,9 @@ std::shared_ptr createSystemLog( engine += " TTL " + ttl; engine += " ORDER BY (event_date, event_time)"; } + ParserStorage storage_parser; + parseQuery(storage_parser, engine.data(), engine.data() + engine.size(), + "Storage to create table for " + config_prefix, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH); size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS); From b13c381d7eb91c692e2d18e11314602c19953a0a Mon Sep 17 00:00:00 2001 From: spongedc Date: Thu, 3 Dec 2020 01:02:37 +0800 Subject: [PATCH 25/48] add log for systemlog tables' engine definition check --- src/Interpreters/SystemLog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index c917716f018..1667d845d77 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -74,6 +74,7 @@ std::shared_ptr createSystemLog( engine += " TTL " + ttl; engine += " ORDER BY (event_date, event_time)"; } + // Validate engine definition grammatically to prevent some configuration errors ParserStorage storage_parser; parseQuery(storage_parser, engine.data(), engine.data() + engine.size(), "Storage to create table for " + config_prefix, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH); From 5365718f011329442984786bf29430ca9db6af05 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 2 Dec 2020 20:11:39 +0300 Subject: [PATCH 26/48] Fix optimize_distributed_group_by_sharding_key for query with OFFSET only (#16996) * Fix optimize_distributed_group_by_sharding_key for query with OFFSET only * Fix 01244_optimize_distributed_group_by_sharding_key flakiness --- src/Storages/StorageDistributed.cpp | 3 ++- ...01244_optimize_distributed_group_by_sharding_key.reference | 4 ++++ .../01244_optimize_distributed_group_by_sharding_key.sql | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index 09667484dea..a991103d33b 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -315,7 +315,8 @@ std::optional getOptimizedQueryProcessingStage(const // LIMIT BY // LIMIT - if (select.limitBy() || select.limitLength()) + // OFFSET + if (select.limitBy() || select.limitLength() || select.limitOffset()) return QueryProcessingStage::WithMergeableStateAfterAggregation; // Only simple SELECT FROM GROUP BY sharding_key can use Complete state. diff --git a/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.reference b/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.reference index bd01c335399..d1697bd2310 100644 --- a/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.reference +++ b/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.reference @@ -57,6 +57,10 @@ LIMIT 1 0 LIMIT OFFSET 1 1 +OFFSET +1 1 +1 0 +1 1 WHERE LIMIT OFFSET 1 1 LIMIT BY 1 diff --git a/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.sql b/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.sql index 41311a9d3a7..9bc50ae2fc7 100644 --- a/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.sql +++ b/tests/queries/0_stateless/01244_optimize_distributed_group_by_sharding_key.sql @@ -16,6 +16,7 @@ create table dist_01247 as data_01247 engine=Distributed(test_cluster_two_shards -- (and this is how we ensure that this optimization will work) set max_distributed_connections=1; +set prefer_localhost_replica=0; select '-'; select * from dist_01247; @@ -63,6 +64,8 @@ select 'LIMIT'; select count(), * from dist_01247 group by number limit 1; select 'LIMIT OFFSET'; select count(), * from dist_01247 group by number limit 1 offset 1; +select 'OFFSET'; +select count(), * from dist_01247 group by number offset 1; -- this will emulate different data on for different shards select 'WHERE LIMIT OFFSET'; select count(), * from dist_01247 where number = _shard_num-1 group by number limit 1 offset 1; From eac2ff6311df868640ebbfc38c17087f37c8e661 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Wed, 2 Dec 2020 20:22:54 +0200 Subject: [PATCH 27/48] Improve showing identifier examples on syntax docs Signed-off-by: Matthew Peveler --- docs/en/sql-reference/syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/sql-reference/syntax.md b/docs/en/sql-reference/syntax.md index 296f5c7c5f3..cb9119773d0 100644 --- a/docs/en/sql-reference/syntax.md +++ b/docs/en/sql-reference/syntax.md @@ -57,7 +57,7 @@ Identifiers are: Identifiers can be quoted or non-quoted. The latter is preferred. -Non-quoted identifiers must match the regex `^[0-9a-zA-Z_]*[a-zA-Z_]$` and can not be equal to [keywords](#syntax-keywords). Examples: `x, _1, X_y__Z123_.` +Non-quoted identifiers must match the regex `^[0-9a-zA-Z_]*[a-zA-Z_]$` and can not be equal to [keywords](#syntax-keywords). Examples: `x`, `_1`, `X_y__Z123_`. If you want to use identifiers the same as keywords or you want to use other symbols in identifiers, quote it using double quotes or backticks, for example, `"id"`, `` `id` ``. From 4479cfbcb0b27330daf4f08ee5f40503b81da798 Mon Sep 17 00:00:00 2001 From: Anna Shakhova <72564598+annvsh@users.noreply.github.com> Date: Thu, 3 Dec 2020 02:03:24 +0700 Subject: [PATCH 28/48] DOCSUP-3871: Document prefer_not_to_merge option (#17090) * Init commit * Translation * Fixed * Fixed * Fixed * Fixed --- .../table-engines/mergetree-family/mergetree.md | 13 +++++++++++++ .../operations/system-tables/storage_policies.md | 1 + docs/en/sql-reference/statements/system.md | 4 ++-- .../table-engines/mergetree-family/mergetree.md | 14 ++++++++++++++ .../operations/system-tables/storage_policies.md | 1 + docs/ru/sql-reference/statements/system.md | 4 ++-- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/en/engines/table-engines/mergetree-family/mergetree.md b/docs/en/engines/table-engines/mergetree-family/mergetree.md index 584bd31e276..5f99ff99dab 100644 --- a/docs/en/engines/table-engines/mergetree-family/mergetree.md +++ b/docs/en/engines/table-engines/mergetree-family/mergetree.md @@ -579,6 +579,7 @@ Tags: - `disk` — a disk within a volume. - `max_data_part_size_bytes` — the maximum size of a part that can be stored on any of the volume’s disks. - `move_factor` — when the amount of available space gets lower than this factor, data automatically start to move on the next volume if any (by default, 0.1). +- `prefer_not_to_merge` — Disables merging of data parts on this volume. When this setting is enabled, merging data on this volume is not allowed. This allows controlling how ClickHouse works with slow disks. Cofiguration examples: @@ -607,6 +608,18 @@ Cofiguration examples: 0.2 + + + +
+ jbod1 +
+ + external + true + +
+
... diff --git a/docs/en/operations/system-tables/storage_policies.md b/docs/en/operations/system-tables/storage_policies.md index c8171b50aed..5adab1cb2aa 100644 --- a/docs/en/operations/system-tables/storage_policies.md +++ b/docs/en/operations/system-tables/storage_policies.md @@ -10,6 +10,7 @@ Columns: - `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — Disk names, defined in the storage policy. - `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Maximum size of a data part that can be stored on volume disks (0 — no limit). - `move_factor` ([Float64](../../sql-reference/data-types/float.md)) — Ratio of free disk space. When the ratio exceeds the value of configuration parameter, ClickHouse start to move data to the next volume in order. +- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Value of the `prefer_not_to_merge` setting. When this setting is enabled, merging data on this volume is not allowed. This allows controlling how ClickHouse works with slow disks. If the storage policy contains more then one volume, then information for each volume is stored in the individual row of the table. diff --git a/docs/en/sql-reference/statements/system.md b/docs/en/sql-reference/statements/system.md index 509b7553536..ddba1443d04 100644 --- a/docs/en/sql-reference/statements/system.md +++ b/docs/en/sql-reference/statements/system.md @@ -152,7 +152,7 @@ ClickHouse can manage background processes in [MergeTree](../../engines/table-en Provides possibility to stop background merges for tables in the MergeTree family: ``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +SYSTEM STOP MERGES [ON VOLUME | [db.]merge_tree_family_table_name] ``` !!! note "Note" @@ -163,7 +163,7 @@ SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] Provides possibility to start background merges for tables in the MergeTree family: ``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] +SYSTEM START MERGES [ON VOLUME | [db.]merge_tree_family_table_name] ``` ### STOP TTL MERGES {#query_language-stop-ttl-merges} diff --git a/docs/ru/engines/table-engines/mergetree-family/mergetree.md b/docs/ru/engines/table-engines/mergetree-family/mergetree.md index 7428c8b0911..f738ce13d7c 100644 --- a/docs/ru/engines/table-engines/mergetree-family/mergetree.md +++ b/docs/ru/engines/table-engines/mergetree-family/mergetree.md @@ -565,6 +565,7 @@ ALTER TABLE example_table - `disk` — диск, находящийся внутри тома. - `max_data_part_size_bytes` — максимальный размер куска данных, который может находится на любом из дисков этого тома. - `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1). +- `prefer_not_to_merge` — Отключает слияние кусков данных, хранящихся на данном томе. Если данная настройка включена, то слияние данных, хранящихся на данном томе, не допускается. Это позволяет контролировать работу ClickHouse с медленными дисками. Примеры конфигураций: @@ -593,6 +594,19 @@ ALTER TABLE example_table 0.2 + + + +
+ jbod1 +
+ + external + true + +
+
+ ... diff --git a/docs/ru/operations/system-tables/storage_policies.md b/docs/ru/operations/system-tables/storage_policies.md index df5c920b5ba..e62266af131 100644 --- a/docs/ru/operations/system-tables/storage_policies.md +++ b/docs/ru/operations/system-tables/storage_policies.md @@ -10,6 +10,7 @@ - `disks` ([Array(String)](../../sql-reference/data-types/array.md)) — имена дисков, содержащихся в политике хранения. - `max_data_part_size` ([UInt64](../../sql-reference/data-types/int-uint.md)) — максимальный размер куска данных, который может храниться на дисках тома (0 — без ограничений). - `move_factor` — доля доступного свободного места на томе, если места становится меньше, то данные начнут перемещение на следующий том, если он есть (по умолчанию 0.1). +- `prefer_not_to_merge` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Значение настройки `prefer_not_to_merge`. Если данная настройка включена, то слияние данных, хранящихся на данном томе, не допускается. Это позволяет контролировать работу ClickHouse с медленными дисками. Если политика хранения содержит несколько томов, то каждому тому соответствует отдельная запись в таблице. diff --git a/docs/ru/sql-reference/statements/system.md b/docs/ru/sql-reference/statements/system.md index 4780e9b613f..4f7ac98807d 100644 --- a/docs/ru/sql-reference/statements/system.md +++ b/docs/ru/sql-reference/statements/system.md @@ -130,7 +130,7 @@ ClickHouse может управлять фоновыми процессами Позволяет остановить фоновые мержи для таблиц семейства MergeTree: ``` sql -SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] +SYSTEM STOP MERGES [ON VOLUME | [db.]merge_tree_family_table_name] ``` !!! note "Note" @@ -141,7 +141,7 @@ SYSTEM STOP MERGES [[db.]merge_tree_family_table_name] Включает фоновые мержи для таблиц семейства MergeTree: ``` sql -SYSTEM START MERGES [[db.]merge_tree_family_table_name] +SYSTEM START MERGES [ON VOLUME | [db.]merge_tree_family_table_name] ``` ### STOP TTL MERGES {#query_language-stop-ttl-merges} From e97ce6afb2d5d3bba7c67dbf34932c3a0bfb77ef Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Wed, 2 Dec 2020 22:43:11 +0300 Subject: [PATCH 29/48] Update syntax.md --- docs/en/sql-reference/syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/sql-reference/syntax.md b/docs/en/sql-reference/syntax.md index cb9119773d0..5d0eee76393 100644 --- a/docs/en/sql-reference/syntax.md +++ b/docs/en/sql-reference/syntax.md @@ -57,7 +57,7 @@ Identifiers are: Identifiers can be quoted or non-quoted. The latter is preferred. -Non-quoted identifiers must match the regex `^[0-9a-zA-Z_]*[a-zA-Z_]$` and can not be equal to [keywords](#syntax-keywords). Examples: `x`, `_1`, `X_y__Z123_`. +Non-quoted identifiers must match the regex `^[a-zA-Z_][0-9a-zA-Z_]*$` and can not be equal to [keywords](#syntax-keywords). Examples: `x`, `_1`, `X_y__Z123_`. If you want to use identifiers the same as keywords or you want to use other symbols in identifiers, quote it using double quotes or backticks, for example, `"id"`, `` `id` ``. From 278cde366caf5d2e72645f26724adb78cf30198b Mon Sep 17 00:00:00 2001 From: Ivan <5627721+abyss7@users.noreply.github.com> Date: Wed, 2 Dec 2020 22:55:48 +0300 Subject: [PATCH 30/48] Update arcadia_skip_list.txt --- tests/queries/0_stateless/arcadia_skip_list.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/arcadia_skip_list.txt b/tests/queries/0_stateless/arcadia_skip_list.txt index 086017ec038..172dd579481 100644 --- a/tests/queries/0_stateless/arcadia_skip_list.txt +++ b/tests/queries/0_stateless/arcadia_skip_list.txt @@ -173,6 +173,6 @@ 00976_ttl_with_old_parts 01584_distributed_buffer_cannot_find_column 01018_ip_dictionary -00976_ttl_with_old_parts +01582_distinct_subquery_groupby 01558_ttest_scipy 01561_mann_whitney_scipy From aca04ebc8709042b83aee05ee2e7ba2b2d124169 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Wed, 2 Dec 2020 23:26:48 +0300 Subject: [PATCH 31/48] Update files in the 'alter'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Внес поправки в английскую версию, выполнил перевод на русский язык, подкорректировал некоторые файлы в 'ALTER'. --- .../sql-reference/statements/alter/delete.md | 2 +- .../statements/alter/partition.md | 6 +-- .../sql-reference/statements/alter/update.md | 2 +- .../sql-reference/statements/alter/delete.md | 2 +- .../statements/alter/partition.md | 42 +++++++++++++++++++ .../sql-reference/statements/alter/update.md | 2 +- 6 files changed, 49 insertions(+), 7 deletions(-) diff --git a/docs/en/sql-reference/statements/alter/delete.md b/docs/en/sql-reference/statements/alter/delete.md index 23a7bf0e8f1..6c638c0a3ac 100644 --- a/docs/en/sql-reference/statements/alter/delete.md +++ b/docs/en/sql-reference/statements/alter/delete.md @@ -9,7 +9,7 @@ toc_title: DELETE ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr ``` -Allows to delete data matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). +Deletes data matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). !!! note "Note" The `ALTER TABLE` prefix makes this syntax different from most other systems supporting SQL. It is intended to signify that unlike similar queries in OLTP databases this is a heavy operation not designed for frequent use. diff --git a/docs/en/sql-reference/statements/alter/partition.md b/docs/en/sql-reference/statements/alter/partition.md index f0561485ea6..517299fc782 100644 --- a/docs/en/sql-reference/statements/alter/partition.md +++ b/docs/en/sql-reference/statements/alter/partition.md @@ -235,7 +235,7 @@ ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' ## UPDATE IN PARTITION {#update-in-partition} -Allows to manipulate data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). +Manipulates data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). Syntax: @@ -255,7 +255,7 @@ ALTER TABLE mt UPDATE x = x + 1 IN PARTITION 2 WHERE p = 2; ## DELETE IN PARTITION {#delete-in-partition} -Allows to delete data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). +Deletes data in the specifies partition matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). Syntax: @@ -290,6 +290,6 @@ All the rules above are also true for the [OPTIMIZE](../../../sql-reference/stat OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ``` -`IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions will be applied as a result of the query `ALTER TABLE`. New parts will be created only from the specified partition. In this way, `IN PARTITION` helps reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. +`IN PARTITION` specifies the partition to which the [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) or [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) expressions are applied as a result of the `ALTER TABLE` query. New parts are created only from the specified partition. In this way, `IN PARTITION` helps to reduce the load when the table is divided into many partitions, and you only need to update the data point-by-point. The examples of `ALTER ... PARTITION` queries are demonstrated in the tests [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) and [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). diff --git a/docs/en/sql-reference/statements/alter/update.md b/docs/en/sql-reference/statements/alter/update.md index 45e00236974..13ea1b2a8db 100644 --- a/docs/en/sql-reference/statements/alter/update.md +++ b/docs/en/sql-reference/statements/alter/update.md @@ -9,7 +9,7 @@ toc_title: UPDATE ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr ``` -Allows to manipulate data matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). +Manipulates data matching the specified filtering expression. Implemented as a [mutation](../../../sql-reference/statements/alter/index.md#mutations). !!! note "Note" The `ALTER TABLE` prefix makes this syntax different from most other systems supporting SQL. It is intended to signify that unlike similar queries in OLTP databases this is a heavy operation not designed for frequent use. diff --git a/docs/ru/sql-reference/statements/alter/delete.md b/docs/ru/sql-reference/statements/alter/delete.md index 29e1ae564d2..ee5f03d9d95 100644 --- a/docs/ru/sql-reference/statements/alter/delete.md +++ b/docs/ru/sql-reference/statements/alter/delete.md @@ -9,7 +9,7 @@ toc_title: DELETE ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr ``` -Позволяет удалить данные, соответствующие указанному выражению фильтрации. Реализовано как [мутация](../../../sql-reference/statements/alter/index.md#mutations). +Удаляет данные, соответствующие указанному выражению фильтрации. Реализовано как [мутация](../../../sql-reference/statements/alter/index.md#mutations). !!! note "Note" Префикс `ALTER TABLE` делает этот синтаксис отличным от большинства других систем, поддерживающих SQL. Он предназначен для обозначения того, что в отличие от аналогичных запросов в базах данных OLTP это тяжелая операция, не предназначенная для частого использования. diff --git a/docs/ru/sql-reference/statements/alter/partition.md b/docs/ru/sql-reference/statements/alter/partition.md index 5c4a23428ad..348f7e9c3db 100644 --- a/docs/ru/sql-reference/statements/alter/partition.md +++ b/docs/ru/sql-reference/statements/alter/partition.md @@ -235,6 +235,46 @@ ALTER TABLE hits MOVE PART '20190301_14343_16206_438' TO VOLUME 'slow' ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' ``` +## UPDATE IN PARTITION {#update-in-partition} + +Манипулирует данными в указанной партиции, соответствующими заданному выражению фильтрации. Реализовано как мутация [mutation](../../../sql-reference/statements/alter/index.md#mutations). + +Синтаксис: + +``` sql +ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] [IN PARTITION partition_id] WHERE filter_expr +``` + +### Пример + +``` sql +ALTER TABLE mt UPDATE x = x + 1 IN PARTITION 2 WHERE p = 2; +``` + +### Смотрите также + +- [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) + +## DELETE IN PARTITION {#delete-in-partition} + +Удаляет данные в указанной партиции, соответствующие указанному выражению фильтрации. Реализовано как мутация [mutation](../../../sql-reference/statements/alter/index.md#mutations). + +Синтаксис: + +``` sql +ALTER TABLE [db.]table DELETE [IN PARTITION partition_id] WHERE filter_expr +``` + +### Пример + +``` sql +ALTER TABLE mt DELETE IN PARTITION 2 WHERE p = 2; +``` + +### Смотрите также + +- [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) + ## Как задавать имя партиции в запросах ALTER {#alter-how-to-specify-part-expr} Чтобы задать нужную партицию в запросах `ALTER ... PARTITION`, можно использовать: @@ -254,6 +294,8 @@ ALTER TABLE hits MOVE PARTITION '2019-09-01' TO DISK 'fast_ssd' OPTIMIZE TABLE table_not_partitioned PARTITION tuple() FINAL; ``` +`IN PARTITION` указывает на партицию, для которой применяются выражения [UPDATE](../../../sql-reference/statements/alter/update.md#alter-table-update-statements) или [DELETE](../../../sql-reference/statements/alter/delete.md#alter-mutations) в результате запроса `ALTER TABLE`. Новые куски создаются только в указанной партиции. Таким образом, `IN PARTITION` помогает снизить нагрузку, когда таблица разбита на множество партиций, а вам нужно обновить данные лишь точечно. + Примеры запросов `ALTER ... PARTITION` можно посмотреть в тестах: [`00502_custom_partitioning_local`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_local.sql) и [`00502_custom_partitioning_replicated_zookeeper`](https://github.com/ClickHouse/ClickHouse/blob/master/tests/queries/0_stateless/00502_custom_partitioning_replicated_zookeeper.sql). [Оригинальная статья](https://clickhouse.tech/docs/ru/query_language/alter/partition/) \ No newline at end of file diff --git a/docs/ru/sql-reference/statements/alter/update.md b/docs/ru/sql-reference/statements/alter/update.md index f497b2c4511..e3d6725419a 100644 --- a/docs/ru/sql-reference/statements/alter/update.md +++ b/docs/ru/sql-reference/statements/alter/update.md @@ -9,7 +9,7 @@ toc_title: UPDATE ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr ``` -Позволяет манипулировать данными, соответствующими заданному выражению фильтрации. Реализовано как [мутация](../../../sql-reference/statements/alter/index.md#mutations). +Манипулирует данными, соответствующими заданному выражению фильтрации. Реализовано как [мутация](../../../sql-reference/statements/alter/index.md#mutations). !!! note "Note" Префикс `ALTER TABLE` делает этот синтаксис отличным от большинства других систем, поддерживающих SQL. Он предназначен для обозначения того, что в отличие от аналогичных запросов в базах данных OLTP это тяжелая операция, не предназначенная для частого использования. From 4b2e3212aa4f03859d5f8b369452683b916ef07e Mon Sep 17 00:00:00 2001 From: jianmei zhang Date: Thu, 3 Dec 2020 10:26:13 +0800 Subject: [PATCH 32/48] modify doc error for drop settings profile and other translation errors. --- docs/zh/sql-reference/statements/misc.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/zh/sql-reference/statements/misc.md b/docs/zh/sql-reference/statements/misc.md index fd3eea9796e..a736ed2af5b 100644 --- a/docs/zh/sql-reference/statements/misc.md +++ b/docs/zh/sql-reference/statements/misc.md @@ -151,7 +151,7 @@ DROP [ROW] POLICY [IF EXISTS] name [,...] ON [database.]table [,...] [ON CLUSTER 删除配额。 -已删除的配额将从分配配额的所有实体撤销。 +已删除的配额将从分配该配额的所有实体撤销。 ### 语法 {#drop-quota-syntax} @@ -161,9 +161,9 @@ DROP QUOTA [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ## DROP SETTINGS PROFILE {#drop-settings-profile-statement} -删除配额。 +删除settings配置。 -已删除的配额将从分配配额的所有实体撤销。 +已删除的settings配置将从分配该settings配置的所有实体撤销。 ### 语法 {#drop-settings-profile-syntax} @@ -177,7 +177,7 @@ DROP [SETTINGS] PROFILE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] EXISTS [TEMPORARY] [TABLE|DICTIONARY] [db.]name [INTO OUTFILE filename] [FORMAT format] ``` -返回单 `UInt8`-type column,其中包含单个值 `0` 如果表或数据库不存在,或 `1` 如果该表存在于指定的数据库中。 +返回单个 `UInt8` 类型的列,其中包含单个值 `0` 如果表或数据库不存在,或 `1` 如果该表存在于指定的数据库中。 ## KILL QUERY {#kill-query-statement} From 3090b545b2e830261f538f6820629b211729b54e Mon Sep 17 00:00:00 2001 From: jetgm Date: Thu, 3 Dec 2020 18:16:49 +0800 Subject: [PATCH 33/48] Fixed Over-translation and wrong function name --- .../functions/string-functions.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/zh/sql-reference/functions/string-functions.md b/docs/zh/sql-reference/functions/string-functions.md index 0dbcc031d56..1c27176a45e 100644 --- a/docs/zh/sql-reference/functions/string-functions.md +++ b/docs/zh/sql-reference/functions/string-functions.md @@ -1,6 +1,6 @@ # 字符串函数 {#zi-fu-chuan-han-shu} -## 空 {#string-functions-empty} +## empty {#string-functions-empty} 对于空字符串返回1,对于非空字符串返回0。 结果类型是UInt8。 @@ -13,13 +13,13 @@ 结果类型是UInt8。 该函数也适用于数组。 -## 长度 {#length} +## length {#length} 返回字符串的字节长度。 结果类型是UInt64。 该函数也适用于数组。 -## 长度8 {#lengthutf8} +## lengthUTF8 {#lengthutf8} 假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 结果类型是UInt64。 @@ -29,16 +29,16 @@ 假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 结果类型是UInt64。 -## 字符长度,字符长度 {#character-length-character-length} +## character_length,CHARACTER_LENGTH {#character-length-character-length} 假定字符串以UTF-8编码组成的文本,返回此字符串的Unicode字符长度。如果传入的字符串不是UTF-8编码,则函数可能返回一个预期外的值(不会抛出异常)。 结果类型是UInt64。 -## 低一点 {#lower-lcase} +## lower, lcase {#lower-lcase} 将字符串中的ASCII转换为小写。 -## 上,ucase {#upper-ucase} +## upper, ucase {#upper-ucase} 将字符串中的ASCII转换为大写。 @@ -84,7 +84,7 @@ SELECT toValidUTF8('\x61\xF0\x80\x80\x80b') └───────────────────────┘ ``` -## 反向 {#reverse} +## reverse {#reverse} 反转字符串。 @@ -118,11 +118,11 @@ SELECT format('{} {}', 'Hello', 'World') 与[concat](#concat-s1-s2)相同,区别在于,你需要保证concat(s1, s2, s3) -\> s4是单射的,它将用于GROUP BY的优化。 -## 子串(s,offset,length),mid(s,offset,length),substr(s,offset,length) {#substrings-offset-length-mids-offset-length-substrs-offset-length} +## substring(s,offset,length),mid(s,offset,length),substr(s,offset,length) {#substrings-offset-length-mids-offset-length-substrs-offset-length} 以字节为单位截取指定位置字符串,返回以’offset’位置为开头,长度为’length’的子串。’offset’从1开始(与标准SQL相同)。’offset’和’length’参数必须是常量。 -## substringf8(s,offset,length) {#substringutf8s-offset-length} +## substringUTF8(s,offset,length) {#substringutf8s-offset-length} 与’substring’相同,但其操作单位为Unicode字符,函数假设字符串是以UTF-8进行编码的文本。如果不是则可能返回一个预期外的结果(不会抛出异常)。 @@ -150,7 +150,7 @@ SELECT format('{} {}', 'Hello', 'World') 返回是否以指定的后缀结尾。如果字符串以指定的后缀结束,则返回1,否则返回0。 -## 开始使用(s,前缀) {#startswiths-prefix} +## startsWith(s,前缀) {#startswiths-prefix} 返回是否以指定的前缀开头。如果字符串以指定的前缀开头,则返回1,否则返回0。 From f29d37421167f5fb6de3888ebaf8f3fd062f7387 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Thu, 3 Dec 2020 16:29:28 +0200 Subject: [PATCH 34/48] Fix note display on alter/index doc Signed-off-by: Matthew Peveler --- docs/en/sql-reference/statements/alter/index/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/en/sql-reference/statements/alter/index/index.md b/docs/en/sql-reference/statements/alter/index/index.md index 5e93d521f38..56d81aaf52f 100644 --- a/docs/en/sql-reference/statements/alter/index/index.md +++ b/docs/en/sql-reference/statements/alter/index/index.md @@ -19,5 +19,4 @@ The first two commands are lightweight in a sense that they only change metadata Also, they are replicated, syncing indices metadata via ZooKeeper. !!! note "Note" - Index manipulation is supported only for tables with [`*MergeTree`](../../../../engines/table-engines/mergetree-family/mergetree.md) engine (including -[replicated](../../../../engines/table-engines/mergetree-family/replication.md) variants). + Index manipulation is supported only for tables with [`*MergeTree`](../../../../engines/table-engines/mergetree-family/mergetree.md) engine (including [replicated](../../../../engines/table-engines/mergetree-family/replication.md) variants). From 44e8e30bf1735d517a4c3a6179c7c9eac65ef0e9 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 08:43:22 -0800 Subject: [PATCH 35/48] removed unused imports --- src/Interpreters/DDLWorker.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index 57bbf95bdbe..06f3b4c48cc 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -31,16 +30,11 @@ #include #include #include -#include -#include -#include -#include #include #include #include #include #include -#include #include @@ -862,6 +856,8 @@ bool DDLWorker::tryExecuteQueryOnLeaderReplica( }; String shard_node_name = get_shard_name(task.cluster->getShardsAddresses().at(task.host_shard_num)); + + String shard_path = node_path + "/shards/" + shard_node_name; String is_executed_path = shard_path + "/executed"; String tries_to_execute_path = shard_path + "/tries_to_execute"; From a2eb7c96dfe509e3d084031e1fc16bde199afb6b Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 3 Dec 2020 19:51:27 +0300 Subject: [PATCH 36/48] Fix ugly bug --- src/Interpreters/Context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index a3088da1fd6..0c9881bf895 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -2015,7 +2015,7 @@ void Context::checkCanBeDropped(const String & database, const String & table, c "1. Size ({}) is greater than max_[table/partition]_size_to_drop ({})\n" "2. File '{}' intended to force DROP {}\n" "How to fix this:\n" - "1. Either increase (or set to zero) max_[table/partition]_size_to_drop in server config\n", + "1. Either increase (or set to zero) max_[table/partition]_size_to_drop in server config\n" "2. Either create forcing file {} and make sure that ClickHouse has write permission for it.\n" "Example:\nsudo touch '{}' && sudo chmod 666 '{}'", backQuoteIfNeed(database), backQuoteIfNeed(table), From 0efe16f9ce2cb26d4567d0b57478cf98076a6262 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 09:04:24 -0800 Subject: [PATCH 37/48] concatenate paths using fs::path --- src/Interpreters/DDLWorker.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index 06f3b4c48cc..cf9bd5d486f 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -37,6 +37,7 @@ #include #include +namespace fs = std::filesystem; namespace DB { @@ -858,10 +859,10 @@ bool DDLWorker::tryExecuteQueryOnLeaderReplica( String shard_node_name = get_shard_name(task.cluster->getShardsAddresses().at(task.host_shard_num)); - String shard_path = node_path + "/shards/" + shard_node_name; - String is_executed_path = shard_path + "/executed"; - String tries_to_execute_path = shard_path + "/tries_to_execute"; - zookeeper->createAncestors(shard_path + "/"); + String shard_path = (fs::path(node_path) / fs::path("shards") / fs::path(shard_node_name)).string(); + String is_executed_path = (fs::path(shard_path) / fs::path("executed")); + String tries_to_execute_path = fs::path(shard_path) / fs::path("tries_to_execute"); + zookeeper->createAncestors((fs::path(shard_path) / "").string()); /* appends "/" at the end of shard_path */ /// Node exists, or we will create or we will get an exception zookeeper->tryCreate(tries_to_execute_path, "0", zkutil::CreateMode::Persistent); @@ -990,8 +991,8 @@ void DDLWorker::cleanupQueue(Int64 current_time_seconds, const ZooKeeperPtr & zo return; String node_name = *it; - String node_path = queue_dir + "/" + node_name; - String lock_path = node_path + "/lock"; + String node_path = (fs::path(queue_dir) / fs::path(node_name)).string(); + String lock_path = (fs::path(node_path) / fs::path("lock")).string(); Coordination::Stat stat; String dummy; @@ -1040,7 +1041,7 @@ void DDLWorker::cleanupQueue(Int64 current_time_seconds, const ZooKeeperPtr & zo for (const String & child : children) { if (child != "lock") - zookeeper->tryRemoveRecursive(node_path + "/" + child); + zookeeper->tryRemoveRecursive((fs::path(node_path) / fs::path(child)).string()); } /// Remove the lock node and its parent atomically @@ -1064,12 +1065,12 @@ void DDLWorker::createStatusDirs(const std::string & node_path, const ZooKeeperP Coordination::Requests ops; { Coordination::CreateRequest request; - request.path = node_path + "/active"; + request.path = (fs::path(node_path) / fs::path("active")).string(); ops.emplace_back(std::make_shared(std::move(request))); } { Coordination::CreateRequest request; - request.path = node_path + "/finished"; + request.path = (fs::path(node_path) / fs::path("finished")).string(); ops.emplace_back(std::make_shared(std::move(request))); } Coordination::Responses responses; @@ -1087,7 +1088,7 @@ String DDLWorker::enqueueQuery(DDLLogEntry & entry) auto zookeeper = getAndSetZooKeeper(); - String query_path_prefix = queue_dir + "/query-"; + String query_path_prefix = (fs::path(queue_dir) / fs::path("query-")).string(); zookeeper->createAncestors(query_path_prefix); String node_path = zookeeper->create(query_path_prefix, entry.toString(), zkutil::CreateMode::PersistentSequential); @@ -1117,7 +1118,7 @@ void DDLWorker::runMainThread() try { auto zookeeper = getAndSetZooKeeper(); - zookeeper->createAncestors(queue_dir + "/"); + zookeeper->createAncestors((fs::path(queue_dir) / "").string()); initialized = true; } catch (const Coordination::Exception & e) @@ -1290,12 +1291,12 @@ public: node_path); } - Strings new_hosts = getNewAndUpdate(getChildrenAllowNoNode(zookeeper, node_path + "/finished")); + Strings new_hosts = getNewAndUpdate(getChildrenAllowNoNode(zookeeper, (fs::path(node_path) / fs::path( "finished").string()))); ++try_number; if (new_hosts.empty()) continue; - current_active_hosts = getChildrenAllowNoNode(zookeeper, node_path + "/active"); + current_active_hosts = getChildrenAllowNoNode(zookeeper, (fs::path(node_path) / fs::path( "active").string())); MutableColumns columns = sample.cloneEmptyColumns(); for (const String & host_id : new_hosts) @@ -1303,7 +1304,7 @@ public: ExecutionStatus status(-1, "Cannot obtain error message"); { String status_data; - if (zookeeper->tryGet(node_path + "/finished/" + host_id, status_data)) + if (zookeeper->tryGet((fs::path(node_path) / fs::path("finished") / fs::path(host_id)).string(), status_data)) status.tryDeserializeText(status_data); } From d05d7e8b0620800bea15fe0c6364ffd0100d40f6 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 09:08:17 -0800 Subject: [PATCH 38/48] fix missing import --- src/Interpreters/DDLWorker.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index cf9bd5d486f..0a4121e6289 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include From a8fea625ae5cdc89c627bb1a2d736202471b10c6 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 09:53:55 -0800 Subject: [PATCH 39/48] simplify path concat --- src/Interpreters/DDLWorker.cpp | 40 ++++++++++++++++------------------ 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index 0a4121e6289..8cea589085e 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -223,7 +223,7 @@ public: const std::string & lock_message_ = "") : zookeeper(zookeeper_), - lock_path(lock_prefix_ + "/" + lock_name_), + lock_path(fs::path(lock_prefix_) / lock_name_), lock_message(lock_message_), log(&Poco::Logger::get("zkutil::Lock")) { @@ -391,7 +391,7 @@ void DDLWorker::recoverZooKeeper() DDLTaskPtr DDLWorker::initAndCheckTask(const String & entry_name, String & out_reason, const ZooKeeperPtr & zookeeper) { String node_data; - String entry_path = queue_dir + "/" + entry_name; + String entry_path = fs::path(queue_dir) / entry_name; if (!zookeeper->tryGet(entry_path, node_data)) { @@ -420,7 +420,7 @@ DDLTaskPtr DDLWorker::initAndCheckTask(const String & entry_name, String & out_r try { createStatusDirs(entry_path, zookeeper); - zookeeper->tryCreate(entry_path + "/finished/" + host_fqdn_id, status, zkutil::CreateMode::Persistent); + zookeeper->tryCreate(fs::path(entry_path) / "finished" / host_fqdn_id, status, zkutil::CreateMode::Persistent); } catch (...) { @@ -501,7 +501,7 @@ void DDLWorker::scheduleTasks() continue; } - bool already_processed = zookeeper->exists(task->entry_path + "/finished/" + task->host_id_str); + bool already_processed = zookeeper->exists(fs::path(task->entry_path) / "finished" / task->host_id_str); if (!server_startup && !task->was_executed && already_processed) { throw Exception(ErrorCodes::LOGICAL_ERROR, @@ -859,12 +859,10 @@ bool DDLWorker::tryExecuteQueryOnLeaderReplica( }; String shard_node_name = get_shard_name(task.cluster->getShardsAddresses().at(task.host_shard_num)); - - - String shard_path = (fs::path(node_path) / fs::path("shards") / fs::path(shard_node_name)).string(); - String is_executed_path = (fs::path(shard_path) / fs::path("executed")); - String tries_to_execute_path = fs::path(shard_path) / fs::path("tries_to_execute"); - zookeeper->createAncestors((fs::path(shard_path) / "").string()); /* appends "/" at the end of shard_path */ + String shard_path = fs::path(node_path) / "shards" / shard_node_name; + String is_executed_path = fs::path(shard_path) / "executed"; + String tries_to_execute_path = fs::path(shard_path) / "tries_to_execute"; + zookeeper->createAncestors(fs::path(shard_path) / ""); /* appends "/" at the end of shard_path */ /// Node exists, or we will create or we will get an exception zookeeper->tryCreate(tries_to_execute_path, "0", zkutil::CreateMode::Persistent); @@ -993,8 +991,8 @@ void DDLWorker::cleanupQueue(Int64 current_time_seconds, const ZooKeeperPtr & zo return; String node_name = *it; - String node_path = (fs::path(queue_dir) / fs::path(node_name)).string(); - String lock_path = (fs::path(node_path) / fs::path("lock")).string(); + String node_path = fs::path(queue_dir) / node_name; + String lock_path = fs::path(node_path) / "lock"; Coordination::Stat stat; String dummy; @@ -1017,7 +1015,7 @@ void DDLWorker::cleanupQueue(Int64 current_time_seconds, const ZooKeeperPtr & zo continue; /// Skip if there are active nodes (it is weak guard) - if (zookeeper->exists(node_path + "/active", &stat) && stat.numChildren > 0) + if (zookeeper->exists(fs::path(node_path) / "active", &stat) && stat.numChildren > 0) { LOG_INFO(log, "Task {} should be deleted, but there are active workers. Skipping it.", node_name); continue; @@ -1043,7 +1041,7 @@ void DDLWorker::cleanupQueue(Int64 current_time_seconds, const ZooKeeperPtr & zo for (const String & child : children) { if (child != "lock") - zookeeper->tryRemoveRecursive((fs::path(node_path) / fs::path(child)).string()); + zookeeper->tryRemoveRecursive(fs::path(node_path) / child); } /// Remove the lock node and its parent atomically @@ -1067,12 +1065,12 @@ void DDLWorker::createStatusDirs(const std::string & node_path, const ZooKeeperP Coordination::Requests ops; { Coordination::CreateRequest request; - request.path = (fs::path(node_path) / fs::path("active")).string(); + request.path = fs::path(node_path) / "active"; ops.emplace_back(std::make_shared(std::move(request))); } { Coordination::CreateRequest request; - request.path = (fs::path(node_path) / fs::path("finished")).string(); + request.path = fs::path(node_path) / "finished"; ops.emplace_back(std::make_shared(std::move(request))); } Coordination::Responses responses; @@ -1090,7 +1088,7 @@ String DDLWorker::enqueueQuery(DDLLogEntry & entry) auto zookeeper = getAndSetZooKeeper(); - String query_path_prefix = (fs::path(queue_dir) / fs::path("query-")).string(); + String query_path_prefix = fs::path(queue_dir) / "query-"; zookeeper->createAncestors(query_path_prefix); String node_path = zookeeper->create(query_path_prefix, entry.toString(), zkutil::CreateMode::PersistentSequential); @@ -1120,7 +1118,7 @@ void DDLWorker::runMainThread() try { auto zookeeper = getAndSetZooKeeper(); - zookeeper->createAncestors((fs::path(queue_dir) / "").string()); + zookeeper->createAncestors(fs::path(queue_dir) / ""); initialized = true; } catch (const Coordination::Exception & e) @@ -1293,12 +1291,12 @@ public: node_path); } - Strings new_hosts = getNewAndUpdate(getChildrenAllowNoNode(zookeeper, (fs::path(node_path) / fs::path( "finished").string()))); + Strings new_hosts = getNewAndUpdate(getChildrenAllowNoNode(zookeeper, fs::path(node_path) / "finished")); ++try_number; if (new_hosts.empty()) continue; - current_active_hosts = getChildrenAllowNoNode(zookeeper, (fs::path(node_path) / fs::path( "active").string())); + current_active_hosts = getChildrenAllowNoNode(zookeeper, fs::path(node_path) / "active"); MutableColumns columns = sample.cloneEmptyColumns(); for (const String & host_id : new_hosts) @@ -1306,7 +1304,7 @@ public: ExecutionStatus status(-1, "Cannot obtain error message"); { String status_data; - if (zookeeper->tryGet((fs::path(node_path) / fs::path("finished") / fs::path(host_id)).string(), status_data)) + if (zookeeper->tryGet(fs::path(node_path) / "finished" / host_id, status_data)) status.tryDeserializeText(status_data); } From 474235dfb1c499c425e5076ac6d4756ca5e511b5 Mon Sep 17 00:00:00 2001 From: Stepan <36516357+EpicStep@users.noreply.github.com> Date: Thu, 3 Dec 2020 21:31:20 +0300 Subject: [PATCH 40/48] Delete last event from README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 763b12439c5..97d6eb605e6 100644 --- a/README.md +++ b/README.md @@ -16,5 +16,4 @@ ClickHouse® is an open-source column-oriented database management system that a * You can also [fill this form](https://clickhouse.tech/#meet) to meet Yandex ClickHouse team in person. ## Upcoming Events -* [SF Bay Area ClickHouse Meetup (online)](https://www.meetup.com/San-Francisco-Bay-Area-ClickHouse-Meetup/events/274498897/) on 2 December 2020. * [SF Bay Area ClickHouse Virtual Office Hours (online)](https://www.meetup.com/San-Francisco-Bay-Area-ClickHouse-Meetup/events/274273549/) on 20 January 2020. From 8e0e29480f1b06dd7d3441fa836fca9af083471e Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 11:15:29 -0800 Subject: [PATCH 41/48] system.columns - add some doc examples --- docs/en/operations/system-tables/columns.md | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/en/operations/system-tables/columns.md b/docs/en/operations/system-tables/columns.md index 92cbdd19ca8..92a6315d06b 100644 --- a/docs/en/operations/system-tables/columns.md +++ b/docs/en/operations/system-tables/columns.md @@ -23,4 +23,50 @@ The `system.columns` table contains the following columns (the column type is sh - `is_in_sampling_key` ([UInt8](../../sql-reference/data-types/int-uint.md)) — Flag that indicates whether the column is in the sampling key expression. - `compression_codec` ([String](../../sql-reference/data-types/string.md)) — Compression codec name. +**Example** + +```sql +:) select * from system.columns LIMIT 2 FORMAT Vertical; +``` + +```text +Row 1: +────── +database: system +table: aggregate_function_combinators +name: name +type: String +default_kind: +default_expression: +data_compressed_bytes: 0 +data_uncompressed_bytes: 0 +marks_bytes: 0 +comment: +is_in_partition_key: 0 +is_in_sorting_key: 0 +is_in_primary_key: 0 +is_in_sampling_key: 0 +compression_codec: + +Row 2: +────── +database: system +table: aggregate_function_combinators +name: is_internal +type: UInt8 +default_kind: +default_expression: +data_compressed_bytes: 0 +data_uncompressed_bytes: 0 +marks_bytes: 0 +comment: +is_in_partition_key: 0 +is_in_sorting_key: 0 +is_in_primary_key: 0 +is_in_sampling_key: 0 +compression_codec: + +2 rows in set. Elapsed: 0.002 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/columns) From 81d9d3237f6d9db687a061a82e80b60d9bf78275 Mon Sep 17 00:00:00 2001 From: Alexander Kazakov Date: Thu, 3 Dec 2020 23:36:10 +0300 Subject: [PATCH 42/48] In mysqlxx::Pool: fix for reconnection problem (#17681) Remove stalled unrecoverable connections from myqsl connections pool --- base/mysqlxx/Connection.cpp | 10 +-- base/mysqlxx/Pool.cpp | 59 ++++++++++---- base/mysqlxx/Pool.h | 5 +- base/mysqlxx/tests/CMakeLists.txt | 3 + base/mysqlxx/tests/mysqlxx_pool_test.cpp | 98 ++++++++++++++++++++++++ 5 files changed, 151 insertions(+), 24 deletions(-) create mode 100644 base/mysqlxx/tests/mysqlxx_pool_test.cpp diff --git a/base/mysqlxx/Connection.cpp b/base/mysqlxx/Connection.cpp index 8c7e11eb4a1..55757008562 100644 --- a/base/mysqlxx/Connection.cpp +++ b/base/mysqlxx/Connection.cpp @@ -104,6 +104,11 @@ void Connection::connect(const char* db, if (mysql_options(driver.get(), MYSQL_OPT_LOCAL_INFILE, &enable_local_infile_arg)) throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); + /// Enables auto-reconnect. + bool reconnect = true; + if (mysql_options(driver.get(), MYSQL_OPT_RECONNECT, reinterpret_cast(&reconnect))) + throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); + /// Specifies particular ssl key and certificate if it needs if (mysql_ssl_set(driver.get(), ifNotEmpty(ssl_key), ifNotEmpty(ssl_cert), ifNotEmpty(ssl_ca), nullptr, nullptr)) throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); @@ -115,11 +120,6 @@ void Connection::connect(const char* db, if (mysql_set_character_set(driver.get(), "UTF8")) throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); - /// Enables auto-reconnect. - bool reconnect = true; - if (mysql_options(driver.get(), MYSQL_OPT_RECONNECT, reinterpret_cast(&reconnect))) - throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get())); - is_connected = true; } diff --git a/base/mysqlxx/Pool.cpp b/base/mysqlxx/Pool.cpp index d845570f1f2..2058429d3da 100644 --- a/base/mysqlxx/Pool.cpp +++ b/base/mysqlxx/Pool.cpp @@ -26,6 +26,7 @@ void Pool::Entry::incrementRefCount() mysql_thread_init(); } + void Pool::Entry::decrementRefCount() { if (!data) @@ -150,28 +151,39 @@ Pool::Entry Pool::tryGet() initialize(); - /// Searching for connection which was established but wasn't used. - for (auto & connection : connections) + /// Try to pick an idle connection from already allocated + for (auto connection_it = connections.cbegin(); connection_it != connections.cend();) { - if (connection->ref_count == 0) + Connection * connection_ptr = *connection_it; + /// Fixme: There is a race condition here b/c we do not synchronize with Pool::Entry's copy-assignment operator + if (connection_ptr->ref_count == 0) { - Entry res(connection, this); - return res.tryForceConnected() ? res : Entry(); + Entry res(connection_ptr, this); + if (res.tryForceConnected()) /// Tries to reestablish connection as well + return res; + + auto & logger = Poco::Util::Application::instance().logger(); + logger.information("Idle connection to mysql server cannot be recovered, dropping it."); + + /// This one is disconnected, cannot be reestablished and so needs to be disposed of. + connection_it = connections.erase(connection_it); + ::delete connection_ptr; /// TODO: Manual memory management is awkward (matches allocConnection() method) } + else + ++connection_it; } - /// Throws if pool is overflowed. if (connections.size() >= max_connections) throw Poco::Exception("mysqlxx::Pool is full"); - /// Allocates new connection. - Connection * conn = allocConnection(true); - if (conn) - return Entry(conn, this); + Connection * connection_ptr = allocConnection(true); + if (connection_ptr) + return {connection_ptr, this}; - return Entry(); + return {}; } + void Pool::removeConnection(Connection* connection) { std::lock_guard lock(mutex); @@ -199,11 +211,9 @@ void Pool::Entry::forceConnected() const throw Poco::RuntimeException("Tried to access NULL database connection."); Poco::Util::Application & app = Poco::Util::Application::instance(); - if (data->conn.ping()) - return; bool first = true; - do + while (!tryForceConnected()) { if (first) first = false; @@ -225,7 +235,26 @@ void Pool::Entry::forceConnected() const pool->rw_timeout, pool->enable_local_infile); } - while (!data->conn.ping()); +} + + +bool Pool::Entry::tryForceConnected() const +{ + auto * const mysql_driver = data->conn.getDriver(); + const auto prev_connection_id = mysql_thread_id(mysql_driver); + if (data->conn.ping()) /// Attempts to reestablish lost connection + { + const auto current_connection_id = mysql_thread_id(mysql_driver); + if (prev_connection_id != current_connection_id) + { + auto & logger = Poco::Util::Application::instance().logger(); + logger.information("Connection to mysql server has been reestablished. Connection id changed: %d -> %d", + prev_connection_id, current_connection_id); + } + return true; + } + + return false; } diff --git a/base/mysqlxx/Pool.h b/base/mysqlxx/Pool.h index 59d15e8c9a0..83b00e0081a 100644 --- a/base/mysqlxx/Pool.h +++ b/base/mysqlxx/Pool.h @@ -127,10 +127,7 @@ public: void forceConnected() const; /// Connects to database. If connection is failed then returns false. - bool tryForceConnected() const - { - return data->conn.ping(); - } + bool tryForceConnected() const; void incrementRefCount(); void decrementRefCount(); diff --git a/base/mysqlxx/tests/CMakeLists.txt b/base/mysqlxx/tests/CMakeLists.txt index ec3fdfaa913..2cf19d78418 100644 --- a/base/mysqlxx/tests/CMakeLists.txt +++ b/base/mysqlxx/tests/CMakeLists.txt @@ -1,2 +1,5 @@ add_executable (mysqlxx_test mysqlxx_test.cpp) target_link_libraries (mysqlxx_test PRIVATE mysqlxx) + +add_executable (mysqlxx_pool_test mysqlxx_pool_test.cpp) +target_link_libraries (mysqlxx_pool_test PRIVATE mysqlxx) diff --git a/base/mysqlxx/tests/mysqlxx_pool_test.cpp b/base/mysqlxx/tests/mysqlxx_pool_test.cpp new file mode 100644 index 00000000000..3dc23e4da85 --- /dev/null +++ b/base/mysqlxx/tests/mysqlxx_pool_test.cpp @@ -0,0 +1,98 @@ +#include + +#include +#include +#include +#include + + +namespace +{ +mysqlxx::Pool::Entry getWithFailover(mysqlxx::Pool & connections_pool) +{ + using namespace std::chrono; + + constexpr size_t max_tries = 3; + + mysqlxx::Pool::Entry worker_connection; + + for (size_t try_no = 1; try_no <= max_tries; ++try_no) + { + try + { + worker_connection = connections_pool.tryGet(); + + if (!worker_connection.isNull()) + { + return worker_connection; + } + } + catch (const Poco::Exception & e) + { + if (e.displayText().find("mysqlxx::Pool is full") != std::string::npos) + { + std::cerr << e.displayText() << std::endl; + } + + std::cerr << "Connection to " << connections_pool.getDescription() << " failed: " << e.displayText() << std::endl; + } + + std::clog << "Connection to all replicas failed " << try_no << " times" << std::endl; + std::this_thread::sleep_for(1s); + } + + std::stringstream message; + message << "Connections to all replicas failed: " << connections_pool.getDescription(); + + throw Poco::Exception(message.str()); +} +} + +int main(int, char **) +{ + using namespace std::chrono; + + const char * remote_mysql = "localhost"; + const std::string test_query = "SHOW DATABASES"; + + mysqlxx::Pool mysql_conn_pool("", remote_mysql, "default", "10203040", 3306); + + size_t iteration = 0; + while (++iteration) + { + std::clog << "Iteration: " << iteration << std::endl; + try + { + std::clog << "Acquiring DB connection ..."; + mysqlxx::Pool::Entry worker = getWithFailover(mysql_conn_pool); + std::clog << "ok" << std::endl; + + std::clog << "Preparing query (5s sleep) ..."; + std::this_thread::sleep_for(5s); + mysqlxx::Query query = worker->query(); + query << test_query; + std::clog << "ok" << std::endl; + + std::clog << "Querying result (5s sleep) ..."; + std::this_thread::sleep_for(5s); + mysqlxx::UseQueryResult result = query.use(); + std::clog << "ok" << std::endl; + + std::clog << "Fetching result data (5s sleep) ..."; + std::this_thread::sleep_for(5s); + size_t rows_count = 0; + while (result.fetch()) + ++rows_count; + std::clog << "ok" << std::endl; + + std::clog << "Read " << rows_count << " rows." << std::endl; + } + catch (const Poco::Exception & e) + { + std::cerr << "Iteration FAILED:\n" << e.displayText() << std::endl; + } + + std::clog << "====================" << std::endl; + std::this_thread::sleep_for(3s); + } +} From 67e6cc8fafb1fb3ae4564e50d4e59232bcc2cd01 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 11:27:55 -0800 Subject: [PATCH 43/48] docs - add more examples for systems tables --- docs/en/operations/system-tables/clusters.md | 40 ++++++++++++++ docs/en/operations/system-tables/disks.md | 18 +++++++ docs/en/operations/system-tables/functions.md | 23 ++++++++ .../system-tables/merge_tree_settings.md | 44 +++++++++++++++ docs/en/operations/system-tables/numbers.md | 23 ++++++++ .../en/operations/system-tables/numbers_mt.md | 23 ++++++++ docs/en/operations/system-tables/one.md | 14 +++++ docs/en/operations/system-tables/processes.md | 48 +++++++++++++++++ docs/en/operations/system-tables/tables.md | 53 +++++++++++++++++++ 9 files changed, 286 insertions(+) diff --git a/docs/en/operations/system-tables/clusters.md b/docs/en/operations/system-tables/clusters.md index f18dfb3d1c0..cba52586e93 100644 --- a/docs/en/operations/system-tables/clusters.md +++ b/docs/en/operations/system-tables/clusters.md @@ -23,4 +23,44 @@ Please note that `errors_count` is updated once per query to the cluster, but `e - [distributed_replica_error_cap setting](../../operations/settings/settings.md#settings-distributed_replica_error_cap) - [distributed_replica_error_half_life setting](../../operations/settings/settings.md#settings-distributed_replica_error_half_life) +**Example** + +```sql +:) SELECT * FROM system.clusters LIMIT 2 FORMAT Vertical; +``` + +```text +Row 1: +────── +cluster: test_cluster +shard_num: 1 +shard_weight: 1 +replica_num: 1 +host_name: clickhouse01 +host_address: 172.23.0.11 +port: 9000 +is_local: 1 +user: default +default_database: +errors_count: 0 +estimated_recovery_time: 0 + +Row 2: +────── +cluster: test_cluster +shard_num: 1 +shard_weight: 1 +replica_num: 2 +host_name: clickhouse02 +host_address: 172.23.0.12 +port: 9000 +is_local: 0 +user: default +default_database: +errors_count: 0 +estimated_recovery_time: 0 + +2 rows in set. Elapsed: 0.002 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/clusters) diff --git a/docs/en/operations/system-tables/disks.md b/docs/en/operations/system-tables/disks.md index 9c01b6d9aa4..e9d324580d8 100644 --- a/docs/en/operations/system-tables/disks.md +++ b/docs/en/operations/system-tables/disks.md @@ -11,3 +11,21 @@ Columns: - `keep_free_space` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Amount of disk space that should stay free on disk in bytes. Defined in the `keep_free_space_bytes` parameter of disk configuration. [Original article](https://clickhouse.tech/docs/en/operations/system_tables/disks) + + +**Example** + +```sql +:) SELECT * FROM system.disks; +``` + +```text +┌─name────┬─path─────────────────┬───free_space─┬──total_space─┬─keep_free_space─┐ +│ default │ /var/lib/clickhouse/ │ 276392587264 │ 490652508160 │ 0 │ +└─────────┴──────────────────────┴──────────────┴──────────────┴─────────────────┘ + +1 rows in set. Elapsed: 0.001 sec. +``` + + + diff --git a/docs/en/operations/system-tables/functions.md b/docs/en/operations/system-tables/functions.md index d9a5e3cc363..fbcd4b7b723 100644 --- a/docs/en/operations/system-tables/functions.md +++ b/docs/en/operations/system-tables/functions.md @@ -8,3 +8,26 @@ Columns: - `is_aggregate`(`UInt8`) — Whether the function is aggregate. [Original article](https://clickhouse.tech/docs/en/operations/system_tables/functions) + +**Example** + +```sql + SELECT * FROM system.functions LIMIT 10; +``` + +```text +┌─name─────────────────────┬─is_aggregate─┬─case_insensitive─┬─alias_to─┐ +│ sumburConsistentHash │ 0 │ 0 │ │ +│ yandexConsistentHash │ 0 │ 0 │ │ +│ demangle │ 0 │ 0 │ │ +│ addressToLine │ 0 │ 0 │ │ +│ JSONExtractRaw │ 0 │ 0 │ │ +│ JSONExtractKeysAndValues │ 0 │ 0 │ │ +│ JSONExtract │ 0 │ 0 │ │ +│ JSONExtractString │ 0 │ 0 │ │ +│ JSONExtractFloat │ 0 │ 0 │ │ +│ JSONExtractInt │ 0 │ 0 │ │ +└──────────────────────────┴──────────────┴──────────────────┴──────────┘ + +10 rows in set. Elapsed: 0.002 sec. +``` \ No newline at end of file diff --git a/docs/en/operations/system-tables/merge_tree_settings.md b/docs/en/operations/system-tables/merge_tree_settings.md index 78aab24cb41..be37dd1c2f3 100644 --- a/docs/en/operations/system-tables/merge_tree_settings.md +++ b/docs/en/operations/system-tables/merge_tree_settings.md @@ -11,3 +11,47 @@ Columns: - `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. [Original article](https://clickhouse.tech/docs/en/operations/system_tables/merge_tree_settings) + + select * from system.functions LIMIT 10; + + +**Example** +```sql +:) SELECT * FROM system.merge_tree_settings LIMIT 4 FORMAT Vertical; +``` + +```text +Row 1: +────── +name: index_granularity +value: 8192 +changed: 0 +description: How many rows correspond to one primary key value. +type: SettingUInt64 + +Row 2: +────── +name: min_bytes_for_wide_part +value: 0 +changed: 0 +description: Minimal uncompressed size in bytes to create part in wide format instead of compact +type: SettingUInt64 + +Row 3: +────── +name: min_rows_for_wide_part +value: 0 +changed: 0 +description: Minimal number of rows to create part in wide format instead of compact +type: SettingUInt64 + +Row 4: +────── +name: merge_max_block_size +value: 8192 +changed: 0 +description: How many rows in blocks should be formed for merge operations. +type: SettingUInt64 + +4 rows in set. Elapsed: 0.001 sec. +``` diff --git a/docs/en/operations/system-tables/numbers.md b/docs/en/operations/system-tables/numbers.md index 9b7e148242c..d1737c9abbb 100644 --- a/docs/en/operations/system-tables/numbers.md +++ b/docs/en/operations/system-tables/numbers.md @@ -6,4 +6,27 @@ You can use this table for tests, or if you need to do a brute force search. Reads from this table are not parallelized. +**Example** + +```sql +:) SELECT * FROM system.numbers LIMIT 10; +``` + +```text +┌─number─┐ +│ 0 │ +│ 1 │ +│ 2 │ +│ 3 │ +│ 4 │ +│ 5 │ +│ 6 │ +│ 7 │ +│ 8 │ +│ 9 │ +└────────┘ + +10 rows in set. Elapsed: 0.001 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/numbers) diff --git a/docs/en/operations/system-tables/numbers_mt.md b/docs/en/operations/system-tables/numbers_mt.md index 870b256223e..b40dc9a2d6f 100644 --- a/docs/en/operations/system-tables/numbers_mt.md +++ b/docs/en/operations/system-tables/numbers_mt.md @@ -4,4 +4,27 @@ The same as [system.numbers](../../operations/system-tables/numbers.md) but read Used for tests. +**Example** + +```sql +:) SELECT * FROM system.numbers_mt LIMIT 10; +``` + +```text +┌─number─┐ +│ 0 │ +│ 1 │ +│ 2 │ +│ 3 │ +│ 4 │ +│ 5 │ +│ 6 │ +│ 7 │ +│ 8 │ +│ 9 │ +└────────┘ + +10 rows in set. Elapsed: 0.001 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/numbers_mt) diff --git a/docs/en/operations/system-tables/one.md b/docs/en/operations/system-tables/one.md index 854fab32730..a85e01bc75a 100644 --- a/docs/en/operations/system-tables/one.md +++ b/docs/en/operations/system-tables/one.md @@ -6,4 +6,18 @@ This table is used if a `SELECT` query doesn’t specify the `FROM` clause. This is similar to the `DUAL` table found in other DBMSs. +**Example** + +```sql +:) SELECT * FROM system.one LIMIT 10; +``` + +```text +┌─dummy─┐ +│ 0 │ +└───────┘ + +1 rows in set. Elapsed: 0.001 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/one) diff --git a/docs/en/operations/system-tables/processes.md b/docs/en/operations/system-tables/processes.md index 2af39eff862..44925713f40 100644 --- a/docs/en/operations/system-tables/processes.md +++ b/docs/en/operations/system-tables/processes.md @@ -14,4 +14,52 @@ Columns: - `query` (String) – The query text. For `INSERT`, it doesn’t include the data to insert. - `query_id` (String) – Query ID, if defined. + +```sql +:) SELECT * FROM system.processes LIMIT 10 FORMAT Vertical; +``` + +```text + +Row 1: +────── +is_initial_query: 1 +user: default +query_id: 35a360fa-3743-441d-8e1f-228c938268da +address: ::ffff:172.23.0.1 +port: 47588 +initial_user: default +initial_query_id: 35a360fa-3743-441d-8e1f-228c938268da +initial_address: ::ffff:172.23.0.1 +initial_port: 47588 +interface: 1 +os_user: bharatnc +client_hostname: tower +client_name: ClickHouse +client_revision: 54437 +client_version_major: 20 +client_version_minor: 7 +client_version_patch: 2 +http_method: 0 +http_user_agent: +quota_key: +elapsed: 0.000582537 +is_cancelled: 0 +read_rows: 0 +read_bytes: 0 +total_rows_approx: 0 +written_rows: 0 +written_bytes: 0 +memory_usage: 0 +peak_memory_usage: 0 +query: SELECT * from system.processes LIMIT 10 FORMAT Vertical; +thread_ids: [67] +ProfileEvents.Names: ['Query','SelectQuery','ReadCompressedBytes','CompressedReadBufferBlocks','CompressedReadBufferBytes','IOBufferAllocs','IOBufferAllocBytes','ContextLock','RWLockAcquiredReadLocks'] +ProfileEvents.Values: [1,1,36,1,10,1,89,16,1] +Settings.Names: ['use_uncompressed_cache','load_balancing','log_queries','max_memory_usage'] +Settings.Values: ['0','in_order','1','10000000000'] + +1 rows in set. Elapsed: 0.002 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/processes) diff --git a/docs/en/operations/system-tables/tables.md b/docs/en/operations/system-tables/tables.md index e69b8aa67a0..a1c5cb5f083 100644 --- a/docs/en/operations/system-tables/tables.md +++ b/docs/en/operations/system-tables/tables.md @@ -52,4 +52,57 @@ This table contains the following columns (the column type is shown in brackets) The `system.tables` table is used in `SHOW TABLES` query implementation. +```sql + +``` +:) SELECT * FROM system.tables LIMIT 2 FORMAT Vertical; + +```text +Row 1: +────── +database: system +name: aggregate_function_combinators +uuid: 00000000-0000-0000-0000-000000000000 +engine: SystemAggregateFunctionCombinators +is_temporary: 0 +data_paths: [] +metadata_path: /var/lib/clickhouse/metadata/system/aggregate_function_combinators.sql +metadata_modification_time: 1970-01-01 03:00:00 +dependencies_database: [] +dependencies_table: [] +create_table_query: +engine_full: +partition_key: +sorting_key: +primary_key: +sampling_key: +storage_policy: +total_rows: ᴺᵁᴸᴸ +total_bytes: ᴺᵁᴸᴸ + +Row 2: +────── +database: system +name: asynchronous_metrics +uuid: 00000000-0000-0000-0000-000000000000 +engine: SystemAsynchronousMetrics +is_temporary: 0 +data_paths: [] +metadata_path: /var/lib/clickhouse/metadata/system/asynchronous_metrics.sql +metadata_modification_time: 1970-01-01 03:00:00 +dependencies_database: [] +dependencies_table: [] +create_table_query: +engine_full: +partition_key: +sorting_key: +primary_key: +sampling_key: +storage_policy: +total_rows: ᴺᵁᴸᴸ +total_bytes: ᴺᵁᴸᴸ + +2 rows in set. Elapsed: 0.004 sec. +``` + [Original article](https://clickhouse.tech/docs/en/operations/system_tables/tables) From 4f33a6b0440f1eb3cd7d422a46cefae81ac2a6b5 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Thu, 3 Dec 2020 13:44:17 -0800 Subject: [PATCH 44/48] few fixes and formatting --- docs/en/operations/system-tables/merge_tree_settings.md | 7 ++----- docs/en/operations/system-tables/processes.md | 1 - docs/en/operations/system-tables/tables.md | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/en/operations/system-tables/merge_tree_settings.md b/docs/en/operations/system-tables/merge_tree_settings.md index be37dd1c2f3..c2c5703f869 100644 --- a/docs/en/operations/system-tables/merge_tree_settings.md +++ b/docs/en/operations/system-tables/merge_tree_settings.md @@ -10,11 +10,6 @@ Columns: - `type` (String) — Setting type (implementation specific string value). - `changed` (UInt8) — Whether the setting was explicitly defined in the config or explicitly changed. -[Original article](https://clickhouse.tech/docs/en/operations/system_tables/merge_tree_settings) - - select * from system.functions LIMIT 10; - - **Example** ```sql :) SELECT * FROM system.merge_tree_settings LIMIT 4 FORMAT Vertical; @@ -55,3 +50,5 @@ type: SettingUInt64 4 rows in set. Elapsed: 0.001 sec. ``` + +[Original article](https://clickhouse.tech/docs/en/operations/system_tables/merge_tree_settings) diff --git a/docs/en/operations/system-tables/processes.md b/docs/en/operations/system-tables/processes.md index 44925713f40..a379fc4a07a 100644 --- a/docs/en/operations/system-tables/processes.md +++ b/docs/en/operations/system-tables/processes.md @@ -20,7 +20,6 @@ Columns: ``` ```text - Row 1: ────── is_initial_query: 1 diff --git a/docs/en/operations/system-tables/tables.md b/docs/en/operations/system-tables/tables.md index a1c5cb5f083..6ad1425e032 100644 --- a/docs/en/operations/system-tables/tables.md +++ b/docs/en/operations/system-tables/tables.md @@ -53,9 +53,8 @@ This table contains the following columns (the column type is shown in brackets) The `system.tables` table is used in `SHOW TABLES` query implementation. ```sql - -``` :) SELECT * FROM system.tables LIMIT 2 FORMAT Vertical; +``` ```text Row 1: From 6a48d25b74127a99737c605fc2b5fe06baa33b94 Mon Sep 17 00:00:00 2001 From: Ivan <5627721+abyss7@users.noreply.github.com> Date: Fri, 4 Dec 2020 02:32:17 +0300 Subject: [PATCH 45/48] Fix arcadian build (#17781) --- src/IO/ya.make | 5 +++++ src/IO/ya.make.in | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/IO/ya.make b/src/IO/ya.make index 611f75489d0..c2913587bb6 100644 --- a/src/IO/ya.make +++ b/src/IO/ya.make @@ -3,11 +3,16 @@ OWNER(g:clickhouse) LIBRARY() +ADDINCL( + contrib/libs/zstd +) + PEERDIR( clickhouse/src/Common contrib/libs/brotli/dec contrib/libs/brotli/enc contrib/libs/poco/NetSSL_OpenSSL + contrib/libs/zstd ) diff --git a/src/IO/ya.make.in b/src/IO/ya.make.in index f4e349bb10c..9b824228b92 100644 --- a/src/IO/ya.make.in +++ b/src/IO/ya.make.in @@ -2,11 +2,16 @@ OWNER(g:clickhouse) LIBRARY() +ADDINCL( + contrib/libs/zstd +) + PEERDIR( clickhouse/src/Common contrib/libs/brotli/dec contrib/libs/brotli/enc contrib/libs/poco/NetSSL_OpenSSL + contrib/libs/zstd ) From 315ff4f0d9befc8b9e3f0b6c323bcc403ba0dac2 Mon Sep 17 00:00:00 2001 From: Ivan <5627721+abyss7@users.noreply.github.com> Date: Fri, 4 Dec 2020 05:15:44 +0300 Subject: [PATCH 46/48] ANTLR4 Grammar for ClickHouse and new parser (#11298) --- .gitignore | 11 + .gitmodules | 3 + CMakeLists.txt | 2 + base/common/defines.h | 6 - cmake/warnings.cmake | 2 +- contrib/CMakeLists.txt | 1 + contrib/antlr4-runtime | 1 + contrib/antlr4-runtime-cmake/CMakeLists.txt | 156 + docker/test/fasttest/run.sh | 1 + .../parseAggregateFunctionParameters.cpp | 11 +- src/CMakeLists.txt | 17 +- src/Core/MySQL/MySQLReplication.cpp | 15 +- src/Core/MySQL/MySQLReplication.h | 2 +- src/Core/Settings.h | 2 + src/DataTypes/DataTypeAggregateFunction.cpp | 27 +- .../DataTypeCustomSimpleAggregateFunction.cpp | 28 +- .../getDictionaryConfigurationFromAST.cpp | 62 +- src/Functions/GatherUtils/Sources.h | 50 +- src/Interpreters/ActionsVisitor.cpp | 284 +- .../AggregateFunctionOfGroupByKeysVisitor.h | 4 +- .../ArithmeticOperationsInAgrFuncOptimize.cpp | 2 +- src/Interpreters/DDLWorker.cpp | 4 +- src/Interpreters/ExpressionAnalyzer.cpp | 9 +- src/Interpreters/GroupByFunctionKeysVisitor.h | 2 +- src/Interpreters/InterpreterAlterQuery.cpp | 7 +- src/Interpreters/InterpreterCreateQuery.cpp | 2 + src/Interpreters/MonotonicityCheckVisitor.h | 3 +- src/Interpreters/MutationsInterpreter.cpp | 4 +- .../MySQL/InterpretersMySQLDDLQuery.cpp | 14 +- ...OptimizeIfWithConstantConditionVisitor.cpp | 14 +- src/Interpreters/QueryNormalizer.cpp | 15 +- .../RemoveInjectiveFunctionsVisitor.cpp | 2 +- .../RewriteAnyFunctionVisitor.cpp | 2 +- src/Interpreters/StorageID.h | 1 + .../TranslateQualifiedNamesVisitor.cpp | 2 + src/Interpreters/TreeRewriter.cpp | 5 +- src/Interpreters/addTypeConversionToAST.cpp | 2 +- src/Interpreters/executeQuery.cpp | 42 +- src/Interpreters/inplaceBlockConversions.cpp | 4 +- src/Parsers/ASTAlterQuery.cpp | 24 - src/Parsers/ASTAlterQuery.h | 26 +- src/Parsers/ASTCreateQuery.h | 2 +- src/Parsers/ASTDictionary.cpp | 4 +- src/Parsers/ASTFunction.cpp | 55 +- src/Parsers/ASTFunction.h | 6 +- src/Parsers/ASTIdentifier.h | 1 - src/Parsers/ASTLiteral.h | 14 +- src/Parsers/ASTOrderByElement.h | 14 - src/Parsers/ASTSampleRatio.h | 2 +- src/Parsers/ASTTablesInSelectQuery.h | 2 +- src/Parsers/ExpressionElementParsers.cpp | 26 +- src/Parsers/IAST.cpp | 4 + src/Parsers/New/AST/AlterTableQuery.cpp | 687 + src/Parsers/New/AST/AlterTableQuery.h | 179 + src/Parsers/New/AST/AttachQuery.cpp | 57 + src/Parsers/New/AST/AttachQuery.h | 32 + src/Parsers/New/AST/CheckQuery.cpp | 44 + src/Parsers/New/AST/CheckQuery.h | 24 + src/Parsers/New/AST/ColumnExpr.cpp | 588 + src/Parsers/New/AST/ColumnExpr.h | 82 + src/Parsers/New/AST/ColumnTypeExpr.cpp | 166 + src/Parsers/New/AST/ColumnTypeExpr.h | 62 + src/Parsers/New/AST/CreateDatabaseQuery.cpp | 51 + src/Parsers/New/AST/CreateDatabaseQuery.h | 26 + src/Parsers/New/AST/CreateDictionaryQuery.cpp | 361 + src/Parsers/New/AST/CreateDictionaryQuery.h | 183 + src/Parsers/New/AST/CreateLiveViewQuery.cpp | 87 + src/Parsers/New/AST/CreateLiveViewQuery.h | 39 + .../New/AST/CreateMaterializedViewQuery.cpp | 100 + .../New/AST/CreateMaterializedViewQuery.h | 40 + src/Parsers/New/AST/CreateTableQuery.cpp | 219 + src/Parsers/New/AST/CreateTableQuery.h | 76 + src/Parsers/New/AST/CreateViewQuery.cpp | 62 + src/Parsers/New/AST/CreateViewQuery.h | 34 + src/Parsers/New/AST/DDLQuery.cpp | 6 + src/Parsers/New/AST/DDLQuery.h | 29 + src/Parsers/New/AST/DescribeQuery.cpp | 36 + src/Parsers/New/AST/DescribeQuery.h | 27 + src/Parsers/New/AST/DropQuery.cpp | 106 + src/Parsers/New/AST/DropQuery.h | 43 + src/Parsers/New/AST/EngineExpr.cpp | 199 + src/Parsers/New/AST/EngineExpr.h | 85 + src/Parsers/New/AST/ExistsQuery.cpp | 55 + src/Parsers/New/AST/ExistsQuery.h | 32 + src/Parsers/New/AST/ExplainQuery.cpp | 35 + src/Parsers/New/AST/ExplainQuery.h | 23 + src/Parsers/New/AST/INode.h | 103 + src/Parsers/New/AST/Identifier.cpp | 175 + src/Parsers/New/AST/Identifier.h | 66 + src/Parsers/New/AST/InsertQuery.cpp | 125 + src/Parsers/New/AST/InsertQuery.h | 73 + src/Parsers/New/AST/JoinExpr.cpp | 326 + src/Parsers/New/AST/JoinExpr.h | 103 + src/Parsers/New/AST/KillQuery.cpp | 56 + src/Parsers/New/AST/KillQuery.h | 33 + src/Parsers/New/AST/LimitExpr.cpp | 39 + src/Parsers/New/AST/LimitExpr.h | 24 + src/Parsers/New/AST/Literal.cpp | 222 + src/Parsers/New/AST/Literal.h | 96 + src/Parsers/New/AST/OptimizeQuery.cpp | 59 + src/Parsers/New/AST/OptimizeQuery.h | 27 + src/Parsers/New/AST/OrderExpr.cpp | 62 + src/Parsers/New/AST/OrderExpr.h | 33 + src/Parsers/New/AST/Query.cpp | 34 + src/Parsers/New/AST/Query.h | 29 + src/Parsers/New/AST/README.md | 32 + src/Parsers/New/AST/RatioExpr.cpp | 43 + src/Parsers/New/AST/RatioExpr.h | 24 + src/Parsers/New/AST/RenameQuery.cpp | 58 + src/Parsers/New/AST/RenameQuery.h | 23 + src/Parsers/New/AST/SelectUnionQuery.cpp | 372 + src/Parsers/New/AST/SelectUnionQuery.h | 170 + src/Parsers/New/AST/SetQuery.cpp | 43 + src/Parsers/New/AST/SetQuery.h | 23 + src/Parsers/New/AST/SettingExpr.cpp | 33 + src/Parsers/New/AST/SettingExpr.h | 25 + src/Parsers/New/AST/ShowCreateQuery.cpp | 96 + src/Parsers/New/AST/ShowCreateQuery.h | 36 + src/Parsers/New/AST/ShowQuery.cpp | 49 + src/Parsers/New/AST/ShowQuery.h | 32 + src/Parsers/New/AST/SystemQuery.cpp | 191 + src/Parsers/New/AST/SystemQuery.h | 50 + src/Parsers/New/AST/TableElementExpr.cpp | 233 + src/Parsers/New/AST/TableElementExpr.h | 116 + src/Parsers/New/AST/TableExpr.cpp | 190 + src/Parsers/New/AST/TableExpr.h | 81 + src/Parsers/New/AST/TruncateQuery.cpp | 47 + src/Parsers/New/AST/TruncateQuery.h | 25 + src/Parsers/New/AST/UseQuery.cpp | 37 + src/Parsers/New/AST/UseQuery.h | 23 + src/Parsers/New/AST/WatchQuery.cpp | 51 + src/Parsers/New/AST/WatchQuery.h | 26 + src/Parsers/New/AST/fwd_decl.h | 89 + src/Parsers/New/CMakeLists.txt | 97 + src/Parsers/New/CharInputStream.cpp | 79 + src/Parsers/New/CharInputStream.h | 34 + src/Parsers/New/ClickHouseLexer.cpp | 1581 ++ src/Parsers/New/ClickHouseLexer.g4 | 279 + src/Parsers/New/ClickHouseLexer.h | 98 + src/Parsers/New/ClickHouseParser.cpp | 19317 ++++++++++++++++ src/Parsers/New/ClickHouseParser.g4 | 449 + src/Parsers/New/ClickHouseParser.h | 3248 +++ src/Parsers/New/ClickHouseParserVisitor.cpp | 9 + src/Parsers/New/ClickHouseParserVisitor.h | 398 + src/Parsers/New/LexerErrorListener.cpp | 25 + src/Parsers/New/LexerErrorListener.h | 21 + src/Parsers/New/ParseTreeVisitor.cpp | 149 + src/Parsers/New/ParseTreeVisitor.h | 290 + src/Parsers/New/ParserErrorListener.cpp | 34 + src/Parsers/New/ParserErrorListener.h | 21 + src/Parsers/New/parseQuery.cpp | 90 + src/Parsers/New/parseQuery.h | 15 + src/Parsers/ParserAlterQuery.cpp | 4 +- src/Parsers/ParserCreateQuery.cpp | 1 + src/Parsers/ParserDataType.cpp | 1 + src/Parsers/ParserExplainQuery.cpp | 10 +- src/Parsers/ParserOptimizeQuery.cpp | 3 +- src/Parsers/ParserSelectWithUnionQuery.cpp | 4 +- src/Parsers/ParserSystemQuery.cpp | 2 +- src/Parsers/parseQuery.cpp | 3 +- src/Parsers/ya.make.in | 2 +- .../Impl/ConstantExpressionTemplate.cpp | 2 +- .../LiveView/TemporaryLiveViewCleaner.cpp | 1 - src/Storages/MergeTree/KeyCondition.cpp | 3 + src/Storages/MutationCommands.cpp | 9 +- src/Storages/MutationCommands.h | 2 +- src/Storages/extractKeyExpressionList.cpp | 7 +- .../00048_a_stored_aggregates_merge.sql | 16 +- .../queries/0_stateless/00063_check_query.sql | 4 +- ...0097_long_storage_buffer_race_condition.sh | 2 +- ...0416_pocopatch_progress_in_http_headers.sh | 3 +- .../00443_optimize_final_vertical_merge.sh | 5 +- .../00462_json_true_false_literals.sql | 2 +- .../00463_long_sessions_in_http_interface.sh | 2 +- ...arison_of_strings_containing_null_char.sql | 3 +- .../0_stateless/00489_pk_subexpression.sql | 4 +- .../00597_push_down_predicate.reference | 2 +- .../0_stateless/00612_pk_in_tuple_perf.sh | 3 + ..._replace_partition_from_table_zookeeper.sh | 4 +- .../queries/0_stateless/00642_cast.reference | 4 +- .../00643_cast_zookeeper.reference | 4 +- .../0_stateless/00674_join_on_syntax.sql | 48 +- .../00725_comment_columns.reference | 6 +- .../00730_unicode_terminal_format.sql | 24 +- ...d_optimize_skip_select_on_unused_shards.sh | 3 + ...p_select_on_unused_shards_with_prewhere.sh | 3 + ...4_test_custom_compression_codecs.reference | 4 +- ...m_compression_codes_log_storages.reference | 8 +- .../00816_long_concurrent_alter_column.sh | 2 +- .../0_stateless/00818_alias_bug_4110.sql | 2 +- .../0_stateless/00834_kill_mutation.reference | 4 +- .../0_stateless/00834_kill_mutation.sh | 32 +- .../0_stateless/00836_indices_alter.reference | 10 +- .../00848_join_use_nulls_segfault.sql | 2 +- .../0_stateless/00900_parquet_decimal.sh | 4 +- tests/queries/0_stateless/00902_entropy.sql | 6 +- .../00926_adaptive_index_granularity_pk.sql | 4 +- .../0_stateless/00937_test_use_header_tsv.sh | 10 +- ...eate_bloom_filter_index_with_merge_tree.sh | 6 +- .../0_stateless/00952_basic_constraints.sh | 3 +- ...0953_zookeeper_suetin_deduplication_bug.sh | 2 + .../0_stateless/00955_test_final_mark_use.sh | 6 +- .../00980_merge_alter_settings.reference | 10 +- .../01001_rename_merge_race_condition.sh | 4 +- .../0_stateless/01005_rwr_shard_deadlock.sh | 4 +- .../01010_low_cardinality_and_native_http.sh | 3 + ...rrent_recreate_reattach_and_show_tables.sh | 2 + .../01018_ddl_dictionaries_create.sql | 8 +- .../01018_ddl_dictionaries_select.sql | 8 +- .../01018_ddl_dictionaries_special.sql | 6 +- .../01018_dictionaries_from_dictionaries.sql | 8 +- .../01019_alter_materialized_view_atomic.sh | 3 + ...1019_alter_materialized_view_consistent.sh | 4 + .../01023_materialized_view_query_context.sql | 12 +- .../01033_dictionaries_lifetime.sql | 2 +- ...rfluous_dict_reload_on_create_database.sql | 7 +- ...luous_dict_reload_on_create_database_2.sql | 7 +- ...ionary_invalidate_query_switchover_long.sh | 2 +- .../01041_create_dictionary_if_not_exists.sql | 4 +- ...em_reload_dictionary_reloads_completely.sh | 2 +- ...dictionary_attribute_properties_values.sql | 2 +- .../01045_order_by_pk_special_storages.sh | 4 +- .../0_stateless/01053_ssd_dictionary.sql | 6 +- .../01054_cache_dictionary_bunch_update.sh | 1 + .../01055_compact_parts_granularity.sh | 4 +- .../0_stateless/01056_create_table_as.sql | 2 +- ..._error_incorrect_size_of_nested_column.sql | 6 +- ...tart_replicas_rename_deadlock_zookeeper.sh | 4 +- ...tionary_layout_without_arguments.reference | 2 +- ...10_dictionary_layout_without_arguments.sql | 2 +- ...01113_local_dictionary_type_conversion.sql | 2 +- .../01114_database_atomic.reference | 8 +- .../01115_join_with_dictionary.sql | 6 +- .../01125_dict_ddl_cannot_add_column.sql | 2 +- .../01129_dict_get_join_lose_constness.sql | 2 +- .../01190_full_attach_syntax.reference | 6 +- .../0_stateless/01190_full_attach_syntax.sql | 4 +- .../0_stateless/01191_rename_dictionary.sql | 2 +- .../01192_rename_database_zookeeper.reference | 2 +- .../01192_rename_database_zookeeper.sh | 2 +- .../01213_alter_rename_nested.reference | 6 +- ...er_rename_with_default_zookeeper.reference | 4 +- .../01213_alter_table_rename_nested.reference | 4 +- ...01224_no_superfluous_dict_reload.reference | 4 +- .../01224_no_superfluous_dict_reload.sql | 2 +- .../01225_drop_dictionary_as_table.sql | 2 +- ...1225_show_create_table_from_dictionary.sql | 2 +- ...9_bad_arguments_for_bloom_filter.reference | 6 +- .../01251_dict_is_in_infinite_loop.sql | 6 +- .../01254_dict_create_without_db.sql | 2 +- .../01254_dict_load_after_detach_attach.sql | 2 +- .../01257_dictionary_mismatch_types.sql | 2 +- .../01259_dictionary_custom_settings_ddl.sql | 2 +- .../01268_dictionary_direct_layout.sql | 6 +- .../01269_create_with_null.reference | 4 +- tests/queries/0_stateless/01273_arrow_load.sh | 1 + ...alter_rename_column_default_expr.reference | 4 +- ..._rename_column_materialized_expr.reference | 4 +- ...7_alter_rename_column_constraint.reference | 4 +- ..._block_size_rows_for_materialized_views.sh | 4 +- .../0_stateless/01279_empty_external_table.sh | 6 +- .../01280_ssd_complex_key_dictionary.sql | 4 +- .../0_stateless/01280_ttl_where_group_by.sh | 7 + ...rrent_recreate_reattach_and_show_tables.sh | 2 + .../01305_replica_create_drop_zookeeper.sh | 2 +- .../01318_alter_add_column_exists.reference | 8 +- ...1318_alter_add_constraint_format.reference | 2 +- .../01338_long_select_and_alter.reference | 2 +- ...GROUP_BY_injective_elimination_dictGet.sql | 6 +- .../0_stateless/01391_join_on_dict_crash.sql | 2 +- ...nactive_replica_cleanup_nodes_zookeeper.sh | 2 +- .../01413_allow_non_metadata_alters.reference | 4 +- .../01415_sticking_mutations.reference | 14 +- .../01429_empty_arrow_and_parquet.sh | 2 + .../0_stateless/01442_merge_detach_attach.sh | 2 + .../0_stateless/01443_merge_truncate.sh | 2 + ...01454_storagememory_data_race_challenge.sh | 2 + .../01455_default_compression.reference | 2 +- .../01461_alter_table_function.reference | 4 +- .../01465_ttl_recompression.reference | 4 +- ...ter_remove_no_property_zookeeper.reference | 4 +- .../01493_alter_remove_properties.reference | 16 +- ...01493_alter_remove_wrong_default.reference | 2 +- ...1501_clickhouse_client_INSERT_exception.sh | 5 +- .../01502_log_tinylog_deadlock_race.sh | 3 + .../01509_dictionary_preallocate.reference | 2 +- .../01509_dictionary_preallocate.sql | 2 +- ...3_defaults_on_defaults_no_column.reference | 2 +- ...01515_with_global_and_with_propagation.sql | 2 +- .../01526_client_start_and_exit.expect | 4 +- .../01526_complex_key_dict_direct_layout.sql | 2 +- ...01527_dist_sharding_key_dictGet_reload.sql | 2 +- ...y_key_without_order_by_zookeeper.reference | 6 +- .../01545_url_file_format_settings.sql | 4 +- .../0_stateless/01552_dict_fixedstring.sql | 2 +- .../01563_distributed_query_finish.sh | 5 +- .../01582_distinct_optimization.sh | 4 +- .../1_stateful/00157_cache_dictionary.sql | 16 +- tests/queries/query_test.py | 19 +- tests/queries/server.py | 47 + utils/CMakeLists.txt | 8 +- utils/check-style/check-style | 50 +- utils/grammar-fuzzer/ClickHouseUnlexer.py | 1771 ++ utils/grammar-fuzzer/ClickHouseUnparser.py | 1815 ++ utils/grammar-fuzzer/README.md | 41 + utils/grammar-fuzzer/SpaceTransformer.py | 38 + utils/grammar-fuzzer/__init__.py | 1 + utils/grammar/ClickHouseLexer.g4 | 237 - utils/grammar/ClickHouseParser.g4 | 593 - utils/grammar/README.md | 8 - utils/syntax-analyzer/CMakeLists.txt | 3 + utils/syntax-analyzer/main.cpp | 63 + 312 files changed, 38835 insertions(+), 1571 deletions(-) create mode 160000 contrib/antlr4-runtime create mode 100644 contrib/antlr4-runtime-cmake/CMakeLists.txt create mode 100644 src/Parsers/New/AST/AlterTableQuery.cpp create mode 100644 src/Parsers/New/AST/AlterTableQuery.h create mode 100644 src/Parsers/New/AST/AttachQuery.cpp create mode 100644 src/Parsers/New/AST/AttachQuery.h create mode 100644 src/Parsers/New/AST/CheckQuery.cpp create mode 100644 src/Parsers/New/AST/CheckQuery.h create mode 100644 src/Parsers/New/AST/ColumnExpr.cpp create mode 100644 src/Parsers/New/AST/ColumnExpr.h create mode 100644 src/Parsers/New/AST/ColumnTypeExpr.cpp create mode 100644 src/Parsers/New/AST/ColumnTypeExpr.h create mode 100644 src/Parsers/New/AST/CreateDatabaseQuery.cpp create mode 100644 src/Parsers/New/AST/CreateDatabaseQuery.h create mode 100644 src/Parsers/New/AST/CreateDictionaryQuery.cpp create mode 100644 src/Parsers/New/AST/CreateDictionaryQuery.h create mode 100644 src/Parsers/New/AST/CreateLiveViewQuery.cpp create mode 100644 src/Parsers/New/AST/CreateLiveViewQuery.h create mode 100644 src/Parsers/New/AST/CreateMaterializedViewQuery.cpp create mode 100644 src/Parsers/New/AST/CreateMaterializedViewQuery.h create mode 100644 src/Parsers/New/AST/CreateTableQuery.cpp create mode 100644 src/Parsers/New/AST/CreateTableQuery.h create mode 100644 src/Parsers/New/AST/CreateViewQuery.cpp create mode 100644 src/Parsers/New/AST/CreateViewQuery.h create mode 100644 src/Parsers/New/AST/DDLQuery.cpp create mode 100644 src/Parsers/New/AST/DDLQuery.h create mode 100644 src/Parsers/New/AST/DescribeQuery.cpp create mode 100644 src/Parsers/New/AST/DescribeQuery.h create mode 100644 src/Parsers/New/AST/DropQuery.cpp create mode 100644 src/Parsers/New/AST/DropQuery.h create mode 100644 src/Parsers/New/AST/EngineExpr.cpp create mode 100644 src/Parsers/New/AST/EngineExpr.h create mode 100644 src/Parsers/New/AST/ExistsQuery.cpp create mode 100644 src/Parsers/New/AST/ExistsQuery.h create mode 100644 src/Parsers/New/AST/ExplainQuery.cpp create mode 100644 src/Parsers/New/AST/ExplainQuery.h create mode 100644 src/Parsers/New/AST/INode.h create mode 100644 src/Parsers/New/AST/Identifier.cpp create mode 100644 src/Parsers/New/AST/Identifier.h create mode 100644 src/Parsers/New/AST/InsertQuery.cpp create mode 100644 src/Parsers/New/AST/InsertQuery.h create mode 100644 src/Parsers/New/AST/JoinExpr.cpp create mode 100644 src/Parsers/New/AST/JoinExpr.h create mode 100644 src/Parsers/New/AST/KillQuery.cpp create mode 100644 src/Parsers/New/AST/KillQuery.h create mode 100644 src/Parsers/New/AST/LimitExpr.cpp create mode 100644 src/Parsers/New/AST/LimitExpr.h create mode 100644 src/Parsers/New/AST/Literal.cpp create mode 100644 src/Parsers/New/AST/Literal.h create mode 100644 src/Parsers/New/AST/OptimizeQuery.cpp create mode 100644 src/Parsers/New/AST/OptimizeQuery.h create mode 100644 src/Parsers/New/AST/OrderExpr.cpp create mode 100644 src/Parsers/New/AST/OrderExpr.h create mode 100644 src/Parsers/New/AST/Query.cpp create mode 100644 src/Parsers/New/AST/Query.h create mode 100644 src/Parsers/New/AST/README.md create mode 100644 src/Parsers/New/AST/RatioExpr.cpp create mode 100644 src/Parsers/New/AST/RatioExpr.h create mode 100644 src/Parsers/New/AST/RenameQuery.cpp create mode 100644 src/Parsers/New/AST/RenameQuery.h create mode 100644 src/Parsers/New/AST/SelectUnionQuery.cpp create mode 100644 src/Parsers/New/AST/SelectUnionQuery.h create mode 100644 src/Parsers/New/AST/SetQuery.cpp create mode 100644 src/Parsers/New/AST/SetQuery.h create mode 100644 src/Parsers/New/AST/SettingExpr.cpp create mode 100644 src/Parsers/New/AST/SettingExpr.h create mode 100644 src/Parsers/New/AST/ShowCreateQuery.cpp create mode 100644 src/Parsers/New/AST/ShowCreateQuery.h create mode 100644 src/Parsers/New/AST/ShowQuery.cpp create mode 100644 src/Parsers/New/AST/ShowQuery.h create mode 100644 src/Parsers/New/AST/SystemQuery.cpp create mode 100644 src/Parsers/New/AST/SystemQuery.h create mode 100644 src/Parsers/New/AST/TableElementExpr.cpp create mode 100644 src/Parsers/New/AST/TableElementExpr.h create mode 100644 src/Parsers/New/AST/TableExpr.cpp create mode 100644 src/Parsers/New/AST/TableExpr.h create mode 100644 src/Parsers/New/AST/TruncateQuery.cpp create mode 100644 src/Parsers/New/AST/TruncateQuery.h create mode 100644 src/Parsers/New/AST/UseQuery.cpp create mode 100644 src/Parsers/New/AST/UseQuery.h create mode 100644 src/Parsers/New/AST/WatchQuery.cpp create mode 100644 src/Parsers/New/AST/WatchQuery.h create mode 100644 src/Parsers/New/AST/fwd_decl.h create mode 100644 src/Parsers/New/CMakeLists.txt create mode 100644 src/Parsers/New/CharInputStream.cpp create mode 100644 src/Parsers/New/CharInputStream.h create mode 100644 src/Parsers/New/ClickHouseLexer.cpp create mode 100644 src/Parsers/New/ClickHouseLexer.g4 create mode 100644 src/Parsers/New/ClickHouseLexer.h create mode 100644 src/Parsers/New/ClickHouseParser.cpp create mode 100644 src/Parsers/New/ClickHouseParser.g4 create mode 100644 src/Parsers/New/ClickHouseParser.h create mode 100644 src/Parsers/New/ClickHouseParserVisitor.cpp create mode 100644 src/Parsers/New/ClickHouseParserVisitor.h create mode 100644 src/Parsers/New/LexerErrorListener.cpp create mode 100644 src/Parsers/New/LexerErrorListener.h create mode 100644 src/Parsers/New/ParseTreeVisitor.cpp create mode 100644 src/Parsers/New/ParseTreeVisitor.h create mode 100644 src/Parsers/New/ParserErrorListener.cpp create mode 100644 src/Parsers/New/ParserErrorListener.h create mode 100644 src/Parsers/New/parseQuery.cpp create mode 100644 src/Parsers/New/parseQuery.h create mode 100644 utils/grammar-fuzzer/ClickHouseUnlexer.py create mode 100644 utils/grammar-fuzzer/ClickHouseUnparser.py create mode 100644 utils/grammar-fuzzer/README.md create mode 100644 utils/grammar-fuzzer/SpaceTransformer.py create mode 100644 utils/grammar-fuzzer/__init__.py delete mode 100644 utils/grammar/ClickHouseLexer.g4 delete mode 100644 utils/grammar/ClickHouseParser.g4 delete mode 100644 utils/grammar/README.md create mode 100644 utils/syntax-analyzer/CMakeLists.txt create mode 100644 utils/syntax-analyzer/main.cpp diff --git a/.gitignore b/.gitignore index 2cb20976632..1e9765dca9e 100644 --- a/.gitignore +++ b/.gitignore @@ -125,4 +125,15 @@ website/package-lock.json # Toolchains /cmake/toolchain/* +# ANTLR extension cache +.antlr + +# ANTLR generated files +/src/Parsers/New/*.interp +/src/Parsers/New/*.tokens +/src/Parsers/New/ClickHouseParserBaseVisitor.* + +# pytest-profiling +/prof + *.iml diff --git a/.gitmodules b/.gitmodules index bd06d9d9acc..b9a22d13c79 100644 --- a/.gitmodules +++ b/.gitmodules @@ -172,6 +172,9 @@ [submodule "contrib/fmtlib"] path = contrib/fmtlib url = https://github.com/fmtlib/fmt.git +[submodule "contrib/antlr4-runtime"] + path = contrib/antlr4-runtime + url = https://github.com/ClickHouse-Extras/antlr4-runtime.git [submodule "contrib/sentry-native"] path = contrib/sentry-native url = https://github.com/ClickHouse-Extras/sentry-native.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 1daff973bb1..e3ddfb0c7ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,8 @@ if (WITH_COVERAGE AND COMPILER_GCC) set(WITHOUT_COVERAGE "-fno-profile-arcs -fno-test-coverage") endif() +set(COMPILER_FLAGS "${COMPILER_FLAGS}") + set (CMAKE_BUILD_COLOR_MAKEFILE ON) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS} ${PLATFORM_EXTRA_CXX_FLAG} ${COMMON_WARNING_FLAGS} ${CXX_WARNING_FLAGS}") set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3 ${CMAKE_CXX_FLAGS_ADD}") diff --git a/base/common/defines.h b/base/common/defines.h index af5981023ff..e4c456796d3 100644 --- a/base/common/defines.h +++ b/base/common/defines.h @@ -76,12 +76,6 @@ # define NO_SANITIZE_THREAD #endif -#if defined __GNUC__ && !defined __clang__ -# define OPTIMIZE(x) __attribute__((__optimize__(x))) -#else -# define OPTIMIZE(x) -#endif - /// A macro for suppressing warnings about unused variables or function results. /// Useful for structured bindings which have no standard way to declare this. #define UNUSED(...) (void)(__VA_ARGS__) diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake index 8fa4a1129ed..8122e9ef31e 100644 --- a/cmake/warnings.cmake +++ b/cmake/warnings.cmake @@ -24,7 +24,7 @@ option (WEVERYTHING "Enable -Weverything option with some exceptions." ON) # Control maximum size of stack frames. It can be important if the code is run in fibers with small stack size. # Only in release build because debug has too large stack frames. if ((NOT CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG") AND (NOT SANITIZE) AND (NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")) - add_warning(frame-larger-than=32768) + add_warning(frame-larger-than=65536) endif () if (COMPILER_CLANG) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 37c18b1e1d6..57f08cc399c 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -21,6 +21,7 @@ endif() set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL 1) +add_subdirectory (antlr4-runtime-cmake) add_subdirectory (boost-cmake) add_subdirectory (cctz-cmake) add_subdirectory (consistent-hashing-sumbur) diff --git a/contrib/antlr4-runtime b/contrib/antlr4-runtime new file mode 160000 index 00000000000..a2fa7b76e2e --- /dev/null +++ b/contrib/antlr4-runtime @@ -0,0 +1 @@ +Subproject commit a2fa7b76e2ee16d2ad955e9214a90bbf79da66fc diff --git a/contrib/antlr4-runtime-cmake/CMakeLists.txt b/contrib/antlr4-runtime-cmake/CMakeLists.txt new file mode 100644 index 00000000000..5baefdb1e29 --- /dev/null +++ b/contrib/antlr4-runtime-cmake/CMakeLists.txt @@ -0,0 +1,156 @@ +set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/antlr4-runtime) + +set (SRCS + ${LIBRARY_DIR}/ANTLRErrorListener.cpp + ${LIBRARY_DIR}/ANTLRErrorStrategy.cpp + ${LIBRARY_DIR}/ANTLRFileStream.cpp + ${LIBRARY_DIR}/ANTLRInputStream.cpp + ${LIBRARY_DIR}/atn/AbstractPredicateTransition.cpp + ${LIBRARY_DIR}/atn/ActionTransition.cpp + ${LIBRARY_DIR}/atn/AmbiguityInfo.cpp + ${LIBRARY_DIR}/atn/ArrayPredictionContext.cpp + ${LIBRARY_DIR}/atn/ATN.cpp + ${LIBRARY_DIR}/atn/ATNConfig.cpp + ${LIBRARY_DIR}/atn/ATNConfigSet.cpp + ${LIBRARY_DIR}/atn/ATNDeserializationOptions.cpp + ${LIBRARY_DIR}/atn/ATNDeserializer.cpp + ${LIBRARY_DIR}/atn/ATNSerializer.cpp + ${LIBRARY_DIR}/atn/ATNSimulator.cpp + ${LIBRARY_DIR}/atn/ATNState.cpp + ${LIBRARY_DIR}/atn/AtomTransition.cpp + ${LIBRARY_DIR}/atn/BasicBlockStartState.cpp + ${LIBRARY_DIR}/atn/BasicState.cpp + ${LIBRARY_DIR}/atn/BlockEndState.cpp + ${LIBRARY_DIR}/atn/BlockStartState.cpp + ${LIBRARY_DIR}/atn/ContextSensitivityInfo.cpp + ${LIBRARY_DIR}/atn/DecisionEventInfo.cpp + ${LIBRARY_DIR}/atn/DecisionInfo.cpp + ${LIBRARY_DIR}/atn/DecisionState.cpp + ${LIBRARY_DIR}/atn/EmptyPredictionContext.cpp + ${LIBRARY_DIR}/atn/EpsilonTransition.cpp + ${LIBRARY_DIR}/atn/ErrorInfo.cpp + ${LIBRARY_DIR}/atn/LexerAction.cpp + ${LIBRARY_DIR}/atn/LexerActionExecutor.cpp + ${LIBRARY_DIR}/atn/LexerATNConfig.cpp + ${LIBRARY_DIR}/atn/LexerATNSimulator.cpp + ${LIBRARY_DIR}/atn/LexerChannelAction.cpp + ${LIBRARY_DIR}/atn/LexerCustomAction.cpp + ${LIBRARY_DIR}/atn/LexerIndexedCustomAction.cpp + ${LIBRARY_DIR}/atn/LexerModeAction.cpp + ${LIBRARY_DIR}/atn/LexerMoreAction.cpp + ${LIBRARY_DIR}/atn/LexerPopModeAction.cpp + ${LIBRARY_DIR}/atn/LexerPushModeAction.cpp + ${LIBRARY_DIR}/atn/LexerSkipAction.cpp + ${LIBRARY_DIR}/atn/LexerTypeAction.cpp + ${LIBRARY_DIR}/atn/LL1Analyzer.cpp + ${LIBRARY_DIR}/atn/LookaheadEventInfo.cpp + ${LIBRARY_DIR}/atn/LoopEndState.cpp + ${LIBRARY_DIR}/atn/NotSetTransition.cpp + ${LIBRARY_DIR}/atn/OrderedATNConfigSet.cpp + ${LIBRARY_DIR}/atn/ParseInfo.cpp + ${LIBRARY_DIR}/atn/ParserATNSimulator.cpp + ${LIBRARY_DIR}/atn/PlusBlockStartState.cpp + ${LIBRARY_DIR}/atn/PlusLoopbackState.cpp + ${LIBRARY_DIR}/atn/PrecedencePredicateTransition.cpp + ${LIBRARY_DIR}/atn/PredicateEvalInfo.cpp + ${LIBRARY_DIR}/atn/PredicateTransition.cpp + ${LIBRARY_DIR}/atn/PredictionContext.cpp + ${LIBRARY_DIR}/atn/PredictionMode.cpp + ${LIBRARY_DIR}/atn/ProfilingATNSimulator.cpp + ${LIBRARY_DIR}/atn/RangeTransition.cpp + ${LIBRARY_DIR}/atn/RuleStartState.cpp + ${LIBRARY_DIR}/atn/RuleStopState.cpp + ${LIBRARY_DIR}/atn/RuleTransition.cpp + ${LIBRARY_DIR}/atn/SemanticContext.cpp + ${LIBRARY_DIR}/atn/SetTransition.cpp + ${LIBRARY_DIR}/atn/SingletonPredictionContext.cpp + ${LIBRARY_DIR}/atn/StarBlockStartState.cpp + ${LIBRARY_DIR}/atn/StarLoopbackState.cpp + ${LIBRARY_DIR}/atn/StarLoopEntryState.cpp + ${LIBRARY_DIR}/atn/TokensStartState.cpp + ${LIBRARY_DIR}/atn/Transition.cpp + ${LIBRARY_DIR}/atn/WildcardTransition.cpp + ${LIBRARY_DIR}/BailErrorStrategy.cpp + ${LIBRARY_DIR}/BaseErrorListener.cpp + ${LIBRARY_DIR}/BufferedTokenStream.cpp + ${LIBRARY_DIR}/CharStream.cpp + ${LIBRARY_DIR}/CommonToken.cpp + ${LIBRARY_DIR}/CommonTokenFactory.cpp + ${LIBRARY_DIR}/CommonTokenStream.cpp + ${LIBRARY_DIR}/ConsoleErrorListener.cpp + ${LIBRARY_DIR}/DefaultErrorStrategy.cpp + ${LIBRARY_DIR}/dfa/DFA.cpp + ${LIBRARY_DIR}/dfa/DFASerializer.cpp + ${LIBRARY_DIR}/dfa/DFAState.cpp + ${LIBRARY_DIR}/dfa/LexerDFASerializer.cpp + ${LIBRARY_DIR}/DiagnosticErrorListener.cpp + ${LIBRARY_DIR}/Exceptions.cpp + ${LIBRARY_DIR}/FailedPredicateException.cpp + ${LIBRARY_DIR}/InputMismatchException.cpp + ${LIBRARY_DIR}/InterpreterRuleContext.cpp + ${LIBRARY_DIR}/IntStream.cpp + ${LIBRARY_DIR}/Lexer.cpp + ${LIBRARY_DIR}/LexerInterpreter.cpp + ${LIBRARY_DIR}/LexerNoViableAltException.cpp + ${LIBRARY_DIR}/ListTokenSource.cpp + ${LIBRARY_DIR}/misc/InterpreterDataReader.cpp + ${LIBRARY_DIR}/misc/Interval.cpp + ${LIBRARY_DIR}/misc/IntervalSet.cpp + ${LIBRARY_DIR}/misc/MurmurHash.cpp + ${LIBRARY_DIR}/misc/Predicate.cpp + ${LIBRARY_DIR}/NoViableAltException.cpp + ${LIBRARY_DIR}/Parser.cpp + ${LIBRARY_DIR}/ParserInterpreter.cpp + ${LIBRARY_DIR}/ParserRuleContext.cpp + ${LIBRARY_DIR}/ProxyErrorListener.cpp + ${LIBRARY_DIR}/RecognitionException.cpp + ${LIBRARY_DIR}/Recognizer.cpp + ${LIBRARY_DIR}/RuleContext.cpp + ${LIBRARY_DIR}/RuleContextWithAltNum.cpp + ${LIBRARY_DIR}/RuntimeMetaData.cpp + ${LIBRARY_DIR}/support/Any.cpp + ${LIBRARY_DIR}/support/Arrays.cpp + ${LIBRARY_DIR}/support/CPPUtils.cpp + ${LIBRARY_DIR}/support/guid.cpp + ${LIBRARY_DIR}/support/StringUtils.cpp + ${LIBRARY_DIR}/Token.cpp + ${LIBRARY_DIR}/TokenSource.cpp + ${LIBRARY_DIR}/TokenStream.cpp + ${LIBRARY_DIR}/TokenStreamRewriter.cpp + ${LIBRARY_DIR}/tree/ErrorNode.cpp + ${LIBRARY_DIR}/tree/ErrorNodeImpl.cpp + ${LIBRARY_DIR}/tree/IterativeParseTreeWalker.cpp + ${LIBRARY_DIR}/tree/ParseTree.cpp + ${LIBRARY_DIR}/tree/ParseTreeListener.cpp + ${LIBRARY_DIR}/tree/ParseTreeVisitor.cpp + ${LIBRARY_DIR}/tree/ParseTreeWalker.cpp + ${LIBRARY_DIR}/tree/pattern/Chunk.cpp + ${LIBRARY_DIR}/tree/pattern/ParseTreeMatch.cpp + ${LIBRARY_DIR}/tree/pattern/ParseTreePattern.cpp + ${LIBRARY_DIR}/tree/pattern/ParseTreePatternMatcher.cpp + ${LIBRARY_DIR}/tree/pattern/RuleTagToken.cpp + ${LIBRARY_DIR}/tree/pattern/TagChunk.cpp + ${LIBRARY_DIR}/tree/pattern/TextChunk.cpp + ${LIBRARY_DIR}/tree/pattern/TokenTagToken.cpp + ${LIBRARY_DIR}/tree/TerminalNode.cpp + ${LIBRARY_DIR}/tree/TerminalNodeImpl.cpp + ${LIBRARY_DIR}/tree/Trees.cpp + ${LIBRARY_DIR}/tree/xpath/XPath.cpp + ${LIBRARY_DIR}/tree/xpath/XPathElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathLexer.cpp + ${LIBRARY_DIR}/tree/xpath/XPathLexerErrorListener.cpp + ${LIBRARY_DIR}/tree/xpath/XPathRuleAnywhereElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathRuleElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathTokenAnywhereElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathTokenElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathWildcardAnywhereElement.cpp + ${LIBRARY_DIR}/tree/xpath/XPathWildcardElement.cpp + ${LIBRARY_DIR}/UnbufferedCharStream.cpp + ${LIBRARY_DIR}/UnbufferedTokenStream.cpp + ${LIBRARY_DIR}/Vocabulary.cpp + ${LIBRARY_DIR}/WritableToken.cpp +) + +add_library (antlr4-runtime ${SRCS}) + +target_include_directories (antlr4-runtime SYSTEM PUBLIC ${LIBRARY_DIR}) diff --git a/docker/test/fasttest/run.sh b/docker/test/fasttest/run.sh index c3f102786ae..63c3c679668 100755 --- a/docker/test/fasttest/run.sh +++ b/docker/test/fasttest/run.sh @@ -131,6 +131,7 @@ function clone_submodules cd "$FASTTEST_SOURCE" SUBMODULES_TO_UPDATE=( + contrib/antlr4-runtime contrib/boost contrib/zlib-ng contrib/libxml2 diff --git a/src/AggregateFunctions/parseAggregateFunctionParameters.cpp b/src/AggregateFunctions/parseAggregateFunctionParameters.cpp index 27772c143e8..679ed78ec8e 100644 --- a/src/AggregateFunctions/parseAggregateFunctionParameters.cpp +++ b/src/AggregateFunctions/parseAggregateFunctionParameters.cpp @@ -1,8 +1,8 @@ #include + +#include #include #include -#include -#include namespace DB @@ -25,6 +25,13 @@ Array getAggregateFunctionParametersArray(const ASTPtr & expression_list, const for (size_t i = 0; i < parameters.size(); ++i) { const auto * literal = parameters[i]->as(); + + ASTPtr func_literal; + if (!literal) + if (const auto * func = parameters[i]->as()) + if ((func_literal = func->toLiteral())) + literal = func_literal->as(); + if (!literal) { throw Exception( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3266c3a2df4..e1ca1729081 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,18 +6,6 @@ if (USE_CLANG_TIDY) set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}") endif () -if(COMPILER_PIPE) - set(MAX_COMPILER_MEMORY 2500) -else() - set(MAX_COMPILER_MEMORY 1500) -endif() -if(MAKE_STATIC_LIBRARIES) - set(MAX_LINKER_MEMORY 3500) -else() - set(MAX_LINKER_MEMORY 2500) -endif() -include(../cmake/limit_jobs.cmake) - set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/Common/config_version.h) set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/Common/config.h) @@ -49,6 +37,7 @@ add_subdirectory (Dictionaries) add_subdirectory (Disks) add_subdirectory (Storages) add_subdirectory (Parsers) +add_subdirectory (Parsers/New) add_subdirectory (IO) add_subdirectory (Functions) add_subdirectory (Interpreters) @@ -186,12 +175,12 @@ endif() if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES) add_library (dbms STATIC ${dbms_headers} ${dbms_sources}) - target_link_libraries (dbms PRIVATE jemalloc libdivide ${DBMS_COMMON_LIBRARIES}) + target_link_libraries (dbms PRIVATE clickhouse_parsers_new jemalloc libdivide ${DBMS_COMMON_LIBRARIES}) set (all_modules dbms) else() add_library (dbms SHARED ${dbms_headers} ${dbms_sources}) target_link_libraries (dbms PUBLIC ${all_modules} ${DBMS_COMMON_LIBRARIES}) - target_link_libraries (clickhouse_interpreters PRIVATE jemalloc libdivide) + target_link_libraries (clickhouse_interpreters PRIVATE clickhouse_parsers_new jemalloc libdivide) list (APPEND all_modules dbms) # force all split libs to be linked set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed") diff --git a/src/Core/MySQL/MySQLReplication.cpp b/src/Core/MySQL/MySQLReplication.cpp index a33d65fcbd5..b86d6447e26 100644 --- a/src/Core/MySQL/MySQLReplication.cpp +++ b/src/Core/MySQL/MySQLReplication.cpp @@ -799,9 +799,8 @@ namespace MySQLReplication break; } case WRITE_ROWS_EVENT_V1: - case WRITE_ROWS_EVENT_V2: - { - if (do_replicate()) + case WRITE_ROWS_EVENT_V2: { + if (doReplicate()) event = std::make_shared(table_map, std::move(event_header)); else event = std::make_shared(std::move(event_header)); @@ -810,9 +809,8 @@ namespace MySQLReplication break; } case DELETE_ROWS_EVENT_V1: - case DELETE_ROWS_EVENT_V2: - { - if (do_replicate()) + case DELETE_ROWS_EVENT_V2: { + if (doReplicate()) event = std::make_shared(table_map, std::move(event_header)); else event = std::make_shared(std::move(event_header)); @@ -821,9 +819,8 @@ namespace MySQLReplication break; } case UPDATE_ROWS_EVENT_V1: - case UPDATE_ROWS_EVENT_V2: - { - if (do_replicate()) + case UPDATE_ROWS_EVENT_V2: { + if (doReplicate()) event = std::make_shared(table_map, std::move(event_header)); else event = std::make_shared(std::move(event_header)); diff --git a/src/Core/MySQL/MySQLReplication.h b/src/Core/MySQL/MySQLReplication.h index bbefb368aaf..7c7604cad58 100644 --- a/src/Core/MySQL/MySQLReplication.h +++ b/src/Core/MySQL/MySQLReplication.h @@ -549,7 +549,7 @@ namespace MySQLReplication std::shared_ptr table_map; size_t checksum_signature_length = 4; - inline bool do_replicate() { return (replicate_do_db.empty() || table_map->schema == replicate_do_db); } + inline bool doReplicate() { return (replicate_do_db.empty() || table_map->schema == replicate_do_db); } }; } diff --git a/src/Core/Settings.h b/src/Core/Settings.h index 3cdad1ee567..26064ea591a 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -399,6 +399,8 @@ class IColumn; M(Bool, enable_global_with_statement, false, "Propagate WITH statements to UNION queries and all subqueries", 0) \ M(Bool, aggregate_functions_null_for_empty, false, "Rewrite all aggregate functions in a query, adding -OrNull suffix to them", 0) \ \ + M(Bool, use_antlr_parser, false, "Parse incoming queries using ANTLR-generated parser", 0) \ + \ /** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \ \ M(UInt64, max_memory_usage_for_all_queries, 0, "Obsolete. Will be removed after 2020-10-20", 0) \ diff --git a/src/DataTypes/DataTypeAggregateFunction.cpp b/src/DataTypes/DataTypeAggregateFunction.cpp index fdb17606f78..c4a62e64feb 100644 --- a/src/DataTypes/DataTypeAggregateFunction.cpp +++ b/src/DataTypes/DataTypeAggregateFunction.cpp @@ -357,20 +357,23 @@ static DataTypePtr create(const ASTPtr & arguments) throw Exception("Unexpected level of parameters to aggregate function", ErrorCodes::SYNTAX_ERROR); function_name = parametric->name; - const ASTs & parameters = parametric->arguments->children; - params_row.resize(parameters.size()); - - for (size_t i = 0; i < parameters.size(); ++i) + if (parametric->arguments) { - const auto * literal = parameters[i]->as(); - if (!literal) - throw Exception( - ErrorCodes::PARAMETERS_TO_AGGREGATE_FUNCTIONS_MUST_BE_LITERALS, - "Parameters to aggregate functions must be literals. " - "Got parameter '{}' for function '{}'", - parameters[i]->formatForErrorMessage(), function_name); + const ASTs & parameters = parametric->arguments->children; + params_row.resize(parameters.size()); - params_row[i] = literal->value; + for (size_t i = 0; i < parameters.size(); ++i) + { + const auto * literal = parameters[i]->as(); + if (!literal) + throw Exception( + ErrorCodes::PARAMETERS_TO_AGGREGATE_FUNCTIONS_MUST_BE_LITERALS, + "Parameters to aggregate functions must be literals. " + "Got parameter '{}' for function '{}'", + parameters[i]->formatForErrorMessage(), function_name); + + params_row[i] = literal->value; + } } } else if (auto opt_name = tryGetIdentifierName(arguments->children[0])) diff --git a/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp b/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp index 1d063dac697..d82adf33108 100644 --- a/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp +++ b/src/DataTypes/DataTypeCustomSimpleAggregateFunction.cpp @@ -72,20 +72,24 @@ static std::pair create(const ASTPtr & argum throw Exception("Unexpected level of parameters to aggregate function", ErrorCodes::SYNTAX_ERROR); function_name = parametric->name; - const ASTs & parameters = parametric->arguments->as().children; - params_row.resize(parameters.size()); - - for (size_t i = 0; i < parameters.size(); ++i) + if (parametric->arguments) { - const ASTLiteral * lit = parameters[i]->as(); - if (!lit) - throw Exception( - ErrorCodes::PARAMETERS_TO_AGGREGATE_FUNCTIONS_MUST_BE_LITERALS, - "Parameters to aggregate functions must be literals. " - "Got parameter '{}' for function '{}'", - parameters[i]->formatForErrorMessage(), function_name); + const ASTs & parameters = parametric->arguments->as().children; + params_row.resize(parameters.size()); - params_row[i] = lit->value; + for (size_t i = 0; i < parameters.size(); ++i) + { + const ASTLiteral * lit = parameters[i]->as(); + if (!lit) + throw Exception( + ErrorCodes::PARAMETERS_TO_AGGREGATE_FUNCTIONS_MUST_BE_LITERALS, + "Parameters to aggregate functions must be literals. " + "Got parameter '{}' for function '{}'", + parameters[i]->formatForErrorMessage(), + function_name); + + params_row[i] = lit->value; + } } } else if (auto opt_name = tryGetIdentifierName(arguments->children[0])) diff --git a/src/Dictionaries/getDictionaryConfigurationFromAST.cpp b/src/Dictionaries/getDictionaryConfigurationFromAST.cpp index 40e86d590c4..5c8159be750 100644 --- a/src/Dictionaries/getDictionaryConfigurationFromAST.cpp +++ b/src/Dictionaries/getDictionaryConfigurationFromAST.cpp @@ -99,38 +99,40 @@ void buildLayoutConfiguration( root->appendChild(layout_element); AutoPtr layout_type_element(doc->createElement(layout->layout_type)); layout_element->appendChild(layout_type_element); - for (const auto & param : layout->parameters->children) - { - const ASTPair * pair = param->as(); - if (!pair) + + if (layout->parameters) + for (const auto & param : layout->parameters->children) { - throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, "Dictionary layout parameters must be key/value pairs, got '{}' instead", - param->formatForErrorMessage()); + const ASTPair * pair = param->as(); + if (!pair) + { + throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, "Dictionary layout parameters must be key/value pairs, got '{}' instead", + param->formatForErrorMessage()); + } + + const ASTLiteral * value_literal = pair->second->as(); + if (!value_literal) + { + throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, + "Dictionary layout parameter value must be a literal, got '{}' instead", + pair->second->formatForErrorMessage()); + } + + const auto value_field = value_literal->value; + + if (value_field.getType() != Field::Types::UInt64 + && value_field.getType() != Field::Types::String) + { + throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, + "Dictionary layout parameter value must be an UInt64 or String, got '{}' instead", + value_field.getTypeName()); + } + + AutoPtr layout_type_parameter_element(doc->createElement(pair->first)); + AutoPtr value_to_append(doc->createTextNode(toString(value_field))); + layout_type_parameter_element->appendChild(value_to_append); + layout_type_element->appendChild(layout_type_parameter_element); } - - const ASTLiteral * value_literal = pair->second->as(); - if (!value_literal) - { - throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, - "Dictionary layout parameter value must be a literal, got '{}' instead", - pair->second->formatForErrorMessage()); - } - - const auto value_field = value_literal->value; - - if (value_field.getType() != Field::Types::UInt64 - && value_field.getType() != Field::Types::String) - { - throw DB::Exception(ErrorCodes::BAD_ARGUMENTS, - "Dictionary layout parameter value must be an UInt64 or String, got '{}' instead", - value_field.getTypeName()); - } - - AutoPtr layout_type_parameter_element(doc->createElement(pair->first)); - AutoPtr value_to_append(doc->createTextNode(toString(value_field))); - layout_type_parameter_element->appendChild(value_to_append); - layout_type_element->appendChild(layout_type_parameter_element); - } } /* diff --git a/src/Functions/GatherUtils/Sources.h b/src/Functions/GatherUtils/Sources.h index 348fabaaa75..e3eb5f6df75 100644 --- a/src/Functions/GatherUtils/Sources.h +++ b/src/Functions/GatherUtils/Sources.h @@ -141,16 +141,16 @@ struct NumericArraySource : public ArraySourceImpl> /// The methods can be virtual or not depending on the template parameter. See IStringSource. #if !__clang__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wsuggest-override" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsuggest-override" #elif __clang_major__ >= 11 - #pragma GCC diagnostic push -#ifdef HAS_SUGGEST_OVERRIDE - #pragma GCC diagnostic ignored "-Wsuggest-override" -#endif -#ifdef HAS_SUGGEST_DESTRUCTOR_OVERRIDE - #pragma GCC diagnostic ignored "-Wsuggest-destructor-override" -#endif +# pragma GCC diagnostic push +# ifdef HAS_SUGGEST_OVERRIDE +# pragma GCC diagnostic ignored "-Wsuggest-override" +# endif +# ifdef HAS_SUGGEST_DESTRUCTOR_OVERRIDE +# pragma GCC diagnostic ignored "-Wsuggest-destructor-override" +# endif #endif template @@ -234,7 +234,7 @@ struct ConstSource : public Base }; #if !__clang__ || __clang_major__ >= 11 -#pragma GCC diagnostic pop +# pragma GCC diagnostic pop #endif struct StringSource @@ -355,9 +355,9 @@ struct UTF8StringSource : public StringSource Slice getSliceFromLeft(size_t offset) const { - auto begin = &elements[prev_offset]; - auto end = elements.data() + offsets[row_num] - 1; - auto res_begin = skipCodePointsForward(begin, offset, end); + const auto * begin = &elements[prev_offset]; + const auto * end = elements.data() + offsets[row_num] - 1; + const auto * res_begin = skipCodePointsForward(begin, offset, end); if (res_begin >= end) return {begin, 0}; @@ -367,14 +367,14 @@ struct UTF8StringSource : public StringSource Slice getSliceFromLeft(size_t offset, size_t length) const { - auto begin = &elements[prev_offset]; - auto end = elements.data() + offsets[row_num] - 1; - auto res_begin = skipCodePointsForward(begin, offset, end); + const auto * begin = &elements[prev_offset]; + const auto * end = elements.data() + offsets[row_num] - 1; + const auto * res_begin = skipCodePointsForward(begin, offset, end); if (res_begin >= end) return {begin, 0}; - auto res_end = skipCodePointsForward(res_begin, length, end); + const auto * res_end = skipCodePointsForward(res_begin, length, end); if (res_end >= end) return {res_begin, size_t(end - res_begin)}; @@ -384,19 +384,19 @@ struct UTF8StringSource : public StringSource Slice getSliceFromRight(size_t offset) const { - auto begin = &elements[prev_offset]; - auto end = elements.data() + offsets[row_num] - 1; - auto res_begin = skipCodePointsBackward(end, offset, begin); + const auto * begin = &elements[prev_offset]; + const auto * end = elements.data() + offsets[row_num] - 1; + const auto * res_begin = skipCodePointsBackward(end, offset, begin); return {res_begin, size_t(end - res_begin)}; } Slice getSliceFromRight(size_t offset, size_t length) const { - auto begin = &elements[prev_offset]; - auto end = elements.data() + offsets[row_num] - 1; - auto res_begin = skipCodePointsBackward(end, offset, begin); - auto res_end = skipCodePointsForward(res_begin, length, end); + const auto * begin = &elements[prev_offset]; + const auto * end = elements.data() + offsets[row_num] - 1; + const auto * res_begin = skipCodePointsBackward(end, offset, begin); + const auto * res_end = skipCodePointsForward(res_begin, length, end); if (res_end >= end) return {res_begin, size_t(end - res_begin)}; @@ -495,7 +495,7 @@ struct IStringSource virtual bool isEnd() const = 0; virtual size_t getSizeForReserve() const = 0; virtual Slice getWhole() const = 0; - virtual ~IStringSource() {} + virtual ~IStringSource() = default; }; diff --git a/src/Interpreters/ActionsVisitor.cpp b/src/Interpreters/ActionsVisitor.cpp index a44dba84aa6..8aaf740b34b 100644 --- a/src/Interpreters/ActionsVisitor.cpp +++ b/src/Interpreters/ActionsVisitor.cpp @@ -757,39 +757,102 @@ void ActionsMatcher::visit(const ASTFunction & node, const ASTPtr & ast, Data & /// If the function has an argument-lambda expression, you need to determine its type before the recursive call. bool has_lambda_arguments = false; - size_t num_arguments = node.arguments->children.size(); - for (size_t arg = 0; arg < num_arguments; ++arg) + + if (node.arguments) { - auto & child = node.arguments->children[arg]; - - const auto * function = child->as(); - const auto * identifier = child->as(); - if (function && function->name == "lambda") + size_t num_arguments = node.arguments->children.size(); + for (size_t arg = 0; arg < num_arguments; ++arg) { - /// If the argument is a lambda expression, just remember its approximate type. - if (function->arguments->children.size() != 2) - throw Exception("lambda requires two arguments", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + auto & child = node.arguments->children[arg]; - const auto * lambda_args_tuple = function->arguments->children.at(0)->as(); - - if (!lambda_args_tuple || lambda_args_tuple->name != "tuple") - throw Exception("First argument of lambda must be a tuple", ErrorCodes::TYPE_MISMATCH); - - has_lambda_arguments = true; - argument_types.emplace_back(std::make_shared(DataTypes(lambda_args_tuple->arguments->children.size()))); - /// Select the name in the next cycle. - argument_names.emplace_back(); - } - else if (function && function->name == "untuple") - { - auto columns = doUntuple(function, data); - - if (columns.empty()) - continue; - - for (const auto & column : columns) + const auto * function = child->as(); + const auto * identifier = child->as(); + if (function && function->name == "lambda") { - if (auto name_type = getNameAndTypeFromAST(column, data)) + /// If the argument is a lambda expression, just remember its approximate type. + if (function->arguments->children.size() != 2) + throw Exception("lambda requires two arguments", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + + const auto * lambda_args_tuple = function->arguments->children.at(0)->as(); + + if (!lambda_args_tuple || lambda_args_tuple->name != "tuple") + throw Exception("First argument of lambda must be a tuple", ErrorCodes::TYPE_MISMATCH); + + has_lambda_arguments = true; + argument_types.emplace_back(std::make_shared(DataTypes(lambda_args_tuple->arguments->children.size()))); + /// Select the name in the next cycle. + argument_names.emplace_back(); + } + else if (function && function->name == "untuple") + { + auto columns = doUntuple(function, data); + + if (columns.empty()) + continue; + + for (const auto & column : columns) + { + if (auto name_type = getNameAndTypeFromAST(column, data)) + { + argument_types.push_back(name_type->type); + argument_names.push_back(name_type->name); + } + else + arguments_present = false; + } + + node.arguments->children.erase(node.arguments->children.begin() + arg); + node.arguments->children.insert(node.arguments->children.begin() + arg, columns.begin(), columns.end()); + num_arguments += columns.size() - 1; + arg += columns.size() - 1; + } + else if (checkFunctionIsInOrGlobalInOperator(node) && arg == 1 && prepared_set) + { + ColumnWithTypeAndName column; + column.type = std::make_shared(); + + /// If the argument is a set given by an enumeration of values (so, the set was already built), give it a unique name, + /// so that sets with the same literal representation do not fuse together (they can have different types). + if (!prepared_set->empty()) + column.name = data.getUniqueName("__set"); + else + column.name = child->getColumnName(); + + if (!data.hasColumn(column.name)) + { + auto column_set = ColumnSet::create(1, prepared_set); + /// If prepared_set is not empty, we have a set made with literals. + /// Create a const ColumnSet to make constant folding work + if (!prepared_set->empty()) + column.column = ColumnConst::create(std::move(column_set), 1); + else + column.column = std::move(column_set); + data.addColumn(column); + } + + argument_types.push_back(column.type); + argument_names.push_back(column.name); + } + else if (identifier && (functionIsJoinGet(node.name) || functionIsDictGet(node.name)) && arg == 0) + { + auto table_id = IdentifierSemantic::extractDatabaseAndTable(*identifier); + table_id = data.context.resolveStorageID(table_id, Context::ResolveOrdinary); + auto column_string = ColumnString::create(); + column_string->insert(table_id.getDatabaseName() + "." + table_id.getTableName()); + ColumnWithTypeAndName column( + ColumnConst::create(std::move(column_string), 1), + std::make_shared(), + data.getUniqueName("__" + node.name)); + data.addColumn(column); + argument_types.push_back(column.type); + argument_names.push_back(column.name); + } + else + { + /// If the argument is not a lambda expression, call it recursively and find out its type. + visit(child, data); + + if (auto name_type = getNameAndTypeFromAST(child, data)) { argument_types.push_back(name_type->type); argument_names.push_back(name_type->name); @@ -797,125 +860,66 @@ void ActionsMatcher::visit(const ASTFunction & node, const ASTPtr & ast, Data & else arguments_present = false; } - - node.arguments->children.erase(node.arguments->children.begin() + arg); - node.arguments->children.insert(node.arguments->children.begin() + arg, columns.begin(), columns.end()); - num_arguments += columns.size() - 1; - arg += columns.size() - 1; } - else if (checkFunctionIsInOrGlobalInOperator(node) && arg == 1 && prepared_set) + + if (data.only_consts && !arguments_present) + return; + + if (has_lambda_arguments && !data.only_consts) { - ColumnWithTypeAndName column; - column.type = std::make_shared(); + function_builder->getLambdaArgumentTypes(argument_types); - /// If the argument is a set given by an enumeration of values (so, the set was already built), give it a unique name, - /// so that sets with the same literal representation do not fuse together (they can have different types). - if (!prepared_set->empty()) - column.name = data.getUniqueName("__set"); - else - column.name = child->getColumnName(); - - if (!data.hasColumn(column.name)) + /// Call recursively for lambda expressions. + for (size_t i = 0; i < node.arguments->children.size(); ++i) { - auto column_set = ColumnSet::create(1, prepared_set); - /// If prepared_set is not empty, we have a set made with literals. - /// Create a const ColumnSet to make constant folding work - if (!prepared_set->empty()) - column.column = ColumnConst::create(std::move(column_set), 1); - else - column.column = std::move(column_set); - data.addColumn(column); - } + ASTPtr child = node.arguments->children[i]; - argument_types.push_back(column.type); - argument_names.push_back(column.name); - } - else if (identifier && (functionIsJoinGet(node.name) || functionIsDictGet(node.name)) && arg == 0) - { - auto table_id = IdentifierSemantic::extractDatabaseAndTable(*identifier); - table_id = data.context.resolveStorageID(table_id, Context::ResolveOrdinary); - auto column_string = ColumnString::create(); - column_string->insert(table_id.getDatabaseName() + "." + table_id.getTableName()); - ColumnWithTypeAndName column( - ColumnConst::create(std::move(column_string), 1), - std::make_shared(), - data.getUniqueName("__" + node.name)); - data.addColumn(column); - argument_types.push_back(column.type); - argument_names.push_back(column.name); - } - else - { - /// If the argument is not a lambda expression, call it recursively and find out its type. - visit(child, data); - - if (auto name_type = getNameAndTypeFromAST(child, data)) - { - argument_types.push_back(name_type->type); - argument_names.push_back(name_type->name); - } - else - arguments_present = false; - } - } - - if (data.only_consts && !arguments_present) - return; - - if (has_lambda_arguments && !data.only_consts) - { - function_builder->getLambdaArgumentTypes(argument_types); - - /// Call recursively for lambda expressions. - for (size_t i = 0; i < node.arguments->children.size(); ++i) - { - ASTPtr child = node.arguments->children[i]; - - const auto * lambda = child->as(); - if (lambda && lambda->name == "lambda") - { - const DataTypeFunction * lambda_type = typeid_cast(argument_types[i].get()); - const auto * lambda_args_tuple = lambda->arguments->children.at(0)->as(); - const ASTs & lambda_arg_asts = lambda_args_tuple->arguments->children; - NamesAndTypesList lambda_arguments; - - for (size_t j = 0; j < lambda_arg_asts.size(); ++j) + const auto * lambda = child->as(); + if (lambda && lambda->name == "lambda") { - auto opt_arg_name = tryGetIdentifierName(lambda_arg_asts[j]); - if (!opt_arg_name) - throw Exception("lambda argument declarations must be identifiers", ErrorCodes::TYPE_MISMATCH); + const DataTypeFunction * lambda_type = typeid_cast(argument_types[i].get()); + const auto * lambda_args_tuple = lambda->arguments->children.at(0)->as(); + const ASTs & lambda_arg_asts = lambda_args_tuple->arguments->children; + NamesAndTypesList lambda_arguments; - lambda_arguments.emplace_back(*opt_arg_name, lambda_type->getArgumentTypes()[j]); + for (size_t j = 0; j < lambda_arg_asts.size(); ++j) + { + auto opt_arg_name = tryGetIdentifierName(lambda_arg_asts[j]); + if (!opt_arg_name) + throw Exception("lambda argument declarations must be identifiers", ErrorCodes::TYPE_MISMATCH); + + lambda_arguments.emplace_back(*opt_arg_name, lambda_type->getArgumentTypes()[j]); + } + + data.actions_stack.pushLevel(lambda_arguments); + visit(lambda->arguments->children.at(1), data); + auto lambda_dag = data.actions_stack.popLevel(); + + String result_name = lambda->arguments->children.at(1)->getColumnName(); + lambda_dag->removeUnusedActions(Names(1, result_name)); + + auto lambda_actions = std::make_shared(lambda_dag); + + DataTypePtr result_type = lambda_actions->getSampleBlock().getByName(result_name).type; + + Names captured; + Names required = lambda_actions->getRequiredColumns(); + for (const auto & required_arg : required) + if (findColumn(required_arg, lambda_arguments) == lambda_arguments.end()) + captured.push_back(required_arg); + + /// We can not name `getColumnName()`, + /// because it does not uniquely define the expression (the types of arguments can be different). + String lambda_name = data.getUniqueName("__lambda"); + + auto function_capture = std::make_unique( + lambda_actions, captured, lambda_arguments, result_type, result_name); + auto function_capture_adapter = std::make_shared(std::move(function_capture)); + data.addFunction(function_capture_adapter, captured, lambda_name); + + argument_types[i] = std::make_shared(lambda_type->getArgumentTypes(), result_type); + argument_names[i] = lambda_name; } - - data.actions_stack.pushLevel(lambda_arguments); - visit(lambda->arguments->children.at(1), data); - auto lambda_dag = data.actions_stack.popLevel(); - - String result_name = lambda->arguments->children.at(1)->getColumnName(); - lambda_dag->removeUnusedActions(Names(1, result_name)); - - auto lambda_actions = std::make_shared(lambda_dag); - - DataTypePtr result_type = lambda_actions->getSampleBlock().getByName(result_name).type; - - Names captured; - Names required = lambda_actions->getRequiredColumns(); - for (const auto & required_arg : required) - if (findColumn(required_arg, lambda_arguments) == lambda_arguments.end()) - captured.push_back(required_arg); - - /// We can not name `getColumnName()`, - /// because it does not uniquely define the expression (the types of arguments can be different). - String lambda_name = data.getUniqueName("__lambda"); - - auto function_capture = std::make_unique( - lambda_actions, captured, lambda_arguments, result_type, result_name); - auto function_capture_adapter = std::make_shared(std::move(function_capture)); - data.addFunction(function_capture_adapter, captured, lambda_name); - - argument_types[i] = std::make_shared(lambda_type->getArgumentTypes(), result_type); - argument_names[i] = lambda_name; } } } diff --git a/src/Interpreters/AggregateFunctionOfGroupByKeysVisitor.h b/src/Interpreters/AggregateFunctionOfGroupByKeysVisitor.h index 327e422e776..80a804ff76c 100644 --- a/src/Interpreters/AggregateFunctionOfGroupByKeysVisitor.h +++ b/src/Interpreters/AggregateFunctionOfGroupByKeysVisitor.h @@ -97,10 +97,10 @@ public: function_node->name == "any" || function_node->name == "anyLast")) { KeepAggregateFunctionVisitor::Data keep_data{data.group_by_keys, false}; - KeepAggregateFunctionVisitor(keep_data).visit(function_node->arguments); + if (function_node->arguments) KeepAggregateFunctionVisitor(keep_data).visit(function_node->arguments); /// Place argument of an aggregate function instead of function - if (!keep_data.keep_aggregator && !function_node->arguments->children.empty()) + if (!keep_data.keep_aggregator && function_node->arguments && !function_node->arguments->children.empty()) { String alias = function_node->alias; ast = (function_node->arguments->children[0])->clone(); diff --git a/src/Interpreters/ArithmeticOperationsInAgrFuncOptimize.cpp b/src/Interpreters/ArithmeticOperationsInAgrFuncOptimize.cpp index 3ee7b59197a..d544ceb81a2 100644 --- a/src/Interpreters/ArithmeticOperationsInAgrFuncOptimize.cpp +++ b/src/Interpreters/ArithmeticOperationsInAgrFuncOptimize.cpp @@ -20,7 +20,7 @@ namespace const ASTFunction * getInternalFunction(const ASTFunction & func) { - if (func.arguments->children.size() == 1) + if (func.arguments && func.arguments->children.size() == 1) return func.arguments->children[0]->as(); return nullptr; } diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index 57bbf95bdbe..62b3bc0e619 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -1412,9 +1412,9 @@ BlockIO executeDDLQueryOnCluster(const ASTPtr & query_ptr_, const Context & cont if (const auto * query_alter = query_ptr->as()) { - for (const auto & command : query_alter->command_list->commands) + for (const auto & command : query_alter->command_list->children) { - if (!isSupportedAlterType(command->type)) + if (!isSupportedAlterType(command->as().type)) throw Exception("Unsupported type of ALTER query", ErrorCodes::NOT_IMPLEMENTED); } } diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index 7c9bb79dd24..1a112e9fef1 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -423,11 +423,11 @@ bool ExpressionAnalyzer::makeAggregateDescriptions(ActionsDAGPtr & actions) for (const ASTFunction * node : aggregates()) { AggregateDescription aggregate; - getRootActionsNoMakeSet(node->arguments, true, actions); + if (node->arguments) getRootActionsNoMakeSet(node->arguments, true, actions); aggregate.column_name = node->getColumnName(); - const ASTs & arguments = node->arguments->children; + const ASTs & arguments = node->arguments ? node->arguments->children : ASTs(); aggregate.argument_names.resize(arguments.size()); DataTypes types(arguments.size()); @@ -820,8 +820,9 @@ void SelectQueryExpressionAnalyzer::appendAggregateFunctionsArguments(Expression /// TODO: data.aggregates -> aggregates() for (const ASTFunction * node : data.aggregates) - for (auto & argument : node->arguments->children) - getRootActions(argument, only_types, step.actions()); + if (node->arguments) + for (auto & argument : node->arguments->children) + getRootActions(argument, only_types, step.actions()); } bool SelectQueryExpressionAnalyzer::appendHaving(ExpressionActionsChain & chain, bool only_types) diff --git a/src/Interpreters/GroupByFunctionKeysVisitor.h b/src/Interpreters/GroupByFunctionKeysVisitor.h index 04917b00c27..0c745be33ed 100644 --- a/src/Interpreters/GroupByFunctionKeysVisitor.h +++ b/src/Interpreters/GroupByFunctionKeysVisitor.h @@ -105,7 +105,7 @@ public: { if (auto * function_node = ast->as()) { - if (!(function_node->arguments->children.empty())) + if (function_node->arguments && !function_node->arguments->children.empty()) visit(function_node, data); } } diff --git a/src/Interpreters/InterpreterAlterQuery.cpp b/src/Interpreters/InterpreterAlterQuery.cpp index be5a4746073..8dfc9f1bea7 100644 --- a/src/Interpreters/InterpreterAlterQuery.cpp +++ b/src/Interpreters/InterpreterAlterQuery.cpp @@ -56,8 +56,9 @@ BlockIO InterpreterAlterQuery::execute() PartitionCommands partition_commands; MutationCommands mutation_commands; LiveViewCommands live_view_commands; - for (ASTAlterCommand * command_ast : alter.command_list->commands) + for (const auto & child : alter.command_list->children) { + auto * command_ast = child->as(); if (auto alter_command = AlterCommand::parse(command_ast)) alter_commands.emplace_back(std::move(*alter_command)); else if (auto partition_command = PartitionCommand::parse(command_ast)) @@ -124,8 +125,8 @@ AccessRightsElements InterpreterAlterQuery::getRequiredAccess() const { AccessRightsElements required_access; const auto & alter = query_ptr->as(); - for (ASTAlterCommand * command : alter.command_list->commands) - boost::range::push_back(required_access, getRequiredAccessForCommand(*command, alter.database, alter.table)); + for (const auto & child : alter.command_list->children) + boost::range::push_back(required_access, getRequiredAccessForCommand(child->as(), alter.database, alter.table)); return required_access; } diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index d1c989c5347..ff58ebf7fc3 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -130,6 +130,7 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create) auto engine = std::make_shared(); auto storage = std::make_shared(); engine->name = old_style_database ? "Ordinary" : "Atomic"; + engine->no_empty_args = true; storage->set(storage->engine, engine); create.set(create.storage, storage); } @@ -600,6 +601,7 @@ void InterpreterCreateQuery::setEngine(ASTCreateQuery & create) const { auto engine_ast = std::make_shared(); engine_ast->name = "Memory"; + engine_ast->no_empty_args = true; auto storage_ast = std::make_shared(); storage_ast->set(storage_ast->engine, engine_ast); create.set(create.storage, storage_ast); diff --git a/src/Interpreters/MonotonicityCheckVisitor.h b/src/Interpreters/MonotonicityCheckVisitor.h index 73c1e5497dd..137f8d25b4a 100644 --- a/src/Interpreters/MonotonicityCheckVisitor.h +++ b/src/Interpreters/MonotonicityCheckVisitor.h @@ -87,8 +87,7 @@ public: return; /// TODO: monotonicity for functions of several arguments - auto arguments = ast_function.arguments; - if (arguments->children.size() != 1) + if (!ast_function.arguments || ast_function.arguments->children.size() != 1) { data.reject(); return; diff --git a/src/Interpreters/MutationsInterpreter.cpp b/src/Interpreters/MutationsInterpreter.cpp index c393b214ee8..528b5ec6d8e 100644 --- a/src/Interpreters/MutationsInterpreter.cpp +++ b/src/Interpreters/MutationsInterpreter.cpp @@ -442,10 +442,10 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run) auto type_literal = std::make_shared(columns_desc.getPhysical(column).type->getName()); const auto & update_expr = kv.second; - auto updated_column = makeASTFunction("CAST", + auto updated_column = makeASTFunction("cast", makeASTFunction("if", getPartitionAndPredicateExpressionForMutationCommand(command), - makeASTFunction("CAST", + makeASTFunction("cast", update_expr->clone(), type_literal), std::make_shared(column)), diff --git a/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp b/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp index 245feae166d..688ab786b56 100644 --- a/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp +++ b/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp @@ -478,7 +478,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( auto rewritten_rename_query = std::make_shared(); rewritten_alter_query->database = mapped_to_database; rewritten_alter_query->table = alter_query.table; - rewritten_alter_query->set(rewritten_alter_query->command_list, std::make_shared()); + rewritten_alter_query->set(rewritten_alter_query->command_list, std::make_shared()); String default_after_column; for (const auto & command_query : alter_query.command_list->children) @@ -542,7 +542,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( } rewritten_command->children.push_back(rewritten_command->col_decl); - rewritten_alter_query->command_list->add(rewritten_command); + rewritten_alter_query->command_list->children.push_back(rewritten_command); } } else if (alter_command->type == MySQLParser::ASTAlterCommand::DROP_COLUMN) @@ -550,7 +550,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( auto rewritten_command = std::make_shared(); rewritten_command->type = ASTAlterCommand::DROP_COLUMN; rewritten_command->column = std::make_shared(alter_command->column_name); - rewritten_alter_query->command_list->add(rewritten_command); + rewritten_alter_query->command_list->children.push_back(rewritten_command); } else if (alter_command->type == MySQLParser::ASTAlterCommand::RENAME_COLUMN) { @@ -561,7 +561,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( rewritten_command->type = ASTAlterCommand::RENAME_COLUMN; rewritten_command->column = std::make_shared(alter_command->old_name); rewritten_command->rename_to = std::make_shared(alter_command->column_name); - rewritten_alter_query->command_list->add(rewritten_command); + rewritten_alter_query->command_list->children.push_back(rewritten_command); } } else if (alter_command->type == MySQLParser::ASTAlterCommand::MODIFY_COLUMN) @@ -590,7 +590,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( rewritten_command->children.push_back(rewritten_command->column); } - rewritten_alter_query->command_list->add(rewritten_command); + rewritten_alter_query->command_list->children.push_back(rewritten_command); } if (!alter_command->old_name.empty() && alter_command->old_name != new_column_name) @@ -599,7 +599,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( rewritten_command->type = ASTAlterCommand::RENAME_COLUMN; rewritten_command->column = std::make_shared(alter_command->old_name); rewritten_command->rename_to = std::make_shared(new_column_name); - rewritten_alter_query->command_list->add(rewritten_command); + rewritten_alter_query->command_list->children.push_back(rewritten_command); } } else if (alter_command->type == MySQLParser::ASTAlterCommand::RENAME_TABLE) @@ -624,7 +624,7 @@ ASTs InterpreterAlterImpl::getRewrittenQueries( ASTs rewritten_queries; /// Order is very important. We always execute alter first and then execute rename - if (!rewritten_alter_query->command_list->commands.empty()) + if (!rewritten_alter_query->command_list->children.empty()) rewritten_queries.push_back(rewritten_alter_query); if (!rewritten_rename_query->elements.empty()) diff --git a/src/Interpreters/OptimizeIfWithConstantConditionVisitor.cpp b/src/Interpreters/OptimizeIfWithConstantConditionVisitor.cpp index 765e7b1fa3d..dee4c69118b 100644 --- a/src/Interpreters/OptimizeIfWithConstantConditionVisitor.cpp +++ b/src/Interpreters/OptimizeIfWithConstantConditionVisitor.cpp @@ -29,7 +29,7 @@ static bool tryExtractConstValueFromCondition(const ASTPtr & condition, bool & v /// cast of numeric constant in condition to UInt8 if (const auto * function = condition->as()) { - if (function->name == "CAST") + if (function->name == "cast") { if (const auto * expr_list = function->arguments->as()) { @@ -64,13 +64,17 @@ void OptimizeIfWithConstantConditionVisitor::visit(ASTPtr & current_ast) continue; } + if (!function_node->arguments) + throw Exception("Wrong number of arguments for function 'if' (0 instead of 3)", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + + if (function_node->arguments->children.size() != 3) + throw Exception( + "Wrong number of arguments for function 'if' (" + toString(function_node->arguments->children.size()) + " instead of 3)", + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + visit(function_node->arguments); const auto * args = function_node->arguments->as(); - if (args->children.size() != 3) - throw Exception("Wrong number of arguments for function 'if' (" + toString(args->children.size()) + " instead of 3)", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); - ASTPtr condition_expr = args->children[0]; ASTPtr then_expr = args->children[1]; ASTPtr else_expr = args->children[2]; diff --git a/src/Interpreters/QueryNormalizer.cpp b/src/Interpreters/QueryNormalizer.cpp index 3252626959d..25496c2b613 100644 --- a/src/Interpreters/QueryNormalizer.cpp +++ b/src/Interpreters/QueryNormalizer.cpp @@ -164,14 +164,17 @@ void QueryNormalizer::visitChildren(const ASTPtr & node, Data & data) if (func_node->name == "lambda") first_pos = 1; - auto & func_children = func_node->arguments->children; - - for (size_t i = first_pos; i < func_children.size(); ++i) + if (func_node->arguments) { - auto & child = func_children[i]; + auto & func_children = func_node->arguments->children; - if (needVisitChild(child)) - visit(child, data); + for (size_t i = first_pos; i < func_children.size(); ++i) + { + auto & child = func_children[i]; + + if (needVisitChild(child)) + visit(child, data); + } } } else if (!node->as()) diff --git a/src/Interpreters/RemoveInjectiveFunctionsVisitor.cpp b/src/Interpreters/RemoveInjectiveFunctionsVisitor.cpp index 20980951115..ae575b8aae7 100644 --- a/src/Interpreters/RemoveInjectiveFunctionsVisitor.cpp +++ b/src/Interpreters/RemoveInjectiveFunctionsVisitor.cpp @@ -22,7 +22,7 @@ static bool removeInjectiveFunction(ASTPtr & ast, const Context & context, const if (!func) return false; - if (func->arguments->children.size() != 1) + if (!func->arguments || func->arguments->children.size() != 1) return false; if (!function_factory.get(func->name, context)->isInjective({})) diff --git a/src/Interpreters/RewriteAnyFunctionVisitor.cpp b/src/Interpreters/RewriteAnyFunctionVisitor.cpp index cb6debfc731..7c3f1bf31b2 100644 --- a/src/Interpreters/RewriteAnyFunctionVisitor.cpp +++ b/src/Interpreters/RewriteAnyFunctionVisitor.cpp @@ -62,7 +62,7 @@ void RewriteAnyFunctionMatcher::visit(ASTPtr & ast, Data & data) void RewriteAnyFunctionMatcher::visit(const ASTFunction & func, ASTPtr & ast, Data & data) { - if (func.arguments->children.empty() || !func.arguments->children[0]) + if (!func.arguments || func.arguments->children.empty() || !func.arguments->children[0]) return; if (func.name != "any" && func.name != "anyLast") diff --git a/src/Interpreters/StorageID.h b/src/Interpreters/StorageID.h index 9343f67fe7a..ec5ccba37c2 100644 --- a/src/Interpreters/StorageID.h +++ b/src/Interpreters/StorageID.h @@ -28,6 +28,7 @@ class ASTQueryWithTableAndOutput; class ASTIdentifier; class Context; +// TODO(ilezhankin): refactor and merge |ASTTableIdentifier| struct StorageID { String database_name; diff --git a/src/Interpreters/TranslateQualifiedNamesVisitor.cpp b/src/Interpreters/TranslateQualifiedNamesVisitor.cpp index 98ed2166c40..0129e6bdce9 100644 --- a/src/Interpreters/TranslateQualifiedNamesVisitor.cpp +++ b/src/Interpreters/TranslateQualifiedNamesVisitor.cpp @@ -126,6 +126,8 @@ void TranslateQualifiedNamesMatcher::visit(ASTFunction & node, const ASTPtr &, D { ASTPtr & func_arguments = node.arguments; + if (!func_arguments) return; + String func_name_lowercase = Poco::toLower(node.name); if (func_name_lowercase == "count" && func_arguments->children.size() == 1 && diff --git a/src/Interpreters/TreeRewriter.cpp b/src/Interpreters/TreeRewriter.cpp index 5f1dc950814..069e76e430b 100644 --- a/src/Interpreters/TreeRewriter.cpp +++ b/src/Interpreters/TreeRewriter.cpp @@ -380,8 +380,9 @@ std::vector getAggregates(ASTPtr & query, const ASTSelectQu /// There can not be other aggregate functions within the aggregate functions. for (const ASTFunction * node : data.aggregates) - for (auto & arg : node->arguments->children) - assertNoAggregates(arg, "inside another aggregate function"); + if (node->arguments) + for (auto & arg : node->arguments->children) + assertNoAggregates(arg, "inside another aggregate function"); return data.aggregates; } diff --git a/src/Interpreters/addTypeConversionToAST.cpp b/src/Interpreters/addTypeConversionToAST.cpp index 699c3bd27c3..07d0d43e0f3 100644 --- a/src/Interpreters/addTypeConversionToAST.cpp +++ b/src/Interpreters/addTypeConversionToAST.cpp @@ -11,7 +11,7 @@ namespace DB ASTPtr addTypeConversionToAST(ASTPtr && ast, const String & type_name) { - auto func = makeASTFunction("CAST", ast, std::make_shared(type_name)); + auto func = makeASTFunction("cast", ast, std::make_shared(type_name)); if (ASTWithAlias * ast_with_alias = dynamic_cast(ast.get())) { diff --git a/src/Interpreters/executeQuery.cpp b/src/Interpreters/executeQuery.cpp index 7d73e40114e..633b1e9bd5e 100644 --- a/src/Interpreters/executeQuery.cpp +++ b/src/Interpreters/executeQuery.cpp @@ -15,18 +15,23 @@ #include #include +#include #include +#include #include #include #include -#include -#include -#include -#include -#include #include #include +#if !defined(ARCADIA_BUILD) +# include // Y_IGNORE +#endif + +#include +#include +#include + #include #include @@ -147,10 +152,11 @@ static void logQuery(const String & query, const Context & context, bool interna const auto & initial_query_id = client_info.initial_query_id; const auto & current_user = client_info.current_user; - LOG_DEBUG(&Poco::Logger::get("executeQuery"), "(from {}{}{}) {}", + LOG_DEBUG(&Poco::Logger::get("executeQuery"), "(from {}{}{}, using {} parser) {}", client_info.current_address.toString(), (current_user != "default" ? ", user: " + current_user : ""), (!initial_query_id.empty() && current_query_id != initial_query_id ? ", initial_query_id: " + initial_query_id : std::string()), + (context.getSettingsRef().use_antlr_parser ? "new" : "old"), joinLines(query)); if (client_info.client_trace_context.trace_id) @@ -321,19 +327,33 @@ static std::tuple executeQueryImpl( const Settings & settings = context.getSettingsRef(); - ParserQuery parser(end); ASTPtr ast; const char * query_end; /// Don't limit the size of internal queries. size_t max_query_size = 0; - if (!internal) - max_query_size = settings.max_query_size; + if (!internal) max_query_size = settings.max_query_size; try { - /// TODO Parser should fail early when max_query_size limit is reached. +#if !defined(ARCADIA_BUILD) + if (settings.use_antlr_parser) + { + ast = parseQuery(begin, end, max_query_size, settings.max_parser_depth); + } + else + { + ParserQuery parser(end); + + /// TODO: parser should fail early when max_query_size limit is reached. + ast = parseQuery(parser, begin, end, "", max_query_size, settings.max_parser_depth); + } +#else + ParserQuery parser(end); + + /// TODO: parser should fail early when max_query_size limit is reached. ast = parseQuery(parser, begin, end, "", max_query_size, settings.max_parser_depth); +#endif /// Interpret SETTINGS clauses as early as possible (before invoking the corresponding interpreter), /// to allow settings to take effect. @@ -874,7 +894,7 @@ void executeQuery( end = istr.buffer().end(); istr.position() += end - begin; /// Actually we don't know will query has additional data or not. - /// But we can't check istr.eof(), because begin and end pointers will became invalid + /// But we can't check istr.eof(), because begin and end pointers will become invalid may_have_tail = true; } else diff --git a/src/Interpreters/inplaceBlockConversions.cpp b/src/Interpreters/inplaceBlockConversions.cpp index 849512adcc1..ab74aa7d631 100644 --- a/src/Interpreters/inplaceBlockConversions.cpp +++ b/src/Interpreters/inplaceBlockConversions.cpp @@ -43,7 +43,7 @@ void addDefaultRequiredExpressionsRecursively(Block & block, const String & requ RequiredSourceColumnsVisitor(columns_context).visit(column_default_expr); NameSet required_columns_names = columns_context.requiredColumns(); - auto cast_func = makeASTFunction("CAST", column_default_expr, std::make_shared(columns.get(required_column).type->getName())); + auto cast_func = makeASTFunction("cast", column_default_expr, std::make_shared(columns.get(required_column).type->getName())); default_expr_list_accum->children.emplace_back(setAlias(cast_func, required_column)); added_columns.emplace(required_column); @@ -79,7 +79,7 @@ ASTPtr convertRequiredExpressions(Block & block, const NamesAndTypesList & requi continue; auto cast_func = makeASTFunction( - "CAST", std::make_shared(required_column.name), std::make_shared(required_column.type->getName())); + "cast", std::make_shared(required_column.name), std::make_shared(required_column.type->getName())); conversion_expr_list->children.emplace_back(setAlias(cast_func, required_column.name)); diff --git a/src/Parsers/ASTAlterQuery.cpp b/src/Parsers/ASTAlterQuery.cpp index 7079c108711..b997164684b 100644 --- a/src/Parsers/ASTAlterQuery.cpp +++ b/src/Parsers/ASTAlterQuery.cpp @@ -345,30 +345,6 @@ void ASTAlterCommand::formatImpl( } -ASTPtr ASTAlterCommandList::clone() const -{ - auto res = std::make_shared(); - for (ASTAlterCommand * command : commands) - res->add(command->clone()); - return res; -} - -void ASTAlterCommandList::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const -{ - std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' '); - - for (size_t i = 0; i < commands.size(); ++i) - { - static_cast(commands[i])->formatImpl(settings, state, frame); - - std::string comma = (i < (commands.size() - 1)) ? "," : ""; - settings.ostr << (settings.hilite ? hilite_keyword : "") << comma << (settings.hilite ? hilite_none : ""); - - settings.ostr << settings.nl_or_ws; - } -} - - /** Get the text that identifies this element. */ String ASTAlterQuery::getID(char delim) const { diff --git a/src/Parsers/ASTAlterQuery.h b/src/Parsers/ASTAlterQuery.h index 65657e5ecfd..91c80867738 100644 --- a/src/Parsers/ASTAlterQuery.h +++ b/src/Parsers/ASTAlterQuery.h @@ -1,9 +1,10 @@ #pragma once -#include -#include +#include #include +#include #include +#include namespace DB @@ -179,31 +180,12 @@ protected: void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; }; -class ASTAlterCommandList : public IAST -{ -public: - std::vector commands; - - void add(const ASTPtr & command) - { - commands.push_back(command->as()); - children.push_back(command); - } - - String getID(char) const override { return "AlterCommandList"; } - - ASTPtr clone() const override; - -protected: - void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; -}; - class ASTAlterQuery : public ASTQueryWithTableAndOutput, public ASTQueryWithOnCluster { public: bool is_live_view{false}; /// true for ALTER LIVE VIEW - ASTAlterCommandList * command_list = nullptr; + ASTExpressionList * command_list = nullptr; String getID(char) const override; diff --git a/src/Parsers/ASTCreateQuery.h b/src/Parsers/ASTCreateQuery.h index 454a3993dfd..b47a1dbd5e2 100644 --- a/src/Parsers/ASTCreateQuery.h +++ b/src/Parsers/ASTCreateQuery.h @@ -4,10 +4,10 @@ #include #include #include +#include #include #include - namespace DB { diff --git a/src/Parsers/ASTDictionary.cpp b/src/Parsers/ASTDictionary.cpp index 878f6000aa9..3d6750f2336 100644 --- a/src/Parsers/ASTDictionary.cpp +++ b/src/Parsers/ASTDictionary.cpp @@ -65,7 +65,7 @@ ASTPtr ASTDictionaryLayout::clone() const { auto res = std::make_shared(); res->layout_type = layout_type; - res->set(res->parameters, parameters->clone()); + if (parameters) res->set(res->parameters, parameters->clone()); res->has_brackets = has_brackets; return res; } @@ -86,7 +86,7 @@ void ASTDictionaryLayout::formatImpl(const FormatSettings & settings, if (has_brackets) settings.ostr << "("; - parameters->formatImpl(settings, state, frame); + if (parameters) parameters->formatImpl(settings, state, frame); if (has_brackets) settings.ostr << ")"; diff --git a/src/Parsers/ASTFunction.cpp b/src/Parsers/ASTFunction.cpp index 76a52b8c641..4cca8ad0807 100644 --- a/src/Parsers/ASTFunction.cpp +++ b/src/Parsers/ASTFunction.cpp @@ -29,12 +29,13 @@ void ASTFunction::appendColumnNameImpl(WriteBuffer & ostr) const } writeChar('(', ostr); - for (auto it = arguments->children.begin(); it != arguments->children.end(); ++it) - { - if (it != arguments->children.begin()) - writeCString(", ", ostr); - (*it)->appendColumnName(ostr); - } + if (arguments) + for (auto it = arguments->children.begin(); it != arguments->children.end(); ++it) + { + if (it != arguments->children.begin()) + writeCString(", ", ostr); + (*it)->appendColumnName(ostr); + } writeChar(')', ostr); } @@ -64,6 +65,35 @@ void ASTFunction::updateTreeHashImpl(SipHash & hash_state) const } +ASTPtr ASTFunction::toLiteral() const +{ + if (!arguments) return {}; + + if (name == "array") + { + Array array; + + for (const auto & arg : arguments->children) + { + if (auto * literal = arg->as()) + array.push_back(literal->value); + else if (auto * func = arg->as()) + { + if (auto func_literal = func->toLiteral()) + array.push_back(func_literal->as()->value); + } + else + /// Some of the Array arguments is not literal + return {}; + } + + return std::make_shared(array); + } + + return {}; +} + + /** A special hack. If it's [I]LIKE or NOT [I]LIKE expression and the right hand side is a string literal, * we will highlight unescaped metacharacters % and _ in string literal for convenience. * Motivation: most people are unaware that _ is a metacharacter and forgot to properly escape it with two backslashes. @@ -378,12 +408,14 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format settings.ostr << (settings.hilite ? hilite_function : "") << ')'; } - if (arguments) - { + if ((arguments && !arguments->children.empty()) || !no_empty_args) settings.ostr << '(' << (settings.hilite ? hilite_none : ""); + if (arguments) + { bool special_hilite_regexp = settings.hilite - && (name == "match" || name == "extract" || name == "extractAll" || name == "replaceRegexpOne" || name == "replaceRegexpAll"); + && (name == "match" || name == "extract" || name == "extractAll" || name == "replaceRegexpOne" + || name == "replaceRegexpAll"); for (size_t i = 0, size = arguments->children.size(); i < size; ++i) { @@ -397,10 +429,11 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format if (!special_hilite) arguments->children[i]->formatImpl(settings, state, nested_dont_need_parens); } - - settings.ostr << (settings.hilite ? hilite_function : "") << ')'; } + if ((arguments && !arguments->children.empty()) || !no_empty_args) + settings.ostr << (settings.hilite ? hilite_function : "") << ')'; + settings.ostr << (settings.hilite ? hilite_none : ""); } } diff --git a/src/Parsers/ASTFunction.h b/src/Parsers/ASTFunction.h index 3b87ab68282..a6e3834ac1a 100644 --- a/src/Parsers/ASTFunction.h +++ b/src/Parsers/ASTFunction.h @@ -18,7 +18,9 @@ public: /// parameters - for parametric aggregate function. Example: quantile(0.9)(x) - what in first parens are 'parameters'. ASTPtr parameters; -public: + /// do not print empty parentheses if there are no args - compatibility with new AST for data types and engine names. + bool no_empty_args = false; + /** Get text identifying the AST node. */ String getID(char delim) const override; @@ -28,6 +30,8 @@ public: ASTSelectWithUnionQuery * tryGetQueryArgument() const; + ASTPtr toLiteral() const; // Try to convert functions like Array or Tuple to a literal form. + protected: void formatImplWithoutAlias(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; void appendColumnNameImpl(WriteBuffer & ostr) const override; diff --git a/src/Parsers/ASTIdentifier.h b/src/Parsers/ASTIdentifier.h index 205b3bb9ad1..597985a6dc2 100644 --- a/src/Parsers/ASTIdentifier.h +++ b/src/Parsers/ASTIdentifier.h @@ -73,7 +73,6 @@ private: void resetFullName(); }; - /// ASTIdentifier Helpers: hide casts and semantic. ASTPtr createTableIdentifier(const String & database_name, const String & table_name); diff --git a/src/Parsers/ASTLiteral.h b/src/Parsers/ASTLiteral.h index 672bc6ddc3e..7e472a16bdd 100644 --- a/src/Parsers/ASTLiteral.h +++ b/src/Parsers/ASTLiteral.h @@ -1,20 +1,23 @@ #pragma once #include -#include #include #include +#include + #include namespace DB { -/** Literal (atomic) - number, string, NULL - */ +/// Literal (atomic) - number, string, NULL class ASTLiteral : public ASTWithAlias { public: + explicit ASTLiteral(Field && value_) : value(value_) {} + explicit ASTLiteral(const Field & value_) : value(value_) {} + Field value; /// For ConstantExpressionTemplate @@ -30,11 +33,6 @@ public: */ String unique_column_name; - -public: - ASTLiteral(Field && value_) : value(value_) {} - ASTLiteral(const Field & value_) : value(value_) {} - /** Get the text that identifies this element. */ String getID(char delim) const override { return "Literal" + (delim + applyVisitor(FieldVisitorDump(), value)); } diff --git a/src/Parsers/ASTOrderByElement.h b/src/Parsers/ASTOrderByElement.h index afeff90741a..8c868312834 100644 --- a/src/Parsers/ASTOrderByElement.h +++ b/src/Parsers/ASTOrderByElement.h @@ -23,20 +23,6 @@ public: ASTPtr fill_to; ASTPtr fill_step; - ASTOrderByElement( - const int direction_, const int nulls_direction_, const bool nulls_direction_was_explicitly_specified_, - ASTPtr & collation_, const bool with_fill_, ASTPtr & fill_from_, ASTPtr & fill_to_, ASTPtr & fill_step_) - : direction(direction_) - , nulls_direction(nulls_direction_) - , nulls_direction_was_explicitly_specified(nulls_direction_was_explicitly_specified_) - , collation(collation_) - , with_fill(with_fill_) - , fill_from(fill_from_) - , fill_to(fill_to_) - , fill_step(fill_step_) - { - } - String getID(char) const override { return "OrderByElement"; } ASTPtr clone() const override diff --git a/src/Parsers/ASTSampleRatio.h b/src/Parsers/ASTSampleRatio.h index e8953dec022..09dec6aac99 100644 --- a/src/Parsers/ASTSampleRatio.h +++ b/src/Parsers/ASTSampleRatio.h @@ -26,7 +26,7 @@ public: Rational ratio; - ASTSampleRatio(Rational & ratio_) : ratio(ratio_) {} + explicit ASTSampleRatio(const Rational & ratio_) : ratio(ratio_) {} String getID(char delim) const override { return "SampleRatio" + (delim + toString(ratio)); } diff --git a/src/Parsers/ASTTablesInSelectQuery.h b/src/Parsers/ASTTablesInSelectQuery.h index 792bef747ff..8b489974804 100644 --- a/src/Parsers/ASTTablesInSelectQuery.h +++ b/src/Parsers/ASTTablesInSelectQuery.h @@ -30,7 +30,7 @@ namespace DB * , (comma) * * In all kinds except cross and comma, there are join condition in one of following forms: - * USING (a, b c) + * USING (a, b, c) * USING a, b, c * ON expr... * diff --git a/src/Parsers/ExpressionElementParsers.cpp b/src/Parsers/ExpressionElementParsers.cpp index 47fc1423d3e..6fbe9abc96e 100644 --- a/src/Parsers/ExpressionElementParsers.cpp +++ b/src/Parsers/ExpressionElementParsers.cpp @@ -441,7 +441,7 @@ bool ParserCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expect expr_list_args->children.push_back(std::move(type_literal)); auto func_node = std::make_shared(); - func_node->name = "CAST"; + func_node->name = "cast"; func_node->arguments = std::move(expr_list_args); func_node->children.push_back(func_node->arguments); @@ -1705,12 +1705,21 @@ bool ParserOrderByElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expect return false; } - node = std::make_shared( - direction, nulls_direction, nulls_direction_was_explicitly_specified, locale_node, - has_with_fill, fill_from, fill_to, fill_step); - node->children.push_back(expr_elem); + auto elem = std::make_shared(); + + elem->direction = direction; + elem->nulls_direction = nulls_direction; + elem->nulls_direction_was_explicitly_specified = nulls_direction_was_explicitly_specified; + elem->collation = locale_node; + elem->with_fill = has_with_fill; + elem->fill_from = fill_from; + elem->fill_to = fill_to; + elem->fill_step = fill_step; + elem->children.push_back(expr_elem); if (locale_node) - node->children.push_back(locale_node); + elem->children.push_back(locale_node); + + node = elem; return true; } @@ -1887,13 +1896,18 @@ bool ParserIdentifierWithOptionalParameters::parseImpl(Pos & pos, ASTPtr & node, ParserIdentifierWithParameters parametric; if (parametric.parse(pos, node, expected)) + { + auto * func = node->as(); + func->no_empty_args = true; return true; + } ASTPtr ident; if (non_parametric.parse(pos, ident, expected)) { auto func = std::make_shared(); tryGetIdentifierNameInto(ident, func->name); + func->no_empty_args = true; node = func; return true; } diff --git a/src/Parsers/IAST.cpp b/src/Parsers/IAST.cpp index bc00e2afe77..56fffe3891a 100644 --- a/src/Parsers/IAST.cpp +++ b/src/Parsers/IAST.cpp @@ -13,6 +13,7 @@ namespace ErrorCodes extern const int TOO_BIG_AST; extern const int TOO_DEEP_AST; extern const int BAD_ARGUMENTS; + extern const int UNKNOWN_ELEMENT_IN_AST; } @@ -154,7 +155,10 @@ void IAST::dumpTree(WriteBuffer & ostr, size_t indent) const writePointerHex(this, ostr); writeChar('\n', ostr); for (const auto & child : children) + { + if (!child) throw Exception("Can't dump nullptr child", ErrorCodes::UNKNOWN_ELEMENT_IN_AST); child->dumpTree(ostr, indent + 1); + } } } diff --git a/src/Parsers/New/AST/AlterTableQuery.cpp b/src/Parsers/New/AST/AlterTableQuery.cpp new file mode 100644 index 00000000000..4b75e8fe1b6 --- /dev/null +++ b/src/Parsers/New/AST/AlterTableQuery.cpp @@ -0,0 +1,687 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +AssignmentExpr::AssignmentExpr(PtrTo identifier, PtrTo expr) : INode{identifier, expr} +{ +} + +ASTPtr AssignmentExpr::convertToOld() const +{ + auto expr = std::make_shared(); + + expr->column_name = get(IDENTIFIER)->convertToOld()->getColumnName(); + expr->children.push_back(get(EXPR)->convertToOld()); + + return expr; +} + +PartitionClause::PartitionClause(PtrTo id) : PartitionClause(ClauseType::ID, {id}) +{ +} + +PartitionClause::PartitionClause(PtrTo> list) : PartitionClause(ClauseType::LIST, {list}) +{ +} + +PartitionClause::PartitionClause(ClauseType type, PtrList exprs) : INode(exprs), clause_type(type) +{ +} + +ASTPtr PartitionClause::convertToOld() const +{ + auto partition = std::make_shared(); + + switch(clause_type) + { + case ClauseType::ID: + partition->id = get(ID)->as(); + break; + case ClauseType::LIST: + { + auto tuple = std::make_shared(); + + tuple->name = "tuple"; + tuple->arguments = std::make_shared(); + for (const auto & child : get(LIST)->as &>()) + tuple->arguments->children.push_back(child->convertToOld()); + tuple->children.push_back(tuple->arguments); + + partition->value = tuple; + partition->children.push_back(partition->value); + partition->fields_count = get>(LIST)->size(); + partition->fields_str = get(LIST)->toString(); + } + break; + } + + return partition; +} + +// static +PtrTo AlterTableClause::createAddColumn(bool if_not_exists, PtrTo element, PtrTo after) +{ + assert(element->getType() == TableElementExpr::ExprType::COLUMN); + PtrTo query(new AlterTableClause(ClauseType::ADD_COLUMN, {element, after})); + query->if_not_exists = if_not_exists; + return query; +} + +// static +PtrTo AlterTableClause::createAddIndex(bool if_not_exists, PtrTo element, PtrTo after) +{ + assert(element->getType() == TableElementExpr::ExprType::INDEX); + PtrTo query(new AlterTableClause(ClauseType::ADD_INDEX, {element, after})); + query->if_not_exists = if_not_exists; + return query; +} + +// static +PtrTo AlterTableClause::createAttach(PtrTo clause, PtrTo from) +{ + return PtrTo(new AlterTableClause(ClauseType::ATTACH, {clause, from})); +} + +// static +PtrTo AlterTableClause::createClear(bool if_exists, PtrTo identifier, PtrTo in) +{ + PtrTo query(new AlterTableClause(ClauseType::CLEAR, {identifier, in})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createCodec(bool if_exists, PtrTo identifier, PtrTo codec) +{ + PtrTo query(new AlterTableClause(ClauseType::CODEC, {identifier, codec})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createComment(bool if_exists, PtrTo identifier, PtrTo comment) +{ + PtrTo query(new AlterTableClause(ClauseType::COMMENT, {identifier, comment})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createDelete(PtrTo expr) +{ + return PtrTo(new AlterTableClause(ClauseType::DELETE, {expr})); +} + +// static +PtrTo AlterTableClause::createDetach(PtrTo clause) +{ + return PtrTo(new AlterTableClause(ClauseType::DETACH, {clause})); +} + +// static +PtrTo AlterTableClause::createDropColumn(bool if_exists, PtrTo identifier) +{ + PtrTo query(new AlterTableClause(ClauseType::DROP_COLUMN, {identifier})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createDropIndex(bool if_exists, PtrTo identifier) +{ + PtrTo query(new AlterTableClause(ClauseType::DROP_INDEX, {identifier})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createDropPartition(PtrTo clause) +{ + return PtrTo(new AlterTableClause(ClauseType::DROP_PARTITION, {clause})); +} + +// static +PtrTo AlterTableClause::createFreezePartition(PtrTo clause) +{ + return PtrTo(new AlterTableClause(ClauseType::FREEZE_PARTITION, {clause})); +} + +// static +PtrTo AlterTableClause::createModify(bool if_exists, PtrTo element) +{ + // TODO: assert(element->getType() == TableElementExpr::ExprType::COLUMN); + PtrTo query(new AlterTableClause(ClauseType::MODIFY, {element})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createMovePartitionToDisk(PtrTo clause, PtrTo literal) +{ + return PtrTo(new AlterTableClause(ClauseType::MOVE_PARTITION_TO_DISK, {clause, literal})); +} + +// static +PtrTo AlterTableClause::createMovePartitionToTable(PtrTo clause, PtrTo identifier) +{ + return PtrTo(new AlterTableClause(ClauseType::MOVE_PARTITION_TO_TABLE, {clause, identifier})); +} + +// static +PtrTo AlterTableClause::createMovePartitionToVolume(PtrTo clause, PtrTo literal) +{ + return PtrTo(new AlterTableClause(ClauseType::MOVE_PARTITION_TO_VOLUME, {clause, literal})); +} + +// static +PtrTo AlterTableClause::createOrderBy(PtrTo expr) +{ + return PtrTo(new AlterTableClause(ClauseType::ORDER_BY, {expr})); +} + +// static +PtrTo AlterTableClause::createRemove(bool if_exists, PtrTo identifier, TableColumnPropertyType type) +{ + PtrTo query(new AlterTableClause(ClauseType::REMOVE, {identifier})); + query->if_exists = if_exists; + query->property_type = type; + return query; +} + +// static +PtrTo AlterTableClause::createRemoveTTL() +{ + return PtrTo(new AlterTableClause(ClauseType::REMOVE_TTL, {})); +} + +// static +PtrTo AlterTableClause::createRename(bool if_exists, PtrTo identifier, PtrTo to) +{ + PtrTo query(new AlterTableClause(ClauseType::RENAME, {identifier, to})); + query->if_exists = if_exists; + return query; +} + +// static +PtrTo AlterTableClause::createReplace(PtrTo clause, PtrTo from) +{ + return PtrTo(new AlterTableClause(ClauseType::REPLACE, {clause, from})); +} + +// static +PtrTo AlterTableClause::createTTL(PtrTo clause) +{ + return PtrTo(new AlterTableClause(ClauseType::TTL, {clause})); +} + +// static +PtrTo AlterTableClause::createUpdate(PtrTo list, PtrTo where) +{ + return PtrTo(new AlterTableClause(ClauseType::UPDATE, {list, where})); +} + +ASTPtr AlterTableClause::convertToOld() const +{ + auto command = std::make_shared(); + + switch(clause_type) + { + case ClauseType::ADD_COLUMN: + command->type = ASTAlterCommand::ADD_COLUMN; + command->if_not_exists = if_not_exists; + // TODO: command->first + command->col_decl = get(ELEMENT)->convertToOld(); + if (has(AFTER)) command->column = get(AFTER)->convertToOld(); + break; + + case ClauseType::ADD_INDEX: + command->type = ASTAlterCommand::ADD_INDEX; + command->if_not_exists = if_not_exists; + command->index_decl = get(ELEMENT)->convertToOld(); + if (has(AFTER)) command->index = get(AFTER)->convertToOld(); + break; + + case ClauseType::ATTACH: + command->type = ASTAlterCommand::ATTACH_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + + if (has(FROM)) + { + auto table_id = getTableIdentifier(get(FROM)->convertToOld()); + + command->from_database = table_id.database_name; + command->from_table = table_id.table_name; + command->replace = false; + command->type = ASTAlterCommand::REPLACE_PARTITION; + } + break; + + case ClauseType::CLEAR: + command->type = ASTAlterCommand::DROP_COLUMN; + command->if_exists = if_exists; + command->clear_column = true; + command->detach = false; + command->column = get(COLUMN)->convertToOld(); + if (has(IN)) command->partition = get(IN)->convertToOld(); + break; + + case ClauseType::CODEC: + command->type = ASTAlterCommand::MODIFY_COLUMN; + command->if_exists = if_exists; + + { + auto column = std::make_shared(); + column->name = get(COLUMN)->toString(); + column->codec = get(CODEC)->convertToOld(); + + command->col_decl = column; + } + break; + + case ClauseType::COMMENT: + command->type = ASTAlterCommand::COMMENT_COLUMN; + command->if_exists = if_exists; + command->column = get(COLUMN)->convertToOld(); + command->comment = get(COMMENT)->convertToOld(); + break; + + case ClauseType::DELETE: + command->type = ASTAlterCommand::DELETE; + command->predicate = get(EXPR)->convertToOld(); + break; + + case ClauseType::DETACH: + command->type = ASTAlterCommand::DROP_PARTITION; + command->detach = true; + command->partition = get(PARTITION)->convertToOld(); + break; + + case ClauseType::DROP_COLUMN: + command->type = ASTAlterCommand::DROP_COLUMN; + command->if_exists = if_exists; + command->detach = false; + command->column = get(COLUMN)->convertToOld(); + break; + + case ClauseType::DROP_INDEX: + command->type = ASTAlterCommand::DROP_INDEX; + command->if_exists = if_exists; + command->detach = false; + command->index = get(COLUMN)->convertToOld(); + break; + + case ClauseType::DROP_PARTITION: + command->type = ASTAlterCommand::DROP_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + break; + + case ClauseType::FREEZE_PARTITION: + if (has(PARTITION)) + { + command->type = ASTAlterCommand::FREEZE_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + } + else + command->type = ASTAlterCommand::FREEZE_ALL; + break; + + case ClauseType::MODIFY: + command->type = ASTAlterCommand::MODIFY_COLUMN; + command->if_exists = if_exists; + command->col_decl = get(ELEMENT)->convertToOld(); + break; + + case ClauseType::MOVE_PARTITION_TO_DISK: + command->type = ASTAlterCommand::MOVE_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + command->move_destination_type = DataDestinationType::DISK; + command->move_destination_name = get(TO)->convertToOld()->as()->value.get(); + break; + + case ClauseType::MOVE_PARTITION_TO_TABLE: + command->type = ASTAlterCommand::MOVE_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + command->move_destination_type = DataDestinationType::TABLE; + { + auto table_id = getTableIdentifier(get(TO)->convertToOld()); + command->to_database = table_id.database_name; + command->to_table = table_id.table_name; + } + break; + + case ClauseType::MOVE_PARTITION_TO_VOLUME: + command->type = ASTAlterCommand::MOVE_PARTITION; + command->partition = get(PARTITION)->convertToOld(); + command->move_destination_type = DataDestinationType::VOLUME; + command->move_destination_name = get(TO)->convertToOld()->as()->value.get(); + break; + + case ClauseType::REMOVE: + command->type = ASTAlterCommand::MODIFY_COLUMN; + command->if_exists = if_exists; + { + auto col_decl = std::make_shared(); + col_decl->name = get(ELEMENT)->convertToOld()->getColumnName(); + command->col_decl = col_decl; + } + switch(property_type) + { + case TableColumnPropertyType::ALIAS: + command->remove_property = "ALIAS"; + break; + case TableColumnPropertyType::CODEC: + command->remove_property = "CODEC"; + break; + case TableColumnPropertyType::COMMENT: + command->remove_property = "COMMENT"; + break; + case TableColumnPropertyType::DEFAULT: + command->remove_property = "DEFAULT"; + break; + case TableColumnPropertyType::MATERIALIZED: + command->remove_property = "MATERIALIZED"; + break; + case TableColumnPropertyType::TTL: + command->remove_property = "TTL"; + break; + } + break; + + case ClauseType::REMOVE_TTL: + command->type = ASTAlterCommand::REMOVE_TTL; + break; + + case ClauseType::RENAME: + command->type = ASTAlterCommand::RENAME_COLUMN; + command->column = get(COLUMN)->convertToOld(); + command->rename_to = get(TO)->convertToOld(); + break; + + case ClauseType::ORDER_BY: + command->type = ASTAlterCommand::MODIFY_ORDER_BY; + command->order_by = get(EXPR)->convertToOld(); + break; + + case ClauseType::REPLACE: + command->type = ASTAlterCommand::REPLACE_PARTITION; + command->replace = true; + command->partition = get(PARTITION)->convertToOld(); + { + auto table_id = getTableIdentifier(get(FROM)->convertToOld()); + command->from_database = table_id.database_name; + command->from_table = table_id.table_name; + } + break; + + case ClauseType::TTL: + command->type = ASTAlterCommand::MODIFY_TTL; + command->ttl = get(CLAUSE)->convertToOld(); + break; + + case ClauseType::UPDATE: + command->type = ASTAlterCommand::UPDATE; + command->update_assignments = get(ASSIGNMENTS)->convertToOld(); + command->predicate = get(WHERE)->convertToOld(); + break; + } + + if (command->col_decl) + command->children.push_back(command->col_decl); + if (command->column) + command->children.push_back(command->column); + if (command->partition) + command->children.push_back(command->partition); + if (command->order_by) + command->children.push_back(command->order_by); + if (command->sample_by) + command->children.push_back(command->sample_by); + if (command->predicate) + command->children.push_back(command->predicate); + if (command->update_assignments) + command->children.push_back(command->update_assignments); + if (command->values) + command->children.push_back(command->values); + if (command->comment) + command->children.push_back(command->comment); + if (command->ttl) + command->children.push_back(command->ttl); + if (command->settings_changes) + command->children.push_back(command->settings_changes); + + return command; +} + +AlterTableClause::AlterTableClause(ClauseType type, PtrList exprs) : INode(exprs), clause_type(type) +{ +} + +AlterTableQuery::AlterTableQuery(PtrTo cluster, PtrTo identifier, PtrTo> clauses) + : DDLQuery(cluster, {identifier, clauses}) +{ +} + +ASTPtr AlterTableQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + + query->cluster = cluster_name; + + query->set(query->command_list, get(CLAUSES)->convertToOld()); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseAddColumn(ClickHouseParser::AlterTableClauseAddColumnContext * ctx) +{ + auto after = ctx->AFTER() ? visit(ctx->nestedIdentifier()).as>() : nullptr; + return AlterTableClause::createAddColumn(!!ctx->IF(), visit(ctx->tableColumnDfnt()), after); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseAddIndex(ClickHouseParser::AlterTableClauseAddIndexContext * ctx) +{ + auto after = ctx->AFTER() ? visit(ctx->nestedIdentifier()).as>() : nullptr; + return AlterTableClause::createAddIndex(!!ctx->IF(), visit(ctx->tableIndexDfnt()), after); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseAttach(ClickHouseParser::AlterTableClauseAttachContext *ctx) +{ + auto from = ctx->tableIdentifier() ? visit(ctx->tableIdentifier()).as>() : nullptr; + return AlterTableClause::createAttach(visit(ctx->partitionClause()), from); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseClear(ClickHouseParser::AlterTableClauseClearContext * ctx) +{ + auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; + return AlterTableClause::createClear(!!ctx->IF(), visit(ctx->nestedIdentifier()), partition); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseComment(ClickHouseParser::AlterTableClauseCommentContext * ctx) +{ + return AlterTableClause::createComment(!!ctx->IF(), visit(ctx->nestedIdentifier()), Literal::createString(ctx->STRING_LITERAL())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseDelete(ClickHouseParser::AlterTableClauseDeleteContext *ctx) +{ + return AlterTableClause::createDelete(visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseDetach(ClickHouseParser::AlterTableClauseDetachContext *ctx) +{ + return AlterTableClause::createDetach(visit(ctx->partitionClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseDropColumn(ClickHouseParser::AlterTableClauseDropColumnContext * ctx) +{ + return AlterTableClause::createDropColumn(!!ctx->IF(), visit(ctx->nestedIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseDropIndex(ClickHouseParser::AlterTableClauseDropIndexContext * ctx) +{ + return AlterTableClause::createDropIndex(!!ctx->IF(), visit(ctx->nestedIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseDropPartition(ClickHouseParser::AlterTableClauseDropPartitionContext *ctx) +{ + return AlterTableClause::createDropPartition(visit(ctx->partitionClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseFreezePartition(ClickHouseParser::AlterTableClauseFreezePartitionContext *ctx) +{ + auto clause = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; + return AlterTableClause::createFreezePartition(clause); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModify(ClickHouseParser::AlterTableClauseModifyContext * ctx) +{ + return AlterTableClause::createModify(!!ctx->IF(), visit(ctx->tableColumnDfnt())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModifyCodec(ClickHouseParser::AlterTableClauseModifyCodecContext * ctx) +{ + return AlterTableClause::createCodec(!!ctx->IF(), visit(ctx->nestedIdentifier()), visit(ctx->codecExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModifyComment(ClickHouseParser::AlterTableClauseModifyCommentContext *ctx) +{ + return AlterTableClause::createComment(!!ctx->IF(), visit(ctx->nestedIdentifier()), Literal::createString(ctx->STRING_LITERAL())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModifyOrderBy(ClickHouseParser::AlterTableClauseModifyOrderByContext * ctx) +{ + return AlterTableClause::createOrderBy(visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModifyRemove(ClickHouseParser::AlterTableClauseModifyRemoveContext *ctx) +{ + return AlterTableClause::createRemove(!!ctx->IF(), visit(ctx->nestedIdentifier()), visit(ctx->tableColumnPropertyType())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseModifyTTL(ClickHouseParser::AlterTableClauseModifyTTLContext *ctx) +{ + return AlterTableClause::createTTL(visit(ctx->ttlClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseMovePartition(ClickHouseParser::AlterTableClauseMovePartitionContext *ctx) +{ + if (ctx->DISK()) + return AlterTableClause::createMovePartitionToDisk(visit(ctx->partitionClause()), Literal::createString(ctx->STRING_LITERAL())); + if (ctx->TABLE()) + return AlterTableClause::createMovePartitionToTable(visit(ctx->partitionClause()), visit(ctx->tableIdentifier())); + if (ctx->VOLUME()) + return AlterTableClause::createMovePartitionToVolume(visit(ctx->partitionClause()), Literal::createString(ctx->STRING_LITERAL())); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseRemoveTTL(ClickHouseParser::AlterTableClauseRemoveTTLContext *) +{ + return AlterTableClause::createRemoveTTL(); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseRename(ClickHouseParser::AlterTableClauseRenameContext *ctx) +{ + return AlterTableClause::createRename(!!ctx->IF(), visit(ctx->nestedIdentifier(0)), visit(ctx->nestedIdentifier(1))); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseReplace(ClickHouseParser::AlterTableClauseReplaceContext *ctx) +{ + return AlterTableClause::createReplace(visit(ctx->partitionClause()), visit(ctx->tableIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseUpdate(ClickHouseParser::AlterTableClauseUpdateContext *ctx) +{ + return AlterTableClause::createUpdate(visit(ctx->assignmentExprList()), visit(ctx->whereClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitAlterTableStmt(ClickHouseParser::AlterTableStmtContext * ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto list = std::make_shared>(); + for (auto * clause : ctx->alterTableClause()) list->push(visit(clause)); + return std::make_shared(cluster, visit(ctx->tableIdentifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitAssignmentExpr(ClickHouseParser::AssignmentExprContext *ctx) +{ + return std::make_shared(visit(ctx->nestedIdentifier()), visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitAssignmentExprList(ClickHouseParser::AssignmentExprListContext *ctx) +{ + auto list = std::make_shared(); + for (auto * expr : ctx->assignmentExpr()) list->push(visit(expr)); + return list; +} + +antlrcpp::Any ParseTreeVisitor::visitTableColumnPropertyType(ClickHouseParser::TableColumnPropertyTypeContext *ctx) +{ + if (ctx->ALIAS()) return TableColumnPropertyType::ALIAS; + if (ctx->CODEC()) return TableColumnPropertyType::CODEC; + if (ctx->COMMENT()) return TableColumnPropertyType::COMMENT; + if (ctx->DEFAULT()) return TableColumnPropertyType::DEFAULT; + if (ctx->MATERIALIZED()) return TableColumnPropertyType::MATERIALIZED; + if (ctx->TTL()) return TableColumnPropertyType::TTL; + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitPartitionClause(ClickHouseParser::PartitionClauseContext *ctx) +{ + if (ctx->STRING_LITERAL()) + return std::make_shared(Literal::createString(ctx->STRING_LITERAL())); + + auto expr = visit(ctx->columnExpr()).as>(); + + if (expr->getType() == ColumnExpr::ExprType::LITERAL) + return std::make_shared(PtrTo>(new List{expr->getLiteral()})); + + if (expr->getType() == ColumnExpr::ExprType::FUNCTION && expr->getFunctionName() == "tuple") + { + auto list = std::make_shared>(); + + for (auto it = expr->argumentsBegin(); it != expr->argumentsEnd(); ++it) + { + auto * literal = (*it)->as(); + + if (literal->getType() == ColumnExpr::ExprType::LITERAL) + list->push(literal->getLiteral()); + else + { + // TODO: 'Expected tuple of literals as Partition Expression'. + } + } + + return std::make_shared(list); + } + + // TODO: 'Expected tuple of literals as Partition Expression'. + __builtin_unreachable(); +} + +} diff --git a/src/Parsers/New/AST/AlterTableQuery.h b/src/Parsers/New/AST/AlterTableQuery.h new file mode 100644 index 00000000000..a1e5becedaf --- /dev/null +++ b/src/Parsers/New/AST/AlterTableQuery.h @@ -0,0 +1,179 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class AssignmentExpr : public INode +{ + public: + AssignmentExpr(PtrTo identifier, PtrTo expr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + IDENTIFIER = 0, // Identifier + EXPR = 1, // ColumnExpr + }; +}; + +enum class TableColumnPropertyType +{ + ALIAS, + CODEC, + COMMENT, + DEFAULT, + MATERIALIZED, + TTL, +}; + +class PartitionClause : public INode +{ + public: + explicit PartitionClause(PtrTo id); + explicit PartitionClause(PtrTo> list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + ID = 0, // Literal + LIST = 0, // List + }; + enum class ClauseType + { + ID, + LIST, + }; + + const ClauseType clause_type; + + PartitionClause(ClauseType type, PtrList exprs); +}; + +class AlterTableClause : public INode +{ + public: + static PtrTo createAddColumn(bool if_not_exists, PtrTo element, PtrTo after); + static PtrTo createAddIndex(bool if_not_exists, PtrTo element, PtrTo after); + static PtrTo createAttach(PtrTo clause, PtrTo from); + static PtrTo createClear(bool if_exists, PtrTo identifier, PtrTo in); + static PtrTo createCodec(bool if_exists, PtrTo identifier, PtrTo codec); + static PtrTo createComment(bool if_exists, PtrTo identifier, PtrTo comment); + static PtrTo createDelete(PtrTo expr); + static PtrTo createDetach(PtrTo clause); + static PtrTo createDropColumn(bool if_exists, PtrTo identifier); + static PtrTo createDropIndex(bool if_exists, PtrTo identifier); + static PtrTo createDropPartition(PtrTo clause); + static PtrTo createFreezePartition(PtrTo clause); + static PtrTo createModify(bool if_exists, PtrTo element); + static PtrTo createMovePartitionToDisk(PtrTo clause, PtrTo literal); + static PtrTo createMovePartitionToTable(PtrTo clause, PtrTo identifier); + static PtrTo createMovePartitionToVolume(PtrTo clause, PtrTo literal); + static PtrTo createRemove(bool if_exists, PtrTo identifier, TableColumnPropertyType type); + static PtrTo createRemoveTTL(); + static PtrTo createRename(bool if_exists, PtrTo identifier, PtrTo to); + static PtrTo createOrderBy(PtrTo expr); + static PtrTo createReplace(PtrTo clause, PtrTo from); + static PtrTo createTTL(PtrTo clause); + static PtrTo createUpdate(PtrTo list, PtrTo where); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + // ADD COLUMN or INDEX + ELEMENT = 0, // TableElementExpr + AFTER = 1, // Identifier (optional) + + // ATTACH/REPLACE + PARTITION = 0, // PartitionClause + FROM = 1, // TableIdentifier (optional) + + // CLEAR + COLUMN = 0, // Identifier + IN = 1, // PartitionClause + + // CODEC + CODEC = 1, // CodecExpr + + // COMMENT + COMMENT = 1, // StringLiteral + + // DELETE + EXPR = 0, // ColumnExpr + + // MOVE + // TO = 1, // TableIdentifier or StringLiteral + + // RENAME + TO = 1, // Identifier + + // TTL + CLAUSE = 0, // TTLClause + + // UPDATE + ASSIGNMENTS = 0, // AssignmentExprList + WHERE = 1, // WhereClause + }; + + enum class ClauseType + { + ADD_COLUMN, + ADD_INDEX, + ATTACH, + CLEAR, + CODEC, + COMMENT, + DELETE, + DETACH, + DROP_COLUMN, + DROP_INDEX, + DROP_PARTITION, + FREEZE_PARTITION, + MODIFY, + MOVE_PARTITION_TO_DISK, + MOVE_PARTITION_TO_TABLE, + MOVE_PARTITION_TO_VOLUME, + ORDER_BY, + REMOVE, + REMOVE_TTL, + RENAME, + REPLACE, + TTL, + UPDATE, + }; + + const ClauseType clause_type; + TableColumnPropertyType property_type = TableColumnPropertyType::ALIAS; // default value to silence PVS-Studio + union + { + bool if_exists; + bool if_not_exists; + }; + + AlterTableClause(ClauseType type, PtrList exprs); +}; + +class AlterTableQuery : public DDLQuery +{ + public: + AlterTableQuery(PtrTo cluster, PtrTo identifier, PtrTo> clauses); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, // TableIdentifier + CLAUSES = 1, // List + }; +}; + +} diff --git a/src/Parsers/New/AST/AttachQuery.cpp b/src/Parsers/New/AST/AttachQuery.cpp new file mode 100644 index 00000000000..8d2e4c12346 --- /dev/null +++ b/src/Parsers/New/AST/AttachQuery.cpp @@ -0,0 +1,57 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo AttachQuery::createDictionary(PtrTo clause, PtrTo identifier) +{ + return PtrTo(new AttachQuery(clause, QueryType::DICTIONARY, {identifier})); +} + +AttachQuery::AttachQuery(PtrTo clause, QueryType type, PtrList exprs) : DDLQuery(clause, exprs), query_type(type) +{ +} + +ASTPtr AttachQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->attach = true; + + switch(query_type) + { + case QueryType::DICTIONARY: + query->is_dictionary = true; + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + } + + query->cluster = cluster_name; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitAttachDictionaryStmt(ClickHouseParser::AttachDictionaryStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + return AttachQuery::createDictionary(cluster, visit(ctx->tableIdentifier())); +} + +} diff --git a/src/Parsers/New/AST/AttachQuery.h b/src/Parsers/New/AST/AttachQuery.h new file mode 100644 index 00000000000..f9b495b5b46 --- /dev/null +++ b/src/Parsers/New/AST/AttachQuery.h @@ -0,0 +1,32 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class AttachQuery : public DDLQuery +{ + public: + static PtrTo createDictionary(PtrTo clause, PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + }; + + enum class QueryType + { + DICTIONARY, + }; + + const QueryType query_type; + + AttachQuery(PtrTo clause, QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/CheckQuery.cpp b/src/Parsers/New/AST/CheckQuery.cpp new file mode 100644 index 00000000000..54ad8e4dac4 --- /dev/null +++ b/src/Parsers/New/AST/CheckQuery.cpp @@ -0,0 +1,44 @@ +#include + +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +CheckQuery::CheckQuery(PtrTo identifier, PtrTo clause) : Query{identifier, clause} +{ +} + +ASTPtr CheckQuery::convertToOld() const +{ + auto query = std::make_shared(); + + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + + if (has(PARTITION)) query->partition = get(PARTITION)->convertToOld(); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCheckStmt(ClickHouseParser::CheckStmtContext *ctx) +{ + auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; + return std::make_shared(visit(ctx->tableIdentifier()), partition); +} + +} diff --git a/src/Parsers/New/AST/CheckQuery.h b/src/Parsers/New/AST/CheckQuery.h new file mode 100644 index 00000000000..d29d2c42acd --- /dev/null +++ b/src/Parsers/New/AST/CheckQuery.h @@ -0,0 +1,24 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CheckQuery : public Query +{ + public: + CheckQuery(PtrTo identifier, PtrTo clause); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + PARTITION = 1, // PartitionClause (optional) + }; +}; + +} diff --git a/src/Parsers/New/AST/ColumnExpr.cpp b/src/Parsers/New/AST/ColumnExpr.cpp new file mode 100644 index 00000000000..0bfcee594cd --- /dev/null +++ b/src/Parsers/New/AST/ColumnExpr.cpp @@ -0,0 +1,588 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::ErrorCodes +{ + extern int SYNTAX_ERROR; +} + +namespace DB::AST +{ + +// static +PtrTo ColumnExpr::createAlias(PtrTo expr, PtrTo alias) +{ + return PtrTo(new ColumnExpr(ExprType::ALIAS, {expr, alias})); +} + +// static +PtrTo ColumnExpr::createAsterisk(PtrTo identifier, bool single_column) +{ + auto expr = PtrTo(new ColumnExpr(ExprType::ASTERISK, {identifier})); + expr->expect_single_column = single_column; + return expr; +} + +// static +PtrTo ColumnExpr::createFunction(PtrTo name, PtrTo params, PtrTo args) +{ + // FIXME: make sure that all function names are camel-case. + + // Flatten some consequent binary operators to a single multi-operator, because they are left-associative. + if ((name->getName() == "or" || name->getName() == "and") && args && args->size() == 2) + { + const auto * left = (*args->begin())->as(); + const auto * right = (*++args->begin())->as(); + + if (left && left->getType() == ExprType::FUNCTION && left->getFunctionName() == name->getName()) + { + auto new_args = std::make_shared(); + for (const auto & arg : left->get(ARGS)->as()) + new_args->push(std::static_pointer_cast(arg)); + new_args->push(std::static_pointer_cast(*++args->begin())); + args = new_args; + } + else if (right && right->getType() == ExprType::FUNCTION && right->getFunctionName() == name->getName()) + { + auto new_args = std::make_shared(); + new_args->push(std::static_pointer_cast(*args->begin())); + for (const auto & arg : right->get(ARGS)->as()) + new_args->push(std::static_pointer_cast(arg)); + args = new_args; + } + } + + return PtrTo(new ColumnExpr(ExprType::FUNCTION, {name, params, args})); +} + +// static +PtrTo ColumnExpr::createIdentifier(PtrTo identifier) +{ + return PtrTo(new ColumnExpr(ExprType::IDENTIFIER, {identifier})); +} + +// static +PtrTo ColumnExpr::createLambda(PtrTo> params, PtrTo expr) +{ + return PtrTo(new ColumnExpr(ExprType::LAMBDA, {params, expr})); +} + +// static +PtrTo ColumnExpr::createLiteral(PtrTo literal) +{ + return PtrTo(new ColumnExpr(ExprType::LITERAL, {literal})); +} + +// static +PtrTo ColumnExpr::createSubquery(PtrTo query, bool scalar) +{ + if (scalar) query->shouldBeScalar(); + return PtrTo(new ColumnExpr(ExprType::SUBQUERY, {query})); +} + +ColumnExpr::ColumnExpr(ColumnExpr::ExprType type, PtrList exprs) : INode(exprs), expr_type(type) +{ +} + +ASTPtr ColumnExpr::convertToOld() const +{ + switch (expr_type) + { + case ExprType::ALIAS: + { + ASTPtr expr = get(EXPR)->convertToOld(); + + if (auto * expr_with_alias = dynamic_cast(expr.get())) + expr_with_alias->setAlias(get(ALIAS)->getName()); + else + throw std::runtime_error("Trying to convert new expression with alias to old one without alias support: " + expr->getID()); + + return expr; + } + case ExprType::ASTERISK: + if (has(TABLE)) + { + auto expr = std::make_shared(); + expr->children.push_back(get(TABLE)->convertToOld()); + return expr; + } + return std::make_shared(); + case ExprType::FUNCTION: + { + auto func = std::make_shared(); + + func->name = get(NAME)->getName(); + if (has(ARGS)) + { + func->arguments = get(ARGS)->convertToOld(); + func->children.push_back(func->arguments); + } + if (has(PARAMS)) + { + func->parameters = get(PARAMS)->convertToOld(); + func->children.push_back(func->parameters); + } + + return func; + } + case ExprType::IDENTIFIER: + return get(IDENTIFIER)->convertToOld(); + case ExprType::LAMBDA: + { + auto func = std::make_shared(); + auto tuple = std::make_shared(); + + func->name = "lambda"; + func->arguments = std::make_shared(); + func->arguments->children.push_back(tuple); + func->arguments->children.push_back(get(LAMBDA_EXPR)->convertToOld()); + func->children.push_back(func->arguments); + + tuple->name = "tuple"; + tuple->arguments = get(LAMBDA_ARGS)->convertToOld(); + tuple->children.push_back(tuple->arguments); + + return func; + } + case ExprType::LITERAL: + return get(LITERAL)->convertToOld(); + case ExprType::SUBQUERY: + { + auto subquery = std::make_shared(); + subquery->children.push_back(get(SUBQUERY)->convertToOld()); + return subquery; + } + } + __builtin_unreachable(); +} + +String ColumnExpr::toString() const +{ + switch(expr_type) + { + case ExprType::LITERAL: return get(LITERAL)->toString(); + default: return {}; + } + __builtin_unreachable(); +} + +String ColumnExpr::dumpInfo() const +{ + switch(expr_type) + { + case ExprType::ALIAS: return "ALIAS"; + case ExprType::ASTERISK: return "ASTERISK"; + case ExprType::FUNCTION: return "FUNCTION"; + case ExprType::IDENTIFIER: return "IDENTIFIER"; + case ExprType::LAMBDA: return "LAMBDA"; + case ExprType::LITERAL: return "LITERAL"; + case ExprType::SUBQUERY: return "SUBQUERY"; + } + __builtin_unreachable(); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitColumnArgExpr(ClickHouseParser::ColumnArgExprContext *ctx) +{ + if (ctx->columnExpr()) return visit(ctx->columnExpr()); + if (ctx->columnLambdaExpr()) return visit(ctx->columnLambdaExpr()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnArgList(ClickHouseParser::ColumnArgListContext *ctx) +{ + auto list = std::make_shared(); + for (auto * arg : ctx->columnArgExpr()) list->push(visit(arg)); + return list; +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprAlias(ClickHouseParser::ColumnExprAliasContext *ctx) +{ + if (ctx->AS()) return ColumnExpr::createAlias(visit(ctx->columnExpr()), visit(ctx->identifier())); + else return ColumnExpr::createAlias(visit(ctx->columnExpr()), visit(ctx->alias())); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprAnd(ClickHouseParser::ColumnExprAndContext *ctx) +{ + auto name = std::make_shared("and"); + auto args = std::make_shared(); + + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprArray(ClickHouseParser::ColumnExprArrayContext *ctx) +{ + auto name = std::make_shared("array"); + auto args = ctx->columnExprList() ? visit(ctx->columnExprList()).as>() : nullptr; + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprArrayAccess(ClickHouseParser::ColumnExprArrayAccessContext *ctx) +{ + auto name = std::make_shared("arrayElement"); + auto args = std::make_shared(); + + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprAsterisk(ClickHouseParser::ColumnExprAsteriskContext *ctx) +{ + auto table = ctx->tableIdentifier() ? visit(ctx->tableIdentifier()).as>() : nullptr; + return ColumnExpr::createAsterisk(table, true); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprBetween(ClickHouseParser::ColumnExprBetweenContext *ctx) +{ + PtrTo expr1, expr2; + + { + auto name = std::make_shared(ctx->NOT() ? "lessOrEquals" : "greaterOrEquals"); + auto args = std::make_shared(); + args->push(visit(ctx->columnExpr(0))); + args->push(visit(ctx->columnExpr(1))); + expr1 = ColumnExpr::createFunction(name, nullptr, args); + } + + { + auto name = std::make_shared(ctx->NOT() ? "greaterOrEquals" : "lessOrEquals"); + auto args = std::make_shared(); + args->push(visit(ctx->columnExpr(0))); + args->push(visit(ctx->columnExpr(2))); + expr2 = ColumnExpr::createFunction(name, nullptr, args); + } + + auto name = std::make_shared("and"); + auto args = std::make_shared(); + + args->push(expr1); + args->push(expr2); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprCase(ClickHouseParser::ColumnExprCaseContext *ctx) +{ + auto has_case_expr = (ctx->ELSE() && ctx->columnExpr().size() % 2 == 0) || (!ctx->ELSE() && ctx->columnExpr().size() % 2 == 1); + auto name = std::make_shared(has_case_expr ? "caseWithExpression" : "multiIf"); + auto args = std::make_shared(); + + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + if (!ctx->ELSE()) args->push(ColumnExpr::createLiteral(Literal::createNull())); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprCast(ClickHouseParser::ColumnExprCastContext *ctx) +{ + auto args = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + args->push(ColumnExpr::createLiteral(Literal::createString(visit(ctx->columnTypeExpr()).as>()->toString()))); + + return ColumnExpr::createFunction(std::make_shared("cast"), nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprDate(ClickHouseParser::ColumnExprDateContext *ctx) +{ + auto name = std::make_shared("toDate"); + auto args = std::make_shared(); + + args->push(ColumnExpr::createLiteral(Literal::createString(ctx->STRING_LITERAL()))); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprExtract(ClickHouseParser::ColumnExprExtractContext *ctx) +{ + String name; + auto args = std::make_shared(); + + if (ctx->interval()->SECOND()) name = "toSecond"; + else if (ctx->interval()->MINUTE()) name = "toMinute"; + else if (ctx->interval()->HOUR()) name = "toHour"; + else if (ctx->interval()->DAY()) name = "toDayOfMonth"; + else if (ctx->interval()->WEEK()) + throw Exception( + "The syntax 'EXTRACT(WEEK FROM date)' is not supported, cannot extract the number of a week", ErrorCodes::SYNTAX_ERROR); + else if (ctx->interval()->MONTH()) name = "toMonth"; + else if (ctx->interval()->QUARTER()) name = "toQuarter"; + else if (ctx->interval()->YEAR()) name = "toYear"; + else __builtin_unreachable(); + + args->push(visit(ctx->columnExpr())); + + return ColumnExpr::createFunction(std::make_shared(name), nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprFunction(ClickHouseParser::ColumnExprFunctionContext *ctx) +{ + auto name = visit(ctx->identifier()).as>(); + auto params = ctx->columnExprList() ? visit(ctx->columnExprList()).as>() : nullptr; + auto args = ctx->columnArgList() ? visit(ctx->columnArgList()).as>() : nullptr; + + if (ctx->DISTINCT()) name = std::make_shared(name->getName() + "Distinct"); + + return ColumnExpr::createFunction(name, params, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprIdentifier(ClickHouseParser::ColumnExprIdentifierContext *ctx) +{ + return ColumnExpr::createIdentifier(visit(ctx->columnIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprInterval(ClickHouseParser::ColumnExprIntervalContext *ctx) +{ + PtrTo name; + auto args = std::make_shared(); + + if (ctx->interval()->SECOND()) name = std::make_shared("toIntervalSecond"); + else if (ctx->interval()->MINUTE()) name = std::make_shared("toIntervalMinute"); + else if (ctx->interval()->HOUR()) name = std::make_shared("toIntervalHour"); + else if (ctx->interval()->DAY()) name = std::make_shared("toIntervalDay"); + else if (ctx->interval()->WEEK()) name = std::make_shared("toIntervalWeek"); + else if (ctx->interval()->MONTH()) name = std::make_shared("toIntervalMonth"); + else if (ctx->interval()->QUARTER()) name = std::make_shared("toIntervalQuarter"); + else if (ctx->interval()->YEAR()) name = std::make_shared("toIntervalYear"); + else __builtin_unreachable(); + + args->push(visit(ctx->columnExpr())); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprIsNull(ClickHouseParser::ColumnExprIsNullContext *ctx) +{ + auto name = std::make_shared(ctx->NOT() ? "isNotNull" : "isNull"); + auto args = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprList(ClickHouseParser::ColumnExprListContext *ctx) +{ + auto list = std::make_shared(); + for (auto * expr : ctx->columnsExpr()) list->push(visit(expr)); + return list; +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprLiteral(ClickHouseParser::ColumnExprLiteralContext *ctx) +{ + return ColumnExpr::createLiteral(visit(ctx->literal()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprNegate(ClickHouseParser::ColumnExprNegateContext *ctx) +{ + auto name = std::make_shared("negate"); + auto args = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprNot(ClickHouseParser::ColumnExprNotContext *ctx) +{ + auto name = std::make_shared("not"); + auto args = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprOr(ClickHouseParser::ColumnExprOrContext *ctx) +{ + auto name = std::make_shared("or"); + + auto args = std::make_shared(); + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprParens(ClickHouseParser::ColumnExprParensContext *ctx) +{ + return visit(ctx->columnExpr()); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprPrecedence1(ClickHouseParser::ColumnExprPrecedence1Context *ctx) +{ + PtrTo name; + if (ctx->ASTERISK()) name = std::make_shared("multiply"); + else if (ctx->SLASH()) name = std::make_shared("divide"); + else if (ctx->PERCENT()) name = std::make_shared("modulo"); + + auto args = std::make_shared(); + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprPrecedence2(ClickHouseParser::ColumnExprPrecedence2Context *ctx) +{ + PtrTo name; + if (ctx->PLUS()) name = std::make_shared("plus"); + else if (ctx->DASH()) name = std::make_shared("minus"); + else if (ctx->CONCAT()) name = std::make_shared("concat"); + + auto args = std::make_shared(); + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprPrecedence3(ClickHouseParser::ColumnExprPrecedence3Context *ctx) +{ + PtrTo name; + if (ctx->EQ_DOUBLE() || ctx->EQ_SINGLE()) name = std::make_shared("equals"); + else if (ctx->NOT_EQ()) name = std::make_shared("notEquals"); + else if (ctx->LE()) name = std::make_shared("lessOrEquals"); + else if (ctx->GE()) name = std::make_shared("greaterOrEquals"); + else if (ctx->LT()) name = std::make_shared("less"); + else if (ctx->GT()) name = std::make_shared("greater"); + else if (ctx->LIKE()) + { + if (ctx->NOT()) name = std::make_shared("notLike"); + else name = std::make_shared("like"); + } + else if (ctx->ILIKE()) + { + if (ctx->NOT()) name = std::make_shared("notILike"); + else name = std::make_shared("ilike"); + } + else if (ctx->IN()) + { + if (ctx->GLOBAL()) + { + if (ctx->NOT()) name = std::make_shared("globalNotIn"); + else name = std::make_shared("globalIn"); + } + else + { + if (ctx->NOT()) name = std::make_shared("notIn"); + else name = std::make_shared("in"); + } + } + + auto args = std::make_shared(); + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprSubquery(ClickHouseParser::ColumnExprSubqueryContext *ctx) +{ + // IN-operator is special since it accepts non-scalar subqueries on the right side. + auto * parent = dynamic_cast(ctx->parent); + return ColumnExpr::createSubquery(visit(ctx->selectUnionStmt()), !(parent && parent->IN())); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprSubstring(ClickHouseParser::ColumnExprSubstringContext *ctx) +{ + auto name = std::make_shared("substring"); + auto args = std::make_shared(); + + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprTernaryOp(ClickHouseParser::ColumnExprTernaryOpContext *ctx) +{ + auto name = std::make_shared("if"); + auto args = std::make_shared(); + + for (auto * expr : ctx->columnExpr()) args->push(visit(expr)); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprTimestamp(ClickHouseParser::ColumnExprTimestampContext *ctx) +{ + auto name = std::make_shared("toDateTime"); + auto args = std::make_shared(); + + args->push(ColumnExpr::createLiteral(Literal::createString(ctx->STRING_LITERAL()))); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprTrim(ClickHouseParser::ColumnExprTrimContext *ctx) +{ + auto name = std::make_shared("trim"); + auto args = std::make_shared(); + auto params = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + // TODO: params->append(Literal::createString(???)); + params->push(ColumnExpr::createLiteral(Literal::createString(ctx->STRING_LITERAL()))); + + return ColumnExpr::createFunction(name, params, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprTuple(ClickHouseParser::ColumnExprTupleContext *ctx) +{ + auto name = std::make_shared("tuple"); + auto args = visit(ctx->columnExprList()).as>(); + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnExprTupleAccess(ClickHouseParser::ColumnExprTupleAccessContext *ctx) +{ + auto name = std::make_shared("tupleElement"); + auto args = std::make_shared(); + + args->push(visit(ctx->columnExpr())); + args->push(ColumnExpr::createLiteral(Literal::createNumber(ctx->DECIMAL_LITERAL()))); + + return ColumnExpr::createFunction(name, nullptr, args); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnLambdaExpr(ClickHouseParser::ColumnLambdaExprContext *ctx) +{ + auto params = std::make_shared>(); + for (auto * id : ctx->identifier()) params->push(visit(id)); + return ColumnExpr::createLambda(params, visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnsExprAsterisk(ClickHouseParser::ColumnsExprAsteriskContext *ctx) +{ + auto table = ctx->tableIdentifier() ? visit(ctx->tableIdentifier()).as>() : nullptr; + return ColumnExpr::createAsterisk(table, false); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnsExprSubquery(ClickHouseParser::ColumnsExprSubqueryContext *ctx) +{ + return ColumnExpr::createSubquery(visit(ctx->selectUnionStmt()), false); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnsExprColumn(ClickHouseParser::ColumnsExprColumnContext *ctx) +{ + return visit(ctx->columnExpr()); +} + +} diff --git a/src/Parsers/New/AST/ColumnExpr.h b/src/Parsers/New/AST/ColumnExpr.h new file mode 100644 index 00000000000..6de707d6b2d --- /dev/null +++ b/src/Parsers/New/AST/ColumnExpr.h @@ -0,0 +1,82 @@ +#pragma once + +#include +#include + + +namespace DB::AST +{ + +class ColumnExpr : public INode +{ + public: + static PtrTo createAlias(PtrTo expr, PtrTo alias); + static PtrTo createAsterisk(PtrTo identifier, bool single_column); + static PtrTo createFunction(PtrTo name, PtrTo params, PtrTo args); + static PtrTo createIdentifier(PtrTo identifier); + static PtrTo createLambda(PtrTo> params, PtrTo expr); + static PtrTo createLiteral(PtrTo literal); + static PtrTo createSubquery(PtrTo query, bool scalar); + + enum class ExprType + { + ALIAS, + ASTERISK, + FUNCTION, + IDENTIFIER, + LAMBDA, + LITERAL, + SUBQUERY, + }; + + auto getType() const { return expr_type; }; + + // FUNCTION + auto getFunctionName() const { return get(NAME)->getName(); } + auto argumentsBegin() const { return has(ARGS) ? get(ARGS)->begin() : end(); } + auto argumentsEnd() const { return has(ARGS) ? get(ARGS)->end() : end(); } + + // LITERAL + auto getLiteral() const { return std::static_pointer_cast(get(LITERAL)); } + + ASTPtr convertToOld() const override; + String toString() const override; + + private: + enum ChildIndex : UInt8 + { + // ALIAS + EXPR = 0, // ColumnExpr + ALIAS = 1, // Identifier + + // ASTERISK + TABLE = 0, // TableIdentifier (optional) + + // IDENTIFIER + IDENTIFIER = 0, // ColumnIdentifier + + // FUNCTION + NAME = 0, // Identifier + PARAMS = 1, // ColumnParamList (optional) + ARGS = 2, // ColumnExprList (optional) + + // LAMBDA + LAMBDA_ARGS = 0, + LAMBDA_EXPR = 1, + + // LITERAL + LITERAL = 0, + + // SUBQUERY + SUBQUERY = 0, + }; + + const ExprType expr_type; + bool expect_single_column = false; + + ColumnExpr(ExprType type, PtrList exprs); + + String dumpInfo() const override; +}; + +} diff --git a/src/Parsers/New/AST/ColumnTypeExpr.cpp b/src/Parsers/New/AST/ColumnTypeExpr.cpp new file mode 100644 index 00000000000..a2947cf0f63 --- /dev/null +++ b/src/Parsers/New/AST/ColumnTypeExpr.cpp @@ -0,0 +1,166 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +EnumValue::EnumValue(PtrTo name, PtrTo value) : INode{name, value} +{ +} + +ASTPtr EnumValue::convertToOld() const +{ + auto func = std::make_shared(); + + func->name = "equals"; + func->arguments = std::make_shared(); + func->arguments->children.push_back(get(NAME)->convertToOld()); + func->arguments->children.push_back(get(VALUE)->convertToOld()); + func->children.push_back(func->arguments); + + return func; +} + +String EnumValue::toString() const +{ + return fmt::format("{} = {}", get(NAME)->toString(), get(VALUE)->toString()); +} + +// static +PtrTo ColumnTypeExpr::createSimple(PtrTo identifier) +{ + return PtrTo(new ColumnTypeExpr(ExprType::SIMPLE, {identifier})); +} + +// static +PtrTo ColumnTypeExpr::createNamed(PtrTo identifier, PtrTo type) +{ + return PtrTo(new ColumnTypeExpr(ExprType::NAMED, {identifier, type})); +} + +// static +PtrTo ColumnTypeExpr::createComplex(PtrTo identifier, PtrTo list) +{ + return PtrTo(new ColumnTypeExpr(ExprType::COMPLEX, {identifier, list})); +} + +// static +PtrTo ColumnTypeExpr::createEnum(PtrTo identifier, PtrTo list) +{ + return PtrTo(new ColumnTypeExpr(ExprType::ENUM, {identifier, list})); +} + +// static +PtrTo ColumnTypeExpr::createParam(PtrTo identifier, PtrTo list) +{ + return PtrTo(new ColumnTypeExpr(ExprType::PARAM, {identifier, list})); +} + +// static +PtrTo ColumnTypeExpr::createNested(PtrTo identifier, PtrTo list) +{ + // TODO: assert that |list| must contain only expressions of NAMED type + return PtrTo(new ColumnTypeExpr(ExprType::NESTED, {identifier, list})); +} + +ColumnTypeExpr::ColumnTypeExpr(ExprType type, PtrList exprs) : INode(exprs), expr_type(type) +{ +} + +ASTPtr ColumnTypeExpr::convertToOld() const +{ + if (expr_type == ExprType::NAMED) + { + auto pair = std::make_shared(); + + pair->name = get(NAME)->getName(); + pair->type = get(TYPE)->convertToOld(); + pair->children.push_back(pair->type); + + return pair; + } + + auto func = std::make_shared(); + + func->name = get(NAME)->getName(); + func->no_empty_args = true; + if (expr_type != ExprType::SIMPLE && has(LIST)) + { + func->arguments = get(LIST)->convertToOld(); + func->children.push_back(func->arguments); + } + + return func; +} + +String ColumnTypeExpr::toString() const +{ + switch(expr_type) + { + case ExprType::SIMPLE: + return get(NAME)->toString(); + case ExprType::NAMED: + return get(NAME)->toString() + " " + get(TYPE)->toString(); + case ExprType::COMPLEX: + case ExprType::ENUM: + case ExprType::PARAM: + case ExprType::NESTED: + return get(NAME)->toString() + "(" + (has(LIST) ? get(LIST)->toString() : "") + ")"; + } + __builtin_unreachable(); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitColumnTypeExprSimple(ClickHouseParser::ColumnTypeExprSimpleContext *ctx) +{ + return ColumnTypeExpr::createSimple(visit(ctx->identifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnTypeExprParam(ClickHouseParser::ColumnTypeExprParamContext *ctx) +{ + auto list = ctx->columnExprList() ? visit(ctx->columnExprList()).as>() : nullptr; + return ColumnTypeExpr::createParam(visit(ctx->identifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnTypeExprEnum(ClickHouseParser::ColumnTypeExprEnumContext *ctx) +{ + auto list = std::make_shared(); + for (auto * value : ctx->enumValue()) list->push(visit(value)); + return ColumnTypeExpr::createEnum(visit(ctx->identifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnTypeExprComplex(ClickHouseParser::ColumnTypeExprComplexContext *ctx) +{ + auto list = std::make_shared(); + for (auto * expr : ctx->columnTypeExpr()) list->push(visit(expr)); + return ColumnTypeExpr::createComplex(visit(ctx->identifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnTypeExprNested(ClickHouseParser::ColumnTypeExprNestedContext *ctx) +{ + auto list = std::make_shared(); + + for (size_t i = 0; i < ctx->columnTypeExpr().size(); ++i) + list->push(ColumnTypeExpr::createNamed(visit(ctx->identifier(i + 1)), visit(ctx->columnTypeExpr(i)))); + + return ColumnTypeExpr::createNested(visit(ctx->identifier(0)), list); +} + +antlrcpp::Any ParseTreeVisitor::visitEnumValue(ClickHouseParser::EnumValueContext *ctx) +{ + return std::make_shared(Literal::createString(ctx->STRING_LITERAL()), visit(ctx->numberLiteral())); +} + +} diff --git a/src/Parsers/New/AST/ColumnTypeExpr.h b/src/Parsers/New/AST/ColumnTypeExpr.h new file mode 100644 index 00000000000..8c4f3c697e7 --- /dev/null +++ b/src/Parsers/New/AST/ColumnTypeExpr.h @@ -0,0 +1,62 @@ +#pragma once + +#include + +#include + + +namespace DB::AST +{ + +class EnumValue : public INode +{ + public: + EnumValue(PtrTo name, PtrTo value); + + ASTPtr convertToOld() const override; + String toString() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // StringLiteral + VALUE = 1, // NumberLiteral + }; +}; + +class ColumnTypeExpr : public INode +{ + public: + static PtrTo createSimple(PtrTo identifier); + static PtrTo createNamed(PtrTo identifier, PtrTo type); + static PtrTo createComplex(PtrTo identifier, PtrTo list); + static PtrTo createEnum(PtrTo identifier, PtrTo list); + static PtrTo createParam(PtrTo identifier, PtrTo list); + static PtrTo createNested(PtrTo identifier, PtrTo list); + + ASTPtr convertToOld() const override; + String toString() const override; + + private: + enum class ExprType + { + SIMPLE, + NAMED, + COMPLEX, + ENUM, + PARAM, + NESTED, + }; + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + TYPE = 1, // ColumnTypeExpr + LIST = 1, // depends on |expr_type| + }; + + ExprType expr_type; + + ColumnTypeExpr(ExprType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/CreateDatabaseQuery.cpp b/src/Parsers/New/AST/CreateDatabaseQuery.cpp new file mode 100644 index 00000000000..9f6c79d592f --- /dev/null +++ b/src/Parsers/New/AST/CreateDatabaseQuery.cpp @@ -0,0 +1,51 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +CreateDatabaseQuery::CreateDatabaseQuery( + PtrTo cluster, bool if_not_exists_, PtrTo identifier, PtrTo expr) + : DDLQuery(cluster, {identifier, expr}), if_not_exists(if_not_exists_) +{ +} + +ASTPtr CreateDatabaseQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->if_not_exists = if_not_exists; + query->database = get(NAME)->getName(); + query->cluster = cluster_name; + if (has(ENGINE)) + { + auto engine = std::make_shared(); + engine->set(engine->engine, get(ENGINE)->convertToOld()); + query->set(query->storage, engine); + } + // TODO: query->uuid + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCreateDatabaseStmt(ClickHouseParser::CreateDatabaseStmtContext *ctx) +{ + auto engine = ctx->engineExpr() ? visit(ctx->engineExpr()).as>() : nullptr; + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + return std::make_shared(cluster, !!ctx->IF(), visit(ctx->databaseIdentifier()), engine); +} + +} diff --git a/src/Parsers/New/AST/CreateDatabaseQuery.h b/src/Parsers/New/AST/CreateDatabaseQuery.h new file mode 100644 index 00000000000..3de16c3dc83 --- /dev/null +++ b/src/Parsers/New/AST/CreateDatabaseQuery.h @@ -0,0 +1,26 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CreateDatabaseQuery: public DDLQuery +{ + public: + CreateDatabaseQuery(PtrTo cluster, bool if_not_exists, PtrTo identifier, PtrTo expr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // DatabaseIdentifier + ENGINE = 1, // EngineExpr (optional) + }; + + const bool if_not_exists; +}; + +} diff --git a/src/Parsers/New/AST/CreateDictionaryQuery.cpp b/src/Parsers/New/AST/CreateDictionaryQuery.cpp new file mode 100644 index 00000000000..4bbf1f3d85c --- /dev/null +++ b/src/Parsers/New/AST/CreateDictionaryQuery.cpp @@ -0,0 +1,361 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +namespace DB::ErrorCodes +{ + extern const int SYNTAX_ERROR; +} + +namespace DB::AST +{ + +// DictionaryAttributeExpr + +DictionaryAttributeExpr::DictionaryAttributeExpr(PtrTo identifier, PtrTo type) : INode(MAX_INDEX) +{ + set(NAME, identifier); + set(TYPE, type); +} + +void DictionaryAttributeExpr::setDefaultClause(PtrTo literal) +{ + set(DEFAULT, literal); +} + +void DictionaryAttributeExpr::setExpressionClause(PtrTo expr) +{ + set(EXPRESSION, expr); +} + +ASTPtr DictionaryAttributeExpr::convertToOld() const +{ + auto expr = std::make_shared(); + + expr->name = get(NAME)->getName(); + if (has(TYPE)) + { + expr->type = get(TYPE)->convertToOld(); + expr->children.push_back(expr->type); + } + if (has(DEFAULT)) + { + expr->default_value = get(DEFAULT)->convertToOld(); + expr->children.push_back(expr->default_value); + } + if (has(EXPRESSION)) + { + expr->expression = get(EXPRESSION)->convertToOld(); + expr->children.push_back(expr->expression); + } + expr->hierarchical = hierarchical; + expr->injective = injective; + expr->is_object_id = is_object_id; + + return expr; +} + +// DictionaryArgExpr + +DictionaryArgExpr::DictionaryArgExpr(PtrTo identifier, PtrTo expr) : INode{identifier, expr} +{ + if (expr->getType() != ColumnExpr::ExprType::LITERAL && expr->getType() != ColumnExpr::ExprType::IDENTIFIER + && expr->getType() != ColumnExpr::ExprType::FUNCTION) + throw DB::Exception(ErrorCodes::SYNTAX_ERROR, "Expected literal, identifier or function"); +} + +ASTPtr DictionaryArgExpr::convertToOld() const +{ + auto expr = std::make_shared(false); // FIXME: always true? + + // TODO: probably there are more variants to parse. + + expr->first = Poco::toLower(get(KEY)->getName()); + expr->set(expr->second, get(VALUE)->convertToOld()); + + return expr; +} + +// SourceClause + +SourceClause::SourceClause(PtrTo identifier, PtrTo list) : INode{identifier, list} +{ +} + +ASTPtr SourceClause::convertToOld() const +{ + auto clause = std::make_shared(true); // FIXME: always true? + + clause->name = Poco::toLower(get(NAME)->getName()); + if (has(ARGS)) + { + clause->elements = get(ARGS)->convertToOld(); + clause->children.push_back(clause->elements); + } + + return clause; +} + +// LifetimeClause + +LifetimeClause::LifetimeClause(PtrTo max, PtrTo min) : INode{max, min} +{ +} + +ASTPtr LifetimeClause::convertToOld() const +{ + auto clause = std::make_shared(); + + clause->max_sec = get(MAX)->convertToOld()->as()->value.get(); + if (has(MIN)) clause->min_sec = get(MIN)->convertToOld()->as()->value.get(); + + return clause; +} + +// LayoutClause + +LayoutClause::LayoutClause(PtrTo identifier, PtrTo list) : INode{identifier, list} +{ +} + +ASTPtr LayoutClause::convertToOld() const +{ + auto clause = std::make_shared(); + + clause->layout_type = Poco::toLower(get(NAME)->getName()); + clause->has_brackets = true; // FIXME: maybe not? + if (has(ARGS)) clause->set(clause->parameters, get(ARGS)->convertToOld()); + + return clause; +} + +// RangeClause + +RangeClause::RangeClause(PtrTo max, PtrTo min) : INode{max, min} +{ +} + +ASTPtr RangeClause::convertToOld() const +{ + auto clause = std::make_shared(); + + clause->max_attr_name = get(MAX)->getName(); + clause->min_attr_name = get(MIN)->getName(); + + return clause; +} + +// DictionarySettingsClause + +DictionarySettingsClause::DictionarySettingsClause(PtrTo list) : INode{list} +{ +} + +ASTPtr DictionarySettingsClause::convertToOld() const +{ + auto clause = std::make_shared(); + + for (const auto & child : get(LIST)->as()) + { + const auto * setting = child->as(); + clause->changes.emplace_back(setting->getName()->getName(), setting->getValue()->convertToOld()->as()->value); + } + + return clause; +} + +// DictionaryEngineClause + +DictionaryEngineClause::DictionaryEngineClause(PtrTo clause) : INode(MAX_INDEX) +{ + set(PRIMARY_KEY, clause); +} + +void DictionaryEngineClause::setSourceClause(PtrTo clause) +{ + set(SOURCE, clause); +} + +void DictionaryEngineClause::setLifetimeClause(PtrTo clause) +{ + set(LIFETIME, clause); +} + +void DictionaryEngineClause::setLayoutClause(PtrTo clause) +{ + set(LAYOUT, clause); +} + +void DictionaryEngineClause::setRangeClause(PtrTo clause) +{ + set(RANGE, clause); +} + +void DictionaryEngineClause::setSettingsClause(PtrTo clause) +{ + set(SETTINGS, clause); +} + +ASTPtr DictionaryEngineClause::convertToOld() const +{ + auto clause = std::make_shared(); + + if (has(PRIMARY_KEY)) clause->set(clause->primary_key, get(PRIMARY_KEY)->convertToOld()); + if (has(SOURCE)) clause->set(clause->source, get(SOURCE)->convertToOld()); + if (has(LIFETIME)) clause->set(clause->lifetime, get(LIFETIME)->convertToOld()); + if (has(LAYOUT)) clause->set(clause->layout, get(LAYOUT)->convertToOld()); + if (has(RANGE)) clause->set(clause->range, get(RANGE)->convertToOld()); + if (has(SETTINGS)) clause->set(clause->dict_settings, get(SETTINGS)->convertToOld()); + + return clause; +} + +// CreateDictionaryQuery + +CreateDictionaryQuery::CreateDictionaryQuery( + PtrTo cluster, + bool attach_, + bool if_not_exists_, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo engine) + : DDLQuery(cluster, {identifier, uuid, schema, engine}), attach(attach_), if_not_exists(if_not_exists_) +{ +} + +ASTPtr CreateDictionaryQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid + = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table_id.uuid; + } + + query->cluster = cluster_name; + + query->is_dictionary = true; + query->attach = attach; + query->if_not_exists = if_not_exists; + + query->set(query->dictionary_attributes_list, get(SCHEMA)->convertToOld()); + query->set(query->dictionary, get(ENGINE)->convertToOld()); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCreateDictionaryStmt(ClickHouseParser::CreateDictionaryStmtContext *ctx) +{ + auto uuid = ctx->uuidClause() ? visit(ctx->uuidClause()).as>() : nullptr; + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto schema = ctx->dictionarySchemaClause() ? visit(ctx->dictionarySchemaClause()).as>() : nullptr; + auto engine = ctx->dictionaryEngineClause() ? visit(ctx->dictionaryEngineClause()).as>() : nullptr; + return std::make_shared( + cluster, !!ctx->ATTACH(), !!ctx->IF(), visit(ctx->tableIdentifier()), uuid, schema, engine); +} + +antlrcpp::Any ParseTreeVisitor::visitDictionaryArgExpr(ClickHouseParser::DictionaryArgExprContext *ctx) +{ + PtrTo expr; + if (ctx->literal()) expr = ColumnExpr::createLiteral(visit(ctx->literal())); + else if (ctx->LPAREN()) expr = ColumnExpr::createFunction(visit(ctx->identifier(1)), nullptr, nullptr); + else expr = ColumnExpr::createIdentifier(visit(ctx->identifier(1))); + return std::make_shared(visit(ctx->identifier(0)), expr); +} + +antlrcpp::Any ParseTreeVisitor::visitDictionaryAttrDfnt(ClickHouseParser::DictionaryAttrDfntContext *ctx) +{ + auto expr = std::make_shared(visit(ctx->identifier()), visit(ctx->columnTypeExpr())); + if (!ctx->DEFAULT().empty()) expr->setDefaultClause(visit(ctx->literal(0))); + if (!ctx->EXPRESSION().empty()) expr->setExpressionClause(visit(ctx->columnExpr(0))); + if (!ctx->HIERARCHICAL().empty()) expr->setHierarchicalFlag(); + if (!ctx->INJECTIVE().empty()) expr->setInjectiveFlag(); + if (!ctx->IS_OBJECT_ID().empty()) expr->setIsObjectIdFlag(); + return expr; +} + +antlrcpp::Any ParseTreeVisitor::visitDictionaryEngineClause(ClickHouseParser::DictionaryEngineClauseContext *ctx) +{ + auto primary_key + = ctx->dictionaryPrimaryKeyClause() ? visit(ctx->dictionaryPrimaryKeyClause()).as>() : nullptr; + auto clause = std::make_shared(primary_key); + if (!ctx->sourceClause().empty()) clause->setSourceClause(visit(ctx->sourceClause(0))); + if (!ctx->lifetimeClause().empty()) clause->setLifetimeClause(visit(ctx->lifetimeClause(0))); + if (!ctx->layoutClause().empty()) clause->setLayoutClause(visit(ctx->layoutClause(0))); + if (!ctx->rangeClause().empty()) clause->setRangeClause(visit(ctx->rangeClause(0))); + if (!ctx->dictionarySettingsClause().empty()) clause->setSettingsClause(visit(ctx->dictionarySettingsClause(0))); + return clause; +} + +antlrcpp::Any ParseTreeVisitor::visitDictionaryPrimaryKeyClause(ClickHouseParser::DictionaryPrimaryKeyClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitDictionarySchemaClause(ClickHouseParser::DictionarySchemaClauseContext *ctx) +{ + auto list = std::make_shared(); + for (auto * attr : ctx->dictionaryAttrDfnt()) list->push(visit(attr)); + return std::make_shared(list); +} + +antlrcpp::Any ParseTreeVisitor::visitDictionarySettingsClause(ClickHouseParser::DictionarySettingsClauseContext *ctx) +{ + return std::make_shared(visit(ctx->settingExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitLayoutClause(ClickHouseParser::LayoutClauseContext *ctx) +{ + auto list = ctx->dictionaryArgExpr().empty() ? nullptr : std::make_shared(); + for (auto * arg : ctx->dictionaryArgExpr()) list->push(visit(arg)); + return std::make_shared(visit(ctx->identifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitLifetimeClause(ClickHouseParser::LifetimeClauseContext *ctx) +{ + if (ctx->DECIMAL_LITERAL().size() == 1) return std::make_shared(Literal::createNumber(ctx->DECIMAL_LITERAL(0))); + if (ctx->MAX()->getSymbol()->getTokenIndex() < ctx->MIN()->getSymbol()->getTokenIndex()) + return std::make_shared( + Literal::createNumber(ctx->DECIMAL_LITERAL(0)), Literal::createNumber(ctx->DECIMAL_LITERAL(1))); + else + return std::make_shared( + Literal::createNumber(ctx->DECIMAL_LITERAL(1)), Literal::createNumber(ctx->DECIMAL_LITERAL(0))); +} + +antlrcpp::Any ParseTreeVisitor::visitRangeClause(ClickHouseParser::RangeClauseContext *ctx) +{ + if (ctx->MAX()->getSymbol()->getTokenIndex() < ctx->MIN()->getSymbol()->getTokenIndex()) + return std::make_shared(visit(ctx->identifier(0)), visit(ctx->identifier(1))); + else + return std::make_shared(visit(ctx->identifier(1)), visit(ctx->identifier(0))); +} + +antlrcpp::Any ParseTreeVisitor::visitSourceClause(ClickHouseParser::SourceClauseContext *ctx) +{ + auto list = ctx->dictionaryArgExpr().empty() ? nullptr : std::make_shared(); + for (auto * arg : ctx->dictionaryArgExpr()) list->push(visit(arg)); + return std::make_shared(visit(ctx->identifier()), list); +} + +} diff --git a/src/Parsers/New/AST/CreateDictionaryQuery.h b/src/Parsers/New/AST/CreateDictionaryQuery.h new file mode 100644 index 00000000000..3c5be3f391c --- /dev/null +++ b/src/Parsers/New/AST/CreateDictionaryQuery.h @@ -0,0 +1,183 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class DictionaryAttributeExpr : public INode +{ + public: + DictionaryAttributeExpr(PtrTo identifier, PtrTo type); + + void setDefaultClause(PtrTo literal); + void setExpressionClause(PtrTo expr); + + void setHierarchicalFlag() { hierarchical = true; } + void setInjectiveFlag() { injective = true; } + void setIsObjectIdFlag() { is_object_id = true; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + TYPE, // ColumnTypeExpr + DEFAULT, // Literal (optional) + EXPRESSION, // ColumnExpr (optional) + + MAX_INDEX, + }; + + bool hierarchical = false, injective = false, is_object_id = false; +}; + +using DictionaryPrimaryKeyClause = SimpleClause; + +using DictionarySchemaClause = SimpleClause; + +class DictionaryArgExpr : public INode +{ + public: + explicit DictionaryArgExpr(PtrTo identifier, PtrTo expr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + KEY = 0, // Identifier + VALUE, // ColumnExpr: literal, identifier or function + }; +}; + +class SourceClause : public INode +{ + public: + SourceClause(PtrTo identifier, PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + ARGS = 1, // DictionaryArgList (optional) + }; +}; + +class LifetimeClause : public INode +{ + public: + explicit LifetimeClause(PtrTo max, PtrTo min = nullptr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + MAX = 0, // NumberLiteral + MIN, // NumberLiteral (optional) + }; +}; + +class LayoutClause : public INode +{ + public: + LayoutClause(PtrTo identifier, PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + ARGS = 1, // DictionaryArgList (optional) + }; +}; + +class RangeClause : public INode +{ + public: + RangeClause(PtrTo max, PtrTo min); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + MAX = 0, // Identifier + MIN, // Identifier + }; +}; + +class DictionarySettingsClause : public INode +{ + public: + explicit DictionarySettingsClause(PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + LIST = 0, // SettingExprList + }; +}; + +class DictionaryEngineClause : public INode +{ + public: + explicit DictionaryEngineClause(PtrTo clause); + + void setSourceClause(PtrTo clause); + void setLifetimeClause(PtrTo clause); + void setLayoutClause(PtrTo clause); + void setRangeClause(PtrTo clause); + void setSettingsClause(PtrTo clause); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + PRIMARY_KEY = 0, // DictionaryPrimaryKeyClause + SOURCE, // SourceClause (optional) + LIFETIME, // LifetimeClause (optional) + LAYOUT, // LayoutClause (optional) + RANGE, // RangeClause (optional) + SETTINGS, // DictionarySettingsClause (optional) + + MAX_INDEX, + }; +}; + +class CreateDictionaryQuery : public DDLQuery +{ + public: + CreateDictionaryQuery( + PtrTo cluster, + bool attach, + bool if_not_exists, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo engine); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + UUID, // UUIDClause (optional) + SCHEMA, // DictionarySchemaClause + ENGINE, // DictionaryEngineClause + }; + + const bool attach, if_not_exists; +}; + +} diff --git a/src/Parsers/New/AST/CreateLiveViewQuery.cpp b/src/Parsers/New/AST/CreateLiveViewQuery.cpp new file mode 100644 index 00000000000..b3323824924 --- /dev/null +++ b/src/Parsers/New/AST/CreateLiveViewQuery.cpp @@ -0,0 +1,87 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +CreateLiveViewQuery::CreateLiveViewQuery( + PtrTo cluster, + bool attach_, + bool if_not_exists_, + PtrTo identifier, + PtrTo uuid, + PtrTo timeout, + PtrTo destination, + PtrTo schema, + PtrTo query) + : DDLQuery(cluster, {identifier, uuid, timeout, destination, schema, query}), attach(attach_), if_not_exists(if_not_exists_) +{ +} + +ASTPtr CreateLiveViewQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid + = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table_id.uuid; + } + + if (has(TIMEOUT)) + query->live_view_timeout.emplace(get(TIMEOUT)->convertToOld()->as()->value.get()); + + if (has(DESTINATION)) + query->to_table_id = getTableIdentifier(get(DESTINATION)->convertToOld()); + + if (has(SCHEMA)) + { + assert(get(SCHEMA)->getType() == TableSchemaClause::ClauseType::DESCRIPTION); + query->set(query->columns_list, get(SCHEMA)->convertToOld()); + } + + query->attach = attach; + query->if_not_exists = if_not_exists; + query->is_live_view = true; + query->set(query->select, get(SUBQUERY)->convertToOld()); + query->cluster = cluster_name; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCreateLiveViewStmt(ClickHouseParser::CreateLiveViewStmtContext *ctx) +{ + auto uuid = ctx->uuidClause() ? visit(ctx->uuidClause()).as>() : nullptr; + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto timeout = ctx->DECIMAL_LITERAL() ? Literal::createNumber(ctx->DECIMAL_LITERAL()) : nullptr; + auto destination = ctx->destinationClause() ? visit(ctx->destinationClause()).as>() : nullptr; + auto schema = ctx->tableSchemaClause() ? visit(ctx->tableSchemaClause()).as>() : nullptr; + if (ctx->TIMEOUT() && !timeout) timeout = Literal::createNumber(std::to_string(DEFAULT_TEMPORARY_LIVE_VIEW_TIMEOUT_SEC)); + return std::make_shared( + cluster, + !!ctx->ATTACH(), + !!ctx->IF(), + visit(ctx->tableIdentifier()), + uuid, + timeout, + destination, + schema, + visit(ctx->subqueryClause())); +} + +} diff --git a/src/Parsers/New/AST/CreateLiveViewQuery.h b/src/Parsers/New/AST/CreateLiveViewQuery.h new file mode 100644 index 00000000000..dd6fe8a2528 --- /dev/null +++ b/src/Parsers/New/AST/CreateLiveViewQuery.h @@ -0,0 +1,39 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CreateLiveViewQuery : public DDLQuery +{ + public: + CreateLiveViewQuery( + PtrTo cluster, + bool attach, + bool if_not_exists, + PtrTo identifier, + PtrTo uuid, + PtrTo timeout, + PtrTo destination, + PtrTo schema, + PtrTo query); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + UUID, // UUIDClause (optional) + TIMEOUT, // NumberLiteral (optional) + DESTINATION, // DestinationClause (optional) + SCHEMA, // TableSchemaClause (optional) + SUBQUERY, // SelectUnionQuery + }; + + const bool attach, if_not_exists; +}; + +} diff --git a/src/Parsers/New/AST/CreateMaterializedViewQuery.cpp b/src/Parsers/New/AST/CreateMaterializedViewQuery.cpp new file mode 100644 index 00000000000..24107d9dd6c --- /dev/null +++ b/src/Parsers/New/AST/CreateMaterializedViewQuery.cpp @@ -0,0 +1,100 @@ +#include + +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ +CreateMaterializedViewQuery::CreateMaterializedViewQuery( + PtrTo cluster, + bool attach_, + bool if_not_exists_, + bool populate_, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo destination, + PtrTo engine, + PtrTo query) + : DDLQuery(cluster, {identifier, uuid, schema, destination, engine, query}) + , attach(attach_) + , if_not_exists(if_not_exists_) + , populate(populate_) +{ + assert(!destination != !engine); +} + +ASTPtr CreateMaterializedViewQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid + = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table_id.uuid; + } + + if (has(DESTINATION)) + query->to_table_id = getTableIdentifier(get(DESTINATION)->convertToOld()); + else if (has(ENGINE)) + { + query->set(query->storage, get(ENGINE)->convertToOld()); + query->is_populate = populate; + } + + if (has(SCHEMA)) + { + assert(get(SCHEMA)->getType() == TableSchemaClause::ClauseType::DESCRIPTION); + query->set(query->columns_list, get(SCHEMA)->convertToOld()); + } + + query->attach = attach; + query->if_not_exists = if_not_exists; + query->is_materialized_view = true; + query->set(query->select, get(SUBQUERY)->convertToOld()); + query->cluster = cluster_name; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCreateMaterializedViewStmt(ClickHouseParser::CreateMaterializedViewStmtContext *ctx) +{ + auto uuid = ctx->uuidClause() ? visit(ctx->uuidClause()).as>() : nullptr; + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto schema = ctx->tableSchemaClause() ? visit(ctx->tableSchemaClause()).as>() : nullptr; + auto engine = ctx->engineClause() ? visit(ctx->engineClause()).as>() : nullptr; + auto destination = ctx->destinationClause() ? visit(ctx->destinationClause()).as>() : nullptr; + return std::make_shared( + cluster, + !!ctx->ATTACH(), + !!ctx->IF(), + !!ctx->POPULATE(), + visit(ctx->tableIdentifier()), + uuid, + schema, + destination, + engine, + visit(ctx->subqueryClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitDestinationClause(ClickHouseParser::DestinationClauseContext *ctx) +{ + return std::make_shared(visit(ctx->tableIdentifier()).as>()); +} + +} diff --git a/src/Parsers/New/AST/CreateMaterializedViewQuery.h b/src/Parsers/New/AST/CreateMaterializedViewQuery.h new file mode 100644 index 00000000000..6cd45132371 --- /dev/null +++ b/src/Parsers/New/AST/CreateMaterializedViewQuery.h @@ -0,0 +1,40 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CreateMaterializedViewQuery : public DDLQuery +{ + public: + CreateMaterializedViewQuery( + PtrTo cluster, + bool attach, + bool if_not_exists, + bool populate, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo destination, + PtrTo engine, + PtrTo query); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + UUID, // UUIDClause (optional) + SCHEMA, // TableSchemaClause (optional) + DESTINATION, // DestinationClause (optional) + ENGINE, // EngineClause (optional) + SUBQUERY, // SelectUnionQuery + }; + + const bool attach, if_not_exists, populate; +}; + +} diff --git a/src/Parsers/New/AST/CreateTableQuery.cpp b/src/Parsers/New/AST/CreateTableQuery.cpp new file mode 100644 index 00000000000..77b43f525ec --- /dev/null +++ b/src/Parsers/New/AST/CreateTableQuery.cpp @@ -0,0 +1,219 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo TableSchemaClause::createDescription(PtrTo list) +{ + return PtrTo(new TableSchemaClause(ClauseType::DESCRIPTION, {list})); +} + +// static +PtrTo TableSchemaClause::createAsTable(PtrTo identifier) +{ + return PtrTo(new TableSchemaClause(ClauseType::TABLE, {identifier})); +} + +// static +PtrTo TableSchemaClause::createAsFunction(PtrTo expr) +{ + return PtrTo(new TableSchemaClause(ClauseType::FUNCTION, {expr})); +} + +TableSchemaClause::TableSchemaClause(ClauseType type, PtrList exprs) : INode(exprs), clause_type(type) +{ +} + +ASTPtr TableSchemaClause::convertToOld() const +{ + switch(clause_type) + { + case ClauseType::DESCRIPTION: + { + auto columns = std::make_shared(); + + auto column_list = std::make_shared(); + auto constraint_list = std::make_shared(); + auto index_list = std::make_shared(); + + for (const auto & element : get(ELEMENTS)->as()) + { + switch(element->as()->getType()) + { + case TableElementExpr::ExprType::COLUMN: + column_list->children.push_back(element->convertToOld()); + break; + case TableElementExpr::ExprType::CONSTRAINT: + constraint_list->children.push_back(element->convertToOld()); + break; + case TableElementExpr::ExprType::INDEX: + index_list->children.push_back(element->convertToOld()); + break; + } + } + + if (!column_list->children.empty()) columns->set(columns->columns, column_list); + if (!constraint_list->children.empty()) columns->set(columns->constraints, constraint_list); + if (!index_list->children.empty()) columns->set(columns->indices, index_list); + + return columns; + } + case ClauseType::FUNCTION: + case ClauseType::TABLE: + return get(EXPR)->convertToOld(); + } + __builtin_unreachable(); // FIXME: old gcc compilers complain about reaching end of non-void function +} + +String TableSchemaClause::dumpInfo() const +{ + switch(clause_type) + { + case ClauseType::DESCRIPTION: return "Description"; + case ClauseType::FUNCTION: return "Function"; + case ClauseType::TABLE: return "Table"; + } + __builtin_unreachable(); // FIXME: old gcc compilers complain about reaching end of non-void function +} + +CreateTableQuery::CreateTableQuery( + PtrTo cluster, + bool attach_, + bool temporary_, + bool if_not_exists_, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo engine, + PtrTo query) + : DDLQuery(cluster, {identifier, uuid, schema, engine, query}), attach(attach_), temporary(temporary_), if_not_exists(if_not_exists_) +{ +} + +ASTPtr CreateTableQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid + = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table_id.uuid; + } + + query->cluster = cluster_name; + + query->attach = attach; + query->if_not_exists = if_not_exists; + query->temporary = temporary; + + if (has(SCHEMA)) + { + switch(get(SCHEMA)->getType()) + { + case TableSchemaClause::ClauseType::DESCRIPTION: + { + query->set(query->columns_list, get(SCHEMA)->convertToOld()); + break; + } + case TableSchemaClause::ClauseType::TABLE: + { + auto table_id = getTableIdentifier(get(SCHEMA)->convertToOld()); + query->as_database = table_id.database_name; + query->as_table = table_id.table_name; + break; + } + case TableSchemaClause::ClauseType::FUNCTION: + { + query->as_table_function = get(SCHEMA)->convertToOld(); + break; + } + } + } + if (has(ENGINE)) query->set(query->storage, get(ENGINE)->convertToOld()); + if (has(SUBQUERY)) query->set(query->select, get(SUBQUERY)->convertToOld()); + + return query; +} + +String CreateTableQuery::dumpInfo() const +{ + String info; + if (attach) info += "attach=true, "; + else info += "attach=false, "; + if (temporary) info += "temporary=true, "; + else info += "temporary=false, "; + if (if_not_exists) info += "if_not_exists=true"; + else info += "if_not_exists=false"; + return info; +} + +} + +namespace DB +{ + +using namespace AST; + +// TODO: assert(!(ctx->parent->TEMPORARY() ^ ctx->engineClause())) + +antlrcpp::Any ParseTreeVisitor::visitClusterClause(ClickHouseParser::ClusterClauseContext *ctx) +{ + auto literal = ctx->STRING_LITERAL() ? Literal::createString(ctx->STRING_LITERAL()) + : Literal::createString(ctx->identifier()->getText()); + return std::make_shared(literal); +} + +antlrcpp::Any ParseTreeVisitor::visitCreateTableStmt(ClickHouseParser::CreateTableStmtContext *ctx) +{ + auto uuid = ctx->uuidClause() ? visit(ctx->uuidClause()).as>() : nullptr; + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto schema = ctx->tableSchemaClause() ? visit(ctx->tableSchemaClause()).as>() : nullptr; + auto engine = ctx->engineClause() ? visit(ctx->engineClause()).as>() : nullptr; + auto query = ctx->subqueryClause() ? visit(ctx->subqueryClause()).as>() : nullptr; + return std::make_shared( + cluster, !!ctx->ATTACH(), !!ctx->TEMPORARY(), !!ctx->IF(), visit(ctx->tableIdentifier()), uuid, schema, engine, query); +} + +antlrcpp::Any ParseTreeVisitor::visitSchemaDescriptionClause(ClickHouseParser::SchemaDescriptionClauseContext *ctx) +{ + auto elems = std::make_shared(); + for (auto * elem : ctx->tableElementExpr()) elems->push(visit(elem)); + return TableSchemaClause::createDescription(elems); +} + +antlrcpp::Any ParseTreeVisitor::visitSchemaAsTableClause(ClickHouseParser::SchemaAsTableClauseContext *ctx) +{ + return TableSchemaClause::createAsTable(visit(ctx->tableIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitSchemaAsFunctionClause(ClickHouseParser::SchemaAsFunctionClauseContext *ctx) +{ + return TableSchemaClause::createAsFunction(visit(ctx->tableFunctionExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitSubqueryClause(ClickHouseParser::SubqueryClauseContext *ctx) +{ + return visit(ctx->selectUnionStmt()); +} + +antlrcpp::Any ParseTreeVisitor::visitUuidClause(ClickHouseParser::UuidClauseContext *ctx) +{ + return std::make_shared(Literal::createString(ctx->STRING_LITERAL())); +} + +} diff --git a/src/Parsers/New/AST/CreateTableQuery.h b/src/Parsers/New/AST/CreateTableQuery.h new file mode 100644 index 00000000000..4fe19832b1d --- /dev/null +++ b/src/Parsers/New/AST/CreateTableQuery.h @@ -0,0 +1,76 @@ +#pragma once + +#include +#include "Parsers/New/AST/SelectUnionQuery.h" + + +namespace DB::AST +{ + +class TableSchemaClause : public INode +{ + public: + static PtrTo createDescription(PtrTo list); + static PtrTo createAsTable(PtrTo identifier); + static PtrTo createAsFunction(PtrTo expr); + + enum class ClauseType + { + DESCRIPTION, + TABLE, + FUNCTION, + }; + + auto getType() const { return clause_type; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + // DESCRIPTION + ELEMENTS = 0, // TableElementList + + // TABLE and FUNCTION + EXPR = 0, // TableIdentifier or TableFunctionExpr + }; + + ClauseType clause_type; + + TableSchemaClause(ClauseType type, PtrList exprs); + + String dumpInfo() const override; +}; + +class CreateTableQuery : public DDLQuery +{ + public: + CreateTableQuery( + PtrTo cluster, + bool attach, + bool temporary, + bool if_not_exists, + PtrTo identifier, + PtrTo uuid, + PtrTo schema, + PtrTo engine, + PtrTo query); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + UUID, // UUIDClause (optional) + SCHEMA, // TableSchemaClause + ENGINE, // EngineClause + SUBQUERY, // SelectUnionQuery + }; + + const bool attach, temporary, if_not_exists; + + String dumpInfo() const override; +}; + +} diff --git a/src/Parsers/New/AST/CreateViewQuery.cpp b/src/Parsers/New/AST/CreateViewQuery.cpp new file mode 100644 index 00000000000..df68687eb13 --- /dev/null +++ b/src/Parsers/New/AST/CreateViewQuery.cpp @@ -0,0 +1,62 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ +CreateViewQuery::CreateViewQuery( + PtrTo cluster, + bool attach_, + bool replace_, + bool if_not_exists_, + PtrTo identifier, + PtrTo clause, + PtrTo query) + : DDLQuery(cluster, {identifier, clause, query}), attach(attach_), replace(replace_), if_not_exists(if_not_exists_) +{ +} + +ASTPtr CreateViewQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(NAME)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + } + + query->attach = attach; + query->replace_view = replace; + query->if_not_exists = if_not_exists; + query->is_view = true; + query->cluster = cluster_name; + + if (has(SCHEMA)) query->set(query->columns_list, get(SCHEMA)->convertToOld()); + query->set(query->select, get(SUBQUERY)->convertToOld()); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCreateViewStmt(ClickHouseParser::CreateViewStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto schema = ctx->tableSchemaClause() ? visit(ctx->tableSchemaClause()).as>() : nullptr; + return std::make_shared( + cluster, !!ctx->ATTACH(), !!ctx->REPLACE(), !!ctx->IF(), visit(ctx->tableIdentifier()), schema, visit(ctx->subqueryClause())); +} + +} diff --git a/src/Parsers/New/AST/CreateViewQuery.h b/src/Parsers/New/AST/CreateViewQuery.h new file mode 100644 index 00000000000..41567c30cdc --- /dev/null +++ b/src/Parsers/New/AST/CreateViewQuery.h @@ -0,0 +1,34 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CreateViewQuery : public DDLQuery +{ + public: + CreateViewQuery( + PtrTo cluster, + bool attach, + bool replace, + bool if_not_exists, + PtrTo identifier, + PtrTo clause, + PtrTo query); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + SCHEMA = 1, // TableSchemaClause (optional) + SUBQUERY = 2, // SelectUnionQuery + }; + + const bool attach, replace, if_not_exists; +}; + +} diff --git a/src/Parsers/New/AST/DDLQuery.cpp b/src/Parsers/New/AST/DDLQuery.cpp new file mode 100644 index 00000000000..0cd06e27abe --- /dev/null +++ b/src/Parsers/New/AST/DDLQuery.cpp @@ -0,0 +1,6 @@ +#include + + +namespace DB::AST +{ +} diff --git a/src/Parsers/New/AST/DDLQuery.h b/src/Parsers/New/AST/DDLQuery.h new file mode 100644 index 00000000000..6aba46d29e3 --- /dev/null +++ b/src/Parsers/New/AST/DDLQuery.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include +#include +#include + + +namespace DB::AST +{ + +class DDLQuery : public Query +{ + protected: + DDLQuery(PtrTo cluster, std::initializer_list list) + : Query(list), cluster_name(cluster ? cluster->convertToOld()->as()->value.get() : String{}) + { + } + + DDLQuery(PtrTo cluster, PtrList list) + : Query(list), cluster_name(cluster ? cluster->convertToOld()->as()->value.get() : String{}) + { + } + + const String cluster_name; +}; + +} diff --git a/src/Parsers/New/AST/DescribeQuery.cpp b/src/Parsers/New/AST/DescribeQuery.cpp new file mode 100644 index 00000000000..b924b1b270b --- /dev/null +++ b/src/Parsers/New/AST/DescribeQuery.cpp @@ -0,0 +1,36 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +DescribeQuery::DescribeQuery(PtrTo expr) : Query{expr} +{ +} + +ASTPtr DescribeQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->table_expression = get(EXPR)->convertToOld(); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitDescribeStmt(ClickHouseParser::DescribeStmtContext *ctx) +{ + return std::make_shared(visit(ctx->tableExpr()).as>()); +} + +} diff --git a/src/Parsers/New/AST/DescribeQuery.h b/src/Parsers/New/AST/DescribeQuery.h new file mode 100644 index 00000000000..e7323476a43 --- /dev/null +++ b/src/Parsers/New/AST/DescribeQuery.h @@ -0,0 +1,27 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +// TODO: rewrite to +// `SELECT name, type, default_type, default_expression, comment, codec_expression, ttl_expression FROM system.columns +// WHERE database=db AND table=table` + +class DescribeQuery : public Query +{ + public: + explicit DescribeQuery(PtrTo expr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, + }; +}; + +} diff --git a/src/Parsers/New/AST/DropQuery.cpp b/src/Parsers/New/AST/DropQuery.cpp new file mode 100644 index 00000000000..dc9657b3e8b --- /dev/null +++ b/src/Parsers/New/AST/DropQuery.cpp @@ -0,0 +1,106 @@ +#include + +#include + +#include + +#include + + +namespace DB::AST +{ + +// static +PtrTo +DropQuery::createDropDatabase(bool detach, bool if_exists, PtrTo identifier, PtrTo cluster) +{ + auto query = PtrTo(new DropQuery(cluster, QueryType::DATABASE, {identifier})); + query->detach = detach; + query->if_exists = if_exists; + return query; +} + +// static +PtrTo +DropQuery::createDropDictionary(bool detach, bool if_exists, PtrTo identifier, PtrTo cluster) +{ + auto query = PtrTo(new DropQuery(cluster, QueryType::DICTIONARY, {identifier})); + query->detach = detach; + query->if_exists = if_exists; + return query; +} + +// static +PtrTo +DropQuery::createDropTable(bool detach, bool if_exists, bool temporary, PtrTo identifier, PtrTo cluster) +{ + auto query = PtrTo(new DropQuery(cluster, QueryType::TABLE, {identifier})); + query->detach = detach; + query->if_exists = if_exists; + query->temporary = temporary; + return query; +} + +DropQuery::DropQuery(PtrTo cluster, QueryType type, PtrList exprs) : DDLQuery(cluster, exprs), query_type(type) +{ +} + +ASTPtr DropQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->kind = detach ? ASTDropQuery::Detach : ASTDropQuery::Drop; + query->if_exists = if_exists; + query->temporary = temporary; + query->cluster = cluster_name; + + // TODO: refactor |ASTQueryWithTableAndOutput| to accept |ASTIdentifier| + switch(query_type) + { + case QueryType::DATABASE: + query->database = get(NAME)->getName(); + break; + case QueryType::DICTIONARY: + query->is_dictionary = true; + query->table = get(NAME)->getName(); + if (auto database = get(NAME)->getDatabase()) + query->database = database->getName(); + break; + case QueryType::TABLE: + { + query->table = get(NAME)->getName(); + if (auto database = get(NAME)->getDatabase()) + query->database = database->getName(); + break; + } + } + + convertToOldPartially(query); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitDropDatabaseStmt(ClickHouseParser::DropDatabaseStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + return DropQuery::createDropDatabase(!!ctx->DETACH(), !!ctx->EXISTS(), visit(ctx->databaseIdentifier()), cluster); +} + +antlrcpp::Any ParseTreeVisitor::visitDropTableStmt(ClickHouseParser::DropTableStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + if (ctx->TABLE()) + return DropQuery::createDropTable(!!ctx->DETACH(), !!ctx->EXISTS(), !!ctx->TEMPORARY(), visit(ctx->tableIdentifier()), cluster); + if (ctx->DICTIONARY()) + return DropQuery::createDropDictionary(!!ctx->DETACH(), !!ctx->EXISTS(), visit(ctx->tableIdentifier()), cluster); + __builtin_unreachable(); +} + +} diff --git a/src/Parsers/New/AST/DropQuery.h b/src/Parsers/New/AST/DropQuery.h new file mode 100644 index 00000000000..2aff85779eb --- /dev/null +++ b/src/Parsers/New/AST/DropQuery.h @@ -0,0 +1,43 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class DropQuery : public DDLQuery +{ + public: + static PtrTo + createDropDatabase(bool detach, bool if_exists, PtrTo identifier, PtrTo cluster); + static PtrTo + createDropTable(bool detach, bool if_exists, bool temporary, PtrTo identifier, PtrTo cluster); + static PtrTo + createDropDictionary(bool detach, bool if_exists, PtrTo identifier, PtrTo cluster); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, + }; + + enum class QueryType + { + DATABASE, + DICTIONARY, + TABLE, + }; + + const QueryType query_type; + + bool detach = false; + bool if_exists = false; + bool temporary = false; + + DropQuery(PtrTo cluster, QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/EngineExpr.cpp b/src/Parsers/New/AST/EngineExpr.cpp new file mode 100644 index 00000000000..7127882c49d --- /dev/null +++ b/src/Parsers/New/AST/EngineExpr.cpp @@ -0,0 +1,199 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::ErrorCodes +{ + extern const int UNEXPECTED_AST_STRUCTURE; +} + +namespace DB::AST +{ + +EngineClause::EngineClause(PtrTo expr) : INode(MAX_INDEX) +{ + set(ENGINE, expr); +} + +void EngineClause::setOrderByClause(PtrTo clause) +{ + set(ORDER_BY, clause); +} + +void EngineClause::setPartitionByClause(PtrTo clause) +{ + set(PARTITION_BY, clause); +} + +void EngineClause::setPrimaryKeyClause(PtrTo clause) +{ + set(PRIMARY_KEY, clause); +} + +void EngineClause::setSampleByClause(PtrTo clause) +{ + set(SAMPLE_BY, clause); +} + +void EngineClause::setTTLClause(PtrTo clause) +{ + set(TTL, clause); +} + +void EngineClause::setSettingsClause(PtrTo clause) +{ + set(SETTINGS, clause); +} + +ASTPtr EngineClause::convertToOld() const +{ + auto storage = std::make_shared(); + + storage->set(storage->engine, get(ENGINE)->convertToOld()); + if (has(PARTITION_BY)) storage->set(storage->partition_by, get(PARTITION_BY)->convertToOld()); + if (has(PRIMARY_KEY)) storage->set(storage->primary_key, get(PRIMARY_KEY)->convertToOld()); + if (has(ORDER_BY)) + { + /// XXX: old parser used very strange grammar for this case, instead of using OrderByElement's. + auto expr_list = get(ORDER_BY)->convertToOld(); + if (expr_list->children.size() > 1) + throw DB::Exception(ErrorCodes::UNEXPECTED_AST_STRUCTURE, "Cannot convert multiple ORDER expression to old AST"); + storage->set(storage->order_by, expr_list->children[0]->children[0]); + } + if (has(SAMPLE_BY)) storage->set(storage->sample_by, get(SAMPLE_BY)->convertToOld()); + if (has(TTL)) storage->set(storage->ttl_table, get(TTL)->convertToOld()); + if (has(SETTINGS)) + { + storage->set(storage->settings, get(SETTINGS)->convertToOld()); + storage->settings->is_standalone = false; + } + + return storage; +} + +EngineExpr::EngineExpr(PtrTo identifier, PtrTo args) : INode{identifier, args} +{ +} + +ASTPtr EngineExpr::convertToOld() const +{ + auto expr = std::make_shared(); + + expr->name = get(NAME)->getName(); + expr->no_empty_args = true; + if (has(ARGS)) + { + expr->arguments = get(ARGS)->convertToOld(); + expr->children.push_back(expr->arguments); + } + + return expr; +} + +TTLExpr::TTLExpr(PtrTo expr, TTLType type, PtrTo literal) : INode{expr, literal}, ttl_type(type) +{ +} + +ASTPtr TTLExpr::convertToOld() const +{ + TTLMode mode = TTLMode::DELETE; + DataDestinationType destination_type = DataDestinationType::DELETE; + String destination_name; + + switch(ttl_type) + { + case TTLType::DELETE: + mode = TTLMode::DELETE; + destination_type = DataDestinationType::DELETE; + break; + case TTLType::TO_DISK: + mode = TTLMode::MOVE; + destination_type = DataDestinationType::DISK; + destination_name = get(TYPE)->convertToOld()->as()->value.get(); + break; + case TTLType::TO_VOLUME: + mode = TTLMode::MOVE; + destination_type = DataDestinationType::VOLUME; + destination_name = get(TYPE)->convertToOld()->as()->value.get(); + break; + } + + auto expr = std::make_shared(mode, destination_type, destination_name); + expr->setTTL(get(EXPR)->convertToOld()); + return expr; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitEngineClause(ClickHouseParser::EngineClauseContext *ctx) +{ + auto clause = std::make_shared(visit(ctx->engineExpr()).as>()); + + if (!ctx->orderByClause().empty()) clause->setOrderByClause(visit(ctx->orderByClause(0))); + if (!ctx->partitionByClause().empty()) clause->setPartitionByClause(visit(ctx->partitionByClause(0))); + if (!ctx->primaryKeyClause().empty()) clause->setPrimaryKeyClause(visit(ctx->primaryKeyClause(0))); + if (!ctx->sampleByClause().empty()) clause->setSampleByClause(visit(ctx->sampleByClause(0))); + if (!ctx->ttlClause().empty()) clause->setTTLClause(visit(ctx->ttlClause(0))); + if (!ctx->settingsClause().empty()) clause->setSettingsClause(visit(ctx->settingsClause(0))); + + return clause; +} + +antlrcpp::Any ParseTreeVisitor::visitEngineExpr(ClickHouseParser::EngineExprContext *ctx) +{ + auto list = ctx->columnExprList() ? visit(ctx->columnExprList()).as>() : nullptr; + return std::make_shared(visit(ctx->identifierOrNull()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitPartitionByClause(ClickHouseParser::PartitionByClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitPrimaryKeyClause(ClickHouseParser::PrimaryKeyClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitSampleByClause(ClickHouseParser::SampleByClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitTtlClause(ClickHouseParser::TtlClauseContext *ctx) +{ + auto list = std::make_shared(); + for (auto * expr : ctx->ttlExpr()) list->push(visit(expr)); + return std::make_shared(list); +} + +antlrcpp::Any ParseTreeVisitor::visitTtlExpr(ClickHouseParser::TtlExprContext *ctx) +{ + TTLExpr::TTLType type; + PtrTo literal; + + if (ctx->DISK()) type = TTLExpr::TTLType::TO_DISK; + else if (ctx->VOLUME()) type = TTLExpr::TTLType::TO_VOLUME; + else type = TTLExpr::TTLType::DELETE; + + if (ctx->STRING_LITERAL()) literal = Literal::createString(ctx->STRING_LITERAL()); + + return std::make_shared(visit(ctx->columnExpr()), type, literal); +} + +} diff --git a/src/Parsers/New/AST/EngineExpr.h b/src/Parsers/New/AST/EngineExpr.h new file mode 100644 index 00000000000..809b398d834 --- /dev/null +++ b/src/Parsers/New/AST/EngineExpr.h @@ -0,0 +1,85 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +// Clauses + +using PartitionByClause = SimpleClause; + +using SampleByClause = SimpleClause; + +class EngineClause : public INode +{ + public: + explicit EngineClause(PtrTo expr); + + void setOrderByClause(PtrTo clause); + void setPartitionByClause(PtrTo clause); + void setPrimaryKeyClause(PtrTo clause); + void setSampleByClause(PtrTo clause); + void setTTLClause(PtrTo clause); + void setSettingsClause(PtrTo clause); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + ENGINE = 0, // EngineExpr + ORDER_BY, // OrderByClause (optional) + PARTITION_BY, // PartitionByClause (optional) + PRIMARY_KEY, // PrimaryKeyClause (optional) + SAMPLE_BY, // SampleByClause (optional) + TTL, // TTLClause (optional) + SETTINGS, // SettingsClause (optional) + + MAX_INDEX, + }; +}; + +// Expressions + +class EngineExpr : public INode +{ + public: + EngineExpr(PtrTo identifier, PtrTo args); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + ARGS, // ColumnExprList (optional) + }; +}; + +class TTLExpr : public INode +{ + public: + enum class TTLType + { + DELETE, + TO_DISK, + TO_VOLUME, + }; + + TTLExpr(PtrTo expr, TTLType type, PtrTo literal); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // ColumnExpr + TYPE = 1, // StringLiteral (optional) + }; + + TTLType ttl_type; +}; + +} diff --git a/src/Parsers/New/AST/ExistsQuery.cpp b/src/Parsers/New/AST/ExistsQuery.cpp new file mode 100644 index 00000000000..0a91ea01d36 --- /dev/null +++ b/src/Parsers/New/AST/ExistsQuery.cpp @@ -0,0 +1,55 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +ExistsQuery::ExistsQuery(QueryType type, bool temporary_, PtrTo identifier) + : Query{identifier}, query_type(type), temporary(temporary_) +{ +} + +ASTPtr ExistsQuery::convertToOld() const +{ + std::shared_ptr query; + + switch(query_type) + { + case QueryType::DICTIONARY: + query = std::make_shared(); + break; + case QueryType::TABLE: + query = std::make_shared(); + query->temporary = temporary; + break; + } + + // FIXME: this won't work if table doesn't exist + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitExistsStmt(ClickHouseParser::ExistsStmtContext *ctx) +{ + auto type = ctx->TABLE() ? ExistsQuery::QueryType::TABLE : ExistsQuery::QueryType::DICTIONARY; + return std::make_shared(type, !!ctx->TEMPORARY(), visit(ctx->tableIdentifier())); +} + +} diff --git a/src/Parsers/New/AST/ExistsQuery.h b/src/Parsers/New/AST/ExistsQuery.h new file mode 100644 index 00000000000..47a93d2b82c --- /dev/null +++ b/src/Parsers/New/AST/ExistsQuery.h @@ -0,0 +1,32 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class ExistsQuery : public Query +{ + public: + enum class QueryType + { + DICTIONARY, + TABLE, + }; + + ExistsQuery(QueryType type, bool temporary, PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, // TableIdentifier + }; + + const QueryType query_type; + const bool temporary; +}; + +} diff --git a/src/Parsers/New/AST/ExplainQuery.cpp b/src/Parsers/New/AST/ExplainQuery.cpp new file mode 100644 index 00000000000..154a401dde0 --- /dev/null +++ b/src/Parsers/New/AST/ExplainQuery.cpp @@ -0,0 +1,35 @@ +#include + +#include +#include + + +namespace DB::AST +{ + +ExplainQuery::ExplainQuery(PtrTo query) : Query{query} +{ +} + +ASTPtr ExplainQuery::convertToOld() const +{ + auto query = std::make_shared(ASTExplainQuery::AnalyzedSyntax); + + query->setExplainedQuery(get(QUERY)->convertToOld()); + + return query; +} + +} + +namespace DB +{ + +using namespace DB::AST; + +antlrcpp::Any ParseTreeVisitor::visitExplainStmt(ClickHouseParser::ExplainStmtContext *ctx) +{ + return std::make_shared(visit(ctx->query()).as>()); +} + +} diff --git a/src/Parsers/New/AST/ExplainQuery.h b/src/Parsers/New/AST/ExplainQuery.h new file mode 100644 index 00000000000..6d6b42cca2d --- /dev/null +++ b/src/Parsers/New/AST/ExplainQuery.h @@ -0,0 +1,23 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class ExplainQuery : public Query +{ + public: + explicit ExplainQuery(PtrTo query); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + QUERY = 0, // Query + }; +}; + +} diff --git a/src/Parsers/New/AST/INode.h b/src/Parsers/New/AST/INode.h new file mode 100644 index 00000000000..68ad774e218 --- /dev/null +++ b/src/Parsers/New/AST/INode.h @@ -0,0 +1,103 @@ +#pragma once + +#include + +#include +#include +#include + +#include +#include + + +namespace DB::AST +{ + +class INode : public TypePromotion +{ + public: + virtual ~INode() = default; + + virtual ASTPtr convertToOld() const { return ASTPtr(); } + virtual String toString() const { return {}; } + + void dump() const { dump(0); } + + protected: + INode() = default; + INode(std::initializer_list list) { children = list; } + explicit INode(PtrList list) { children = list; } + explicit INode(size_t size) { children.resize(size); } + + void push(const Ptr& child) { children.push_back(child); } + void set(size_t i, const Ptr& child) { children[i] = child; } + bool has(size_t i) const { return i < children.size() && children[i]; } + const Ptr & get(size_t i) const { return children[i]; } + + template + bool has(size_t i) const { return has(i) && children[i]->as(); } + + template + ChildType * get(size_t i) const { return children[i]->template as(); } + + auto begin() const { return children.cbegin(); } + auto end() const { return children.cend(); } + auto size() const { return children.size(); } + + private: + PtrList children; // any child potentially may point to |nullptr| + + void dump(int indentation) const + { + for (auto i = 0; i < indentation; ++i) std::cout << " "; + std::cout << "⭸ " << demangle(typeid(*this).name()) << " (" << dumpInfo() << ")" << std::endl; + for (const auto & child : children) if (child) child->dump(indentation + 1); + } + + virtual String dumpInfo() const { return ""; } +}; + +template +class List : public INode { + public: + List() = default; + List(std::initializer_list> list) + { + for (const auto & i : list) push(i); + } + + using INode::begin; + using INode::end; + using INode::size; + + void push(const PtrTo & node) { INode::push(node); } + + ASTPtr convertToOld() const override + { + auto list = std::make_shared(Separator); + for (const auto & child : *this) list->children.emplace_back(child->convertToOld()); + return list; + } + + String toString() const override + { + if (!size()) return {}; + + auto string = (*begin())->toString(); + + for (auto next = ++begin(); next != end(); ++next) + string += String(1, Separator) + " " + (*next)->toString(); + + return string; + } +}; + +template +class SimpleClause : public INode +{ + public: + explicit SimpleClause(PtrTo expr) : INode{expr} {} + ASTPtr convertToOld() const override { return get(0)->convertToOld(); } +}; + +} diff --git a/src/Parsers/New/AST/Identifier.cpp b/src/Parsers/New/AST/Identifier.cpp new file mode 100644 index 00000000000..a5c41bf9876 --- /dev/null +++ b/src/Parsers/New/AST/Identifier.cpp @@ -0,0 +1,175 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +Identifier::Identifier(const String & name_) : name(name_) +{ + if (name.front() == '`' || name.front() == '"') + { + String s; + ReadBufferFromMemory in(name.data(), name.size()); + + if (name.front() == '`') + readBackQuotedStringWithSQLStyle(s, in); + else + readDoubleQuotedStringWithSQLStyle(s, in); + + assert(in.count() == name.size()); + name = s; + } +} + +Identifier::Identifier(const String & name_, const String & nested_name) : name(name_ + "." + nested_name) +{ +} + +ASTPtr Identifier::convertToOld() const +{ + return std::make_shared(getQualifiedName()); +} + +String Identifier::toString() const +{ + return getQualifiedName(); +} + +DatabaseIdentifier::DatabaseIdentifier(PtrTo name) : Identifier(*name) +{ +} + +TableIdentifier::TableIdentifier(PtrTo database, PtrTo name) : Identifier(*name), db(database) +{ +} + +void TableIdentifier::makeCompound() const +{ + if (db) + { + name = db->getName(); + db.reset(); + } +} + +ASTPtr TableIdentifier::convertToOld() const +{ + std::vector parts; + + if (db && !db->getName().empty()) parts.push_back(db->getName()); + parts.push_back(getName()); + + return std::make_shared(std::move(parts)); +} + +ColumnIdentifier::ColumnIdentifier(PtrTo table_, PtrTo name) : Identifier(name->getName()), table(table_) +{ +} + +void ColumnIdentifier::makeCompound() const +{ + if (table) + { + name = table->getName() + "." + getName(); + if (table->getDatabase()) table->makeCompound(); + else table.reset(); + } +} + +ASTPtr ColumnIdentifier::convertToOld() const +{ + std::vector parts; + + if (table) + { + if (table->getDatabase()) parts.push_back(table->getDatabase()->getName()); + parts.push_back(table->getName()); + } + parts.push_back(getName()); + + return std::make_shared(std::move(parts)); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitAlias(ClickHouseParser::AliasContext *ctx) +{ + if (ctx->IDENTIFIER()) return std::make_shared(ctx->IDENTIFIER()->getText()); + if (ctx->keywordForAlias()) return std::make_shared(ctx->keywordForAlias()->getText()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitColumnIdentifier(ClickHouseParser::ColumnIdentifierContext *ctx) +{ + auto table = ctx->tableIdentifier() ? visit(ctx->tableIdentifier()).as>() : nullptr; + return std::make_shared(table, visit(ctx->nestedIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitDatabaseIdentifier(ClickHouseParser::DatabaseIdentifierContext *ctx) +{ + return std::make_shared(visit(ctx->identifier()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitIdentifier(ClickHouseParser::IdentifierContext *ctx) +{ + if (ctx->IDENTIFIER()) return std::make_shared(ctx->IDENTIFIER()->getText()); + if (ctx->interval()) return std::make_shared(ctx->interval()->getText()); + if (ctx->keyword()) return std::make_shared(ctx->keyword()->getText()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitIdentifierOrNull(ClickHouseParser::IdentifierOrNullContext *ctx) +{ + if (ctx->identifier()) return visit(ctx->identifier()); + if (ctx->NULL_SQL()) + { + if (ctx->NULL_SQL()->getSymbol()->getText() == "Null") return std::make_shared("Null"); + else { + // TODO: raise error + } + } + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitInterval(ClickHouseParser::IntervalContext *) +{ + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitKeyword(ClickHouseParser::KeywordContext *) +{ + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitKeywordForAlias(ClickHouseParser::KeywordForAliasContext *) +{ + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitNestedIdentifier(ClickHouseParser::NestedIdentifierContext *ctx) +{ + if (ctx->identifier().size() == 2) + { + auto name1 = visit(ctx->identifier(0)).as>()->getName(); + auto name2 = visit(ctx->identifier(1)).as>()->getName(); + return std::make_shared(name1, name2); + } + else return visit(ctx->identifier(0)); +} + +antlrcpp::Any ParseTreeVisitor::visitTableIdentifier(ClickHouseParser::TableIdentifierContext *ctx) +{ + auto database = ctx->databaseIdentifier() ? visit(ctx->databaseIdentifier()).as>() : nullptr; + return std::make_shared(database, visit(ctx->identifier())); +} + +} diff --git a/src/Parsers/New/AST/Identifier.h b/src/Parsers/New/AST/Identifier.h new file mode 100644 index 00000000000..3d3688c30ef --- /dev/null +++ b/src/Parsers/New/AST/Identifier.h @@ -0,0 +1,66 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class Identifier : public INode +{ + public: + explicit Identifier(const String & name_); + Identifier(const String & name_, const String & nested_name); + + const auto & getName() const { return name; } + + ASTPtr convertToOld() const override; + String toString() const override; + + virtual String getQualifiedName() const { return name; }; + + protected: + mutable String name; // protected and non-const because identifiers may become `column.nested` from `table.column` + + String dumpInfo() const override { return getQualifiedName(); } +}; + +class DatabaseIdentifier : public Identifier +{ + public: + explicit DatabaseIdentifier(PtrTo name); +}; + +class TableIdentifier : public Identifier +{ + public: + TableIdentifier(PtrTo database, PtrTo name); + + auto getDatabase() const { return db; } + void makeCompound() const; + + String getQualifiedName() const override { return (db ? db->getQualifiedName() + "." : String()) + getName(); } + + ASTPtr convertToOld() const override; + + private: + mutable PtrTo db; +}; + +class ColumnIdentifier : public Identifier +{ + public: + ColumnIdentifier(PtrTo table, PtrTo name); + + auto getTable() const { return table; } + void makeCompound() const; + + String getQualifiedName() const override { return (table ? table->getQualifiedName() + "." : String()) + getName(); } + + ASTPtr convertToOld() const override; + + private: + mutable PtrTo table; +}; + +} diff --git a/src/Parsers/New/AST/InsertQuery.cpp b/src/Parsers/New/AST/InsertQuery.cpp new file mode 100644 index 00000000000..1f9325d3677 --- /dev/null +++ b/src/Parsers/New/AST/InsertQuery.cpp @@ -0,0 +1,125 @@ +#include + +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo DataClause::createFormat(PtrTo identifier, size_t data_offset) +{ + PtrTo clause(new DataClause(ClauseType::FORMAT, {identifier})); + clause->offset = data_offset; + return clause; +} + +// static +PtrTo DataClause::createSelect(PtrTo query) +{ + return PtrTo(new DataClause(ClauseType::SELECT, {query})); +} + +// static +PtrTo DataClause::createValues(size_t data_offset) +{ + PtrTo clause(new DataClause(ClauseType::VALUES, {})); + clause->offset = data_offset; + return clause; +} + +DataClause::DataClause(ClauseType type, PtrList exprs) : INode(exprs), clause_type(type) +{ +} + +ASTPtr DataClause::convertToOld() const +{ + if (clause_type != ClauseType::SELECT) return {}; + return get(SUBQUERY)->convertToOld(); +} + +// static +PtrTo InsertQuery::createTable(PtrTo identifier, PtrTo list, PtrTo clause) +{ + return PtrTo(new InsertQuery(QueryType::TABLE, {identifier, list, clause})); +} + +// static +PtrTo InsertQuery::createFunction(PtrTo function, PtrTo list, PtrTo clause) +{ + return PtrTo(new InsertQuery(QueryType::FUNCTION, {function, list, clause})); +} + +InsertQuery::InsertQuery(QueryType type, PtrList exprs) : Query(exprs), query_type(type) +{ +} + +ASTPtr InsertQuery::convertToOld() const +{ + auto query = std::make_shared(); + + switch(query_type) + { + case QueryType::FUNCTION: + query->table_function = get(FUNCTION)->convertToOld(); + break; + case QueryType::TABLE: + query->table_id = getTableIdentifier(get(IDENTIFIER)->convertToOld()); + break; + } + + if (has(COLUMNS)) query->columns = get(COLUMNS)->convertToOld(); + if (get(DATA)->getType() == DataClause::ClauseType::SELECT) + { + query->select = get(DATA)->convertToOld(); + query->children.push_back(query->select); + } + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitColumnsClause(ClickHouseParser::ColumnsClauseContext *ctx) +{ + auto list = std::make_shared(); + for (auto * name : ctx->nestedIdentifier()) list->push(visit(name)); + return list; +} + +antlrcpp::Any ParseTreeVisitor::visitDataClauseFormat(ClickHouseParser::DataClauseFormatContext *ctx) +{ + return DataClause::createFormat(visit(ctx->identifier()), ctx->getStop()->getStopIndex() + 1); +} + +antlrcpp::Any ParseTreeVisitor::visitDataClauseSelect(ClickHouseParser::DataClauseSelectContext *ctx) +{ + return DataClause::createSelect(visit(ctx->selectUnionStmt())); +} + +antlrcpp::Any ParseTreeVisitor::visitDataClauseValues(ClickHouseParser::DataClauseValuesContext *ctx) +{ + return DataClause::createValues(ctx->getStop()->getStopIndex() + 1); +} + +antlrcpp::Any ParseTreeVisitor::visitInsertStmt(ClickHouseParser::InsertStmtContext *ctx) +{ + auto columns = ctx->columnsClause() ? visit(ctx->columnsClause()).as>() : nullptr; + + if (ctx->FUNCTION()) return InsertQuery::createFunction(visit(ctx->tableFunctionExpr()), columns, visit(ctx->dataClause())); + if (ctx->tableIdentifier()) return InsertQuery::createTable(visit(ctx->tableIdentifier()), columns, visit(ctx->dataClause())); + __builtin_unreachable(); +} + +} diff --git a/src/Parsers/New/AST/InsertQuery.h b/src/Parsers/New/AST/InsertQuery.h new file mode 100644 index 00000000000..e7543d6e875 --- /dev/null +++ b/src/Parsers/New/AST/InsertQuery.h @@ -0,0 +1,73 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class DataClause : public INode +{ + public: + enum class ClauseType + { + FORMAT, + SELECT, + VALUES, + }; + + static PtrTo createFormat(PtrTo identifier, size_t data_offset); + static PtrTo createSelect(PtrTo query); + static PtrTo createValues(size_t data_offset); + + auto getType() const { return clause_type; } + auto getOffset() const { return offset; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + FORMAT = 0, // Identifier + SUBQUERY = 0, // SelectUnionQuery + }; + + ClauseType clause_type; + size_t offset = 0; + + DataClause(ClauseType type, PtrList exprs); +}; + +class InsertQuery : public Query +{ + public: + static PtrTo createFunction(PtrTo function, PtrTo list, PtrTo clause); + static PtrTo createTable(PtrTo identifier, PtrTo list, PtrTo clause); + + bool hasData() const { return get(DATA)->getType() != DataClause::ClauseType::SELECT; } + size_t getDataOffset() const { return get(DATA)->getOffset(); } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + IDENTIFIER = 0, // TableIdentifier + FUNCTION = 0, // TableFunctionExpr + COLUMNS = 1, // ColumnNameList + DATA = 2, // DataClause + }; + enum class QueryType + { + FUNCTION, + TABLE, + }; + + QueryType query_type; + + InsertQuery(QueryType type, PtrList exprs); + + String dumpInfo() const override { return String("has_data=") + (hasData() ? "true" : "false"); } +}; + +} diff --git a/src/Parsers/New/AST/JoinExpr.cpp b/src/Parsers/New/AST/JoinExpr.cpp new file mode 100644 index 00000000000..a5effedc242 --- /dev/null +++ b/src/Parsers/New/AST/JoinExpr.cpp @@ -0,0 +1,326 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::ErrorCodes +{ + extern const int UNEXPECTED_AST_STRUCTURE; +} + +namespace DB::AST +{ + +JoinConstraintClause::JoinConstraintClause(ConstraintType type_, PtrTo list) : SimpleClause{list}, type(type_) +{ +} + +SampleClause::SampleClause(PtrTo ratio, PtrTo offset) : INode{ratio, offset} +{ +} + +ASTPtr SampleClause::convertToOld() const +{ + auto list = std::make_shared(); + + list->children.push_back(get(RATIO)->convertToOld()); + if (has(OFFSET)) list->children.push_back(get(OFFSET)->convertToOld()); + + return list; +} + +// static +PtrTo JoinExpr::createTableExpr(PtrTo expr, PtrTo clause, bool final) +{ + return PtrTo(new JoinExpr(JoinExpr::ExprType::TABLE, final, {expr, clause})); +} + +// static +PtrTo JoinExpr::createJoinOp( + PtrTo left_expr, PtrTo right_expr, JoinOpType op, JoinOpMode mode, PtrTo clause) +{ + return PtrTo(new JoinExpr(ExprType::JOIN_OP, op, mode, {left_expr, right_expr, clause})); +} + +JoinExpr::JoinExpr(JoinExpr::ExprType type, bool final_, PtrList exprs) : INode(exprs), expr_type(type), final(final_) +{ +} + +JoinExpr::JoinExpr(JoinExpr::ExprType type, JoinExpr::JoinOpType op, JoinExpr::JoinOpMode mode, PtrList exprs) + : INode(exprs), expr_type(type), op_type(op), op_mode(mode) +{ +} + +ASTPtr JoinExpr::convertToOld() const +{ + /** The sole convertable chain of Join's may look like: + * + * … FROM table1 JOIN table2 ON SMTH JOIN table3 ON SMTH JOIN … + * + * Since Join is a left-associative operation then the tree will look like: + * + * JoinExpr + * / \ + * JoinExpr … + * / \ + * JoinExpr table3 + * / \ + * table1 table2 + * + * To linearize this tree we have to start from the top-most expression. + */ + + auto list = std::make_shared(); + + if (expr_type == ExprType::TABLE) + { + auto element = std::make_shared(); + element->children.emplace_back(get(TABLE)->convertToOld()); + element->table_expression = element->children.back(); + element->table_expression->as()->final = final; + if (has(SAMPLE)) + { + auto old_list = get(SAMPLE)->convertToOld(); + + element->table_expression->as()->sample_size = old_list->children[0]; + element->table_expression->children.push_back(element->table_expression->as()->sample_size); + + if (old_list->children.size() > 1) + { + element->table_expression->as()->sample_offset = old_list->children[1]; + element->table_expression->children.push_back(element->table_expression->as()->sample_offset); + } + } + + list->children.emplace_back(element); + } + else if (expr_type == ExprType::JOIN_OP) + { + if (get(RIGHT_EXPR)->expr_type != ExprType::TABLE) + throw Exception(ErrorCodes::UNEXPECTED_AST_STRUCTURE, "Cannot convert new tree-like JoinExpr to old AST"); + + auto left = get(LEFT_EXPR)->convertToOld(), right = get(RIGHT_EXPR)->convertToOld(); // ASTExpressionList's + list->children.insert(list->children.end(), left->children.begin(), left->children.end()); // Insert all the previously parsed left subtree + list->children.emplace_back(right->children[0]); // Insert only first (single) ASTTablesInSelectQueryElement which should contain only ASTTableExpression + + auto element = std::make_shared(); + switch (op_mode) + { + case JoinOpMode::DEFAULT: + element->locality = ASTTableJoin::Locality::Unspecified; + break; + case JoinOpMode::GLOBAL: + element->locality = ASTTableJoin::Locality::Global; + break; + case JoinOpMode::LOCAL: + element->locality = ASTTableJoin::Locality::Local; + break; + } + switch (op_type) + { + case JoinOpType::CROSS: + element->kind = ASTTableJoin::Kind::Cross; + break; + case JoinOpType::FULL: + element->kind = ASTTableJoin::Kind::Full; + break; + case JoinOpType::FULL_ALL: + element->kind = ASTTableJoin::Kind::Full; + element->strictness = ASTTableJoin::Strictness::All; + break; + case JoinOpType::FULL_ANY: + element->kind = ASTTableJoin::Kind::Full; + element->strictness = ASTTableJoin::Strictness::Any; + break; + case JoinOpType::INNER: + element->kind = ASTTableJoin::Kind::Inner; + break; + case JoinOpType::INNER_ALL: + element->kind = ASTTableJoin::Kind::Inner; + element->strictness = ASTTableJoin::Strictness::All; + break; + case JoinOpType::INNER_ANY: + element->kind = ASTTableJoin::Kind::Inner; + element->strictness = ASTTableJoin::Strictness::Any; + break; + case JoinOpType::INNER_ASOF: + element->kind = ASTTableJoin::Kind::Inner; + element->strictness = ASTTableJoin::Strictness::Asof; + break; + case JoinOpType::LEFT: + element->kind = ASTTableJoin::Kind::Left; + break; + case JoinOpType::LEFT_ALL: + element->kind = ASTTableJoin::Kind::Left; + element->strictness = ASTTableJoin::Strictness::All; + break; + case JoinOpType::LEFT_ANTI: + element->kind = ASTTableJoin::Kind::Left; + element->strictness = ASTTableJoin::Strictness::Anti; + break; + case JoinOpType::LEFT_ANY: + element->kind = ASTTableJoin::Kind::Left; + element->strictness = ASTTableJoin::Strictness::Any; + break; + case JoinOpType::LEFT_ASOF: + element->kind = ASTTableJoin::Kind::Left; + element->strictness = ASTTableJoin::Strictness::Asof; + break; + case JoinOpType::LEFT_SEMI: + element->kind = ASTTableJoin::Kind::Left; + element->strictness = ASTTableJoin::Strictness::Semi; + break; + case JoinOpType::RIGHT: + element->kind = ASTTableJoin::Kind::Right; + break; + case JoinOpType::RIGHT_ANTI: + element->kind = ASTTableJoin::Kind::Right; + element->strictness = ASTTableJoin::Strictness::Anti; + break; + case JoinOpType::RIGHT_ALL: + element->kind = ASTTableJoin::Kind::Right; + element->strictness = ASTTableJoin::Strictness::All; + break; + case JoinOpType::RIGHT_ANY: + element->kind = ASTTableJoin::Kind::Right; + element->strictness = ASTTableJoin::Strictness::Any; + break; + case JoinOpType::RIGHT_ASOF: + element->kind = ASTTableJoin::Kind::Right; + element->strictness = ASTTableJoin::Strictness::Asof; + break; + case JoinOpType::RIGHT_SEMI: + element->kind = ASTTableJoin::Kind::Right; + element->strictness = ASTTableJoin::Strictness::Semi; + break; + } + + if (has(CONSTRAINT)) + { + const auto * constraint = get(CONSTRAINT); + switch(constraint->getType()) + { + case JoinConstraintClause::ConstraintType::ON: + element->on_expression = constraint->convertToOld(); + if (element->on_expression->children.size() > 1) + throw Exception(ErrorCodes::UNEXPECTED_AST_STRUCTURE, "Cannot convert JoinExpr with more than one ON expression"); + element->on_expression = element->on_expression->children[0]; + element->children.push_back(element->on_expression); + break; + case JoinConstraintClause::ConstraintType::USING: + element->using_expression_list = constraint->convertToOld(); + element->children.push_back(element->using_expression_list); + break; + } + } + + list->children.back()->children.emplace_back(element); + list->children.back()->as()->table_join = element; + } + + return list; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitJoinConstraintClause(ClickHouseParser::JoinConstraintClauseContext *ctx) +{ + return std::make_shared( + ctx->ON() ? JoinConstraintClause::ConstraintType::ON : JoinConstraintClause::ConstraintType::USING, + visit(ctx->columnExprList())); +} + +antlrcpp::Any ParseTreeVisitor::visitJoinExprCrossOp(ClickHouseParser::JoinExprCrossOpContext *ctx) +{ + auto [op, mode] = std::pair(visit(ctx->joinOpCross())); + + return JoinExpr::createJoinOp(visit(ctx->joinExpr(0)), visit(ctx->joinExpr(1)), op, mode, nullptr); +} + +antlrcpp::Any ParseTreeVisitor::visitJoinExprOp(ClickHouseParser::JoinExprOpContext *ctx) +{ + auto mode = JoinExpr::JoinOpMode::DEFAULT; + auto op = ctx->joinOp() ? visit(ctx->joinOp()).as() : JoinExpr::JoinOpType::INNER; + + if (ctx->GLOBAL()) mode = JoinExpr::JoinOpMode::GLOBAL; + else if (ctx->LOCAL()) mode = JoinExpr::JoinOpMode::LOCAL; + + return JoinExpr::createJoinOp(visit(ctx->joinExpr(0)), visit(ctx->joinExpr(1)), op, mode, visit(ctx->joinConstraintClause())); +} + +antlrcpp::Any ParseTreeVisitor::visitJoinExprParens(ClickHouseParser::JoinExprParensContext *ctx) +{ + return visit(ctx->joinExpr()); +} + +antlrcpp::Any ParseTreeVisitor::visitJoinExprTable(ClickHouseParser::JoinExprTableContext *ctx) +{ + auto sample = ctx->sampleClause() ? visit(ctx->sampleClause()).as>() : nullptr; + return JoinExpr::createTableExpr(visit(ctx->tableExpr()), sample, !!ctx->FINAL()); +} + +antlrcpp::Any ParseTreeVisitor::visitJoinOpCross(ClickHouseParser::JoinOpCrossContext *ctx) +{ + std::pair op{ + JoinExpr::JoinOpType::CROSS, JoinExpr::JoinOpMode::DEFAULT}; + + if (ctx->GLOBAL()) op.second = JoinExpr::JoinOpMode::GLOBAL; + else if (ctx->LOCAL()) op.second = JoinExpr::JoinOpMode::LOCAL; + + return op; +} + +antlrcpp::Any ParseTreeVisitor::visitJoinOpFull(ClickHouseParser::JoinOpFullContext *ctx) +{ + if (ctx->ALL()) return JoinExpr::JoinOpType::FULL_ALL; + if (ctx->ANY()) return JoinExpr::JoinOpType::FULL_ANY; + return JoinExpr::JoinOpType::FULL; +} + +antlrcpp::Any ParseTreeVisitor::visitJoinOpInner(ClickHouseParser::JoinOpInnerContext *ctx) +{ + if (ctx->ALL()) return JoinExpr::JoinOpType::INNER_ALL; + if (ctx->ANY()) return JoinExpr::JoinOpType::INNER_ANY; + if (ctx->ASOF()) return JoinExpr::JoinOpType::INNER_ASOF; + return JoinExpr::JoinOpType::INNER; +} + +antlrcpp::Any ParseTreeVisitor::visitJoinOpLeftRight(ClickHouseParser::JoinOpLeftRightContext *ctx) +{ + if (ctx->LEFT()) + { + if (ctx->SEMI()) return JoinExpr::JoinOpType::LEFT_SEMI; + if (ctx->ALL()) return JoinExpr::JoinOpType::LEFT_ALL; + if (ctx->ANTI()) return JoinExpr::JoinOpType::LEFT_ANTI; + if (ctx->ANY()) return JoinExpr::JoinOpType::LEFT_ANY; + if (ctx->ASOF()) return JoinExpr::JoinOpType::LEFT_ASOF; + return JoinExpr::JoinOpType::LEFT; + } + else if (ctx->RIGHT()) + { + if (ctx->SEMI()) return JoinExpr::JoinOpType::RIGHT_SEMI; + if (ctx->ALL()) return JoinExpr::JoinOpType::RIGHT_ALL; + if (ctx->ANTI()) return JoinExpr::JoinOpType::RIGHT_ANTI; + if (ctx->ANY()) return JoinExpr::JoinOpType::RIGHT_ANY; + if (ctx->ASOF()) return JoinExpr::JoinOpType::RIGHT_ASOF; + return JoinExpr::JoinOpType::RIGHT; + } + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitSampleClause(ClickHouseParser::SampleClauseContext *ctx) +{ + auto offset = ctx->ratioExpr().size() == 2 ? visit(ctx->ratioExpr(1)).as>() : nullptr; + return std::make_shared(visit(ctx->ratioExpr(0)), offset); +} + +} diff --git a/src/Parsers/New/AST/JoinExpr.h b/src/Parsers/New/AST/JoinExpr.h new file mode 100644 index 00000000000..08117d6b6e8 --- /dev/null +++ b/src/Parsers/New/AST/JoinExpr.h @@ -0,0 +1,103 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class JoinConstraintClause : public SimpleClause +{ + public: + enum class ConstraintType + { + ON, + USING, + }; + + JoinConstraintClause(ConstraintType type, PtrTo list); + + auto getType() const { return type; } + + private: + const ConstraintType type; +}; + +class SampleClause : public INode +{ + public: + SampleClause(PtrTo ratio_, PtrTo offset_); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + RATIO = 0, // RatioExpr + OFFSET = 1, // RatioExpr (optional) + }; +}; + +class JoinExpr : public INode +{ + public: + enum class JoinOpType + { + INNER, + INNER_ALL, + INNER_ANY, + INNER_ASOF, + LEFT, + LEFT_SEMI, + LEFT_ALL, + LEFT_ANTI, + LEFT_ANY, + LEFT_ASOF, + RIGHT, + RIGHT_SEMI, + RIGHT_ALL, + RIGHT_ANTI, + RIGHT_ANY, + RIGHT_ASOF, + FULL, + FULL_ALL, + FULL_ANY, + CROSS, + }; + enum class JoinOpMode + { + DEFAULT, // actual mode depends on setting's 'distributed_product_mode' value + GLOBAL, + LOCAL, + }; + + static PtrTo createTableExpr(PtrTo expr, PtrTo clause, bool final); + static PtrTo createJoinOp(PtrTo left_expr, PtrTo right_expr, JoinOpType op, JoinOpMode mode, PtrTo clause); + + ASTPtr convertToOld() const override; // returns topologically sorted elements as ASTExpressionList + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, // TableExpr + SAMPLE = 1, // SampleClause (optional) + LEFT_EXPR = 0, // JoinExpr + RIGHT_EXPR = 1, // JoinExpr + CONSTRAINT = 2, // JoinConstraintClause + }; + enum class ExprType + { + TABLE, + JOIN_OP, + }; + + const ExprType expr_type; + const JoinOpType op_type = JoinOpType::INNER; + const JoinOpMode op_mode = JoinOpMode::DEFAULT; + const bool final = false; + + JoinExpr(ExprType type, bool final, PtrList exprs); + JoinExpr(ExprType type, JoinOpType op, JoinOpMode mode, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/KillQuery.cpp b/src/Parsers/New/AST/KillQuery.cpp new file mode 100644 index 00000000000..615b5ec3fe3 --- /dev/null +++ b/src/Parsers/New/AST/KillQuery.cpp @@ -0,0 +1,56 @@ +#include + +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo KillQuery::createMutation(PtrTo cluster, bool sync, bool test, PtrTo where) +{ + PtrTo query(new KillQuery(cluster, QueryType::MUTATION, {where})); + query->sync = sync; + query->test = test; + return query; +} + +KillQuery::KillQuery(PtrTo cluster, QueryType type, PtrList exprs) : DDLQuery(cluster, exprs), query_type(type) +{ +} + +ASTPtr KillQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->cluster = cluster_name; + + switch(query_type) + { + case QueryType::MUTATION: + query->type = ASTKillQueryQuery::Type::Mutation; + query->sync = sync; + query->test = test; + query->where_expression = get(WHERE)->convertToOld(); + query->children.push_back(query->where_expression); + break; + } + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitKillMutationStmt(ClickHouseParser::KillMutationStmtContext * ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + return KillQuery::createMutation(cluster, !!ctx->SYNC(), !!ctx->TEST(), visit(ctx->whereClause())); +} + +} diff --git a/src/Parsers/New/AST/KillQuery.h b/src/Parsers/New/AST/KillQuery.h new file mode 100644 index 00000000000..61a73599cec --- /dev/null +++ b/src/Parsers/New/AST/KillQuery.h @@ -0,0 +1,33 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class KillQuery : public DDLQuery +{ + public: + static PtrTo createMutation(PtrTo cluster, bool sync, bool test, PtrTo where); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + WHERE = 0, // WhereClause + }; + + enum class QueryType + { + MUTATION, + }; + + const QueryType query_type; + bool sync = false, test = false; + + KillQuery(PtrTo cluster, QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/LimitExpr.cpp b/src/Parsers/New/AST/LimitExpr.cpp new file mode 100644 index 00000000000..b41c56d21f9 --- /dev/null +++ b/src/Parsers/New/AST/LimitExpr.cpp @@ -0,0 +1,39 @@ +#include + +#include +#include + + +namespace DB::AST +{ + +LimitExpr::LimitExpr(PtrTo limit, PtrTo offset) : INode{limit, offset} +{ +} + +ASTPtr LimitExpr::convertToOld() const +{ + auto list = std::make_shared(); + + if (has(OFFSET)) list->children.push_back(get(OFFSET)->convertToOld()); + list->children.push_back(get(LIMIT)->convertToOld()); + + return list; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitLimitExpr(ClickHouseParser::LimitExprContext *ctx) +{ + if (ctx->columnExpr().size() == 2) + return std::make_shared(visit(ctx->columnExpr(0)), visit(ctx->columnExpr(1))); + else + return std::make_shared(visit(ctx->columnExpr(0)).as>()); +} + +} diff --git a/src/Parsers/New/AST/LimitExpr.h b/src/Parsers/New/AST/LimitExpr.h new file mode 100644 index 00000000000..986806c2bd9 --- /dev/null +++ b/src/Parsers/New/AST/LimitExpr.h @@ -0,0 +1,24 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class LimitExpr : public INode +{ + public: + explicit LimitExpr(PtrTo limit, PtrTo offset = nullptr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + LIMIT = 0, // ColumnExpr + OFFSET = 1, // ColumnExpr (optional) + }; +}; + +} diff --git a/src/Parsers/New/AST/Literal.cpp b/src/Parsers/New/AST/Literal.cpp new file mode 100644 index 00000000000..30aacd3d590 --- /dev/null +++ b/src/Parsers/New/AST/Literal.cpp @@ -0,0 +1,222 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo Literal::createNull() +{ + return PtrTo(new Literal(LiteralType::NULL_LITERAL, String())); +} + +// static +PtrTo Literal::createNumber(antlr4::tree::TerminalNode * literal, bool negative) +{ + auto number = std::make_shared(literal); + if (negative) number->makeNegative(); + return number; +} + +// static +PtrTo Literal::createNumber(const String & literal) +{ + bool has_minus = literal[0] == '-'; + auto number = std::make_shared(has_minus ? literal.substr(1) : literal); + if (has_minus) number->makeNegative(); + return number; +} + +// static +PtrTo Literal::createString(antlr4::tree::TerminalNode * literal) +{ + return std::make_shared(literal); +} + +// static +PtrTo Literal::createString(const String & literal) +{ + return std::make_shared(literal); +} + +Literal::Literal(LiteralType type_, const String & token_) : token(token_), type(type_) +{ +} + +ASTPtr Literal::convertToOld() const +{ + auto as_field = [this] () -> Field + { + switch(type) + { + case LiteralType::NULL_LITERAL: + return Field(Null()); + case LiteralType::NUMBER: + { + const auto * number = this->as(); + + if (!number->isNegative()) + if (auto value = number->as()) return Field(*value); + if (auto value = number->as()) return Field(*value); + if (auto value = number->as()) return Field(*value); + + return Field(); + } + case LiteralType::STRING: + return asString(); + } + __builtin_unreachable(); + }; + + return std::make_shared(as_field()); +} + +String Literal::toString() const +{ + WriteBufferFromOwnString wb; + writeEscapedString(token, wb); + return type == LiteralType::STRING ? "'" + wb.str() + "'" : wb.str(); +} + +NumberLiteral::NumberLiteral(antlr4::tree::TerminalNode * literal) : Literal(LiteralType::NUMBER, literal->getSymbol()->getText()) +{ +} + +NumberLiteral::NumberLiteral(const String & literal) : Literal(LiteralType::NUMBER, literal) +{ +} + +String NumberLiteral::toString() const +{ + return (minus ? String("-") : String()) + Literal::toString(); +} + +ASTSampleRatio::Rational NumberLiteral::convertToOldRational() const +{ + UInt64 num_before = 0; + UInt64 num_after = 0; + Int64 exponent = 0; + + const char * pos = token.data(), * end = token.data() + token.size(); + const char * pos_after_first_num = tryReadIntText(num_before, pos, end); + + bool has_num_before_point [[maybe_unused]] = pos_after_first_num > pos; + pos = pos_after_first_num; + bool has_point = pos < end && *pos == '.'; + + if (has_point) + ++pos; + + assert (has_num_before_point || has_point); + + size_t number_of_digits_after_point = 0; + + if (has_point) + { + const char * pos_after_second_num = tryReadIntText(num_after, pos, end); + number_of_digits_after_point = pos_after_second_num - pos; + pos = pos_after_second_num; + } + + bool has_exponent = pos < end && (*pos == 'e' || *pos == 'E'); + + if (has_exponent) + { + ++pos; + const char * pos_after_exponent [[maybe_unused]] = tryReadIntText(exponent, pos, end); + assert (pos_after_exponent != pos); + } + + ASTSampleRatio::Rational res; + res.numerator = num_before * intExp10(number_of_digits_after_point) + num_after; + res.denominator = intExp10(number_of_digits_after_point); + + if (exponent > 0) + res.numerator *= intExp10(exponent); + if (exponent < 0) + res.denominator *= intExp10(-exponent); + + return res; +} + +StringLiteral::StringLiteral(antlr4::tree::TerminalNode * literal) : Literal(LiteralType::STRING, literal->getSymbol()->getText()) +{ + String s; + ReadBufferFromMemory in(token.data(), token.size()); + + readQuotedStringWithSQLStyle(s, in); + + assert(in.count() == token.size()); + token = s; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitFloatingLiteral(ClickHouseParser::FloatingLiteralContext * ctx) +{ + if (ctx->FLOATING_LITERAL()) return Literal::createNumber(ctx->FLOATING_LITERAL()); + + const auto * dot = ctx->DOT()->getSymbol(); + + if (!ctx->DECIMAL_LITERAL().empty()) + { + // .1234 + if (dot->getTokenIndex() < ctx->DECIMAL_LITERAL(0)->getSymbol()->getTokenIndex()) + return Literal::createNumber(dot->getText() + ctx->DECIMAL_LITERAL(0)->getSymbol()->getText()); + // 1234. + else if (ctx->DECIMAL_LITERAL().size() == 1 && !ctx->OCTAL_LITERAL()) + return Literal::createNumber(ctx->DECIMAL_LITERAL(0)->getSymbol()->getText() + dot->getText()); + // 1234.1234 + else if (ctx->DECIMAL_LITERAL().size() == 2) + return Literal::createNumber( + ctx->DECIMAL_LITERAL(0)->getSymbol()->getText() + dot->getText() + ctx->DECIMAL_LITERAL(1)->getSymbol()->getText()); + // 1234.0123 + else + return Literal::createNumber( + ctx->DECIMAL_LITERAL(0)->getSymbol()->getText() + dot->getText() + ctx->OCTAL_LITERAL()->getSymbol()->getText()); + } + else + // .0123 + return Literal::createNumber(dot->getText() + ctx->OCTAL_LITERAL()->getSymbol()->getText()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitLiteral(ClickHouseParser::LiteralContext * ctx) +{ + if (ctx->NULL_SQL()) + return Literal::createNull(); + if (ctx->STRING_LITERAL()) + return std::static_pointer_cast(Literal::createString(ctx->STRING_LITERAL())); + if (ctx->numberLiteral()) + return std::static_pointer_cast(visit(ctx->numberLiteral()).as>()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitNumberLiteral(ClickHouseParser::NumberLiteralContext *ctx) +{ + if (ctx->floatingLiteral()) + { + auto number = visit(ctx->floatingLiteral()).as>(); + if (ctx->DASH()) number->makeNegative(); + return number; + } + if (ctx->OCTAL_LITERAL()) return Literal::createNumber(ctx->OCTAL_LITERAL(), !!ctx->DASH()); + if (ctx->DECIMAL_LITERAL()) return Literal::createNumber(ctx->DECIMAL_LITERAL(), !!ctx->DASH()); + if (ctx->HEXADECIMAL_LITERAL()) return Literal::createNumber(ctx->HEXADECIMAL_LITERAL(), !!ctx->DASH()); + if (ctx->INF()) return Literal::createNumber(ctx->INF(), !!ctx->DASH()); + if (ctx->NAN_SQL()) return Literal::createNumber(ctx->NAN_SQL()); + __builtin_unreachable(); +} + +} diff --git a/src/Parsers/New/AST/Literal.h b/src/Parsers/New/AST/Literal.h new file mode 100644 index 00000000000..75790daed20 --- /dev/null +++ b/src/Parsers/New/AST/Literal.h @@ -0,0 +1,96 @@ +#pragma once + +#include + +#include +#include + +#include +#include + +#include + + +namespace DB::AST +{ + +class Literal : public INode +{ + public: + enum class LiteralType + { + NULL_LITERAL, + NUMBER, + STRING, + }; + + static PtrTo createNull(); + static PtrTo createNumber(antlr4::tree::TerminalNode * literal, bool negative = false); + static PtrTo createNumber(const String& literal); // checks first symbol for '-' character + static PtrTo createString(antlr4::tree::TerminalNode * literal); + static PtrTo createString(const String& literal); // without quotes + + ASTPtr convertToOld() const override; + String toString() const override; + + bool is(LiteralType what) const { return type == what; } + + protected: + String token; // STRING is stored without quotes and interpolated with escape-sequences. + + Literal(LiteralType type, const String & token); + + template + std::optional asNumber(bool minus) const + { + T number; + std::stringstream ss(String(minus ? "-" : "+") + token); + if (token.size() > 2 && (token[1] == 'x' || token[1] == 'X')) ss >> std::hex >> number; + else if (token.size() > 1 && (token[0] == '0')) ss >> std::oct >> number; + else ss >> number; + if (ss.fail() || !ss.eof()) + return {}; + return number; + } + + auto asString() const { return token; } + + private: + LiteralType type; + + String dumpInfo() const override { return token; } +}; + +class NumberLiteral : public Literal +{ + public: + explicit NumberLiteral(antlr4::tree::TerminalNode * literal); + explicit NumberLiteral(const String & literal); + + String toString() const override; + + void makeNegative() { minus = true; } + bool isNegative() const { return minus; } + + template std::optional as() const { return asNumber(minus); } + + ASTSampleRatio::Rational convertToOldRational() const; + + private: + bool minus = false; +}; + +class StringLiteral : public Literal +{ + public: + explicit StringLiteral(antlr4::tree::TerminalNode * literal); + explicit StringLiteral(const String & literal) : Literal(LiteralType::STRING, literal) {} + + template + T as() const + { + return asString(); + } +}; + +} diff --git a/src/Parsers/New/AST/OptimizeQuery.cpp b/src/Parsers/New/AST/OptimizeQuery.cpp new file mode 100644 index 00000000000..88bb6cfbe7b --- /dev/null +++ b/src/Parsers/New/AST/OptimizeQuery.cpp @@ -0,0 +1,59 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +OptimizeQuery::OptimizeQuery(PtrTo cluster, PtrTo identifier, PtrTo clause, bool final_, bool deduplicate_) + : DDLQuery(cluster, {identifier, clause}), final(final_), deduplicate(deduplicate_) +{ +} + +ASTPtr OptimizeQuery::convertToOld() const +{ + auto query = std::make_shared(); + + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + } + + if (has(PARTITION)) + { + query->partition = get(PARTITION)->convertToOld(); + query->children.push_back(query->partition); + } + + query->final = final; + query->deduplicate = deduplicate; + query->cluster = cluster_name; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitOptimizeStmt(ClickHouseParser::OptimizeStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + auto clause = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; + return std::make_shared(cluster, visit(ctx->tableIdentifier()), clause, !!ctx->FINAL(), !!ctx->DEDUPLICATE()); +} + +} diff --git a/src/Parsers/New/AST/OptimizeQuery.h b/src/Parsers/New/AST/OptimizeQuery.h new file mode 100644 index 00000000000..b94351518a7 --- /dev/null +++ b/src/Parsers/New/AST/OptimizeQuery.h @@ -0,0 +1,27 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class OptimizeQuery : public DDLQuery +{ + public: + OptimizeQuery( + PtrTo cluster, PtrTo identifier, PtrTo clause, bool final, bool deduplicate); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, // TableIdentifier + PARTITION, // PartitionClause + }; + + const bool final, deduplicate; +}; + +} diff --git a/src/Parsers/New/AST/OrderExpr.cpp b/src/Parsers/New/AST/OrderExpr.cpp new file mode 100644 index 00000000000..8511bc23276 --- /dev/null +++ b/src/Parsers/New/AST/OrderExpr.cpp @@ -0,0 +1,62 @@ +#include + +#include +#include +#include +#include + + +namespace DB::AST +{ + +OrderExpr::OrderExpr(PtrTo expr, NullsOrder nulls_, PtrTo collate, bool ascending) + : INode{expr, collate}, nulls(nulls_), asc(ascending) +{ +} + +ASTPtr OrderExpr::convertToOld() const +{ + auto expr = std::make_shared(); + + expr->children.push_back(get(EXPR)->convertToOld()); + expr->direction = asc ? 1 : -1; + expr->nulls_direction_was_explicitly_specified = (nulls != NATURAL); + if (nulls == NATURAL) expr->nulls_direction = expr->direction; + else expr->nulls_direction = (nulls == NULLS_LAST) ? expr->direction : -expr->direction; + + if (has(COLLATE)) + { + expr->collation = get(COLLATE)->convertToOld(); + expr->children.push_back(expr->collation); + } + + // TODO: WITH FILL? + + return expr; +} + +} + +namespace DB +{ + +antlrcpp::Any ParseTreeVisitor::visitOrderExprList(ClickHouseParser::OrderExprListContext *ctx) +{ + auto expr_list = std::make_shared(); + for (auto* expr : ctx->orderExpr()) expr_list->push(visit(expr)); + return expr_list; +} + +antlrcpp::Any ParseTreeVisitor::visitOrderExpr(ClickHouseParser::OrderExprContext *ctx) +{ + AST::OrderExpr::NullsOrder nulls = AST::OrderExpr::NATURAL; + if (ctx->FIRST()) nulls = AST::OrderExpr::NULLS_FIRST; + else if (ctx->LAST()) nulls = AST::OrderExpr::NULLS_LAST; + + AST::PtrTo collate; + if (ctx->COLLATE()) collate = AST::Literal::createString(ctx->STRING_LITERAL()); + + return std::make_shared(visit(ctx->columnExpr()), nulls, collate, !ctx->DESCENDING() && !ctx->DESC()); +} + +} diff --git a/src/Parsers/New/AST/OrderExpr.h b/src/Parsers/New/AST/OrderExpr.h new file mode 100644 index 00000000000..2c13e7f5298 --- /dev/null +++ b/src/Parsers/New/AST/OrderExpr.h @@ -0,0 +1,33 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class OrderExpr : public INode +{ + public: + enum NullsOrder { + NATURAL, + NULLS_FIRST, + NULLS_LAST, + }; + + OrderExpr(PtrTo expr, NullsOrder nulls_, PtrTo collate, bool ascending = true); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // ColumnExpr + COLLATE, // StringLiteral (optional) + }; + + NullsOrder nulls; + bool asc; +}; + +} diff --git a/src/Parsers/New/AST/Query.cpp b/src/Parsers/New/AST/Query.cpp new file mode 100644 index 00000000000..1ef2ee935b6 --- /dev/null +++ b/src/Parsers/New/AST/Query.cpp @@ -0,0 +1,34 @@ +#include + +#include +#include + + +namespace DB::AST +{ + +void Query::setOutFile(PtrTo literal) +{ + out_file = literal; +} + +void Query::setFormat(PtrTo id) +{ + format = id; +} + +void Query::convertToOldPartially(const std::shared_ptr & query) const +{ + if (out_file) + { + query->out_file = out_file->convertToOld(); + query->children.push_back(query->out_file); + } + if (format) + { + query->format = format->convertToOld(); + query->children.push_back(query->format); + } +} + +} diff --git a/src/Parsers/New/AST/Query.h b/src/Parsers/New/AST/Query.h new file mode 100644 index 00000000000..2998d1f0146 --- /dev/null +++ b/src/Parsers/New/AST/Query.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + + +namespace DB::AST +{ + +class Query : public INode { + public: + void setOutFile(PtrTo literal); + void setFormat(PtrTo id); + + protected: + Query() = default; + Query(std::initializer_list list) : INode(list) {} + explicit Query(PtrList list) : INode(list) {} + + void convertToOldPartially(const std::shared_ptr & query) const; + + private: + // TODO: put them to |children| + PtrTo out_file; + PtrTo format; +}; + +} diff --git a/src/Parsers/New/AST/README.md b/src/Parsers/New/AST/README.md new file mode 100644 index 00000000000..51e587f296c --- /dev/null +++ b/src/Parsers/New/AST/README.md @@ -0,0 +1,32 @@ +What is AST? +=== +AST stands for Abstract Syntax Tree, which is opposed to Concrete Syntax Tree (or Parse Tree). Read [this](https://eli.thegreenplace.net/2009/02/16/abstract-vs-concrete-syntax-trees/) post to get a sketchy overview of the difference between two concepts. + +AST **must not** repeat the grammar constructions or follow them. It's convenient to have similar structure but nothing more. +The main purpose of AST is to be easily handled by interpreter - the formatting of the original query is not the purpose of AST. + +Basic principles in code +=== + +- The base class for all AST elements is `INode` (INode.h). +- **All** sub-elements must be stored inside `INode::children` vector in a +**predetermined order** and with **predetermined type**: some elements may be `nullptr` to preserve positions of other elements. +- The order may be defined as a position in vector from the start, the last element, and some pattern of variable number of elements +in between. It's convenient to define `enum ChildIndex : Uint8 {…}` with index numbers for each class. +- If there is more than one variable pack of elements or the order can't be determenistic, then wrap elements into the lists and store the +multi-level structure (see `ColumnExpr::ExprType::FUNCTION` for example). +- Don't do multi-level structure just for nothing or to mimic the parse tree: the less is depth the better. +- The whole grammar separates expressions for databases, tables and columns. That way we already assess the semantics on the parser level. +E.g. don't use `identifier` where you know you should use `tableIdentifier`, etc. + +Name conventions +=== + +**Query**. The top-level element that allows to distinguish different types of SQL queries. The base class is `Query` (Query.h). + +**Statement**. An essential part of a query that describes its structure and possible alternatives. + +**Clause**. A part of the statement designed to differ logical parts for more convenient parsing. I.e. there are many clauses in SELECT statement that are optional and contain `columnExpr` elements. Without clauses it will be hard for visitor to distinguish which `columnExpr` refers to what. + +**Expression**. An element that should be somehow calculated or interpreted and result in some value. +** diff --git a/src/Parsers/New/AST/RatioExpr.cpp b/src/Parsers/New/AST/RatioExpr.cpp new file mode 100644 index 00000000000..b9f56928227 --- /dev/null +++ b/src/Parsers/New/AST/RatioExpr.cpp @@ -0,0 +1,43 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +RatioExpr::RatioExpr(PtrTo num1, PtrTo num2) : INode{num1, num2} +{ +} + +ASTPtr RatioExpr::convertToOld() const +{ + auto numerator = get(NUMERATOR)->convertToOldRational(); + + if (has(DENOMINATOR)) + { + auto denominator = get(DENOMINATOR)->convertToOldRational(); + + numerator.numerator = numerator.numerator * denominator.denominator; + numerator.denominator = numerator.denominator * denominator.numerator; + } + + return std::make_shared(numerator); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitRatioExpr(ClickHouseParser::RatioExprContext *ctx) +{ + auto denominator = ctx->numberLiteral().size() == 2 ? visit(ctx->numberLiteral(1)).as>() : nullptr; + return std::make_shared(visit(ctx->numberLiteral(0)), denominator); +} + +} diff --git a/src/Parsers/New/AST/RatioExpr.h b/src/Parsers/New/AST/RatioExpr.h new file mode 100644 index 00000000000..8e48edbf6ea --- /dev/null +++ b/src/Parsers/New/AST/RatioExpr.h @@ -0,0 +1,24 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class RatioExpr : public INode +{ + public: + RatioExpr(PtrTo num1, PtrTo num2); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NUMERATOR = 0, // NumberLiteral + DENOMINATOR = 1, // NumberLiteral (optional) + }; +}; + +} diff --git a/src/Parsers/New/AST/RenameQuery.cpp b/src/Parsers/New/AST/RenameQuery.cpp new file mode 100644 index 00000000000..78a4530a20f --- /dev/null +++ b/src/Parsers/New/AST/RenameQuery.cpp @@ -0,0 +1,58 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +RenameQuery::RenameQuery(PtrTo cluster, PtrTo> list) : DDLQuery(cluster, {list}) +{ +} + +ASTPtr RenameQuery::convertToOld() const +{ + auto query = std::make_shared(); + + for (auto table = get>(EXPRS)->begin(), end = get>(EXPRS)->end(); table != end; ++table) + { + ASTRenameQuery::Element element; + + if (auto database = (*table)->as()->getDatabase()) + element.from.database = database->getName(); + element.from.table = (*table)->as()->getName(); + + ++table; + + if (auto database = (*table)->as()->getDatabase()) + element.to.database = database->getName(); + element.to.table = (*table)->as()->getName(); + + query->elements.push_back(element); + } + + query->cluster = cluster_name; + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitRenameStmt(ClickHouseParser::RenameStmtContext *ctx) +{ + auto list = std::make_shared>(); + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + for (auto * identifier : ctx->tableIdentifier()) list->push(visit(identifier)); + return std::make_shared(cluster, list); +} + +} diff --git a/src/Parsers/New/AST/RenameQuery.h b/src/Parsers/New/AST/RenameQuery.h new file mode 100644 index 00000000000..74909043d4d --- /dev/null +++ b/src/Parsers/New/AST/RenameQuery.h @@ -0,0 +1,23 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class RenameQuery : public DDLQuery +{ + public: + explicit RenameQuery(PtrTo cluster, PtrTo> list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPRS = 0, // List + }; +}; + +} diff --git a/src/Parsers/New/AST/SelectUnionQuery.cpp b/src/Parsers/New/AST/SelectUnionQuery.cpp new file mode 100644 index 00000000000..b3c6e2a923b --- /dev/null +++ b/src/Parsers/New/AST/SelectUnionQuery.cpp @@ -0,0 +1,372 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace DB::ErrorCodes +{ + extern const int TOP_AND_LIMIT_TOGETHER; +} + +namespace DB::AST +{ + +// FROM Clause + +FromClause::FromClause(PtrTo expr) : INode{expr} +{ +} + +ASTPtr FromClause::convertToOld() const +{ + auto old_tables = std::make_shared(); + old_tables->children = get(EXPR)->convertToOld()->children; + return old_tables; +} + +// ARRAY JOIN Clause + +ArrayJoinClause::ArrayJoinClause(PtrTo expr_list, bool left_) : INode{expr_list}, left(left_) +{ +} + +ASTPtr ArrayJoinClause::convertToOld() const +{ + auto element = std::make_shared(); + auto array_join = std::make_shared(); + + if (left) array_join->kind = ASTArrayJoin::Kind::Left; + else array_join->kind = ASTArrayJoin::Kind::Inner; + + array_join->expression_list = get(EXPRS)->convertToOld(); + array_join->children.push_back(array_join->expression_list); + + element->array_join = array_join; + element->children.push_back(element->array_join); + + return element; +} + +// LIMIT By Clause + +LimitByClause::LimitByClause(PtrTo expr, PtrTo expr_list) : INode{expr, expr_list} +{ +} + +ASTPtr LimitByClause::convertToOld() const +{ + auto list = std::make_shared(); + + list->children.push_back(get(LIMIT)->convertToOld()); + list->children.push_back(get(EXPRS)->convertToOld()); + + return list; +} + +// LIMIT Clause + +LimitClause::LimitClause(bool with_ties_, PtrTo expr) : INode{expr}, with_ties(with_ties_) +{ +} + +ASTPtr LimitClause::convertToOld() const +{ + return get(EXPR)->convertToOld(); +} + +// SETTINGS Clause + +SettingsClause::SettingsClause(PtrTo expr_list) : INode{expr_list} +{ +} + +ASTPtr SettingsClause::convertToOld() const +{ + auto expr = std::make_shared(); + + for (const auto & child : get(EXPRS)->as()) + { + const auto * setting = child->as(); + expr->changes.emplace_back(setting->getName()->getName(), setting->getValue()->convertToOld()->as()->value); + } + + return expr; +} + +// SELECT Statement + +SelectStmt::SelectStmt(bool distinct_, ModifierType type, bool totals, PtrTo expr_list) + : INode(MAX_INDEX), modifier_type(type), distinct(distinct_), with_totals(totals) +{ + set(COLUMNS, expr_list); +} + +void SelectStmt::setWithClause(PtrTo clause) +{ + set(WITH, clause); +} + +void SelectStmt::setFromClause(PtrTo clause) +{ + set(FROM, clause); +} + +void SelectStmt::setArrayJoinClause(PtrTo clause) +{ + set(ARRAY_JOIN, clause); +} + +void SelectStmt::setPrewhereClause(PtrTo clause) +{ + set(PREWHERE, clause); +} + +void SelectStmt::setWhereClause(PtrTo clause) +{ + set(WHERE, clause); +} + +void SelectStmt::setGroupByClause(PtrTo clause) +{ + set(GROUP_BY, clause); +} + +void SelectStmt::setHavingClause(PtrTo clause) +{ + set(HAVING, clause); +} + +void SelectStmt::setOrderByClause(PtrTo clause) +{ + set(ORDER_BY, clause); +} + +void SelectStmt::setLimitByClause(PtrTo clause) +{ + set(LIMIT_BY, clause); +} + +void SelectStmt::setLimitClause(PtrTo clause) +{ + set(LIMIT, clause); +} + +void SelectStmt::setSettingsClause(PtrTo clause) +{ + set(SETTINGS, clause); +} + +ASTPtr SelectStmt::convertToOld() const +{ + auto old_select = std::make_shared(); + + old_select->setExpression(ASTSelectQuery::Expression::SELECT, get(COLUMNS)->convertToOld()); + old_select->distinct = distinct; + old_select->group_by_with_totals = with_totals; + + switch(modifier_type) + { + case ModifierType::NONE: + break; + case ModifierType::CUBE: + old_select->group_by_with_cube = true; + break; + case ModifierType::ROLLUP: + old_select->group_by_with_rollup = true; + break; + } + + if (has(WITH)) old_select->setExpression(ASTSelectQuery::Expression::WITH, get(WITH)->convertToOld()); + if (has(FROM)) old_select->setExpression(ASTSelectQuery::Expression::TABLES, get(FROM)->convertToOld()); + if (has(ARRAY_JOIN)) old_select->tables()->children.push_back(get(ARRAY_JOIN)->convertToOld()); + if (has(PREWHERE)) old_select->setExpression(ASTSelectQuery::Expression::PREWHERE, get(PREWHERE)->convertToOld()); + if (has(WHERE)) old_select->setExpression(ASTSelectQuery::Expression::WHERE, get(WHERE)->convertToOld()); + if (has(GROUP_BY)) old_select->setExpression(ASTSelectQuery::Expression::GROUP_BY, get(GROUP_BY)->convertToOld()); + if (has(HAVING)) old_select->setExpression(ASTSelectQuery::Expression::HAVING, get(HAVING)->convertToOld()); + if (has(ORDER_BY)) old_select->setExpression(ASTSelectQuery::Expression::ORDER_BY, get(ORDER_BY)->convertToOld()); + if (has(LIMIT_BY)) + { + auto old_list = get(LIMIT_BY)->convertToOld(); + old_select->setExpression(ASTSelectQuery::Expression::LIMIT_BY, std::move(old_list->children[1])); + old_select->setExpression(ASTSelectQuery::Expression::LIMIT_BY_LENGTH, std::move(old_list->children[0]->children[0])); + if (old_list->children[0]->children.size() > 1) + old_select->setExpression(ASTSelectQuery::Expression::LIMIT_BY_OFFSET, std::move(old_list->children[0]->children[1])); + } + if (has(LIMIT)) + { + auto old_list = get(LIMIT)->convertToOld(); + old_select->limit_with_ties = get(LIMIT)->with_ties; + old_select->setExpression(ASTSelectQuery::Expression::LIMIT_LENGTH, std::move(old_list->children[0])); + if (old_list->children.size() > 1) + old_select->setExpression(ASTSelectQuery::Expression::LIMIT_OFFSET, std::move(old_list->children[1])); + } + if (has(SETTINGS)) old_select->setExpression(ASTSelectQuery::Expression::SETTINGS, get(SETTINGS)->convertToOld()); + + return old_select; +} + +SelectUnionQuery::SelectUnionQuery(PtrTo> stmts) : Query{stmts} +{ +} + +void SelectUnionQuery::appendSelect(PtrTo stmt) +{ + if (!has(STMTS)) push(std::make_shared>()); + get>(STMTS)->push(stmt); +} + +void SelectUnionQuery::appendSelect(PtrTo query) +{ + for (const auto & stmt : query->get(STMTS)->as &>()) + appendSelect(std::static_pointer_cast(stmt)); +} + +ASTPtr SelectUnionQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->list_of_selects = std::make_shared(); + query->children.push_back(query->list_of_selects); + + for (const auto & select : get(STMTS)->as &>()) + query->list_of_selects->children.push_back(select->convertToOld()); + + // TODO(ilezhankin): need to parse new UNION DISTINCT + query->list_of_modes + = ASTSelectWithUnionQuery::UnionModes(query->list_of_selects->children.size() - 1, ASTSelectWithUnionQuery::Mode::ALL); + + convertToOldPartially(query); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitWithClause(ClickHouseParser::WithClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitTopClause(ClickHouseParser::TopClauseContext *ctx) +{ + auto limit = std::make_shared(ColumnExpr::createLiteral(Literal::createNumber(ctx->DECIMAL_LITERAL()))); + return std::make_shared(!!ctx->WITH(), limit); +} + +antlrcpp::Any ParseTreeVisitor::visitFromClause(ClickHouseParser::FromClauseContext *ctx) +{ + return std::make_shared(visit(ctx->joinExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitArrayJoinClause(ClickHouseParser::ArrayJoinClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExprList()), !!ctx->LEFT()); +} + +antlrcpp::Any ParseTreeVisitor::visitPrewhereClause(ClickHouseParser::PrewhereClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitWhereClause(ClickHouseParser::WhereClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitGroupByClause(ClickHouseParser::GroupByClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitHavingClause(ClickHouseParser::HavingClauseContext *ctx) +{ + return std::make_shared(visit(ctx->columnExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitOrderByClause(ClickHouseParser::OrderByClauseContext *ctx) +{ + return std::make_shared(visit(ctx->orderExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitLimitByClause(ClickHouseParser::LimitByClauseContext *ctx) +{ + return std::make_shared(visit(ctx->limitExpr()), visit(ctx->columnExprList())); +} + +antlrcpp::Any ParseTreeVisitor::visitLimitClause(ClickHouseParser::LimitClauseContext *ctx) +{ + return std::make_shared(!!ctx->WITH(), visit(ctx->limitExpr()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitSettingsClause(ClickHouseParser::SettingsClauseContext *ctx) +{ + return std::make_shared(visit(ctx->settingExprList()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitSelectStmt(ClickHouseParser::SelectStmtContext *ctx) +{ + SelectStmt::ModifierType type = SelectStmt::ModifierType::NONE; + + if (ctx->CUBE() || (ctx->groupByClause() && ctx->groupByClause()->CUBE())) type = SelectStmt::ModifierType::CUBE; + else if (ctx->ROLLUP() || (ctx->groupByClause() && ctx->groupByClause()->ROLLUP())) type = SelectStmt::ModifierType::ROLLUP; + + auto select_stmt = std::make_shared(!!ctx->DISTINCT(), type, !!ctx->TOTALS(), visit(ctx->columnExprList())); + + if (ctx->topClause() && ctx->limitClause()) + throw Exception("Can not use TOP and LIMIT together", ErrorCodes::TOP_AND_LIMIT_TOGETHER); + + if (ctx->withClause()) select_stmt->setWithClause(visit(ctx->withClause())); + if (ctx->topClause()) select_stmt->setLimitClause(visit(ctx->topClause())); + if (ctx->fromClause()) select_stmt->setFromClause(visit(ctx->fromClause())); + if (ctx->arrayJoinClause()) select_stmt->setArrayJoinClause(visit(ctx->arrayJoinClause())); + if (ctx->prewhereClause()) select_stmt->setPrewhereClause(visit(ctx->prewhereClause())); + if (ctx->whereClause()) select_stmt->setWhereClause(visit(ctx->whereClause())); + if (ctx->groupByClause()) select_stmt->setGroupByClause(visit(ctx->groupByClause())); + if (ctx->havingClause()) select_stmt->setHavingClause(visit(ctx->havingClause())); + if (ctx->orderByClause()) select_stmt->setOrderByClause(visit(ctx->orderByClause())); + if (ctx->limitByClause()) select_stmt->setLimitByClause(visit(ctx->limitByClause())); + if (ctx->limitClause()) select_stmt->setLimitClause(visit(ctx->limitClause())); + if (ctx->settingsClause()) select_stmt->setSettingsClause(visit(ctx->settingsClause())); + + return select_stmt; +} + +antlrcpp::Any ParseTreeVisitor::visitSelectStmtWithParens(ClickHouseParser::SelectStmtWithParensContext *ctx) +{ + PtrTo query; + + if (ctx->selectStmt()) + { + query = std::make_shared(); + query->appendSelect(visit(ctx->selectStmt()).as>()); + } + else if (ctx->selectUnionStmt()) + { + query = visit(ctx->selectUnionStmt()); + } + + return query; +} + +antlrcpp::Any ParseTreeVisitor::visitSelectUnionStmt(ClickHouseParser::SelectUnionStmtContext *ctx) +{ + auto select_union_query = std::make_shared(); + for (auto * stmt : ctx->selectStmtWithParens()) select_union_query->appendSelect(visit(stmt).as>()); + return select_union_query; +} + +} diff --git a/src/Parsers/New/AST/SelectUnionQuery.h b/src/Parsers/New/AST/SelectUnionQuery.h new file mode 100644 index 00000000000..0d9b74dd192 --- /dev/null +++ b/src/Parsers/New/AST/SelectUnionQuery.h @@ -0,0 +1,170 @@ +#pragma once + +#include + +#include + +#include + + +namespace DB::AST +{ + +// Clauses + +using WithClause = SimpleClause; + +class FromClause : public INode +{ + public: + explicit FromClause(PtrTo join_expr); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // JoinExpr + }; +}; + +class ArrayJoinClause : public INode +{ + public: + ArrayJoinClause(PtrTo expr_list, bool left); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPRS = 0, // ColumnExprList + }; + + const bool left; +}; + +using PrewhereClause = SimpleClause; + +using GroupByClause = SimpleClause; + +using HavingClause = SimpleClause; + +class LimitByClause : public INode +{ + public: + LimitByClause(PtrTo expr, PtrTo expr_list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + LIMIT = 0, // LimitExpr + EXPRS = 1, // ColumnExprList + }; +}; + +class LimitClause : public INode +{ + public: + LimitClause(bool with_ties, PtrTo expr); + + ASTPtr convertToOld() const override; + + const bool with_ties; // FIXME: bad interface, because old AST stores this inside ASTSelectQuery. + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // LimitExpr + }; +}; + +class SettingsClause : public INode +{ + public: + explicit SettingsClause(PtrTo expr_list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPRS = 0, // SettingExprList + }; +}; + +// Statement + +class SelectStmt : public INode +{ + public: + enum class ModifierType + { + NONE, + CUBE, + ROLLUP, + }; + + SelectStmt(bool distinct_, ModifierType type, bool totals, PtrTo expr_list); + + void setWithClause(PtrTo clause); + void setFromClause(PtrTo clause); + void setArrayJoinClause(PtrTo clause); + void setPrewhereClause(PtrTo clause); + void setWhereClause(PtrTo clause); + void setGroupByClause(PtrTo clause); + void setHavingClause(PtrTo clause); + void setOrderByClause(PtrTo clause); + void setLimitByClause(PtrTo clause); + void setLimitClause(PtrTo clause); + void setSettingsClause(PtrTo clause); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + COLUMNS = 0, // ColumnExprList + WITH, // WithClause (optional) + FROM, // FromClause (optional) + ARRAY_JOIN, // ArrayJoinClause (optional) + PREWHERE, // PrewhereClause (optional) + WHERE, // WhereClause (optional) + GROUP_BY, // GroupByClause (optional) + HAVING, // HavingClause (optional) + ORDER_BY, // OrderByClause (optional) + LIMIT_BY, // LimitByClause (optional) + LIMIT, // LimitClause (optional) + SETTINGS, // SettingsClause (optional) + + MAX_INDEX, + }; + + const ModifierType modifier_type; + const bool distinct, with_totals; +}; + +class SelectUnionQuery : public Query +{ + public: + SelectUnionQuery() = default; + explicit SelectUnionQuery(PtrTo> stmts); + + void appendSelect(PtrTo stmt); + void appendSelect(PtrTo query); + void shouldBeScalar() { is_scalar = true; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + STMTS = 0, // List + }; + + bool is_scalar = false; +}; + +} diff --git a/src/Parsers/New/AST/SetQuery.cpp b/src/Parsers/New/AST/SetQuery.cpp new file mode 100644 index 00000000000..1f7087e21e3 --- /dev/null +++ b/src/Parsers/New/AST/SetQuery.cpp @@ -0,0 +1,43 @@ +#include + +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +SetQuery::SetQuery(PtrTo list) : Query{list} +{ +} + +ASTPtr SetQuery::convertToOld() const +{ + auto expr = std::make_shared(); + + for (const auto & child : get(EXPRS)->as()) + { + const auto * setting = child->as(); + expr->changes.emplace_back(setting->getName()->getName(), setting->getValue()->convertToOld()->as()->value); + } + + return expr; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitSetStmt(ClickHouseParser::SetStmtContext *ctx) +{ + return std::make_shared(visit(ctx->settingExprList()).as>()); +} + +} diff --git a/src/Parsers/New/AST/SetQuery.h b/src/Parsers/New/AST/SetQuery.h new file mode 100644 index 00000000000..451371f6896 --- /dev/null +++ b/src/Parsers/New/AST/SetQuery.h @@ -0,0 +1,23 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class SetQuery : public Query +{ + public: + explicit SetQuery(PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPRS = 0, // SettingExprList + }; +}; + +} diff --git a/src/Parsers/New/AST/SettingExpr.cpp b/src/Parsers/New/AST/SettingExpr.cpp new file mode 100644 index 00000000000..e38b9d57ff8 --- /dev/null +++ b/src/Parsers/New/AST/SettingExpr.cpp @@ -0,0 +1,33 @@ +#include + +#include +#include + +#include + + +namespace DB::AST +{ + +SettingExpr::SettingExpr(PtrTo name, PtrTo value) : INode{name, value} +{ +} + +} + +namespace DB +{ + +antlrcpp::Any ParseTreeVisitor::visitSettingExprList(ClickHouseParser::SettingExprListContext *ctx) +{ + auto expr_list = std::make_shared(); + for (auto* expr : ctx->settingExpr()) expr_list->push(visit(expr)); + return expr_list; +} + +antlrcpp::Any ParseTreeVisitor::visitSettingExpr(ClickHouseParser::SettingExprContext *ctx) +{ + return std::make_shared(visit(ctx->identifier()), visit(ctx->literal())); +} + +} diff --git a/src/Parsers/New/AST/SettingExpr.h b/src/Parsers/New/AST/SettingExpr.h new file mode 100644 index 00000000000..8dad6166189 --- /dev/null +++ b/src/Parsers/New/AST/SettingExpr.h @@ -0,0 +1,25 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class SettingExpr : public INode +{ + public: + SettingExpr(PtrTo name, PtrTo value); + + auto getName() const { return std::static_pointer_cast(get(NAME)); } + auto getValue() const { return std::static_pointer_cast(get(VALUE)); } + + private: + enum ChildIndex : UInt8 + { + NAME = 0, + VALUE = 1, + }; +}; + +} diff --git a/src/Parsers/New/AST/ShowCreateQuery.cpp b/src/Parsers/New/AST/ShowCreateQuery.cpp new file mode 100644 index 00000000000..4210f2cb67c --- /dev/null +++ b/src/Parsers/New/AST/ShowCreateQuery.cpp @@ -0,0 +1,96 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo ShowCreateQuery::createDatabase(PtrTo identifier) +{ + return PtrTo(new ShowCreateQuery(QueryType::DATABASE, {identifier})); +} + +// static +PtrTo ShowCreateQuery::createDictionary(PtrTo identifier) +{ + return PtrTo(new ShowCreateQuery(QueryType::DICTIONARY, {identifier})); +} + +// static +PtrTo ShowCreateQuery::createTable(bool temporary, PtrTo identifier) +{ + PtrTo query(new ShowCreateQuery(QueryType::TABLE, {identifier})); + query->temporary = temporary; + return query; +} + +ShowCreateQuery::ShowCreateQuery(QueryType type, PtrList exprs) : Query(exprs), query_type(type) +{ +} + +ASTPtr ShowCreateQuery::convertToOld() const +{ + switch(query_type) + { + case QueryType::DATABASE: + { + auto query = std::make_shared(); + query->database = get(IDENTIFIER)->getName(); + return query; + } + case QueryType::DICTIONARY: + { + auto query = std::make_shared(); + auto table_id = getTableIdentifier(get(IDENTIFIER)->convertToOld()); + + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + + return query; + } + case QueryType::TABLE: + { + auto query = std::make_shared(); + auto table_id = getTableIdentifier(get(IDENTIFIER)->convertToOld()); + + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + query->temporary = temporary; + + return query; + } + } + __builtin_unreachable(); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitShowCreateDatabaseStmt(ClickHouseParser::ShowCreateDatabaseStmtContext *ctx) +{ + return ShowCreateQuery::createDatabase(visit(ctx->databaseIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitShowCreateDictionaryStmt(ClickHouseParser::ShowCreateDictionaryStmtContext * ctx) +{ + return ShowCreateQuery::createDictionary(visit(ctx->tableIdentifier())); +} + +antlrcpp::Any ParseTreeVisitor::visitShowCreateTableStmt(ClickHouseParser::ShowCreateTableStmtContext *ctx) +{ + return ShowCreateQuery::createTable(!!ctx->TEMPORARY(), visit(ctx->tableIdentifier())); +} + +} diff --git a/src/Parsers/New/AST/ShowCreateQuery.h b/src/Parsers/New/AST/ShowCreateQuery.h new file mode 100644 index 00000000000..5f4d31bce60 --- /dev/null +++ b/src/Parsers/New/AST/ShowCreateQuery.h @@ -0,0 +1,36 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class ShowCreateQuery : public Query +{ + public: + static PtrTo createDatabase(PtrTo identifier); + static PtrTo createDictionary(PtrTo identifier); + static PtrTo createTable(bool temporary, PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + IDENTIFIER = 0, // DatabaseIdentifier or TableIdentifier + }; + enum class QueryType + { + DATABASE, + DICTIONARY, + TABLE, + }; + + QueryType query_type; + bool temporary = false; + + ShowCreateQuery(QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/ShowQuery.cpp b/src/Parsers/New/AST/ShowQuery.cpp new file mode 100644 index 00000000000..e6ea357dd70 --- /dev/null +++ b/src/Parsers/New/AST/ShowQuery.cpp @@ -0,0 +1,49 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo ShowQuery::createDictionaries(PtrTo from) +{ + return PtrTo(new ShowQuery(QueryType::DICTIONARIES, {from})); +} + +ShowQuery::ShowQuery(QueryType type, PtrList exprs) : Query(exprs), query_type(type) +{ +} + +ASTPtr ShowQuery::convertToOld() const +{ + auto query = std::make_shared(); + + switch(query_type) + { + case QueryType::DICTIONARIES: + query->dictionaries = true; + if (has(FROM)) query->from = get(FROM)->getQualifiedName(); + break; + } + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitShowDictionariesStmt(ClickHouseParser::ShowDictionariesStmtContext *ctx) +{ + auto from = ctx->databaseIdentifier() ? visit(ctx->databaseIdentifier()).as>() : nullptr; + return ShowQuery::createDictionaries(from); +} + +} diff --git a/src/Parsers/New/AST/ShowQuery.h b/src/Parsers/New/AST/ShowQuery.h new file mode 100644 index 00000000000..93951676bbb --- /dev/null +++ b/src/Parsers/New/AST/ShowQuery.h @@ -0,0 +1,32 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class ShowQuery : public Query +{ + public: + static PtrTo createDictionaries(PtrTo from); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + FROM = 0, // DatabaseIdentifier (optional) + }; + + enum class QueryType + { + DICTIONARIES, + }; + + const QueryType query_type; + + ShowQuery(QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/SystemQuery.cpp b/src/Parsers/New/AST/SystemQuery.cpp new file mode 100644 index 00000000000..a9c4b01f218 --- /dev/null +++ b/src/Parsers/New/AST/SystemQuery.cpp @@ -0,0 +1,191 @@ +#include + +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +// static +PtrTo SystemQuery::createDistributedSends(bool stop, PtrTo identifier) +{ + PtrTo query(new SystemQuery(QueryType::DISTRIBUTED_SENDS, {identifier})); + query->stop = stop; + return query; +} + +// static +PtrTo SystemQuery::createFetches(bool stop, PtrTo identifier) +{ + PtrTo query(new SystemQuery(QueryType::FETCHES, {identifier})); + query->stop = stop; + return query; +} + +// static +PtrTo SystemQuery::createFlushDistributed(PtrTo identifier) +{ + return PtrTo(new SystemQuery(QueryType::FLUSH_DISTRIBUTED, {identifier})); +} + +// static +PtrTo SystemQuery::createFlushLogs() +{ + return PtrTo(new SystemQuery(QueryType::FLUSH_LOGS, {})); +} + +// static +PtrTo SystemQuery::createMerges(bool stop, PtrTo identifier) +{ + PtrTo query(new SystemQuery(QueryType::MERGES, {identifier})); + query->stop = stop; + return query; +} + +// static +PtrTo SystemQuery::createReloadDictionaries() +{ + return PtrTo(new SystemQuery(QueryType::RELOAD_DICTIONARIES, {})); +} + +// static +PtrTo SystemQuery::createReloadDictionary(PtrTo identifier) +{ + return PtrTo(new SystemQuery(QueryType::RELOAD_DICTIONARY, {identifier})); +} + +// static +PtrTo SystemQuery::createReplicatedSends(bool stop) +{ + PtrTo query(new SystemQuery(QueryType::REPLICATED_SENDS, {})); + query->stop = stop; + return query; +} + +// static +PtrTo SystemQuery::createSyncReplica(PtrTo identifier) +{ + return PtrTo(new SystemQuery(QueryType::SYNC_REPLICA, {identifier})); +} + +// static +PtrTo SystemQuery::createTTLMerges(bool stop, PtrTo identifier) +{ + PtrTo query(new SystemQuery(QueryType::TTL_MERGES, {identifier})); + query->stop = stop; + return query; +} + +SystemQuery::SystemQuery(QueryType type, PtrList exprs) : Query(exprs), query_type(type) +{ +} + +ASTPtr SystemQuery::convertToOld() const +{ + auto query = std::make_shared(); + + switch(query_type) + { + case QueryType::DISTRIBUTED_SENDS: + query->type = stop ? ASTSystemQuery::Type::STOP_DISTRIBUTED_SENDS : ASTSystemQuery::Type::START_DISTRIBUTED_SENDS; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + case QueryType::FETCHES: + query->type = stop ? ASTSystemQuery::Type::STOP_FETCHES : ASTSystemQuery::Type::START_FETCHES; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + case QueryType::FLUSH_DISTRIBUTED: + query->type = ASTSystemQuery::Type::FLUSH_DISTRIBUTED; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + case QueryType::FLUSH_LOGS: + query->type = ASTSystemQuery::Type::FLUSH_LOGS; + break; + case QueryType::MERGES: + query->type = stop ? ASTSystemQuery::Type::STOP_MERGES : ASTSystemQuery::Type::START_MERGES; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + case QueryType::RELOAD_DICTIONARIES: + query->type = ASTSystemQuery::Type::RELOAD_DICTIONARIES; + break; + case QueryType::RELOAD_DICTIONARY: + query->type = ASTSystemQuery::Type::RELOAD_DICTIONARY; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->target_dictionary = table_id.table_name; + } + break; + case QueryType::REPLICATED_SENDS: + query->type = stop ? ASTSystemQuery::Type::STOP_REPLICATED_SENDS : ASTSystemQuery::Type::START_REPLICATED_SENDS; + break; + case QueryType::SYNC_REPLICA: + query->type = ASTSystemQuery::Type::SYNC_REPLICA; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + case QueryType::TTL_MERGES: + query->type = stop ? ASTSystemQuery::Type::STOP_TTL_MERGES : ASTSystemQuery::Type::START_TTL_MERGES; + { + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + } + break; + } + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitSystemStmt(ClickHouseParser::SystemStmtContext *ctx) +{ + if (ctx->FLUSH() && ctx->DISTRIBUTED()) return SystemQuery::createFlushDistributed(visit(ctx->tableIdentifier())); + if (ctx->FLUSH() && ctx->LOGS()) return SystemQuery::createFlushLogs(); + if (ctx->DISTRIBUTED() && ctx->SENDS()) return SystemQuery::createDistributedSends(!!ctx->STOP(), visit(ctx->tableIdentifier())); + if (ctx->FETCHES()) return SystemQuery::createFetches(!!ctx->STOP(), visit(ctx->tableIdentifier())); + if (ctx->MERGES()) + { + if (ctx->TTL()) return SystemQuery::createTTLMerges(!!ctx->STOP(), visit(ctx->tableIdentifier())); + else return SystemQuery::createMerges(!!ctx->STOP(), visit(ctx->tableIdentifier())); + } + if (ctx->RELOAD()) + { + if (ctx->DICTIONARIES()) return SystemQuery::createReloadDictionaries(); + if (ctx->DICTIONARY()) return SystemQuery::createReloadDictionary(visit(ctx->tableIdentifier())); + } + if (ctx->REPLICATED() && ctx->SENDS()) return SystemQuery::createReplicatedSends(!!ctx->STOP()); + if (ctx->SYNC() && ctx->REPLICA()) return SystemQuery::createSyncReplica(visit(ctx->tableIdentifier())); + __builtin_unreachable(); +} + +} diff --git a/src/Parsers/New/AST/SystemQuery.h b/src/Parsers/New/AST/SystemQuery.h new file mode 100644 index 00000000000..98a5cfd0932 --- /dev/null +++ b/src/Parsers/New/AST/SystemQuery.h @@ -0,0 +1,50 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class SystemQuery : public Query +{ + public: + static PtrTo createDistributedSends(bool stop, PtrTo identifier); + static PtrTo createFetches(bool stop, PtrTo identifier); + static PtrTo createFlushDistributed(PtrTo identifier); + static PtrTo createFlushLogs(); + static PtrTo createMerges(bool stop, PtrTo identifier); + static PtrTo createReloadDictionaries(); + static PtrTo createReloadDictionary(PtrTo identifier); + static PtrTo createReplicatedSends(bool stop); + static PtrTo createSyncReplica(PtrTo identifier); + static PtrTo createTTLMerges(bool stop, PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, + }; + enum class QueryType + { + DISTRIBUTED_SENDS, + FETCHES, + FLUSH_DISTRIBUTED, + FLUSH_LOGS, + MERGES, + RELOAD_DICTIONARIES, + RELOAD_DICTIONARY, + REPLICATED_SENDS, + SYNC_REPLICA, + TTL_MERGES, + }; + + QueryType query_type; + bool stop = false; + + SystemQuery(QueryType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/TableElementExpr.cpp b/src/Parsers/New/AST/TableElementExpr.cpp new file mode 100644 index 00000000000..1336ea06b27 --- /dev/null +++ b/src/Parsers/New/AST/TableElementExpr.cpp @@ -0,0 +1,233 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +CodecArgExpr::CodecArgExpr(PtrTo identifier, PtrTo list) : INode{identifier, list} +{ +} + +ASTPtr CodecArgExpr::convertToOld() const +{ + auto func = std::make_shared(); + + func->name = get(NAME)->getName(); + if (has(ARGS)) + { + func->arguments = get(ARGS)->convertToOld(); + func->children.push_back(func->arguments); + } + + return func; +} + +CodecExpr::CodecExpr(PtrTo list) : INode{list} +{ +} + +ASTPtr CodecExpr::convertToOld() const +{ + auto func = std::make_shared(); + + func->name = "codec"; + func->arguments = get(ARGS)->convertToOld(); + func->children.push_back(func->arguments); + + return func; +} + +TableColumnPropertyExpr::TableColumnPropertyExpr(PropertyType type, PtrTo expr) : INode{expr}, property_type(type) +{ +} + +ASTPtr TableColumnPropertyExpr::convertToOld() const +{ + return get(EXPR)->convertToOld(); +} + +// static +PtrTo TableElementExpr::createColumn( + PtrTo name, + PtrTo type, + PtrTo property, + PtrTo comment, + PtrTo codec, + PtrTo ttl) +{ + return PtrTo(new TableElementExpr(ExprType::COLUMN, {name, type, property, comment, codec, ttl})); +} + +// static +PtrTo TableElementExpr::createConstraint(PtrTo identifier, PtrTo expr) +{ + return PtrTo(new TableElementExpr(ExprType::CONSTRAINT, {identifier, expr})); +} + +// static +PtrTo +TableElementExpr::createIndex(PtrTo name, PtrTo expr, PtrTo type, PtrTo granularity) +{ + return PtrTo(new TableElementExpr(ExprType::INDEX, {name, expr, type, granularity})); +} + +TableElementExpr::TableElementExpr(ExprType type, PtrList exprs) : INode(exprs), expr_type(type) +{ +} + +ASTPtr TableElementExpr::convertToOld() const +{ + switch(expr_type) + { + case ExprType::COLUMN: + { + auto expr = std::make_shared(); + + expr->name = get(NAME)->getName(); // FIXME: do we have correct nested identifier here already? + if (has(TYPE)) + { + expr->type = get(TYPE)->convertToOld(); + expr->children.push_back(expr->type); + } + if (has(PROPERTY)) + { + switch(get(PROPERTY)->getType()) + { + case TableColumnPropertyExpr::PropertyType::ALIAS: + expr->default_specifier = "ALIAS"; + break; + case TableColumnPropertyExpr::PropertyType::DEFAULT: + expr->default_specifier = "DEFAULT"; + break; + case TableColumnPropertyExpr::PropertyType::MATERIALIZED: + expr->default_specifier = "MATERIALIZED"; + break; + } + expr->default_expression = get(PROPERTY)->convertToOld(); + expr->children.push_back(expr->default_expression); + } + if (has(COMMENT)) + { + expr->comment = get(COMMENT)->convertToOld(); + expr->children.push_back(expr->comment); + } + if (has(CODEC)) + { + expr->codec = get(CODEC)->convertToOld(); + expr->children.push_back(expr->codec); + } + if (has(TTL)) + { + expr->ttl = get(TTL)->convertToOld(); + expr->children.push_back(expr->ttl); + } + + return expr; + } + case ExprType::CONSTRAINT: + { + auto expr = std::make_shared(); + + expr->name = get(NAME)->getName(); + expr->set(expr->expr, get(EXPR)->convertToOld()); + + return expr; + } + case ExprType::INDEX: + { + auto expr = std::make_shared(); + + expr->name = get(NAME)->getName(); + expr->set(expr->expr, get(EXPR)->convertToOld()); + expr->set(expr->type, get(INDEX_TYPE)->convertToOld()); + expr->granularity = get(GRANULARITY)->as().value_or(0); // FIXME: throw exception instead of default. + + return expr; + } + } + __builtin_unreachable(); +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitCodecArgExpr(ClickHouseParser::CodecArgExprContext *ctx) +{ + auto list = ctx->columnExprList() ? visit(ctx->columnExprList()).as>() : nullptr; + return std::make_shared(visit(ctx->identifier()), list); +} + +antlrcpp::Any ParseTreeVisitor::visitCodecExpr(ClickHouseParser::CodecExprContext *ctx) +{ + auto list = std::make_shared(); + for (auto * arg : ctx->codecArgExpr()) list->push(visit(arg)); + return std::make_shared(list); +} + +antlrcpp::Any ParseTreeVisitor::visitTableColumnDfnt(ClickHouseParser::TableColumnDfntContext *ctx) +{ + PtrTo property; + PtrTo type; + PtrTo comment; + PtrTo codec; + PtrTo ttl; + + if (ctx->tableColumnPropertyExpr()) property = visit(ctx->tableColumnPropertyExpr()); + if (ctx->columnTypeExpr()) type = visit(ctx->columnTypeExpr()); + if (ctx->STRING_LITERAL()) comment = Literal::createString(ctx->STRING_LITERAL()); + if (ctx->codecExpr()) codec = visit(ctx->codecExpr()); + if (ctx->TTL()) ttl = visit(ctx->columnExpr()); + + return TableElementExpr::createColumn(visit(ctx->nestedIdentifier()), type, property, comment, codec, ttl); +} + +antlrcpp::Any ParseTreeVisitor::visitTableColumnPropertyExpr(ClickHouseParser::TableColumnPropertyExprContext *ctx) +{ + TableColumnPropertyExpr::PropertyType type; + + if (ctx->DEFAULT()) type = TableColumnPropertyExpr::PropertyType::DEFAULT; + else if (ctx->MATERIALIZED()) type = TableColumnPropertyExpr::PropertyType::MATERIALIZED; + else if (ctx->ALIAS()) type = TableColumnPropertyExpr::PropertyType::ALIAS; + else __builtin_unreachable(); + + return std::make_shared(type, visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitTableElementExprColumn(ClickHouseParser::TableElementExprColumnContext *ctx) +{ + return visit(ctx->tableColumnDfnt()); +} + +antlrcpp::Any ParseTreeVisitor::visitTableElementExprConstraint(ClickHouseParser::TableElementExprConstraintContext *ctx) +{ + return TableElementExpr::createConstraint(visit(ctx->identifier()), visit(ctx->columnExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitTableElementExprIndex(ClickHouseParser::TableElementExprIndexContext *ctx) +{ + return visit(ctx->tableIndexDfnt()); +} + +antlrcpp::Any ParseTreeVisitor::visitTableIndexDfnt(ClickHouseParser::TableIndexDfntContext *ctx) +{ + return TableElementExpr::createIndex( + visit(ctx->nestedIdentifier()), + visit(ctx->columnExpr()), + visit(ctx->columnTypeExpr()), + Literal::createNumber(ctx->DECIMAL_LITERAL())); +} + +} diff --git a/src/Parsers/New/AST/TableElementExpr.h b/src/Parsers/New/AST/TableElementExpr.h new file mode 100644 index 00000000000..ca0a4f23bdd --- /dev/null +++ b/src/Parsers/New/AST/TableElementExpr.h @@ -0,0 +1,116 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class CodecArgExpr : public INode +{ + public: + CodecArgExpr(PtrTo identifier, PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // Identifier + ARGS = 1, // ColumnExprList (optional) + }; +}; + +class CodecExpr : public INode +{ + public: + explicit CodecExpr(PtrTo list); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + ARGS = 0, // CodecArgList + }; +}; + +class TableColumnPropertyExpr : public INode +{ + public: + enum class PropertyType + { + DEFAULT, + MATERIALIZED, + ALIAS, + }; + + TableColumnPropertyExpr(PropertyType type, PtrTo expr); + + auto getType() const { return property_type; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // ColumnExpr + }; + + PropertyType property_type; +}; + +class TableElementExpr : public INode +{ + public: + enum class ExprType + { + COLUMN, + CONSTRAINT, + INDEX, + }; + + static PtrTo createColumn( + PtrTo name, + PtrTo type, + PtrTo property, + PtrTo comment, + PtrTo codec, + PtrTo ttl); + + static PtrTo createConstraint(PtrTo identifier, PtrTo expr); + + static PtrTo + createIndex(PtrTo name, PtrTo expr, PtrTo type, PtrTo granularity); + + auto getType() const { return expr_type; } + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex: UInt8 + { + // COLUMN + NAME = 0, // Identifier + TYPE = 1, // ColumnExprType (optional) + PROPERTY = 2, // TableColumnPropertyExpr + COMMENT = 3, // StringLiteral (optional) + CODEC = 4, // CodecExpr (optional) + TTL = 5, // ColumnExpr (optional) + + // CONSTRAINT + // NAME = 0, + // EXPR = 1, + + // INDEX + EXPR = 1, // ColumnExpr + INDEX_TYPE = 2, // ColumnTypeExpr + GRANULARITY = 3, // NumberLiteral + }; + + const ExprType expr_type; + + TableElementExpr(ExprType type, PtrList exprs); +}; + +} diff --git a/src/Parsers/New/AST/TableExpr.cpp b/src/Parsers/New/AST/TableExpr.cpp new file mode 100644 index 00000000000..9d79a797085 --- /dev/null +++ b/src/Parsers/New/AST/TableExpr.cpp @@ -0,0 +1,190 @@ +#include + +#include +#include +#include +#include + +#include +#include +#include + + +namespace DB::AST +{ + +TableArgExpr::TableArgExpr(PtrTo literal) : INode{literal} +{ +} + +TableArgExpr::TableArgExpr(PtrTo function) : INode{function} +{ +} + +TableArgExpr::TableArgExpr(PtrTo identifier) : INode{identifier} +{ +} + +ASTPtr TableArgExpr::convertToOld() const +{ + return get(EXPR)->convertToOld(); +} + +// static +PtrTo TableExpr::createAlias(PtrTo expr, PtrTo alias) +{ + return PtrTo(new TableExpr(ExprType::ALIAS, {expr, alias})); +} + +// static +PtrTo TableExpr::createFunction(PtrTo function) +{ + return PtrTo(new TableExpr(ExprType::FUNCTION, {function})); +} + +// static +PtrTo TableExpr::createIdentifier(PtrTo identifier) +{ + return PtrTo(new TableExpr(ExprType::IDENTIFIER, {identifier})); +} + +// static +PtrTo TableExpr::createSubquery(PtrTo subquery) +{ + return PtrTo(new TableExpr(ExprType::SUBQUERY, {subquery})); +} + +ASTPtr TableExpr::convertToOld() const +{ + // TODO: SAMPLE and RATIO also goes here somehow + + switch (expr_type) + { + case ExprType::ALIAS: + { + auto expr = get(EXPR)->convertToOld(); + auto * table_expr = expr->as(); + + if (table_expr->database_and_table_name) + table_expr->database_and_table_name->setAlias(get(ALIAS)->getName()); + else if (table_expr->table_function) + table_expr->table_function->setAlias(get(ALIAS)->getName()); + else if (table_expr->subquery) + table_expr->subquery->setAlias(get(ALIAS)->getName()); + + return expr; + } + case ExprType::FUNCTION: + { + auto expr = std::make_shared(); + auto func = get(FUNCTION)->convertToOld(); + + expr->table_function = func; + expr->children.push_back(func); + + return expr; + } + case ExprType::IDENTIFIER: + { + auto expr = std::make_shared(); + + expr->database_and_table_name = get(IDENTIFIER)->convertToOld(); + expr->children.emplace_back(expr->database_and_table_name); + + return expr; + } + case ExprType::SUBQUERY: + { + auto expr = std::make_shared(); + + expr->subquery = std::make_shared(); + expr->subquery->children.push_back(get(SUBQUERY)->convertToOld()); + expr->children.push_back(expr->subquery); + + return expr; + } + } + __builtin_unreachable(); +} + +TableExpr::TableExpr(TableExpr::ExprType type, PtrList exprs) : INode(exprs), expr_type(type) +{ +} + +String TableExpr::dumpInfo() const +{ + switch(expr_type) + { + case ExprType::ALIAS: return "ALIAS"; + case ExprType::FUNCTION: return "FUNCTION"; + case ExprType::IDENTIFIER: return "IDENTIFIER"; + case ExprType::SUBQUERY: return "SUBQUERY"; + } + __builtin_unreachable(); +} + +TableFunctionExpr::TableFunctionExpr(PtrTo name, PtrTo args) : INode{name, args} +{ +} + +ASTPtr TableFunctionExpr::convertToOld() const +{ + auto func = std::make_shared(); + + func->name = get(NAME)->getName(); + func->arguments = has(ARGS) ? get(ARGS)->convertToOld() : std::make_shared()->convertToOld(); + func->children.push_back(func->arguments); + + return func; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitTableArgExpr(ClickHouseParser::TableArgExprContext *ctx) +{ + if (ctx->literal()) return std::make_shared(visit(ctx->literal()).as>()); + if (ctx->tableFunctionExpr()) return std::make_shared(visit(ctx->tableFunctionExpr()).as>()); + if (ctx->tableIdentifier()) return std::make_shared(visit(ctx->tableIdentifier()).as>()); + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitTableArgList(ClickHouseParser::TableArgListContext * ctx) +{ + auto list = std::make_shared(); + for (auto * arg : ctx->tableArgExpr()) list->push(visit(arg)); + return list; +} + +antlrcpp::Any ParseTreeVisitor::visitTableExprAlias(ClickHouseParser::TableExprAliasContext *ctx) +{ + if (ctx->AS()) return TableExpr::createAlias(visit(ctx->tableExpr()), visit(ctx->identifier())); + else return TableExpr::createAlias(visit(ctx->tableExpr()), visit(ctx->alias())); +} + +antlrcpp::Any ParseTreeVisitor::visitTableExprFunction(ClickHouseParser::TableExprFunctionContext *ctx) +{ + return TableExpr::createFunction(visit(ctx->tableFunctionExpr())); +} + +antlrcpp::Any ParseTreeVisitor::visitTableExprIdentifier(ClickHouseParser::TableExprIdentifierContext *ctx) +{ + return TableExpr::createIdentifier(visit(ctx->tableIdentifier()).as>()); +} + +antlrcpp::Any ParseTreeVisitor::visitTableExprSubquery(ClickHouseParser::TableExprSubqueryContext *ctx) +{ + return TableExpr::createSubquery(visit(ctx->selectUnionStmt())); +} + +antlrcpp::Any ParseTreeVisitor::visitTableFunctionExpr(ClickHouseParser::TableFunctionExprContext *ctx) +{ + auto list = ctx->tableArgList() ? visit(ctx->tableArgList()).as>() : nullptr; + return std::make_shared(visit(ctx->identifier()), list); +} + +} diff --git a/src/Parsers/New/AST/TableExpr.h b/src/Parsers/New/AST/TableExpr.h new file mode 100644 index 00000000000..08a443fd217 --- /dev/null +++ b/src/Parsers/New/AST/TableExpr.h @@ -0,0 +1,81 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class TableArgExpr : public INode +{ + public: + explicit TableArgExpr(PtrTo literal); + explicit TableArgExpr(PtrTo function); + explicit TableArgExpr(PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + EXPR = 0, // Literal or TableFunctionExpr or TableIdentifier + }; +}; + +class TableExpr : public INode +{ + public: + static PtrTo createAlias(PtrTo expr, PtrTo alias); + static PtrTo createFunction(PtrTo function); + static PtrTo createIdentifier(PtrTo identifier); + static PtrTo createSubquery(PtrTo subquery); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + // ALIAS + EXPR = 0, // TableExpr + ALIAS = 1, // Identifier + + // FUNCTION + FUNCTION = 0, // TableFunctionExpr + + // IDENTIFIER + IDENTIFIER = 0, // TableIdentifier + + // SUBQUERY + SUBQUERY = 0, // SelectUnionSubquery + }; + enum class ExprType + { + ALIAS, + FUNCTION, + IDENTIFIER, + SUBQUERY, + }; + + ExprType expr_type; + + TableExpr(ExprType type, PtrList exprs); + + String dumpInfo() const override; +}; + +class TableFunctionExpr : public INode +{ + public: + TableFunctionExpr(PtrTo name, PtrTo args); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, + ARGS = 1, + }; +}; + +} diff --git a/src/Parsers/New/AST/TruncateQuery.cpp b/src/Parsers/New/AST/TruncateQuery.cpp new file mode 100644 index 00000000000..43d7f7ed042 --- /dev/null +++ b/src/Parsers/New/AST/TruncateQuery.cpp @@ -0,0 +1,47 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +TruncateQuery::TruncateQuery(PtrTo cluster, bool temporary_, bool if_exists_, PtrTo identifier) + : DDLQuery(cluster, {identifier}), temporary(temporary_), if_exists(if_exists_) +{ +} + +ASTPtr TruncateQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->kind = ASTDropQuery::Truncate; + query->if_exists = if_exists; + query->temporary = temporary; + query->cluster = cluster_name; + + query->table = get(NAME)->getName(); + if (auto database = get(NAME)->getDatabase()) + query->database = database->getName(); + + convertToOldPartially(query); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitTruncateStmt(ClickHouseParser::TruncateStmtContext *ctx) +{ + auto cluster = ctx->clusterClause() ? visit(ctx->clusterClause()).as>() : nullptr; + return std::make_shared(cluster, !!ctx->TEMPORARY(), !!ctx->IF(), visit(ctx->tableIdentifier())); +} + +} diff --git a/src/Parsers/New/AST/TruncateQuery.h b/src/Parsers/New/AST/TruncateQuery.h new file mode 100644 index 00000000000..463e561890f --- /dev/null +++ b/src/Parsers/New/AST/TruncateQuery.h @@ -0,0 +1,25 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class TruncateQuery : public DDLQuery +{ + public: + TruncateQuery(PtrTo cluster, bool temporary, bool if_exists, PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + NAME = 0, // TableIdentifier + }; + + const bool temporary, if_exists; +}; + +} diff --git a/src/Parsers/New/AST/UseQuery.cpp b/src/Parsers/New/AST/UseQuery.cpp new file mode 100644 index 00000000000..4dd4d564c27 --- /dev/null +++ b/src/Parsers/New/AST/UseQuery.cpp @@ -0,0 +1,37 @@ +#include + +#include +#include +#include + + +namespace DB::AST +{ + +UseQuery::UseQuery(PtrTo identifier) +{ + push(identifier); +} + +ASTPtr UseQuery::convertToOld() const +{ + auto query = std::make_shared(); + + query->database = get(DATABASE)->getName(); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitUseStmt(ClickHouseParser::UseStmtContext *ctx) +{ + return std::make_shared(visit(ctx->databaseIdentifier()).as>()); +} + +} diff --git a/src/Parsers/New/AST/UseQuery.h b/src/Parsers/New/AST/UseQuery.h new file mode 100644 index 00000000000..c71f271edb5 --- /dev/null +++ b/src/Parsers/New/AST/UseQuery.h @@ -0,0 +1,23 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class UseQuery : public Query +{ + public: + explicit UseQuery(PtrTo identifier); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + DATABASE = 0, + }; +}; + +} diff --git a/src/Parsers/New/AST/WatchQuery.cpp b/src/Parsers/New/AST/WatchQuery.cpp new file mode 100644 index 00000000000..224ff935f97 --- /dev/null +++ b/src/Parsers/New/AST/WatchQuery.cpp @@ -0,0 +1,51 @@ +#include + +#include +#include +#include +#include +#include +#include + + +namespace DB::AST +{ + +WatchQuery::WatchQuery(bool events_, PtrTo identifier, PtrTo literal) + : Query{identifier, literal}, events(events_) +{ +} + +ASTPtr WatchQuery::convertToOld() const +{ + auto query = std::make_shared(); + + auto table_id = getTableIdentifier(get(TABLE)->convertToOld()); + query->database = table_id.database_name; + query->table = table_id.table_name; + query->uuid = table_id.uuid; + + query->is_watch_events = events; + + if (has(LIMIT)) + query->limit_length = get(LIMIT)->convertToOld(); + + convertToOldPartially(query); + + return query; +} + +} + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitWatchStmt(ClickHouseParser::WatchStmtContext *ctx) +{ + auto limit = ctx->DECIMAL_LITERAL() ? Literal::createNumber(ctx->DECIMAL_LITERAL()) : nullptr; + return std::make_shared(!!ctx->EVENTS(), visit(ctx->tableIdentifier()), limit); +} + +} diff --git a/src/Parsers/New/AST/WatchQuery.h b/src/Parsers/New/AST/WatchQuery.h new file mode 100644 index 00000000000..041f71b75ff --- /dev/null +++ b/src/Parsers/New/AST/WatchQuery.h @@ -0,0 +1,26 @@ +#pragma once + +#include + + +namespace DB::AST +{ + +class WatchQuery : public Query +{ + public: + WatchQuery(bool events, PtrTo identifier, PtrTo literal); + + ASTPtr convertToOld() const override; + + private: + enum ChildIndex : UInt8 + { + TABLE = 0, // TableIdentifier + LIMIT = 1, // NumberLiteral (optional) + }; + + const bool events; +}; + +} diff --git a/src/Parsers/New/AST/fwd_decl.h b/src/Parsers/New/AST/fwd_decl.h new file mode 100644 index 00000000000..555e9cb5727 --- /dev/null +++ b/src/Parsers/New/AST/fwd_decl.h @@ -0,0 +1,89 @@ +#pragma once + +#include +#include + + +namespace DB::AST +{ + +class INode; + +template +class List; + +template +class SimpleClause; + +template +using PtrTo = std::shared_ptr; + +using Ptr = PtrTo<>; +using PtrList = std::vector; + +class AssignmentExpr; +class CodecArgExpr; +class CodecExpr; +class ColumnExpr; +class ColumnFunctionExpr; +class ColumnIdentifier; +class ColumnLambdaExpr; +class ColumnTypeExpr; +class DatabaseIdentifier; +class DictionaryArgExpr; +class DictionaryAttributeExpr; +class EngineClause; +class EngineExpr; +class EnumValue; +class Identifier; +class JoinExpr; +class JsonExpr; +class JsonValue; +class LimitExpr; +class Literal; +class NumberLiteral; +class OrderExpr; +class PartitionClause; +class Query; +class RatioExpr; +class TableSchemaClause; +class SelectStmt; +class SelectUnionQuery; +class SettingExpr; +class SettingsClause; +class StringLiteral; +class TableArgExpr; +class TableColumnPropertyExpr; +class TableElementExpr; +class TableExpr; +class TableFunctionExpr; +class TableIdentifier; +class TTLExpr; + +using AssignmentExprList = List; +using CodecArgList = List; +using ColumnExprList = List; +using ColumnNameList = List; +using ColumnParamList = ColumnExprList; +using ColumnTypeExprList = List; +using DictionaryArgList = List; +using DictionaryAttributeList = List; +using EnumValueList = List; +using JsonExprList = List; +using JsonValueList = List; +using OrderExprList = List; +using QueryList = List; +using SettingExprList = List; +using TableArgList = List; +using TableElementList = List; +using TTLExprList = List; + +using ClusterClause = SimpleClause; +using DestinationClause = SimpleClause; +using OrderByClause = SimpleClause; +using PrimaryKeyClause = SimpleClause; +using TTLClause = SimpleClause; +using UUIDClause = SimpleClause; +using WhereClause = SimpleClause; + +} diff --git a/src/Parsers/New/CMakeLists.txt b/src/Parsers/New/CMakeLists.txt new file mode 100644 index 00000000000..1c3fd8368be --- /dev/null +++ b/src/Parsers/New/CMakeLists.txt @@ -0,0 +1,97 @@ +set (SRCS + AST/AlterTableQuery.cpp + AST/AttachQuery.cpp + AST/CheckQuery.cpp + AST/ColumnExpr.cpp + AST/ColumnTypeExpr.cpp + AST/CreateDatabaseQuery.cpp + AST/CreateDictionaryQuery.cpp + AST/CreateLiveViewQuery.cpp + AST/CreateMaterializedViewQuery.cpp + AST/CreateTableQuery.cpp + AST/CreateViewQuery.cpp + AST/DDLQuery.cpp + AST/DescribeQuery.cpp + AST/DropQuery.cpp + AST/EngineExpr.cpp + AST/ExistsQuery.cpp + AST/ExplainQuery.cpp + AST/Identifier.cpp + AST/InsertQuery.cpp + AST/JoinExpr.cpp + AST/KillQuery.cpp + AST/LimitExpr.cpp + AST/Literal.cpp + AST/OptimizeQuery.cpp + AST/OrderExpr.cpp + AST/Query.cpp + AST/RatioExpr.cpp + AST/RenameQuery.cpp + AST/SelectUnionQuery.cpp + AST/SetQuery.cpp + AST/SettingExpr.cpp + AST/ShowCreateQuery.cpp + AST/ShowQuery.cpp + AST/SystemQuery.cpp + AST/TableElementExpr.cpp + AST/TableExpr.cpp + AST/TruncateQuery.cpp + AST/UseQuery.cpp + AST/WatchQuery.cpp + CharInputStream.cpp + ClickHouseLexer.cpp + ClickHouseParser.cpp + ClickHouseParserVisitor.cpp + LexerErrorListener.cpp + parseQuery.cpp + ParserErrorListener.cpp + ParseTreeVisitor.cpp +) + +add_library (clickhouse_parsers_new ${SRCS}) + +# XXX: hack for old clang-10! +check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE) + +# XXX: hack for old gcc-10! +check_cxx_compiler_flag("-Wshadow" HAS_SHADOW) + +target_compile_options (clickhouse_parsers_new + PRIVATE + -Wno-c++20-compat + -Wno-deprecated-this-capture + -Wno-documentation-html + -Wno-documentation + -Wno-documentation-deprecated-sync + -Wno-shadow-field + -Wno-unused-parameter + + PUBLIC + -Wno-extra-semi + -Wno-inconsistent-missing-destructor-override +) +if (HAS_SUGGEST_DESTRUCTOR_OVERRIDE) + target_compile_options (clickhouse_parsers_new + PRIVATE + -Wno-suggest-destructor-override + ) +endif () +if (HAS_SHADOW) + target_compile_options (clickhouse_parsers_new + PRIVATE + -Wno-shadow + ) +endif () + +target_link_libraries (clickhouse_parsers_new PUBLIC antlr4-runtime clickhouse_common_io clickhouse_parsers) + +# ANTLR generates u8 string literals, which are incompatible with |std::string| in C++20. +# See https://github.com/antlr/antlr4/issues/2683 +set_source_files_properties( + ClickHouseLexer.cpp + ClickHouseParser.cpp + PROPERTIES COMPILE_FLAGS -std=c++17 +) + +# Disable clang-tidy for whole target. +set_target_properties(clickhouse_parsers_new PROPERTIES CXX_CLANG_TIDY "") diff --git a/src/Parsers/New/CharInputStream.cpp b/src/Parsers/New/CharInputStream.cpp new file mode 100644 index 00000000000..820666ff801 --- /dev/null +++ b/src/Parsers/New/CharInputStream.cpp @@ -0,0 +1,79 @@ +#include + +#include + + +namespace DB +{ + +using namespace antlr4; + +CharInputStream::CharInputStream(const char * begin, const char * end) +{ + d = begin; + s = end - begin; +} + +size_t CharInputStream::LA(ssize_t i) +{ + if (i == 0) return 0; // undefined + + ssize_t position = static_cast(p); + if (i < 0) + { + i++; // e.g., translate LA(-1) to use offset i=0; then data[p+0-1] + if ((position + i - 1) < 0) + return IntStream::EOF; // invalid; no char before first char + } + + if ((position + i - 1) >= static_cast(s)) + return IntStream::EOF; + + return d[static_cast((position + i - 1))]; +} + +void CharInputStream::consume() +{ + if (p >= s) + { + assert(LA(1) == IntStream::EOF); + throw IllegalStateException("cannot consume EOF"); + } + + if (p < s) ++p; +} + +void CharInputStream::seek(size_t i) +{ + if (i <= p) + { + p = i; // just jump; don't update stream state (line, ...) + return; + } + + // seek forward, consume until p hits index or s (whichever comes first) + i = std::min(i, s); + while (p < i) + consume(); +} + +std::string CharInputStream::getText(const antlr4::misc::Interval &interval) +{ + if (interval.a < 0 || interval.b < 0) + return {}; + + size_t start = static_cast(interval.a); + size_t stop = static_cast(interval.b); + + + if (stop >= s) + stop = s - 1; + + size_t count = stop - start + 1; + if (start >= s) + return ""; + + return {d + start, count}; +} + +} diff --git a/src/Parsers/New/CharInputStream.h b/src/Parsers/New/CharInputStream.h new file mode 100644 index 00000000000..735f5c2bc38 --- /dev/null +++ b/src/Parsers/New/CharInputStream.h @@ -0,0 +1,34 @@ +#pragma once + +#include + + +namespace DB +{ + +class CharInputStream : public antlr4::CharStream +{ + public: + CharInputStream(const char * begin, const char * end); + + private: + const char * d; + size_t s = 0; + size_t p = 0; + + size_t index() override { return p; } + size_t size() override { return s; } + + size_t LA(ssize_t i) override; + void consume() override; + void seek(size_t i) override; + + ssize_t mark() override { return -1; } + void release(ssize_t marker) override {}; + + std::string getSourceName() const override { return "CharInputStream"; }; + std::string getText(const antlr4::misc::Interval &interval) override; + std::string toString() const override { return {d, s}; } +}; + +} diff --git a/src/Parsers/New/ClickHouseLexer.cpp b/src/Parsers/New/ClickHouseLexer.cpp new file mode 100644 index 00000000000..832e5969426 --- /dev/null +++ b/src/Parsers/New/ClickHouseLexer.cpp @@ -0,0 +1,1581 @@ + +// Generated from ClickHouseLexer.g4 by ANTLR 4.7.2 + + +#include "ClickHouseLexer.h" + + +using namespace antlr4; + +using namespace DB; + +ClickHouseLexer::ClickHouseLexer(CharStream *input) : Lexer(input) { + _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); +} + +ClickHouseLexer::~ClickHouseLexer() { + delete _interpreter; +} + +std::string ClickHouseLexer::getGrammarFileName() const { + return "ClickHouseLexer.g4"; +} + +const std::vector& ClickHouseLexer::getRuleNames() const { + return _ruleNames; +} + +const std::vector& ClickHouseLexer::getChannelNames() const { + return _channelNames; +} + +const std::vector& ClickHouseLexer::getModeNames() const { + return _modeNames; +} + +const std::vector& ClickHouseLexer::getTokenNames() const { + return _tokenNames; +} + +dfa::Vocabulary& ClickHouseLexer::getVocabulary() const { + return _vocabulary; +} + +const std::vector ClickHouseLexer::getSerializedATN() const { + return _serializedATN; +} + +const atn::ATN& ClickHouseLexer::getATN() const { + return _atn; +} + + + + +// Static vars and initialization. +std::vector ClickHouseLexer::_decisionToDFA; +atn::PredictionContextCache ClickHouseLexer::_sharedContextCache; + +// We own the ATN which in turn owns the ATN states. +atn::ATN ClickHouseLexer::_atn; +std::vector ClickHouseLexer::_serializedATN; + +std::vector ClickHouseLexer::_ruleNames = { + u8"ADD", u8"AFTER", u8"ALIAS", u8"ALL", u8"ALTER", u8"AND", u8"ANTI", + u8"ANY", u8"ARRAY", u8"AS", u8"ASCENDING", u8"ASOF", u8"ASYNC", u8"ATTACH", + u8"BETWEEN", u8"BOTH", u8"BY", u8"CASE", u8"CAST", u8"CHECK", u8"CLEAR", + u8"CLUSTER", u8"CODEC", u8"COLLATE", u8"COLUMN", u8"COMMENT", u8"CONSTRAINT", + u8"CREATE", u8"CROSS", u8"CUBE", u8"DATABASE", u8"DATABASES", u8"DATE", + u8"DAY", u8"DEDUPLICATE", u8"DEFAULT", u8"DELAY", u8"DELETE", u8"DESC", + u8"DESCENDING", u8"DESCRIBE", u8"DETACH", u8"DICTIONARIES", u8"DICTIONARY", + u8"DISK", u8"DISTINCT", u8"DISTRIBUTED", u8"DROP", u8"ELSE", u8"END", + u8"ENGINE", u8"EVENTS", u8"EXISTS", u8"EXPLAIN", u8"EXPRESSION", u8"EXTRACT", + u8"FETCHES", u8"FINAL", u8"FIRST", u8"FLUSH", u8"FOR", u8"FORMAT", u8"FREEZE", + u8"FROM", u8"FULL", u8"FUNCTION", u8"GLOBAL", u8"GRANULARITY", u8"GROUP", + u8"HAVING", u8"HIERARCHICAL", u8"HOUR", u8"ID", u8"IF", u8"ILIKE", u8"IN", + u8"INDEX", u8"INF", u8"INJECTIVE", u8"INNER", u8"INSERT", u8"INTERVAL", + u8"INTO", u8"IS", u8"IS_OBJECT_ID", u8"JOIN", u8"KEY", u8"KILL", u8"LAST", + u8"LAYOUT", u8"LEADING", u8"LEFT", u8"LIFETIME", u8"LIKE", u8"LIMIT", + u8"LIVE", u8"LOCAL", u8"LOGS", u8"MATERIALIZED", u8"MAX", u8"MERGES", + u8"MIN", u8"MINUTE", u8"MODIFY", u8"MONTH", u8"MOVE", u8"MUTATION", u8"NAN_SQL", + u8"NO", u8"NOT", u8"NULL_SQL", u8"NULLS", u8"OFFSET", u8"ON", u8"OPTIMIZE", + u8"OR", u8"ORDER", u8"OUTER", u8"OUTFILE", u8"PARTITION", u8"POPULATE", + u8"PREWHERE", u8"PRIMARY", u8"QUARTER", u8"RANGE", u8"RELOAD", u8"REMOVE", + u8"RENAME", u8"REPLACE", u8"REPLICA", u8"REPLICATED", u8"RIGHT", u8"ROLLUP", + u8"SAMPLE", u8"SECOND", u8"SELECT", u8"SEMI", u8"SENDS", u8"SET", u8"SETTINGS", + u8"SHOW", u8"SOURCE", u8"START", u8"STOP", u8"SUBSTRING", u8"SYNC", u8"SYNTAX", + u8"SYSTEM", u8"TABLE", u8"TABLES", u8"TEMPORARY", u8"TEST", u8"THEN", + u8"TIES", u8"TIMEOUT", u8"TIMESTAMP", u8"TO", u8"TOP", u8"TOTALS", u8"TRAILING", + u8"TRIM", u8"TRUNCATE", u8"TTL", u8"TYPE", u8"UNION", u8"UPDATE", u8"USE", + u8"USING", u8"UUID", u8"VALUES", u8"VIEW", u8"VOLUME", u8"WATCH", u8"WEEK", + u8"WHEN", u8"WHERE", u8"WITH", u8"YEAR", u8"JSON_FALSE", u8"JSON_TRUE", + u8"IDENTIFIER", u8"FLOATING_LITERAL", u8"OCTAL_LITERAL", u8"DECIMAL_LITERAL", + u8"HEXADECIMAL_LITERAL", u8"STRING_LITERAL", u8"A", u8"B", u8"C", u8"D", + u8"E", u8"F", u8"G", u8"H", u8"I", u8"J", u8"K", u8"L", u8"M", u8"N", + u8"O", u8"P", u8"Q", u8"R", u8"S", u8"T", u8"U", u8"V", u8"W", u8"X", + u8"Y", u8"Z", u8"LETTER", u8"OCT_DIGIT", u8"DEC_DIGIT", u8"HEX_DIGIT", + u8"ARROW", u8"ASTERISK", u8"BACKQUOTE", u8"BACKSLASH", u8"COLON", u8"COMMA", + u8"CONCAT", u8"DASH", u8"DOT", u8"EQ_DOUBLE", u8"EQ_SINGLE", u8"GE", u8"GT", + u8"LBRACE", u8"LBRACKET", u8"LE", u8"LPAREN", u8"LT", u8"NOT_EQ", u8"PERCENT", + u8"PLUS", u8"QUERY", u8"QUOTE_DOUBLE", u8"QUOTE_SINGLE", u8"RBRACE", u8"RBRACKET", + u8"RPAREN", u8"SEMICOLON", u8"SLASH", u8"UNDERSCORE", u8"MULTI_LINE_COMMENT", + u8"SINGLE_LINE_COMMENT", u8"WHITESPACE" +}; + +std::vector ClickHouseLexer::_channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" +}; + +std::vector ClickHouseLexer::_modeNames = { + u8"DEFAULT_MODE" +}; + +std::vector ClickHouseLexer::_literalNames = { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", u8"'false'", + u8"'true'", "", "", "", "", "", "", u8"'->'", u8"'*'", u8"'`'", u8"'\\'", + u8"':'", u8"','", u8"'||'", u8"'-'", u8"'.'", u8"'=='", u8"'='", u8"'>='", + u8"'>'", u8"'{'", u8"'['", u8"'<='", u8"'('", u8"'<'", "", u8"'%'", u8"'+'", + u8"'?'", u8"'\"'", u8"'''", u8"'}'", u8"']'", u8"')'", u8"';'", u8"'/'", + u8"'_'" +}; + +std::vector ClickHouseLexer::_symbolicNames = { + "", u8"ADD", u8"AFTER", u8"ALIAS", u8"ALL", u8"ALTER", u8"AND", u8"ANTI", + u8"ANY", u8"ARRAY", u8"AS", u8"ASCENDING", u8"ASOF", u8"ASYNC", u8"ATTACH", + u8"BETWEEN", u8"BOTH", u8"BY", u8"CASE", u8"CAST", u8"CHECK", u8"CLEAR", + u8"CLUSTER", u8"CODEC", u8"COLLATE", u8"COLUMN", u8"COMMENT", u8"CONSTRAINT", + u8"CREATE", u8"CROSS", u8"CUBE", u8"DATABASE", u8"DATABASES", u8"DATE", + u8"DAY", u8"DEDUPLICATE", u8"DEFAULT", u8"DELAY", u8"DELETE", u8"DESC", + u8"DESCENDING", u8"DESCRIBE", u8"DETACH", u8"DICTIONARIES", u8"DICTIONARY", + u8"DISK", u8"DISTINCT", u8"DISTRIBUTED", u8"DROP", u8"ELSE", u8"END", + u8"ENGINE", u8"EVENTS", u8"EXISTS", u8"EXPLAIN", u8"EXPRESSION", u8"EXTRACT", + u8"FETCHES", u8"FINAL", u8"FIRST", u8"FLUSH", u8"FOR", u8"FORMAT", u8"FREEZE", + u8"FROM", u8"FULL", u8"FUNCTION", u8"GLOBAL", u8"GRANULARITY", u8"GROUP", + u8"HAVING", u8"HIERARCHICAL", u8"HOUR", u8"ID", u8"IF", u8"ILIKE", u8"IN", + u8"INDEX", u8"INF", u8"INJECTIVE", u8"INNER", u8"INSERT", u8"INTERVAL", + u8"INTO", u8"IS", u8"IS_OBJECT_ID", u8"JOIN", u8"KEY", u8"KILL", u8"LAST", + u8"LAYOUT", u8"LEADING", u8"LEFT", u8"LIFETIME", u8"LIKE", u8"LIMIT", + u8"LIVE", u8"LOCAL", u8"LOGS", u8"MATERIALIZED", u8"MAX", u8"MERGES", + u8"MIN", u8"MINUTE", u8"MODIFY", u8"MONTH", u8"MOVE", u8"MUTATION", u8"NAN_SQL", + u8"NO", u8"NOT", u8"NULL_SQL", u8"NULLS", u8"OFFSET", u8"ON", u8"OPTIMIZE", + u8"OR", u8"ORDER", u8"OUTER", u8"OUTFILE", u8"PARTITION", u8"POPULATE", + u8"PREWHERE", u8"PRIMARY", u8"QUARTER", u8"RANGE", u8"RELOAD", u8"REMOVE", + u8"RENAME", u8"REPLACE", u8"REPLICA", u8"REPLICATED", u8"RIGHT", u8"ROLLUP", + u8"SAMPLE", u8"SECOND", u8"SELECT", u8"SEMI", u8"SENDS", u8"SET", u8"SETTINGS", + u8"SHOW", u8"SOURCE", u8"START", u8"STOP", u8"SUBSTRING", u8"SYNC", u8"SYNTAX", + u8"SYSTEM", u8"TABLE", u8"TABLES", u8"TEMPORARY", u8"TEST", u8"THEN", + u8"TIES", u8"TIMEOUT", u8"TIMESTAMP", u8"TO", u8"TOP", u8"TOTALS", u8"TRAILING", + u8"TRIM", u8"TRUNCATE", u8"TTL", u8"TYPE", u8"UNION", u8"UPDATE", u8"USE", + u8"USING", u8"UUID", u8"VALUES", u8"VIEW", u8"VOLUME", u8"WATCH", u8"WEEK", + u8"WHEN", u8"WHERE", u8"WITH", u8"YEAR", u8"JSON_FALSE", u8"JSON_TRUE", + u8"IDENTIFIER", u8"FLOATING_LITERAL", u8"OCTAL_LITERAL", u8"DECIMAL_LITERAL", + u8"HEXADECIMAL_LITERAL", u8"STRING_LITERAL", u8"ARROW", u8"ASTERISK", + u8"BACKQUOTE", u8"BACKSLASH", u8"COLON", u8"COMMA", u8"CONCAT", u8"DASH", + u8"DOT", u8"EQ_DOUBLE", u8"EQ_SINGLE", u8"GE", u8"GT", u8"LBRACE", u8"LBRACKET", + u8"LE", u8"LPAREN", u8"LT", u8"NOT_EQ", u8"PERCENT", u8"PLUS", u8"QUERY", + u8"QUOTE_DOUBLE", u8"QUOTE_SINGLE", u8"RBRACE", u8"RBRACKET", u8"RPAREN", + u8"SEMICOLON", u8"SLASH", u8"UNDERSCORE", u8"MULTI_LINE_COMMENT", u8"SINGLE_LINE_COMMENT", + u8"WHITESPACE" +}; + +dfa::Vocabulary ClickHouseLexer::_vocabulary(_literalNames, _symbolicNames); + +std::vector ClickHouseLexer::_tokenNames; + +ClickHouseLexer::Initializer::Initializer() { + // This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there. + for (size_t i = 0; i < _symbolicNames.size(); ++i) { + std::string name = _vocabulary.getLiteralName(i); + if (name.empty()) { + name = _vocabulary.getSymbolicName(i); + } + + if (name.empty()) { + _tokenNames.push_back(""); + } else { + _tokenNames.push_back(name); + } + } + + _serializedATN = { + 0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964, + 0x2, 0xdd, 0x7e2, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, + 0x4, 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, + 0x9, 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, 0x9, 0xa, + 0x4, 0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x4, 0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, 0xfa, 0x3, 0xfa, 0x3, 0xfa, + 0x3, 0xfa, 0x3, 0x7c8, 0x2, 0xfb, 0x3, 0x3, 0x5, 0x4, 0x7, 0x5, 0x9, + 0x6, 0xb, 0x7, 0xd, 0x8, 0xf, 0x9, 0x11, 0xa, 0x13, 0xb, 0x15, 0xc, + 0x17, 0xd, 0x19, 0xe, 0x1b, 0xf, 0x1d, 0x10, 0x1f, 0x11, 0x21, 0x12, + 0x23, 0x13, 0x25, 0x14, 0x27, 0x15, 0x29, 0x16, 0x2b, 0x17, 0x2d, 0x18, + 0x2f, 0x19, 0x31, 0x1a, 0x33, 0x1b, 0x35, 0x1c, 0x37, 0x1d, 0x39, 0x1e, + 0x3b, 0x1f, 0x3d, 0x20, 0x3f, 0x21, 0x41, 0x22, 0x43, 0x23, 0x45, 0x24, + 0x47, 0x25, 0x49, 0x26, 0x4b, 0x27, 0x4d, 0x28, 0x4f, 0x29, 0x51, 0x2a, + 0x53, 0x2b, 0x55, 0x2c, 0x57, 0x2d, 0x59, 0x2e, 0x5b, 0x2f, 0x5d, 0x30, + 0x5f, 0x31, 0x61, 0x32, 0x63, 0x33, 0x65, 0x34, 0x67, 0x35, 0x69, 0x36, + 0x6b, 0x37, 0x6d, 0x38, 0x6f, 0x39, 0x71, 0x3a, 0x73, 0x3b, 0x75, 0x3c, + 0x77, 0x3d, 0x79, 0x3e, 0x7b, 0x3f, 0x7d, 0x40, 0x7f, 0x41, 0x81, 0x42, + 0x83, 0x43, 0x85, 0x44, 0x87, 0x45, 0x89, 0x46, 0x8b, 0x47, 0x8d, 0x48, + 0x8f, 0x49, 0x91, 0x4a, 0x93, 0x4b, 0x95, 0x4c, 0x97, 0x4d, 0x99, 0x4e, + 0x9b, 0x4f, 0x9d, 0x50, 0x9f, 0x51, 0xa1, 0x52, 0xa3, 0x53, 0xa5, 0x54, + 0xa7, 0x55, 0xa9, 0x56, 0xab, 0x57, 0xad, 0x58, 0xaf, 0x59, 0xb1, 0x5a, + 0xb3, 0x5b, 0xb5, 0x5c, 0xb7, 0x5d, 0xb9, 0x5e, 0xbb, 0x5f, 0xbd, 0x60, + 0xbf, 0x61, 0xc1, 0x62, 0xc3, 0x63, 0xc5, 0x64, 0xc7, 0x65, 0xc9, 0x66, + 0xcb, 0x67, 0xcd, 0x68, 0xcf, 0x69, 0xd1, 0x6a, 0xd3, 0x6b, 0xd5, 0x6c, + 0xd7, 0x6d, 0xd9, 0x6e, 0xdb, 0x6f, 0xdd, 0x70, 0xdf, 0x71, 0xe1, 0x72, + 0xe3, 0x73, 0xe5, 0x74, 0xe7, 0x75, 0xe9, 0x76, 0xeb, 0x77, 0xed, 0x78, + 0xef, 0x79, 0xf1, 0x7a, 0xf3, 0x7b, 0xf5, 0x7c, 0xf7, 0x7d, 0xf9, 0x7e, + 0xfb, 0x7f, 0xfd, 0x80, 0xff, 0x81, 0x101, 0x82, 0x103, 0x83, 0x105, + 0x84, 0x107, 0x85, 0x109, 0x86, 0x10b, 0x87, 0x10d, 0x88, 0x10f, 0x89, + 0x111, 0x8a, 0x113, 0x8b, 0x115, 0x8c, 0x117, 0x8d, 0x119, 0x8e, 0x11b, + 0x8f, 0x11d, 0x90, 0x11f, 0x91, 0x121, 0x92, 0x123, 0x93, 0x125, 0x94, + 0x127, 0x95, 0x129, 0x96, 0x12b, 0x97, 0x12d, 0x98, 0x12f, 0x99, 0x131, + 0x9a, 0x133, 0x9b, 0x135, 0x9c, 0x137, 0x9d, 0x139, 0x9e, 0x13b, 0x9f, + 0x13d, 0xa0, 0x13f, 0xa1, 0x141, 0xa2, 0x143, 0xa3, 0x145, 0xa4, 0x147, + 0xa5, 0x149, 0xa6, 0x14b, 0xa7, 0x14d, 0xa8, 0x14f, 0xa9, 0x151, 0xaa, + 0x153, 0xab, 0x155, 0xac, 0x157, 0xad, 0x159, 0xae, 0x15b, 0xaf, 0x15d, + 0xb0, 0x15f, 0xb1, 0x161, 0xb2, 0x163, 0xb3, 0x165, 0xb4, 0x167, 0xb5, + 0x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 0x15d, 0x67a, 0x3, 0x2, + 0x2, 0x2, 0x15f, 0x67f, 0x3, 0x2, 0x2, 0x2, 0x161, 0x684, 0x3, 0x2, + 0x2, 0x2, 0x163, 0x68a, 0x3, 0x2, 0x2, 0x2, 0x165, 0x699, 0x3, 0x2, + 0x2, 0x2, 0x167, 0x69b, 0x3, 0x2, 0x2, 0x2, 0x169, 0x6a1, 0x3, 0x2, + 0x2, 0x2, 0x16b, 0x6d0, 0x3, 0x2, 0x2, 0x2, 0x16d, 0x71e, 0x3, 0x2, + 0x2, 0x2, 0x16f, 0x720, 0x3, 0x2, 0x2, 0x2, 0x171, 0x727, 0x3, 0x2, + 0x2, 0x2, 0x173, 0x72b, 0x3, 0x2, 0x2, 0x2, 0x175, 0x732, 0x3, 0x2, + 0x2, 0x2, 0x177, 0x741, 0x3, 0x2, 0x2, 0x2, 0x179, 0x743, 0x3, 0x2, + 0x2, 0x2, 0x17b, 0x745, 0x3, 0x2, 0x2, 0x2, 0x17d, 0x747, 0x3, 0x2, + 0x2, 0x2, 0x17f, 0x749, 0x3, 0x2, 0x2, 0x2, 0x181, 0x74b, 0x3, 0x2, + 0x2, 0x2, 0x183, 0x74d, 0x3, 0x2, 0x2, 0x2, 0x185, 0x74f, 0x3, 0x2, + 0x2, 0x2, 0x187, 0x751, 0x3, 0x2, 0x2, 0x2, 0x189, 0x753, 0x3, 0x2, + 0x2, 0x2, 0x18b, 0x755, 0x3, 0x2, 0x2, 0x2, 0x18d, 0x757, 0x3, 0x2, + 0x2, 0x2, 0x18f, 0x759, 0x3, 0x2, 0x2, 0x2, 0x191, 0x75b, 0x3, 0x2, + 0x2, 0x2, 0x193, 0x75d, 0x3, 0x2, 0x2, 0x2, 0x195, 0x75f, 0x3, 0x2, + 0x2, 0x2, 0x197, 0x761, 0x3, 0x2, 0x2, 0x2, 0x199, 0x763, 0x3, 0x2, + 0x2, 0x2, 0x19b, 0x765, 0x3, 0x2, 0x2, 0x2, 0x19d, 0x767, 0x3, 0x2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c7, 0x2, 0x207, 0x208, 0x5, 0x18d, + 0xc7, 0x2, 0x208, 0xa, 0x3, 0x2, 0x2, 0x2, 0x209, 0x20a, 0x5, 0x177, + 0xbc, 0x2, 0x20a, 0x20b, 0x5, 0x18d, 0xc7, 0x2, 0x20b, 0x20c, 0x5, 0x19d, + 0xcf, 0x2, 0x20c, 0x20d, 0x5, 0x17f, 0xc0, 0x2, 0x20d, 0x20e, 0x5, 0x199, + 0xcd, 0x2, 0x20e, 0xc, 0x3, 0x2, 0x2, 0x2, 0x20f, 0x210, 0x5, 0x177, + 0xbc, 0x2, 0x210, 0x211, 0x5, 0x191, 0xc9, 0x2, 0x211, 0x212, 0x5, 0x17d, + 0xbf, 0x2, 0x212, 0xe, 0x3, 0x2, 0x2, 0x2, 0x213, 0x214, 0x5, 0x177, + 0xbc, 0x2, 0x214, 0x215, 0x5, 0x191, 0xc9, 0x2, 0x215, 0x216, 0x5, 0x19d, + 0xcf, 0x2, 0x216, 0x217, 0x5, 0x187, 0xc4, 0x2, 0x217, 0x10, 0x3, 0x2, + 0x2, 0x2, 0x218, 0x219, 0x5, 0x177, 0xbc, 0x2, 0x219, 0x21a, 0x5, 0x191, + 0xc9, 0x2, 0x21a, 0x21b, 0x5, 0x1a7, 0xd4, 0x2, 0x21b, 0x12, 0x3, 0x2, + 0x2, 0x2, 0x21c, 0x21d, 0x5, 0x177, 0xbc, 0x2, 0x21d, 0x21e, 0x5, 0x199, + 0xcd, 0x2, 0x21e, 0x21f, 0x5, 0x199, 0xcd, 0x2, 0x21f, 0x220, 0x5, 0x177, + 0xbc, 0x2, 0x220, 0x221, 0x5, 0x1a7, 0xd4, 0x2, 0x221, 0x14, 0x3, 0x2, + 0x2, 0x2, 0x222, 0x223, 0x5, 0x177, 0xbc, 0x2, 0x223, 0x224, 0x5, 0x19b, + 0xce, 0x2, 0x224, 0x16, 0x3, 0x2, 0x2, 0x2, 0x225, 0x226, 0x5, 0x177, + 0xbc, 0x2, 0x226, 0x227, 0x5, 0x19b, 0xce, 0x2, 0x227, 0x228, 0x5, 0x17b, + 0xbe, 0x2, 0x228, 0x234, 0x3, 0x2, 0x2, 0x2, 0x229, 0x22a, 0x5, 0x177, + 0xbc, 0x2, 0x22a, 0x22b, 0x5, 0x19b, 0xce, 0x2, 0x22b, 0x22c, 0x5, 0x17b, + 0xbe, 0x2, 0x22c, 0x22d, 0x5, 0x17f, 0xc0, 0x2, 0x22d, 0x22e, 0x5, 0x191, + 0xc9, 0x2, 0x22e, 0x22f, 0x5, 0x17d, 0xbf, 0x2, 0x22f, 0x230, 0x5, 0x187, + 0xc4, 0x2, 0x230, 0x231, 0x5, 0x191, 0xc9, 0x2, 0x231, 0x232, 0x5, 0x183, + 0xc2, 0x2, 0x232, 0x234, 0x3, 0x2, 0x2, 0x2, 0x233, 0x225, 0x3, 0x2, + 0x2, 0x2, 0x233, 0x229, 0x3, 0x2, 0x2, 0x2, 0x234, 0x18, 0x3, 0x2, 0x2, + 0x2, 0x235, 0x236, 0x5, 0x177, 0xbc, 0x2, 0x236, 0x237, 0x5, 0x19b, + 0xce, 0x2, 0x237, 0x238, 0x5, 0x193, 0xca, 0x2, 0x238, 0x239, 0x5, 0x181, + 0xc1, 0x2, 0x239, 0x1a, 0x3, 0x2, 0x2, 0x2, 0x23a, 0x23b, 0x5, 0x177, + 0xbc, 0x2, 0x23b, 0x23c, 0x5, 0x19b, 0xce, 0x2, 0x23c, 0x23d, 0x5, 0x1a7, + 0xd4, 0x2, 0x23d, 0x23e, 0x5, 0x191, 0xc9, 0x2, 0x23e, 0x23f, 0x5, 0x17b, + 0xbe, 0x2, 0x23f, 0x1c, 0x3, 0x2, 0x2, 0x2, 0x240, 0x241, 0x5, 0x177, + 0xbc, 0x2, 0x241, 0x242, 0x5, 0x19d, 0xcf, 0x2, 0x242, 0x243, 0x5, 0x19d, + 0xcf, 0x2, 0x243, 0x244, 0x5, 0x177, 0xbc, 0x2, 0x244, 0x245, 0x5, 0x17b, + 0xbe, 0x2, 0x245, 0x246, 0x5, 0x185, 0xc3, 0x2, 0x246, 0x1e, 0x3, 0x2, + 0x2, 0x2, 0x247, 0x248, 0x5, 0x179, 0xbd, 0x2, 0x248, 0x249, 0x5, 0x17f, + 0xc0, 0x2, 0x249, 0x24a, 0x5, 0x19d, 0xcf, 0x2, 0x24a, 0x24b, 0x5, 0x1a3, + 0xd2, 0x2, 0x24b, 0x24c, 0x5, 0x17f, 0xc0, 0x2, 0x24c, 0x24d, 0x5, 0x17f, + 0xc0, 0x2, 0x24d, 0x24e, 0x5, 0x191, 0xc9, 0x2, 0x24e, 0x20, 0x3, 0x2, + 0x2, 0x2, 0x24f, 0x250, 0x5, 0x179, 0xbd, 0x2, 0x250, 0x251, 0x5, 0x193, + 0xca, 0x2, 0x251, 0x252, 0x5, 0x19d, 0xcf, 0x2, 0x252, 0x253, 0x5, 0x185, + 0xc3, 0x2, 0x253, 0x22, 0x3, 0x2, 0x2, 0x2, 0x254, 0x255, 0x5, 0x179, + 0xbd, 0x2, 0x255, 0x256, 0x5, 0x1a7, 0xd4, 0x2, 0x256, 0x24, 0x3, 0x2, + 0x2, 0x2, 0x257, 0x258, 0x5, 0x17b, 0xbe, 0x2, 0x258, 0x259, 0x5, 0x177, + 0xbc, 0x2, 0x259, 0x25a, 0x5, 0x19b, 0xce, 0x2, 0x25a, 0x25b, 0x5, 0x17f, + 0xc0, 0x2, 0x25b, 0x26, 0x3, 0x2, 0x2, 0x2, 0x25c, 0x25d, 0x5, 0x17b, + 0xbe, 0x2, 0x25d, 0x25e, 0x5, 0x177, 0xbc, 0x2, 0x25e, 0x25f, 0x5, 0x19b, + 0xce, 0x2, 0x25f, 0x260, 0x5, 0x19d, 0xcf, 0x2, 0x260, 0x28, 0x3, 0x2, + 0x2, 0x2, 0x261, 0x262, 0x5, 0x17b, 0xbe, 0x2, 0x262, 0x263, 0x5, 0x185, + 0xc3, 0x2, 0x263, 0x264, 0x5, 0x17f, 0xc0, 0x2, 0x264, 0x265, 0x5, 0x17b, + 0xbe, 0x2, 0x265, 0x266, 0x5, 0x18b, 0xc6, 0x2, 0x266, 0x2a, 0x3, 0x2, + 0x2, 0x2, 0x267, 0x268, 0x5, 0x17b, 0xbe, 0x2, 0x268, 0x269, 0x5, 0x18d, + 0xc7, 0x2, 0x269, 0x26a, 0x5, 0x17f, 0xc0, 0x2, 0x26a, 0x26b, 0x5, 0x177, + 0xbc, 0x2, 0x26b, 0x26c, 0x5, 0x199, 0xcd, 0x2, 0x26c, 0x2c, 0x3, 0x2, + 0x2, 0x2, 0x26d, 0x26e, 0x5, 0x17b, 0xbe, 0x2, 0x26e, 0x26f, 0x5, 0x18d, + 0xc7, 0x2, 0x26f, 0x270, 0x5, 0x19f, 0xd0, 0x2, 0x270, 0x271, 0x5, 0x19b, + 0xce, 0x2, 0x271, 0x272, 0x5, 0x19d, 0xcf, 0x2, 0x272, 0x273, 0x5, 0x17f, + 0xc0, 0x2, 0x273, 0x274, 0x5, 0x199, 0xcd, 0x2, 0x274, 0x2e, 0x3, 0x2, + 0x2, 0x2, 0x275, 0x276, 0x5, 0x17b, 0xbe, 0x2, 0x276, 0x277, 0x5, 0x193, + 0xca, 0x2, 0x277, 0x278, 0x5, 0x17d, 0xbf, 0x2, 0x278, 0x279, 0x5, 0x17f, + 0xc0, 0x2, 0x279, 0x27a, 0x5, 0x17b, 0xbe, 0x2, 0x27a, 0x30, 0x3, 0x2, + 0x2, 0x2, 0x27b, 0x27c, 0x5, 0x17b, 0xbe, 0x2, 0x27c, 0x27d, 0x5, 0x193, + 0xca, 0x2, 0x27d, 0x27e, 0x5, 0x18d, 0xc7, 0x2, 0x27e, 0x27f, 0x5, 0x18d, + 0xc7, 0x2, 0x27f, 0x280, 0x5, 0x177, 0xbc, 0x2, 0x280, 0x281, 0x5, 0x19d, + 0xcf, 0x2, 0x281, 0x282, 0x5, 0x17f, 0xc0, 0x2, 0x282, 0x32, 0x3, 0x2, + 0x2, 0x2, 0x283, 0x284, 0x5, 0x17b, 0xbe, 0x2, 0x284, 0x285, 0x5, 0x193, + 0xca, 0x2, 0x285, 0x286, 0x5, 0x18d, 0xc7, 0x2, 0x286, 0x287, 0x5, 0x19f, + 0xd0, 0x2, 0x287, 0x288, 0x5, 0x18f, 0xc8, 0x2, 0x288, 0x289, 0x5, 0x191, + 0xc9, 0x2, 0x289, 0x34, 0x3, 0x2, 0x2, 0x2, 0x28a, 0x28b, 0x5, 0x17b, + 0xbe, 0x2, 0x28b, 0x28c, 0x5, 0x193, 0xca, 0x2, 0x28c, 0x28d, 0x5, 0x18f, + 0xc8, 0x2, 0x28d, 0x28e, 0x5, 0x18f, 0xc8, 0x2, 0x28e, 0x28f, 0x5, 0x17f, + 0xc0, 0x2, 0x28f, 0x290, 0x5, 0x191, 0xc9, 0x2, 0x290, 0x291, 0x5, 0x19d, + 0xcf, 0x2, 0x291, 0x36, 0x3, 0x2, 0x2, 0x2, 0x292, 0x293, 0x5, 0x17b, + 0xbe, 0x2, 0x293, 0x294, 0x5, 0x193, 0xca, 0x2, 0x294, 0x295, 0x5, 0x191, + 0xc9, 0x2, 0x295, 0x296, 0x5, 0x19b, 0xce, 0x2, 0x296, 0x297, 0x5, 0x19d, + 0xcf, 0x2, 0x297, 0x298, 0x5, 0x199, 0xcd, 0x2, 0x298, 0x299, 0x5, 0x177, + 0xbc, 0x2, 0x299, 0x29a, 0x5, 0x187, 0xc4, 0x2, 0x29a, 0x29b, 0x5, 0x191, + 0xc9, 0x2, 0x29b, 0x29c, 0x5, 0x19d, 0xcf, 0x2, 0x29c, 0x38, 0x3, 0x2, + 0x2, 0x2, 0x29d, 0x29e, 0x5, 0x17b, 0xbe, 0x2, 0x29e, 0x29f, 0x5, 0x199, + 0xcd, 0x2, 0x29f, 0x2a0, 0x5, 0x17f, 0xc0, 0x2, 0x2a0, 0x2a1, 0x5, 0x177, + 0xbc, 0x2, 0x2a1, 0x2a2, 0x5, 0x19d, 0xcf, 0x2, 0x2a2, 0x2a3, 0x5, 0x17f, + 0xc0, 0x2,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a, 0x5, 0x191, 0xc9, 0x2, 0x2fa, 0x2fb, 0x5, 0x183, + 0xc2, 0x2, 0x2fb, 0x52, 0x3, 0x2, 0x2, 0x2, 0x2fc, 0x2fd, 0x5, 0x17d, + 0xbf, 0x2, 0x2fd, 0x2fe, 0x5, 0x17f, 0xc0, 0x2, 0x2fe, 0x2ff, 0x5, 0x19b, + 0xce, 0x2, 0x2ff, 0x300, 0x5, 0x17b, 0xbe, 0x2, 0x300, 0x301, 0x5, 0x199, + 0xcd, 0x2, 0x301, 0x302, 0x5, 0x187, 0xc4, 0x2, 0x302, 0x303, 0x5, 0x179, + 0xbd, 0x2, 0x303, 0x304, 0x5, 0x17f, 0xc0, 0x2, 0x304, 0x54, 0x3, 0x2, + 0x2, 0x2, 0x305, 0x306, 0x5, 0x17d, 0xbf, 0x2, 0x306, 0x307, 0x5, 0x17f, + 0xc0, 0x2, 0x307, 0x308, 0x5, 0x19d, 0xcf, 0x2, 0x308, 0x309, 0x5, 0x177, + 0xbc, 0x2, 0x309, 0x30a, 0x5, 0x17b, 0xbe, 0x2, 0x30a, 0x30b, 0x5, 0x185, + 0xc3, 0x2, 0x30b, 0x56, 0x3, 0x2, 0x2, 0x2, 0x30c, 0x30d, 0x5, 0x17d, + 0xbf, 0x2, 0x30d, 0x30e, 0x5, 0x187, 0xc4, 0x2, 0x30e, 0x30f, 0x5, 0x17b, + 0xbe, 0x2, 0x30f, 0x310, 0x5, 0x19d, 0xcf, 0x2, 0x310, 0x311, 0x5, 0x187, + 0xc4, 0x2, 0x311, 0x312, 0x5, 0x193, 0xca, 0x2, 0x312, 0x313, 0x5, 0x191, + 0xc9, 0x2, 0x313, 0x314, 0x5, 0x177, 0xbc, 0x2, 0x314, 0x315, 0x5, 0x199, + 0xcd, 0x2, 0x315, 0x316, 0x5, 0x187, 0xc4, 0x2, 0x316, 0x317, 0x5, 0x17f, + 0xc0, 0x2, 0x317, 0x318, 0x5, 0x19b, 0xce, 0x2, 0x318, 0x58, 0x3, 0x2, + 0x2, 0x2, 0x319, 0x31a, 0x5, 0x17d, 0xbf, 0x2, 0x31a, 0x31b, 0x5, 0x187, + 0xc4, 0x2, 0x31b, 0x31c, 0x5, 0x17b, 0xbe, 0x2, 0x31c, 0x31d, 0x5, 0x19d, + 0xcf, 0x2, 0x31d, 0x31e, 0x5, 0x187, 0xc4, 0x2, 0x31e, 0x31f, 0x5, 0x193, + 0xca, 0x2, 0x31f, 0x320, 0x5, 0x191, 0xc9, 0x2, 0x320, 0x321, 0x5, 0x177, + 0xbc, 0x2, 0x321, 0x322, 0x5, 0x199, 0xcd, 0x2, 0x322, 0x323, 0x5, 0x1a7, + 0xd4, 0x2, 0x323, 0x5a, 0x3, 0x2, 0x2, 0x2, 0x324, 0x325, 0x5, 0x17d, + 0xbf, 0x2, 0x325, 0x326, 0x5, 0x187, 0xc4, 0x2, 0x326, 0x327, 0x5, 0x19b, + 0xce, 0x2, 0x327, 0x328, 0x5, 0x18b, 0xc6, 0x2, 0x328, 0x5c, 0x3, 0x2, + 0x2, 0x2, 0x329, 0x32a, 0x5, 0x17d, 0xbf, 0x2, 0x32a, 0x32b, 0x5, 0x187, + 0xc4, 0x2, 0x32b, 0x32c, 0x5, 0x19b, 0xce, 0x2, 0x32c, 0x32d, 0x5, 0x19d, + 0xcf, 0x2, 0x32d, 0x32e, 0x5, 0x187, 0xc4, 0x2, 0x32e, 0x32f, 0x5, 0x191, + 0xc9, 0x2, 0x32f, 0x330, 0x5, 0x17b, 0xbe, 0x2, 0x330, 0x331, 0x5, 0x19d, + 0xcf, 0x2, 0x331, 0x5e, 0x3, 0x2, 0x2, 0x2, 0x332, 0x333, 0x5, 0x17d, + 0xbf, 0x2, 0x333, 0x334, 0x5, 0x187, 0xc4, 0x2, 0x334, 0x335, 0x5, 0x19b, + 0xce, 0x2, 0x335, 0x336, 0x5, 0x19d, 0xcf, 0x2, 0x336, 0x337, 0x5, 0x199, + 0xcd, 0x2, 0x337, 0x338, 0x5, 0x187, 0xc4, 0x2, 0x338, 0x339, 0x5, 0x179, + 0xbd, 0x2, 0x339, 0x33a, 0x5, 0x19f, 0xd0, 0x2, 0x33a, 0x33b, 0x5, 0x19d, + 0xcf, 0x2, 0x33b, 0x33c, 0x5, 0x17f, 0xc0, 0x2, 0x33c, 0x33d, 0x5, 0x17d, + 0xbf, 0x2, 0x33d, 0x60, 0x3, 0x2, 0x2, 0x2, 0x33e, 0x33f, 0x5, 0x17d, + 0xbf, 0x2, 0x33f, 0x340, 0x5, 0x199, 0xcd, 0x2, 0x340, 0x341, 0x5, 0x193, + 0xca, 0x2, 0x341, 0x342, 0x5, 0x195, 0xcb, 0x2, 0x342, 0x62, 0x3, 0x2, + 0x2, 0x2, 0x343, 0x344, 0x5, 0x17f, 0xc0, 0x2, 0x344, 0x345, 0x5, 0x18d, + 0xc7, 0x2, 0x345, 0x346, 0x5, 0x19b, 0xce, 0x2, 0x346, 0x347, 0x5, 0x17f, + 0xc0, 0x2, 0x347, 0x64, 0x3, 0x2, 0x2, 0x2, 0x348, 0x349, 0x5, 0x17f, + 0xc0, 0x2, 0x349, 0x34a, 0x5, 0x191, 0xc9, 0x2, 0x34a, 0x34b, 0x5, 0x17d, + 0xbf, 0x2, 0x34b, 0x66, 0x3, 0x2, 0x2, 0x2, 0x34c, 0x34d, 0x5, 0x17f, + 0xc0, 0x2, 0x34d, 0x34e, 0x5, 0x191, 0xc9, 0x2, 0x34e, 0x34f, 0x5, 0x183, + 0xc2, 0x2, 0x34f, 0x350, 0x5, 0x187, 0xc4, 0x2, 0x350, 0x351, 0x5, 0x191, + 0xc9, 0x2, 0x351, 0x352, 0x5, 0x17f, 0xc0, 0x2, 0x352, 0x68, 0x3, 0x2, + 0x2, 0x2, 0x353, 0x354, 0x5, 0x17f, 0xc0, 0x2, 0x354, 0x355, 0x5, 0x1a1, + 0xd1, 0x2, 0x355, 0x356, 0x5, 0x17f, 0xc0, 0x2, 0x356, 0x357, 0x5, 0x191, + 0xc9, 0x2, 0x357, 0x358, 0x5, 0x19d, 0xcf, 0x2, 0x358, 0x359, 0x5, 0x19b, + 0xce, 0x2, 0x359, 0x6a, 0x3, 0x2, 0x2, 0x2, 0x35a, 0x35b, 0x5, 0x17f, + 0xc0, 0x2, 0x35b, 0x35c, 0x5, 0x1a5, 0xd3, 0x2, 0x35c, 0x35d, 0x5, 0x187, + 0xc4, 0x2, 0x35d, 0x35e, 0x5, 0x19b, 0xce, 0x2, 0x35e, 0x35f, 0x5, 0x19d, + 0xcf, 0x2, 0x35f, 0x360, 0x5, 0x19b, 0xce, 0x2, 0x360, 0x6c, 0x3, 0x2, + 0x2, 0x2, 0x361, 0x362, 0x5, 0x17f, 0xc0, 0x2, 0x362, 0x363, 0x5, 0x1a5, + 0xd3, 0x2, 0x363, 0x364, 0x5, 0x195, 0xcb, 0x2, 0x364, 0x365, 0x5, 0x18d, + 0xc7, 0x2, 0x365, 0x366, 0x5, 0x177, 0xbc, 0x2, 0x366, 0x367, 0x5, 0x187, + 0xc4, 0x2, 0x367, 0x368, 0x5, 0x191, 0xc9, 0x2, 0x368, 0x6e, 0x3, 0x2, + 0x2, 0x2, 0x369, 0x36a, 0x5, 0x17f, 0xc0, 0x2, 0x36a, 0x36b, 0x5, 0x1a5, + 0xd3, 0x2, 0x36b, 0x36c, 0x5, 0x195, 0xcb, 0x2, 0x36c, 0x36d, 0x5, 0x199, + 0xcd, 0x2, 0x36d, 0x36e, 0x5, 0x17f, 0xc0, 0x2, 0x36e, 0x36f, 0x5, 0x19b, + 0xce, 0x2, 0x36f, 0x370, 0x5, 0x19b, 0xce, 0x2, 0x370, 0x371, 0x5, 0x187, + 0xc4, 0x2, 0x371, 0x372, 0x5, 0x193, 0xca, 0x2, 0x372, 0x373, 0x5, 0x191, + 0xc9, 0x2, 0x373, 0x70, 0x3, 0x2, 0x2, 0x2, 0x374, 0x375, 0x5, 0x17f, + 0xc0, 0x2, 0x375, 0x376, 0x5, 0x1a5, 0xd3, 0x2, 0x376, 0x377, 0x5, 0x19d, + 0xcf, 0x2, 0x377, 0x378, 0x5, 0x199, 0xcd, 0x2, 0x378, 0x379, 0x5, 0x177, + 0xbc, 0x2, 0x379, 0x37a, 0x5, 0x17b, 0xbe, 0x2, 0x37a, 0x37b, 0x5, 0x19d, + 0xcf, 0x2, 0x37b, 0x72, 0x3, 0x2, 0x2, 0x2, 0x37c, 0x37d, 0x5, 0x181, + 0xc1, 0x2, 0x37d, 0x37e, 0x5, 0x17f, 0xc0, 0x2, 0x37e, 0x37f, 0x5, 0x19d, + 0xcf, 0x2, 0x37f, 0x380, 0x5, 0x17b, 0xbe, 0x2, 0x380, 0x381, 0x5, 0x185, + 0xc3, 0x2, 0x381, 0x382, 0x5, 0x17f, 0xc0, 0x2, 0x382, 0x383, 0x5, 0x19b, + 0xce, 0x2, 0x383, 0x74, 0x3, 0x2, 0x2, 0x2, 0x384, 0x385, 0x5, 0x181, + 0xc1, 0x2, 0x385, 0x386, 0x5, 0x187, 0xc4, 0x2, 0x386, 0x387, 0x5, 0x191, + 0xc9, 0x2, 0x387, 0x388, 0x5, 0x177, 0xbc, 0x2, 0x388, 0x389, 0x5, 0x18d, + 0xc7, 0x2, 0x389, 0x76, 0x3, 0x2, 0x2, 0x2, 0x38a, 0x38b, 0x5, 0x181, + 0xc1, 0x2, 0x38b, 0x38c, 0x5, 0x187, 0xc4, 0x2, 0x38c, 0x38d, 0x5, 0x199, + 0xcd, 0x2, 0x38d, 0x38e, 0x5, 0x19b, 0xce, 0x2, 0x38e, 0x38f, 0x5, 0x19d, + 0xcf, 0x2, 0x38f, 0x78, 0x3, 0x2, 0x2, 0x2, 0x390, 0x391, 0x5, 0x181, + 0xc1, 0x2, 0x391, 0x392, 0x5, 0x18d, 0xc7, 0x2, 0x392, 0x393, 0x5, 0x19f, + 0xd0, 0x2, 0x393, 0x394, 0x5, 0x19b, 0xce, 0x2, 0x394, 0x395, 0x5, 0x185, + 0xc3, 0x2, 0x395, 0x7a, 0x3, 0x2, 0x2, 0x2, 0x396, 0x397, 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ee, 0x3ef, 0x5, 0x17d, + 0xbf, 0x2, 0x3ef, 0x94, 0x3, 0x2, 0x2, 0x2, 0x3f0, 0x3f1, 0x5, 0x187, + 0xc4, 0x2, 0x3f1, 0x3f2, 0x5, 0x181, 0xc1, 0x2, 0x3f2, 0x96, 0x3, 0x2, + 0x2, 0x2, 0x3f3, 0x3f4, 0x5, 0x187, 0xc4, 0x2, 0x3f4, 0x3f5, 0x5, 0x18d, + 0xc7, 0x2, 0x3f5, 0x3f6, 0x5, 0x187, 0xc4, 0x2, 0x3f6, 0x3f7, 0x5, 0x18b, + 0xc6, 0x2, 0x3f7, 0x3f8, 0x5, 0x17f, 0xc0, 0x2, 0x3f8, 0x98, 0x3, 0x2, + 0x2, 0x2, 0x3f9, 0x3fa, 0x5, 0x187, 0xc4, 0x2, 0x3fa, 0x3fb, 0x5, 0x191, + 0xc9, 0x2, 0x3fb, 0x9a, 0x3, 0x2, 0x2, 0x2, 0x3fc, 0x3fd, 0x5, 0x187, + 0xc4, 0x2, 0x3fd, 0x3fe, 0x5, 0x191, 0xc9, 0x2, 0x3fe, 0x3ff, 0x5, 0x17d, + 0xbf, 0x2, 0x3ff, 0x400, 0x5, 0x17f, 0xc0, 0x2, 0x400, 0x401, 0x5, 0x1a5, + 0xd3, 0x2, 0x401, 0x9c, 0x3, 0x2, 0x2, 0x2, 0x402, 0x403, 0x5, 0x187, + 0xc4, 0x2, 0x403, 0x404, 0x5, 0x191, 0xc9, 0x2, 0x404, 0x405, 0x5, 0x181, + 0xc1, 0x2, 0x405, 0x410, 0x3, 0x2, 0x2, 0x2, 0x406, 0x407, 0x5, 0x187, + 0xc4, 0x2, 0x407, 0x408, 0x5, 0x191, 0xc9, 0x2, 0x408, 0x409, 0x5, 0x181, + 0xc1, 0x2, 0x409, 0x40a, 0x5, 0x187, 0xc4, 0x2, 0x40a, 0x40b, 0x5, 0x191, + 0xc9, 0x2, 0x40b, 0x40c, 0x5, 0x187, 0xc4, 0x2, 0x40c, 0x40d, 0x5, 0x19d, + 0xcf, 0x2, 0x40d, 0x40e, 0x5, 0x1a7, 0xd4, 0x2, 0x40e, 0x410, 0x3, 0x2, + 0x2, 0x2, 0x40f, 0x402, 0x3, 0x2, 0x2, 0x2, 0x40f, 0x406, 0x3, 0x2, + 0x2, 0x2, 0x410, 0x9e, 0x3, 0x2, 0x2, 0x2, 0x411, 0x412, 0x5, 0x187, + 0xc4, 0x2, 0x412, 0x413, 0x5, 0x191, 0xc9, 0x2, 0x413, 0x414, 0x5, 0x189, + 0xc5, 0x2, 0x414, 0x415, 0x5, 0x17f, 0xc0, 0x2, 0x415, 0x416, 0x5, 0x17b, + 0xbe, 0x2, 0x416, 0x417, 0x5, 0x19d, 0xcf, 0x2, 0x417, 0x418, 0x5, 0x187, + 0xc4, 0x2, 0x418, 0x419, 0x5, 0x1a1, 0xd1, 0x2, 0x419, 0x41a, 0x5, 0x17f, + 0xc0, 0x2, 0x41a, 0xa0, 0x3, 0x2, 0x2, 0x2, 0x41b, 0x41c, 0x5, 0x187, + 0xc4, 0x2, 0x41c, 0x41d, 0x5, 0x191, 0xc9, 0x2, 0x41d, 0x41e, 0x5, 0x191, + 0xc9, 0x2, 0x41e, 0x41f, 0x5, 0x17f, 0xc0, 0x2, 0x41f, 0x420, 0x5, 0x199, + 0xcd, 0x2, 0x420, 0xa2, 0x3, 0x2, 0x2, 0x2, 0x421, 0x422, 0x5, 0x187, + 0xc4, 0x2, 0x422, 0x423, 0x5, 0x191, 0xc9, 0x2, 0x423, 0x424, 0x5, 0x19b, + 0xce, 0x2, 0x424, 0x425, 0x5, 0x17f, 0xc0, 0x2, 0x425, 0x426, 0x5, 0x199, + 0xcd, 0x2, 0x426, 0x427, 0x5, 0x19d, 0xcf, 0x2, 0x427, 0xa4, 0x3, 0x2, + 0x2, 0x2, 0x428, 0x429, 0x5, 0x187, 0xc4, 0x2, 0x429, 0x42a, 0x5, 0x191, + 0xc9, 0x2, 0x42a, 0x42b, 0x5, 0x19d, 0xcf, 0x2, 0x42b, 0x42c, 0x5, 0x17f, + 0xc0, 0x2, 0x42c, 0x42d, 0x5, 0x199, 0xcd, 0x2, 0x42d, 0x42e, 0x5, 0x1a1, + 0xd1, 0x2, 0x42e, 0x42f, 0x5, 0x177, 0xbc, 0x2, 0x42f, 0x430, 0x5, 0x18d, + 0xc7, 0x2, 0x430, 0xa6, 0x3, 0x2, 0x2, 0x2, 0x431, 0x432, 0x5, 0x187, + 0xc4, 0x2, 0x432, 0x433, 0x5, 0x191, 0xc9, 0x2, 0x433, 0x434, 0x5, 0x19d, + 0xcf, 0x2, 0x434, 0x435, 0x5, 0x193, 0xca, 0x2, 0x435, 0xa8, 0x3, 0x2, + 0x2, 0x2, 0x436, 0x437, 0x5, 0x187, 0xc4, 0x2, 0x437, 0x438, 0x5, 0x19b, + 0xce, 0x2, 0x438, 0xaa, 0x3, 0x2, 0x2, 0x2, 0x439, 0x43a, 0x5, 0x187, + 0xc4, 0x2, 0x43a, 0x43b, 0x5, 0x19b, 0xce, 0x2, 0x43b, 0x43c, 0x5, 0x1ed, + 0xf7, 0x2, 0x43c, 0x43d, 0x5, 0x193, 0xca, 0x2, 0x43d, 0x43e, 0x5, 0x179, + 0xbd, 0x2, 0x43e, 0x43f, 0x5, 0x189, 0xc5, 0x2, 0x43f, 0x440, 0x5, 0x17f, + 0xc0, 0x2, 0x440, 0x441, 0x5, 0x17b, 0xbe, 0x2, 0x441, 0x442, 0x5, 0x19d, + 0xcf, 0x2, 0x442, 0x443, 0x5, 0x1ed, 0xf7, 0x2, 0x443, 0x444, 0x5, 0x187, + 0xc4, 0x2, 0x444, 0x445, 0x5, 0x17d, 0xbf, 0x2, 0x445, 0xac, 0x3, 0x2, + 0x2, 0x2, 0x446, 0x447, 0x5, 0x189, 0xc5, 0x2, 0x447, 0x448, 0x5, 0x193, + 0xca, 0x2, 0x448, 0x449, 0x5, 0x187, 0xc4, 0x2, 0x449, 0x44a, 0x5, 0x191, + 0xc9, 0x2, 0x44a, 0xae, 0x3, 0x2, 0x2, 0x2, 0x44b, 0x44c, 0x5, 0x18b, + 0xc6, 0x2, 0x44c, 0x44d, 0x5, 0x17f, 0xc0, 0x2, 0x44d, 0x44e, 0x5, 0x1a7, + 0xd4, 0x2, 0x44e, 0xb0, 0x3, 0x2, 0x2, 0x2, 0x44f, 0x450, 0x5, 0x18b, + 0xc6, 0x2, 0x450, 0x451, 0x5, 0x187, 0xc4, 0x2, 0x451, 0x452, 0x5, 0x18d, + 0xc7, 0x2, 0x452, 0x453, 0x5, 0x18d, 0xc7, 0x2, 0x453, 0xb2, 0x3, 0x2, + 0x2, 0x2, 0x454, 0x455, 0x5, 0x18d, 0xc7, 0x2, 0x455, 0x456, 0x5, 0x177, + 0xbc, 0x2, 0x456, 0x457, 0x5, 0x19b, 0xce, 0x2, 0x457, 0x458, 0x5, 0x19d, + 0xcf, 0x2, 0x458, 0xb4, 0x3, 0x2, 0x2, 0x2, 0x459, 0x45a, 0x5, 0x18d, + 0xc7, 0x2, 0x45a, 0x45b, 0x5, 0x177, 0xbc, 0x2, 0x45b, 0x45c, 0x5, 0x1a7, + 0xd4, 0x2, 0x45c, 0x45d, 0x5, 0x193, 0xca, 0x2, 0x45d, 0x45e, 0x5, 0x19f, + 0xd0, 0x2, 0x45e, 0x45f, 0x5, 0x19d, 0xcf, 0x2, 0x45f, 0xb6, 0x3, 0x2, + 0x2, 0x2, 0x460, 0x461, 0x5, 0x18d, 0xc7, 0x2, 0x461, 0x462, 0x5, 0x17f, + 0xc0, 0x2, 0x462, 0x463, 0x5, 0x177, 0xbc, 0x2, 0x463, 0x464, 0x5, 0x17d, + 0xbf, 0x2, 0x464, 0x465, 0x5, 0x187, 0xc4, 0x2, 0x465, 0x466, 0x5, 0x191, + 0xc9, 0x2, 0x466, 0x467, 0x5, 0x183, 0xc2, 0x2, 0x467, 0xb8, 0x3, 0x2, + 0x2, 0x2, 0x468, 0x469, 0x5, 0x18d, 0xc7, 0x2, 0x469, 0x46a, 0x5, 0x17f, + 0xc0, 0x2, 0x46a, 0x46b, 0x5, 0x181, 0xc1, 0x2, 0x46b, 0x46c, 0x5, 0x19d, + 0xcf, 0x2, 0x46c, 0xba, 0x3, 0x2, 0x2, 0x2, 0x46d, 0x46e, 0x5, 0x18d, + 0xc7, 0x2, 0x46e, 0x46f, 0x5, 0x187, 0xc4, 0x2, 0x46f, 0x470, 0x5, 0x181, + 0xc1, 0x2, 0x470, 0x471, 0x5, 0x17f, 0xc0, 0x2, 0x471, 0x472, 0x5, 0x19d, + 0xcf, 0x2, 0x472, 0x473, 0x5, 0x187, 0xc4, 0x2, 0x473, 0x474, 0x5, 0x18f, + 0xc8, 0x2, 0x474, 0x475, 0x5, 0x17f, 0xc0, 0x2, 0x475, 0xbc, 0x3, 0x2, + 0x2, 0x2, 0x476, 0x477, 0x5, 0x18d, 0xc7, 0x2, 0x477, 0x478, 0x5, 0x187, + 0xc4, 0x2, 0x478, 0x479, 0x5, 0x18b, 0xc6, 0x2, 0x479, 0x47a, 0x5, 0x17f, + 0xc0, 0x2, 0x47a, 0xbe, 0x3, 0x2, 0x2, 0x2, 0x47b, 0x47c, 0x5, 0x18d, + 0xc7, 0x2, 0x47c, 0x47d, 0x5, 0x187, 0xc4, 0x2, 0x47d, 0x47e, 0x5, 0x18f, + 0xc8, 0x2, 0x47e, 0x47f, 0x5, 0x187, 0xc4, 0x2, 0x47f, 0x480, 0x5, 0x19d, + 0xcf, 0x2, 0x480, 0xc0, 0x3, 0x2, 0x2, 0x2, 0x481, 0x482, 0x5, 0x18d, + 0xc7, 0x2, 0x482, 0x483, 0x5, 0x187, 0xc4, 0x2, 0x483, 0x484, 0x5, 0x1a1, + 0xd1, 0x2, 0x484, 0x485, 0x5, 0x17f, 0xc0, 0x2, 0x485, 0xc2, 0x3, 0x2, + 0x2, 0x2, 0x486, 0x487, 0x5, 0x18d, 0xc7, 0x2, 0x487, 0x488, 0x5, 0x193, + 0xca, 0x2, 0x488, 0x489, 0x5, 0x17b, 0xbe, 0x2, 0x489, 0x48a, 0x5, 0x177, + 0xbc, 0x2, 0x48a, 0x48b, 0x5, 0x18d, 0xc7, 0x2, 0x48b, 0xc4, 0x3, 0x2, + 0x2, 0x2, 0x48c, 0x48d, 0x5, 0x18d, 0xc7, 0x2, 0x48d, 0x48e, 0x5, 0x193, + 0xca, 0x2, 0x48e, 0x48f, 0x5, 0x183, 0xc2, 0x2, 0x48f, 0x490, 0x5, 0x19b, + 0xce, 0x2, 0x490, 0xc6, 0x3, 0x2, 0x2, 0x2, 0x491, 0x492, 0x5, 0x18f, + 0xc8, 0x2, 0x492, 0x493, 0x5, 0x177, 0xbc, 0x2, 0x493, 0x494, 0x5, 0x19d, + 0xcf, 0x2, 0x494, 0x495, 0x5, 0x17f, 0xc0, 0x2, 0x495, 0x496, 0x5, 0x199, + 0xcd, 0x2, 0x496, 0x497, 0x5, 0x187, 0xc4, 0x2, 0x497, 0x498, 0x5, 0x177, + 0xbc, 0x2, 0x498, 0x499, 0x5, 0x18d, 0xc7, 0x2, 0x499, 0x49a, 0x5, 0x187, + 0xc4, 0x2, 0x49a, 0x49b, 0x5, 0x1a9, 0xd5, 0x2, 0x49b, 0x49c, 0x5, 0x17f, + 0xc0, 0x2, 0x49c, 0x49d, 0x5, 0x17d, 0xbf, 0x2, 0x49d, 0xc8, 0x3, 0x2, + 0x2, 0x2, 0x49e, 0x49f, 0x5, 0x18f, 0xc8, 0x2, 0x49f, 0x4a0, 0x5, 0x177, + 0xbc, 0x2, 0x4a0, 0x4a1, 0x5, 0x1a5, 0xd3, 0x2, 0x4a1, 0xca, 0x3, 0x2, + 0x2, 0x2, 0x4a2, 0x4a3, 0x5, 0x18f, 0xc8, 0x2, 0x4a3, 0x4a4, 0x5, 0x17f, + 0xc0, 0x2, 0x4a4, 0x4a5, 0x5, 0x199, 0xcd, 0x2, 0x4a5, 0x4a6, 0x5, 0x183, + 0xc2, 0x2, 0x4a6, 0x4a7, 0x5, 0x17f, 0xc0, 0x2, 0x4a7, 0x4a8, 0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17f, 0xc0, 0x2, 0x4ff, 0x500, 0x5, 0x199, + 0xcd, 0x2, 0x500, 0xec, 0x3, 0x2, 0x2, 0x2, 0x501, 0x502, 0x5, 0x193, + 0xca, 0x2, 0x502, 0x503, 0x5, 0x19f, 0xd0, 0x2, 0x503, 0x504, 0x5, 0x19d, + 0xcf, 0x2, 0x504, 0x505, 0x5, 0x17f, 0xc0, 0x2, 0x505, 0x506, 0x5, 0x199, + 0xcd, 0x2, 0x506, 0xee, 0x3, 0x2, 0x2, 0x2, 0x507, 0x508, 0x5, 0x193, + 0xca, 0x2, 0x508, 0x509, 0x5, 0x19f, 0xd0, 0x2, 0x509, 0x50a, 0x5, 0x19d, + 0xcf, 0x2, 0x50a, 0x50b, 0x5, 0x181, 0xc1, 0x2, 0x50b, 0x50c, 0x5, 0x187, + 0xc4, 0x2, 0x50c, 0x50d, 0x5, 0x18d, 0xc7, 0x2, 0x50d, 0x50e, 0x5, 0x17f, + 0xc0, 0x2, 0x50e, 0xf0, 0x3, 0x2, 0x2, 0x2, 0x50f, 0x510, 0x5, 0x195, + 0xcb, 0x2, 0x510, 0x511, 0x5, 0x177, 0xbc, 0x2, 0x511, 0x512, 0x5, 0x199, + 0xcd, 0x2, 0x512, 0x513, 0x5, 0x19d, 0xcf, 0x2, 0x513, 0x514, 0x5, 0x187, + 0xc4, 0x2, 0x514, 0x515, 0x5, 0x19d, 0xcf, 0x2, 0x515, 0x516, 0x5, 0x187, + 0xc4, 0x2, 0x516, 0x517, 0x5, 0x193, 0xca, 0x2, 0x517, 0x518, 0x5, 0x191, + 0xc9, 0x2, 0x518, 0xf2, 0x3, 0x2, 0x2, 0x2, 0x519, 0x51a, 0x5, 0x195, + 0xcb, 0x2, 0x51a, 0x51b, 0x5, 0x193, 0xca, 0x2, 0x51b, 0x51c, 0x5, 0x195, + 0xcb, 0x2, 0x51c, 0x51d, 0x5, 0x19f, 0xd0, 0x2, 0x51d, 0x51e, 0x5, 0x18d, + 0xc7, 0x2, 0x51e, 0x51f, 0x5, 0x177, 0xbc, 0x2, 0x51f, 0x520, 0x5, 0x19d, + 0xcf, 0x2, 0x520, 0x521, 0x5, 0x17f, 0xc0, 0x2, 0x521, 0xf4, 0x3, 0x2, + 0x2, 0x2, 0x522, 0x523, 0x5, 0x195, 0xcb, 0x2, 0x523, 0x524, 0x5, 0x199, + 0xcd, 0x2, 0x524, 0x525, 0x5, 0x17f, 0xc0, 0x2, 0x525, 0x526, 0x5, 0x1a3, + 0xd2, 0x2, 0x526, 0x527, 0x5, 0x185, 0xc3, 0x2, 0x527, 0x528, 0x5, 0x17f, + 0xc0, 0x2, 0x528, 0x529, 0x5, 0x199, 0xcd, 0x2, 0x529, 0x52a, 0x5, 0x17f, + 0xc0, 0x2, 0x52a, 0xf6, 0x3, 0x2, 0x2, 0x2, 0x52b, 0x52c, 0x5, 0x195, + 0xcb, 0x2, 0x52c, 0x52d, 0x5, 0x199, 0xcd, 0x2, 0x52d, 0x52e, 0x5, 0x187, + 0xc4, 0x2, 0x52e, 0x52f, 0x5, 0x18f, 0xc8, 0x2, 0x52f, 0x530, 0x5, 0x177, + 0xbc, 0x2, 0x530, 0x531, 0x5, 0x199, 0xcd, 0x2, 0x531, 0x532, 0x5, 0x1a7, + 0xd4, 0x2, 0x532, 0xf8, 0x3, 0x2, 0x2, 0x2, 0x533, 0x534, 0x5, 0x197, + 0xcc, 0x2, 0x534, 0x535, 0x5, 0x19f, 0xd0, 0x2, 0x535, 0x536, 0x5, 0x177, + 0xbc, 0x2, 0x536, 0x537, 0x5, 0x199, 0xcd, 0x2, 0x537, 0x538, 0x5, 0x19d, + 0xcf, 0x2, 0x538, 0x539, 0x5, 0x17f, 0xc0, 0x2, 0x539, 0x53a, 0x5, 0x199, + 0xcd, 0x2, 0x53a, 0xfa, 0x3, 0x2, 0x2, 0x2, 0x53b, 0x53c, 0x5, 0x199, + 0xcd, 0x2, 0x53c, 0x53d, 0x5, 0x177, 0xbc, 0x2, 0x53d, 0x53e, 0x5, 0x191, + 0xc9, 0x2, 0x53e, 0x53f, 0x5, 0x183, 0xc2, 0x2, 0x53f, 0x540, 0x5, 0x17f, + 0xc0, 0x2, 0x540, 0xfc, 0x3, 0x2, 0x2, 0x2, 0x541, 0x542, 0x5, 0x199, + 0xcd, 0x2, 0x542, 0x543, 0x5, 0x17f, 0xc0, 0x2, 0x543, 0x544, 0x5, 0x18d, + 0xc7, 0x2, 0x544, 0x545, 0x5, 0x193, 0xca, 0x2, 0x545, 0x546, 0x5, 0x177, + 0xbc, 0x2, 0x546, 0x547, 0x5, 0x17d, 0xbf, 0x2, 0x547, 0xfe, 0x3, 0x2, + 0x2, 0x2, 0x548, 0x549, 0x5, 0x199, 0xcd, 0x2, 0x549, 0x54a, 0x5, 0x17f, + 0xc0, 0x2, 0x54a, 0x54b, 0x5, 0x18f, 0xc8, 0x2, 0x54b, 0x54c, 0x5, 0x193, + 0xca, 0x2, 0x54c, 0x54d, 0x5, 0x1a1, 0xd1, 0x2, 0x54d, 0x54e, 0x5, 0x17f, + 0xc0, 0x2, 0x54e, 0x100, 0x3, 0x2, 0x2, 0x2, 0x54f, 0x550, 0x5, 0x199, + 0xcd, 0x2, 0x550, 0x551, 0x5, 0x17f, 0xc0, 0x2, 0x551, 0x552, 0x5, 0x191, + 0xc9, 0x2, 0x552, 0x553, 0x5, 0x177, 0xbc, 0x2, 0x553, 0x554, 0x5, 0x18f, + 0xc8, 0x2, 0x554, 0x555, 0x5, 0x17f, 0xc0, 0x2, 0x555, 0x102, 0x3, 0x2, + 0x2, 0x2, 0x556, 0x557, 0x5, 0x199, 0xcd, 0x2, 0x557, 0x558, 0x5, 0x17f, + 0xc0, 0x2, 0x558, 0x559, 0x5, 0x195, 0xcb, 0x2, 0x559, 0x55a, 0x5, 0x18d, + 0xc7, 0x2, 0x55a, 0x55b, 0x5, 0x177, 0xbc, 0x2, 0x55b, 0x55c, 0x5, 0x17b, + 0xbe, 0x2, 0x55c, 0x55d, 0x5, 0x17f, 0xc0, 0x2, 0x55d, 0x104, 0x3, 0x2, + 0x2, 0x2, 0x55e, 0x55f, 0x5, 0x199, 0xcd, 0x2, 0x55f, 0x560, 0x5, 0x17f, + 0xc0, 0x2, 0x560, 0x561, 0x5, 0x195, 0xcb, 0x2, 0x561, 0x562, 0x5, 0x18d, + 0xc7, 0x2, 0x562, 0x563, 0x5, 0x187, 0xc4, 0x2, 0x563, 0x564, 0x5, 0x17b, + 0xbe, 0x2, 0x564, 0x565, 0x5, 0x177, 0xbc, 0x2, 0x565, 0x106, 0x3, 0x2, + 0x2, 0x2, 0x566, 0x567, 0x5, 0x199, 0xcd, 0x2, 0x567, 0x568, 0x5, 0x17f, + 0xc0, 0x2, 0x568, 0x569, 0x5, 0x195, 0xcb, 0x2, 0x569, 0x56a, 0x5, 0x18d, + 0xc7, 0x2, 0x56a, 0x56b, 0x5, 0x187, 0xc4, 0x2, 0x56b, 0x56c, 0x5, 0x17b, + 0xbe, 0x2, 0x56c, 0x56d, 0x5, 0x177, 0xbc, 0x2, 0x56d, 0x56e, 0x5, 0x19d, + 0xcf, 0x2, 0x56e, 0x56f, 0x5, 0x17f, 0xc0, 0x2, 0x56f, 0x570, 0x5, 0x17d, + 0xbf, 0x2, 0x570, 0x108, 0x3, 0x2, 0x2, 0x2, 0x571, 0x572, 0x5, 0x199, + 0xcd, 0x2, 0x572, 0x573, 0x5, 0x187, 0xc4, 0x2, 0x573, 0x574, 0x5, 0x183, + 0xc2, 0x2, 0x574, 0x575, 0x5, 0x185, 0xc3, 0x2, 0x575, 0x576, 0x5, 0x19d, + 0xcf, 0x2, 0x576, 0x10a, 0x3, 0x2, 0x2, 0x2, 0x577, 0x578, 0x5, 0x199, + 0xcd, 0x2, 0x578, 0x579, 0x5, 0x193, 0xca, 0x2, 0x579, 0x57a, 0x5, 0x18d, + 0xc7, 0x2, 0x57a, 0x57b, 0x5, 0x18d, 0xc7, 0x2, 0x57b, 0x57c, 0x5, 0x19f, + 0xd0, 0x2, 0x57c, 0x57d, 0x5, 0x195, 0xcb, 0x2, 0x57d, 0x10c, 0x3, 0x2, + 0x2, 0x2, 0x57e, 0x57f, 0x5, 0x19b, 0xce, 0x2, 0x57f, 0x580, 0x5, 0x177, + 0xbc, 0x2, 0x580, 0x581, 0x5, 0x18f, 0xc8, 0x2, 0x581, 0x582, 0x5, 0x195, + 0xcb, 0x2, 0x582, 0x583, 0x5, 0x18d, 0xc7, 0x2, 0x583, 0x584, 0x5, 0x17f, + 0xc0, 0x2, 0x584, 0x10e, 0x3, 0x2, 0x2, 0x2, 0x585, 0x586, 0x5, 0x19b, + 0xce, 0x2, 0x586, 0x587, 0x5, 0x17f, 0xc0, 0x2, 0x587, 0x588, 0x5, 0x17b, + 0xbe, 0x2, 0x588, 0x589, 0x5, 0x193, 0xca, 0x2, 0x589, 0x58a, 0x5, 0x191, + 0xc9, 0x2, 0x58a, 0x58b, 0x5, 0x17d, 0xbf, 0x2, 0x58b, 0x110, 0x3, 0x2, + 0x2, 0x2, 0x58c, 0x58d, 0x5, 0x19b, 0xce, 0x2, 0x58d, 0x58e, 0x5, 0x17f, + 0xc0, 0x2, 0x58e, 0x58f, 0x5, 0x18d, 0xc7, 0x2, 0x58f, 0x590, 0x5, 0x17f, + 0xc0, 0x2, 0x590, 0x591, 0x5, 0x17b, 0xbe, 0x2, 0x591, 0x592, 0x5, 0x19d, + 0xcf, 0x2, 0x592, 0x112, 0x3, 0x2, 0x2, 0x2, 0x593, 0x594, 0x5, 0x19b, + 0xce, 0x2, 0x594, 0x595, 0x5, 0x17f, 0xc0, 0x2, 0x595, 0x596, 0x5, 0x18f, + 0xc8, 0x2, 0x596, 0x597, 0x5, 0x187, 0xc4, 0x2, 0x597, 0x114, 0x3, 0x2, + 0x2, 0x2, 0x598, 0x599, 0x5, 0x19b, 0xce, 0x2, 0x599, 0x59a, 0x5, 0x17f, + 0xc0, 0x2, 0x59a, 0x59b, 0x5, 0x191, 0xc9, 0x2, 0x59b, 0x59c, 0x5, 0x17d, + 0xbf, 0x2, 0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5f3, 0x5f4, 0x5, 0x199, + 0xcd, 0x2, 0x5f4, 0x5f5, 0x5, 0x1a7, 0xd4, 0x2, 0x5f5, 0x130, 0x3, 0x2, + 0x2, 0x2, 0x5f6, 0x5f7, 0x5, 0x19d, 0xcf, 0x2, 0x5f7, 0x5f8, 0x5, 0x17f, + 0xc0, 0x2, 0x5f8, 0x5f9, 0x5, 0x19b, 0xce, 0x2, 0x5f9, 0x5fa, 0x5, 0x19d, + 0xcf, 0x2, 0x5fa, 0x132, 0x3, 0x2, 0x2, 0x2, 0x5fb, 0x5fc, 0x5, 0x19d, + 0xcf, 0x2, 0x5fc, 0x5fd, 0x5, 0x185, 0xc3, 0x2, 0x5fd, 0x5fe, 0x5, 0x17f, + 0xc0, 0x2, 0x5fe, 0x5ff, 0x5, 0x191, 0xc9, 0x2, 0x5ff, 0x134, 0x3, 0x2, + 0x2, 0x2, 0x600, 0x601, 0x5, 0x19d, 0xcf, 0x2, 0x601, 0x602, 0x5, 0x187, + 0xc4, 0x2, 0x602, 0x603, 0x5, 0x17f, 0xc0, 0x2, 0x603, 0x604, 0x5, 0x19b, + 0xce, 0x2, 0x604, 0x136, 0x3, 0x2, 0x2, 0x2, 0x605, 0x606, 0x5, 0x19d, + 0xcf, 0x2, 0x606, 0x607, 0x5, 0x187, 0xc4, 0x2, 0x607, 0x608, 0x5, 0x18f, + 0xc8, 0x2, 0x608, 0x609, 0x5, 0x17f, 0xc0, 0x2, 0x609, 0x60a, 0x5, 0x193, + 0xca, 0x2, 0x60a, 0x60b, 0x5, 0x19f, 0xd0, 0x2, 0x60b, 0x60c, 0x5, 0x19d, + 0xcf, 0x2, 0x60c, 0x138, 0x3, 0x2, 0x2, 0x2, 0x60d, 0x60e, 0x5, 0x19d, + 0xcf, 0x2, 0x60e, 0x60f, 0x5, 0x187, 0xc4, 0x2, 0x60f, 0x610, 0x5, 0x18f, + 0xc8, 0x2, 0x610, 0x611, 0x5, 0x17f, 0xc0, 0x2, 0x611, 0x612, 0x5, 0x19b, + 0xce, 0x2, 0x612, 0x613, 0x5, 0x19d, 0xcf, 0x2, 0x613, 0x614, 0x5, 0x177, + 0xbc, 0x2, 0x614, 0x615, 0x5, 0x18f, 0xc8, 0x2, 0x615, 0x616, 0x5, 0x195, + 0xcb, 0x2, 0x616, 0x13a, 0x3, 0x2, 0x2, 0x2, 0x617, 0x618, 0x5, 0x19d, + 0xcf, 0x2, 0x618, 0x619, 0x5, 0x193, 0xca, 0x2, 0x619, 0x13c, 0x3, 0x2, + 0x2, 0x2, 0x61a, 0x61b, 0x5, 0x19d, 0xcf, 0x2, 0x61b, 0x61c, 0x5, 0x193, + 0xca, 0x2, 0x61c, 0x61d, 0x5, 0x195, 0xcb, 0x2, 0x61d, 0x13e, 0x3, 0x2, + 0x2, 0x2, 0x61e, 0x61f, 0x5, 0x19d, 0xcf, 0x2, 0x61f, 0x620, 0x5, 0x193, + 0xca, 0x2, 0x620, 0x621, 0x5, 0x19d, 0xcf, 0x2, 0x621, 0x622, 0x5, 0x177, + 0xbc, 0x2, 0x622, 0x623, 0x5, 0x18d, 0xc7, 0x2, 0x623, 0x624, 0x5, 0x19b, + 0xce, 0x2, 0x624, 0x140, 0x3, 0x2, 0x2, 0x2, 0x625, 0x626, 0x5, 0x19d, + 0xcf, 0x2, 0x626, 0x627, 0x5, 0x199, 0xcd, 0x2, 0x627, 0x628, 0x5, 0x177, + 0xbc, 0x2, 0x628, 0x629, 0x5, 0x187, 0xc4, 0x2, 0x629, 0x62a, 0x5, 0x18d, + 0xc7, 0x2, 0x62a, 0x62b, 0x5, 0x187, 0xc4, 0x2, 0x62b, 0x62c, 0x5, 0x191, + 0xc9, 0x2, 0x62c, 0x62d, 0x5, 0x183, 0xc2, 0x2, 0x62d, 0x142, 0x3, 0x2, + 0x2, 0x2, 0x62e, 0x62f, 0x5, 0x19d, 0xcf, 0x2, 0x62f, 0x630, 0x5, 0x199, + 0xcd, 0x2, 0x630, 0x631, 0x5, 0x187, 0xc4, 0x2, 0x631, 0x632, 0x5, 0x18f, + 0xc8, 0x2, 0x632, 0x144, 0x3, 0x2, 0x2, 0x2, 0x633, 0x634, 0x5, 0x19d, + 0xcf, 0x2, 0x634, 0x635, 0x5, 0x199, 0xcd, 0x2, 0x635, 0x636, 0x5, 0x19f, + 0xd0, 0x2, 0x636, 0x637, 0x5, 0x191, 0xc9, 0x2, 0x637, 0x638, 0x5, 0x17b, + 0xbe, 0x2, 0x638, 0x639, 0x5, 0x177, 0xbc, 0x2, 0x639, 0x63a, 0x5, 0x19d, + 0xcf, 0x2, 0x63a, 0x63b, 0x5, 0x17f, 0xc0, 0x2, 0x63b, 0x146, 0x3, 0x2, + 0x2, 0x2, 0x63c, 0x63d, 0x5, 0x19d, 0xcf, 0x2, 0x63d, 0x63e, 0x5, 0x19d, + 0xcf, 0x2, 0x63e, 0x63f, 0x5, 0x18d, 0xc7, 0x2, 0x63f, 0x148, 0x3, 0x2, + 0x2, 0x2, 0x640, 0x641, 0x5, 0x19d, 0xcf, 0x2, 0x641, 0x642, 0x5, 0x1a7, + 0xd4, 0x2, 0x642, 0x643, 0x5, 0x195, 0xcb, 0x2, 0x643, 0x644, 0x5, 0x17f, + 0xc0, 0x2, 0x644, 0x14a, 0x3, 0x2, 0x2, 0x2, 0x645, 0x646, 0x5, 0x19f, + 0xd0, 0x2, 0x646, 0x647, 0x5, 0x191, 0xc9, 0x2, 0x647, 0x648, 0x5, 0x187, + 0xc4, 0x2, 0x648, 0x649, 0x5, 0x193, 0xca, 0x2, 0x649, 0x64a, 0x5, 0x191, + 0xc9, 0x2, 0x64a, 0x14c, 0x3, 0x2, 0x2, 0x2, 0x64b, 0x64c, 0x5, 0x19f, + 0xd0, 0x2, 0x64c, 0x64d, 0x5, 0x195, 0xcb, 0x2, 0x64d, 0x64e, 0x5, 0x17d, + 0xbf, 0x2, 0x64e, 0x64f, 0x5, 0x177, 0xbc, 0x2, 0x64f, 0x650, 0x5, 0x19d, + 0xcf, 0x2, 0x650, 0x651, 0x5, 0x17f, 0xc0, 0x2, 0x651, 0x14e, 0x3, 0x2, + 0x2, 0x2, 0x652, 0x653, 0x5, 0x19f, 0xd0, 0x2, 0x653, 0x654, 0x5, 0x19b, + 0xce, 0x2, 0x654, 0x655, 0x5, 0x17f, 0xc0, 0x2, 0x655, 0x150, 0x3, 0x2, + 0x2, 0x2, 0x656, 0x657, 0x5, 0x19f, 0xd0, 0x2, 0x657, 0x658, 0x5, 0x19b, + 0xce, 0x2, 0x658, 0x659, 0x5, 0x187, 0xc4, 0x2, 0x659, 0x65a, 0x5, 0x191, + 0xc9, 0x2, 0x65a, 0x65b, 0x5, 0x183, 0xc2, 0x2, 0x65b, 0x152, 0x3, 0x2, + 0x2, 0x2, 0x65c, 0x65d, 0x5, 0x19f, 0xd0, 0x2, 0x65d, 0x65e, 0x5, 0x19f, + 0xd0, 0x2, 0x65e, 0x65f, 0x5, 0x187, 0xc4, 0x2, 0x65f, 0x660, 0x5, 0x17d, + 0xbf, 0x2, 0x660, 0x154, 0x3, 0x2, 0x2, 0x2, 0x661, 0x662, 0x5, 0x1a1, + 0xd1, 0x2, 0x662, 0x663, 0x5, 0x177, 0xbc, 0x2, 0x663, 0x664, 0x5, 0x18d, + 0xc7, 0x2, 0x664, 0x665, 0x5, 0x19f, 0xd0, 0x2, 0x665, 0x666, 0x5, 0x17f, + 0xc0, 0x2, 0x666, 0x667, 0x5, 0x19b, 0xce, 0x2, 0x667, 0x156, 0x3, 0x2, + 0x2, 0x2, 0x668, 0x669, 0x5, 0x1a1, 0xd1, 0x2, 0x669, 0x66a, 0x5, 0x187, + 0xc4, 0x2, 0x66a, 0x66b, 0x5, 0x17f, 0xc0, 0x2, 0x66b, 0x66c, 0x5, 0x1a3, + 0xd2, 0x2, 0x66c, 0x158, 0x3, 0x2, 0x2, 0x2, 0x66d, 0x66e, 0x5, 0x1a1, + 0xd1, 0x2, 0x66e, 0x66f, 0x5, 0x193, 0xca, 0x2, 0x66f, 0x670, 0x5, 0x18d, + 0xc7, 0x2, 0x670, 0x671, 0x5, 0x19f, 0xd0, 0x2, 0x671, 0x672, 0x5, 0x18f, + 0xc8, 0x2, 0x672, 0x673, 0x5, 0x17f, 0xc0, 0x2, 0x673, 0x15a, 0x3, 0x2, + 0x2, 0x2, 0x674, 0x675, 0x5, 0x1a3, 0xd2, 0x2, 0x675, 0x676, 0x5, 0x177, + 0xbc, 0x2, 0x676, 0x677, 0x5, 0x19d, 0xcf, 0x2, 0x677, 0x678, 0x5, 0x17b, + 0xbe, 0x2, 0x678, 0x679, 0x5, 0x185, 0xc3, 0x2, 0x679, 0x15c, 0x3, 0x2, + 0x2, 0x2, 0x67a, 0x67b, 0x5, 0x1a3, 0xd2, 0x2, 0x67b, 0x67c, 0x5, 0x17f, + 0xc0, 0x2, 0x67c, 0x67d, 0x5, 0x17f, 0xc0, 0x2, 0x67d, 0x67e, 0x5, 0x18b, + 0xc6, 0x2, 0x67e, 0x15e, 0x3, 0x2, 0x2, 0x2, 0x67f, 0x680, 0x5, 0x1a3, + 0xd2, 0x2, 0x680, 0x681, 0x5, 0x185, 0xc3, 0x2, 0x681, 0x682, 0x5, 0x17f, + 0xc0, 0x2, 0x682, 0x683, 0x5, 0x191, 0xc9, 0x2, 0x683, 0x160, 0x3, 0x2, + 0x2, 0x2, 0x684, 0x685, 0x5, 0x1a3, 0xd2, 0x2, 0x685, 0x686, 0x5, 0x185, + 0xc3, 0x2, 0x686, 0x687, 0x5, 0x17f, 0xc0, 0x2, 0x687, 0x688, 0x5, 0x199, + 0xcd, 0x2, 0x688, 0x689, 0x5, 0x17f, 0xc0, 0x2, 0x689, 0x162, 0x3, 0x2, + 0x2, 0x2, 0x68a, 0x68b, 0x5, 0x1a3, 0xd2, 0x2, 0x68b, 0x68c, 0x5, 0x187, + 0xc4, 0x2, 0x68c, 0x68d, 0x5, 0x19d, 0xcf, 0x2, 0x68d, 0x68e, 0x5, 0x185, + 0xc3, 0x2, 0x68e, 0x164, 0x3, 0x2, 0x2, 0x2, 0x68f,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70d, 0x5, 0x1db, 0xee, 0x2, 0x70b, 0x70d, 0x5, 0x1c1, + 0xe1, 0x2, 0x70c, 0x70a, 0x3, 0x2, 0x2, 0x2, 0x70c, 0x70b, 0x3, 0x2, + 0x2, 0x2, 0x70c, 0x70d, 0x3, 0x2, 0x2, 0x2, 0x70d, 0x70f, 0x3, 0x2, + 0x2, 0x2, 0x70e, 0x710, 0x5, 0x1af, 0xd8, 0x2, 0x70f, 0x70e, 0x3, 0x2, + 0x2, 0x2, 0x710, 0x711, 0x3, 0x2, 0x2, 0x2, 0x711, 0x70f, 0x3, 0x2, + 0x2, 0x2, 0x711, 0x712, 0x3, 0x2, 0x2, 0x2, 0x712, 0x71f, 0x3, 0x2, + 0x2, 0x2, 0x713, 0x714, 0x5, 0x171, 0xb9, 0x2, 0x714, 0x717, 0x5, 0x17f, + 0xc0, 0x2, 0x715, 0x718, 0x5, 0x1db, 0xee, 0x2, 0x716, 0x718, 0x5, 0x1c1, + 0xe1, 0x2, 0x717, 0x715, 0x3, 0x2, 0x2, 0x2, 0x717, 0x716, 0x3, 0x2, + 0x2, 0x2, 0x717, 0x718, 0x3, 0x2, 0x2, 0x2, 0x718, 0x71a, 0x3, 0x2, + 0x2, 0x2, 0x719, 0x71b, 0x5, 0x1af, 0xd8, 0x2, 0x71a, 0x719, 0x3, 0x2, + 0x2, 0x2, 0x71b, 0x71c, 0x3, 0x2, 0x2, 0x2, 0x71c, 0x71a, 0x3, 0x2, + 0x2, 0x2, 0x71c, 0x71d, 0x3, 0x2, 0x2, 0x2, 0x71d, 0x71f, 0x3, 0x2, + 0x2, 0x2, 0x71e, 0x6d2, 0x3, 0x2, 0x2, 0x2, 0x71e, 0x6e7, 0x3, 0x2, + 0x2, 0x2, 0x71e, 0x6f5, 0x3, 0x2, 0x2, 0x2, 0x71e, 0x707, 0x3, 0x2, + 0x2, 0x2, 0x71e, 0x713, 0x3, 0x2, 0x2, 0x2, 0x71f, 0x16e, 0x3, 0x2, + 0x2, 0x2, 0x720, 0x722, 0x7, 0x32, 0x2, 0x2, 0x721, 0x723, 0x5, 0x1ad, + 0xd7, 0x2, 0x722, 0x721, 0x3, 0x2, 0x2, 0x2, 0x723, 0x724, 0x3, 0x2, + 0x2, 0x2, 0x724, 0x722, 0x3, 0x2, 0x2, 0x2, 0x724, 0x725, 0x3, 0x2, + 0x2, 0x2, 0x725, 0x170, 0x3, 0x2, 0x2, 0x2, 0x726, 0x728, 0x5, 0x1af, + 0xd8, 0x2, 0x727, 0x726, 0x3, 0x2, 0x2, 0x2, 0x728, 0x729, 0x3, 0x2, + 0x2, 0x2, 0x729, 0x727, 0x3, 0x2, 0x2, 0x2, 0x729, 0x72a, 0x3, 0x2, + 0x2, 0x2, 0x72a, 0x172, 0x3, 0x2, 0x2, 0x2, 0x72b, 0x72c, 0x7, 0x32, + 0x2, 0x2, 0x72c, 0x72e, 0x5, 0x1a5, 0xd3, 0x2, 0x72d, 0x72f, 0x5, 0x1b1, + 0xd9, 0x2, 0x72e, 0x72d, 0x3, 0x2, 0x2, 0x2, 0x72f, 0x730, 0x3, 0x2, + 0x2, 0x2, 0x730, 0x72e, 0x3, 0x2, 0x2, 0x2, 0x730, 0x731, 0x3, 0x2, + 0x2, 0x2, 0x731, 0x174, 0x3, 0x2, 0x2, 0x2, 0x732, 0x73c, 0x5, 0x1e1, + 0xf1, 0x2, 0x733, 0x73b, 0xa, 0x4, 0x2, 0x2, 0x734, 0x735, 0x5, 0x1b9, + 0xdd, 0x2, 0x735, 0x736, 0xb, 0x2, 0x2, 0x2, 0x736, 0x73b, 0x3, 0x2, + 0x2, 0x2, 0x737, 0x738, 0x5, 0x1e1, 0xf1, 0x2, 0x738, 0x739, 0x5, 0x1e1, + 0xf1, 0x2, 0x739, 0x73b, 0x3, 0x2, 0x2, 0x2, 0x73a, 0x733, 0x3, 0x2, + 0x2, 0x2, 0x73a, 0x734, 0x3, 0x2, 0x2, 0x2, 0x73a, 0x737, 0x3, 0x2, + 0x2, 0x2, 0x73b, 0x73e, 0x3, 0x2, 0x2, 0x2, 0x73c, 0x73a, 0x3, 0x2, + 0x2, 0x2, 0x73c, 0x73d, 0x3, 0x2, 0x2, 0x2, 0x73d, 0x73f, 0x3, 0x2, + 0x2, 0x2, 0x73e, 0x73c, 0x3, 0x2, 0x2, 0x2, 0x73f, 0x740, 0x5, 0x1e1, + 0xf1, 0x2, 0x740, 0x176, 0x3, 0x2, 0x2, 0x2, 0x741, 0x742, 0x9, 0x5, + 0x2, 0x2, 0x742, 0x178, 0x3, 0x2, 0x2, 0x2, 0x743, 0x744, 0x9, 0x6, + 0x2, 0x2, 0x744, 0x17a, 0x3, 0x2, 0x2, 0x2, 0x745, 0x746, 0x9, 0x7, + 0x2, 0x2, 0x746, 0x17c, 0x3, 0x2, 0x2, 0x2, 0x747, 0x748, 0x9, 0x8, + 0x2, 0x2, 0x748, 0x17e, 0x3, 0x2, 0x2, 0x2, 0x749, 0x74a, 0x9, 0x9, + 0x2, 0x2, 0x74a, 0x180, 0x3, 0x2, 0x2, 0x2, 0x74b, 0x74c, 0x9, 0xa, + 0x2, 0x2, 0x74c, 0x182, 0x3, 0x2, 0x2, 0x2, 0x74d, 0x74e, 0x9, 0xb, + 0x2, 0x2, 0x74e, 0x184, 0x3, 0x2, 0x2, 0x2, 0x74f, 0x750, 0x9, 0xc, + 0x2, 0x2, 0x750, 0x186, 0x3, 0x2, 0x2, 0x2, 0x751, 0x752, 0x9, 0xd, + 0x2, 0x2, 0x752, 0x188, 0x3, 0x2, 0x2, 0x2, 0x753, 0x754, 0x9, 0xe, + 0x2, 0x2, 0x754, 0x18a, 0x3, 0x2, 0x2, 0x2, 0x755, 0x756, 0x9, 0xf, + 0x2, 0x2, 0x756, 0x18c, 0x3, 0x2, 0x2, 0x2, 0x757, 0x758, 0x9, 0x10, + 0x2, 0x2, 0x758, 0x18e, 0x3, 0x2, 0x2, 0x2, 0x759, 0x75a, 0x9, 0x11, + 0x2, 0x2, 0x75a, 0x190, 0x3, 0x2, 0x2, 0x2, 0x75b, 0x75c, 0x9, 0x12, + 0x2, 0x2, 0x75c, 0x192, 0x3, 0x2, 0x2, 0x2, 0x75d, 0x75e, 0x9, 0x13, + 0x2, 0x2, 0x75e, 0x194, 0x3, 0x2, 0x2, 0x2, 0x75f, 0x760, 0x9, 0x14, + 0x2, 0x2, 0x760, 0x196, 0x3, 0x2, 0x2, 0x2, 0x761, 0x762, 0x9, 0x15, + 0x2, 0x2, 0x762, 0x198, 0x3, 0x2, 0x2, 0x2, 0x763, 0x764, 0x9, 0x16, + 0x2, 0x2, 0x764, 0x19a, 0x3, 0x2, 0x2, 0x2, 0x765, 0x766, 0x9, 0x17, + 0x2, 0x2, 0x766, 0x19c, 0x3, 0x2, 0x2, 0x2, 0x767, 0x768, 0x9, 0x18, + 0x2, 0x2, 0x768, 0x19e, 0x3, 0x2, 0x2, 0x2, 0x769, 0x76a, 0x9, 0x19, + 0x2, 0x2, 0x76a, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x76b, 0x76c, 0x9, 0x1a, + 0x2, 0x2, 0x76c, 0x1a2, 0x3, 0x2, 0x2, 0x2, 0x76d, 0x76e, 0x9, 0x1b, + 0x2, 0x2, 0x76e, 0x1a4, 0x3, 0x2, 0x2, 0x2, 0x76f, 0x770, 0x9, 0x1c, + 0x2, 0x2, 0x770, 0x1a6, 0x3, 0x2, 0x2, 0x2, 0x771, 0x772, 0x9, 0x1d, + 0x2, 0x2, 0x772, 0x1a8, 0x3, 0x2, 0x2, 0x2, 0x773, 0x774, 0x9, 0x1e, + 0x2, 0x2, 0x774, 0x1aa, 0x3, 0x2, 0x2, 0x2, 0x775, 0x776, 0x9, 0x1f, + 0x2, 0x2, 0x776, 0x1ac, 0x3, 0x2, 0x2, 0x2, 0x777, 0x778, 0x9, 0x20, + 0x2, 0x2, 0x778, 0x1ae, 0x3, 0x2, 0x2, 0x2, 0x779, 0x77a, 0x9, 0x21, + 0x2, 0x2, 0x77a, 0x1b0, 0x3, 0x2, 0x2, 0x2, 0x77b, 0x77c, 0x9, 0x22, + 0x2, 0x2, 0x77c, 0x1b2, 0x3, 0x2, 0x2, 0x2, 0x77d, 0x77e, 0x7, 0x2f, + 0x2, 0x2, 0x77e, 0x77f, 0x7, 0x40, 0x2, 0x2, 0x77f, 0x1b4, 0x3, 0x2, + 0x2, 0x2, 0x780, 0x781, 0x7, 0x2c, 0x2, 0x2, 0x781, 0x1b6, 0x3, 0x2, + 0x2, 0x2, 0x782, 0x783, 0x7, 0x62, 0x2, 0x2, 0x783, 0x1b8, 0x3, 0x2, + 0x2, 0x2, 0x784, 0x785, 0x7, 0x5e, 0x2, 0x2, 0x785, 0x1ba, 0x3, 0x2, + 0x2, 0x2, 0x786, 0x787, 0x7, 0x3c, 0x2, 0x2, 0x787, 0x1bc, 0x3, 0x2, + 0x2, 0x2, 0x788, 0x789, 0x7, 0x2e, 0x2, 0x2, 0x789, 0x1be, 0x3, 0x2, + 0x2, 0x2, 0x78a, 0x78b, 0x7, 0x7e, 0x2, 0x2, 0x78b, 0x78c, 0x7, 0x7e, + 0x2, 0x2, 0x78c, 0x1c0, 0x3, 0x2, 0x2, 0x2, 0x78d, 0x78e, 0x7, 0x2f, + 0x2, 0x2, 0x78e, 0x1c2, 0x3, 0x2, 0x2, 0x2, 0x78f, 0x790, 0x7, 0x30, + 0x2, 0x2, 0x790, 0x1c4, 0x3, 0x2, 0x2, 0x2, 0x791, 0x792, 0x7, 0x3f, + 0x2, 0x2, 0x792, 0x793, 0x7, 0x3f, 0x2, 0x2, 0x793, 0x1c6, 0x3, 0x2, + 0x2, 0x2, 0x794, 0x795, 0x7, 0x3f, 0x2, 0x2, 0x795, 0x1c8, 0x3, 0x2, + 0x2, 0x2, 0x796, 0x797, 0x7, 0x40, 0x2, 0x2, 0x797, 0x798, 0x7, 0x3f, + 0x2, 0x2, 0x798, 0x1ca, 0x3, 0x2, 0x2, 0x2, 0x799, 0x79a, 0x7, 0x40, + 0x2, 0x2, 0x79a, 0x1cc, 0x3, 0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2, 0x2, 0x7d4, 0x7d3, 0x3, 0x2, 0x2, 0x2, 0x7d5, 0x7d8, 0x3, 0x2, + 0x2, 0x2, 0x7d6, 0x7d4, 0x3, 0x2, 0x2, 0x2, 0x7d6, 0x7d7, 0x3, 0x2, + 0x2, 0x2, 0x7d7, 0x7da, 0x3, 0x2, 0x2, 0x2, 0x7d8, 0x7d6, 0x3, 0x2, + 0x2, 0x2, 0x7d9, 0x7db, 0x9, 0x24, 0x2, 0x2, 0x7da, 0x7d9, 0x3, 0x2, + 0x2, 0x2, 0x7db, 0x7dc, 0x3, 0x2, 0x2, 0x2, 0x7dc, 0x7dd, 0x8, 0xf9, + 0x2, 0x2, 0x7dd, 0x1f2, 0x3, 0x2, 0x2, 0x2, 0x7de, 0x7df, 0x9, 0x25, + 0x2, 0x2, 0x7df, 0x7e0, 0x3, 0x2, 0x2, 0x2, 0x7e0, 0x7e1, 0x8, 0xfa, + 0x2, 0x2, 0x7e1, 0x1f4, 0x3, 0x2, 0x2, 0x2, 0x26, 0x2, 0x233, 0x40f, + 0x699, 0x6a8, 0x6ad, 0x6af, 0x6ba, 0x6bc, 0x6c9, 0x6cb, 0x6d0, 0x6d7, + 0x6dc, 0x6e0, 0x6e5, 0x6ea, 0x6ee, 0x6f3, 0x6fa, 0x700, 0x705, 0x70c, + 0x711, 0x717, 0x71c, 0x71e, 0x724, 0x729, 0x730, 0x73a, 0x73c, 0x7aa, + 0x7c8, 0x7d6, 0x7da, 0x3, 0x8, 0x2, 0x2, + }; + + atn::ATNDeserializer deserializer; + _atn = deserializer.deserialize(_serializedATN); + + size_t count = _atn.getNumberOfDecisions(); + _decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + _decisionToDFA.emplace_back(_atn.getDecisionState(i), i); + } +} + +ClickHouseLexer::Initializer ClickHouseLexer::_init; diff --git a/src/Parsers/New/ClickHouseLexer.g4 b/src/Parsers/New/ClickHouseLexer.g4 new file mode 100644 index 00000000000..508bc1d33ff --- /dev/null +++ b/src/Parsers/New/ClickHouseLexer.g4 @@ -0,0 +1,279 @@ +lexer grammar ClickHouseLexer; + +// NOTE: don't forget to add new keywords to the parser rule "keyword"! + +// Keywords + +ADD: A D D; +AFTER: A F T E R; +ALIAS: A L I A S; +ALL: A L L; +ALTER: A L T E R; +AND: A N D; +ANTI: A N T I; +ANY: A N Y; +ARRAY: A R R A Y; +AS: A S; +ASCENDING: A S C | A S C E N D I N G; +ASOF: A S O F; +ASYNC: A S Y N C; +ATTACH: A T T A C H; +BETWEEN: B E T W E E N; +BOTH: B O T H; +BY: B Y; +CASE: C A S E; +CAST: C A S T; +CHECK: C H E C K; +CLEAR: C L E A R; +CLUSTER: C L U S T E R; +CODEC: C O D E C; +COLLATE: C O L L A T E; +COLUMN: C O L U M N; +COMMENT: C O M M E N T; +CONSTRAINT: C O N S T R A I N T; +CREATE: C R E A T E; +CROSS: C R O S S; +CUBE: C U B E; +DATABASE: D A T A B A S E; +DATABASES: D A T A B A S E S; +DATE: D A T E; +DAY: D A Y; +DEDUPLICATE: D E D U P L I C A T E; +DEFAULT: D E F A U L T; +DELAY: D E L A Y; +DELETE: D E L E T E; +DESC: D E S C; +DESCENDING: D E S C E N D I N G; +DESCRIBE: D E S C R I B E; +DETACH: D E T A C H; +DICTIONARIES: D I C T I O N A R I E S; +DICTIONARY: D I C T I O N A R Y; +DISK: D I S K; +DISTINCT: D I S T I N C T; +DISTRIBUTED: D I S T R I B U T E D; +DROP: D R O P; +ELSE: E L S E; +END: E N D; +ENGINE: E N G I N E; +EVENTS: E V E N T S; +EXISTS: E X I S T S; +EXPLAIN: E X P L A I N; +EXPRESSION: E X P R E S S I O N; +EXTRACT: E X T R A C T; +FETCHES: F E T C H E S; +FINAL: F I N A L; +FIRST: F I R S T; +FLUSH: F L U S H; +FOR: F O R; +FORMAT: F O R M A T; +FREEZE: F R E E Z E; +FROM: F R O M; +FULL: F U L L; +FUNCTION: F U N C T I O N; +GLOBAL: G L O B A L; +GRANULARITY: G R A N U L A R I T Y; +GROUP: G R O U P; +HAVING: H A V I N G; +HIERARCHICAL: H I E R A R C H I C A L; +HOUR: H O U R; +ID: I D; +IF: I F; +ILIKE: I L I K E; +IN: I N; +INDEX: I N D E X; +INF: I N F | I N F I N I T Y; +INJECTIVE: I N J E C T I V E; +INNER: I N N E R; +INSERT: I N S E R T; +INTERVAL: I N T E R V A L; +INTO: I N T O; +IS: I S; +IS_OBJECT_ID: I S UNDERSCORE O B J E C T UNDERSCORE I D; +JOIN: J O I N; +KEY: K E Y; +KILL: K I L L; +LAST: L A S T; +LAYOUT: L A Y O U T; +LEADING: L E A D I N G; +LEFT: L E F T; +LIFETIME: L I F E T I M E; +LIKE: L I K E; +LIMIT: L I M I T; +LIVE: L I V E; +LOCAL: L O C A L; +LOGS: L O G S; +MATERIALIZED: M A T E R I A L I Z E D; +MAX: M A X; +MERGES: M E R G E S; +MIN: M I N; +MINUTE: M I N U T E; +MODIFY: M O D I F Y; +MONTH: M O N T H; +MOVE: M O V E; +MUTATION: M U T A T I O N; +NAN_SQL: N A N; // conflicts with macro NAN +NO: N O; +NOT: N O T; +NULL_SQL: N U L L; // conflicts with macro NULL +NULLS: N U L L S; +OFFSET: O F F S E T; +ON: O N; +OPTIMIZE: O P T I M I Z E; +OR: O R; +ORDER: O R D E R; +OUTER: O U T E R; +OUTFILE: O U T F I L E; +PARTITION: P A R T I T I O N; +POPULATE: P O P U L A T E; +PREWHERE: P R E W H E R E; +PRIMARY: P R I M A R Y; +QUARTER: Q U A R T E R; +RANGE: R A N G E; +RELOAD: R E L O A D; +REMOVE: R E M O V E; +RENAME: R E N A M E; +REPLACE: R E P L A C E; +REPLICA: R E P L I C A; +REPLICATED: R E P L I C A T E D; +RIGHT: R I G H T; +ROLLUP: R O L L U P; +SAMPLE: S A M P L E; +SECOND: S E C O N D; +SELECT: S E L E C T; +SEMI: S E M I; +SENDS: S E N D S; +SET: S E T; +SETTINGS: S E T T I N G S; +SHOW: S H O W; +SOURCE: S O U R C E; +START: S T A R T; +STOP: S T O P; +SUBSTRING: S U B S T R I N G; +SYNC: S Y N C; +SYNTAX: S Y N T A X; +SYSTEM: S Y S T E M; +TABLE: T A B L E; +TABLES: T A B L E S; +TEMPORARY: T E M P O R A R Y; +TEST: T E S T; +THEN: T H E N; +TIES: T I E S; +TIMEOUT: T I M E O U T; +TIMESTAMP: T I M E S T A M P; +TO: T O; +TOP: T O P; +TOTALS: T O T A L S; +TRAILING: T R A I L I N G; +TRIM: T R I M; +TRUNCATE: T R U N C A T E; +TTL: T T L; +TYPE: T Y P E; +UNION: U N I O N; +UPDATE: U P D A T E; +USE: U S E; +USING: U S I N G; +UUID: U U I D; +VALUES: V A L U E S; +VIEW: V I E W; +VOLUME: V O L U M E; +WATCH: W A T C H; +WEEK: W E E K; +WHEN: W H E N; +WHERE: W H E R E; +WITH: W I T H; +YEAR: Y E A R | Y Y Y Y; + +JSON_FALSE: 'false'; +JSON_TRUE: 'true'; + +// Tokens + +IDENTIFIER + : (LETTER | UNDERSCORE) (LETTER | UNDERSCORE | DEC_DIGIT)* + | BACKQUOTE ( ~([\\`]) | (BACKSLASH .) | (BACKQUOTE BACKQUOTE) )* BACKQUOTE + | QUOTE_DOUBLE ( ~([\\"]) | (BACKSLASH .) | (QUOTE_DOUBLE QUOTE_DOUBLE) )* QUOTE_DOUBLE + ; +FLOATING_LITERAL + : HEXADECIMAL_LITERAL DOT HEX_DIGIT* (P | E) (PLUS | DASH)? DEC_DIGIT+ + | HEXADECIMAL_LITERAL (P | E) (PLUS | DASH)? DEC_DIGIT+ + | DECIMAL_LITERAL DOT DEC_DIGIT* E (PLUS | DASH)? DEC_DIGIT+ + | DOT DECIMAL_LITERAL E (PLUS | DASH)? DEC_DIGIT+ + | DECIMAL_LITERAL E (PLUS | DASH)? DEC_DIGIT+ + ; +OCTAL_LITERAL: '0' OCT_DIGIT+; +DECIMAL_LITERAL: DEC_DIGIT+; +HEXADECIMAL_LITERAL: '0' X HEX_DIGIT+; + +// It's important that quote-symbol is a single character. +STRING_LITERAL: QUOTE_SINGLE ( ~([\\']) | (BACKSLASH .) | (QUOTE_SINGLE QUOTE_SINGLE) )* QUOTE_SINGLE; + +// Alphabet and allowed symbols + +fragment A: [aA]; +fragment B: [bB]; +fragment C: [cC]; +fragment D: [dD]; +fragment E: [eE]; +fragment F: [fF]; +fragment G: [gG]; +fragment H: [hH]; +fragment I: [iI]; +fragment J: [jJ]; +fragment K: [kK]; +fragment L: [lL]; +fragment M: [mM]; +fragment N: [nN]; +fragment O: [oO]; +fragment P: [pP]; +fragment Q: [qQ]; +fragment R: [rR]; +fragment S: [sS]; +fragment T: [tT]; +fragment U: [uU]; +fragment V: [vV]; +fragment W: [wW]; +fragment X: [xX]; +fragment Y: [yY]; +fragment Z: [zZ]; + +fragment LETTER: [a-zA-Z]; +fragment OCT_DIGIT: [0-7]; +fragment DEC_DIGIT: [0-9]; +fragment HEX_DIGIT: [0-9a-fA-F]; + +ARROW: '->'; +ASTERISK: '*'; +BACKQUOTE: '`'; +BACKSLASH: '\\'; +COLON: ':'; +COMMA: ','; +CONCAT: '||'; +DASH: '-'; +DOT: '.'; +EQ_DOUBLE: '=='; +EQ_SINGLE: '='; +GE: '>='; +GT: '>'; +LBRACE: '{'; +LBRACKET: '['; +LE: '<='; +LPAREN: '('; +LT: '<'; +NOT_EQ: '!=' | '<>'; +PERCENT: '%'; +PLUS: '+'; +QUERY: '?'; +QUOTE_DOUBLE: '"'; +QUOTE_SINGLE: '\''; +RBRACE: '}'; +RBRACKET: ']'; +RPAREN: ')'; +SEMICOLON: ';'; +SLASH: '/'; +UNDERSCORE: '_'; + +// Comments and whitespace + +MULTI_LINE_COMMENT: '/*' .*? '*/' -> skip; +SINGLE_LINE_COMMENT: '--' ~('\n'|'\r')* ('\n' | '\r' | EOF) -> skip; +WHITESPACE: [ \u000B\u000C\t\r\n] -> skip; // '\n' can be part of multiline single query diff --git a/src/Parsers/New/ClickHouseLexer.h b/src/Parsers/New/ClickHouseLexer.h new file mode 100644 index 00000000000..e925c5d271f --- /dev/null +++ b/src/Parsers/New/ClickHouseLexer.h @@ -0,0 +1,98 @@ + +// Generated from ClickHouseLexer.g4 by ANTLR 4.7.2 + +#pragma once + + +#include "antlr4-runtime.h" + + +namespace DB { + + +class ClickHouseLexer : public antlr4::Lexer { +public: + enum { + ADD = 1, AFTER = 2, ALIAS = 3, ALL = 4, ALTER = 5, AND = 6, ANTI = 7, + ANY = 8, ARRAY = 9, AS = 10, ASCENDING = 11, ASOF = 12, ASYNC = 13, + ATTACH = 14, BETWEEN = 15, BOTH = 16, BY = 17, CASE = 18, CAST = 19, + CHECK = 20, CLEAR = 21, CLUSTER = 22, CODEC = 23, COLLATE = 24, COLUMN = 25, + COMMENT = 26, CONSTRAINT = 27, CREATE = 28, CROSS = 29, CUBE = 30, DATABASE = 31, + DATABASES = 32, DATE = 33, DAY = 34, DEDUPLICATE = 35, DEFAULT = 36, + DELAY = 37, DELETE = 38, DESC = 39, DESCENDING = 40, DESCRIBE = 41, + DETACH = 42, DICTIONARIES = 43, DICTIONARY = 44, DISK = 45, DISTINCT = 46, + DISTRIBUTED = 47, DROP = 48, ELSE = 49, END = 50, ENGINE = 51, EVENTS = 52, + EXISTS = 53, EXPLAIN = 54, EXPRESSION = 55, EXTRACT = 56, FETCHES = 57, + FINAL = 58, FIRST = 59, FLUSH = 60, FOR = 61, FORMAT = 62, FREEZE = 63, + FROM = 64, FULL = 65, FUNCTION = 66, GLOBAL = 67, GRANULARITY = 68, + GROUP = 69, HAVING = 70, HIERARCHICAL = 71, HOUR = 72, ID = 73, IF = 74, + ILIKE = 75, IN = 76, INDEX = 77, INF = 78, INJECTIVE = 79, INNER = 80, + INSERT = 81, INTERVAL = 82, INTO = 83, IS = 84, IS_OBJECT_ID = 85, JOIN = 86, + KEY = 87, KILL = 88, LAST = 89, LAYOUT = 90, LEADING = 91, LEFT = 92, + LIFETIME = 93, LIKE = 94, LIMIT = 95, LIVE = 96, LOCAL = 97, LOGS = 98, + MATERIALIZED = 99, MAX = 100, MERGES = 101, MIN = 102, MINUTE = 103, + MODIFY = 104, MONTH = 105, MOVE = 106, MUTATION = 107, NAN_SQL = 108, + NO = 109, NOT = 110, NULL_SQL = 111, NULLS = 112, OFFSET = 113, ON = 114, + OPTIMIZE = 115, OR = 116, ORDER = 117, OUTER = 118, OUTFILE = 119, PARTITION = 120, + POPULATE = 121, PREWHERE = 122, PRIMARY = 123, QUARTER = 124, RANGE = 125, + RELOAD = 126, REMOVE = 127, RENAME = 128, REPLACE = 129, REPLICA = 130, + REPLICATED = 131, RIGHT = 132, ROLLUP = 133, SAMPLE = 134, SECOND = 135, + SELECT = 136, SEMI = 137, SENDS = 138, SET = 139, SETTINGS = 140, SHOW = 141, + SOURCE = 142, START = 143, STOP = 144, SUBSTRING = 145, SYNC = 146, + SYNTAX = 147, SYSTEM = 148, TABLE = 149, TABLES = 150, TEMPORARY = 151, + TEST = 152, THEN = 153, TIES = 154, TIMEOUT = 155, TIMESTAMP = 156, + TO = 157, TOP = 158, TOTALS = 159, TRAILING = 160, TRIM = 161, TRUNCATE = 162, + TTL = 163, TYPE = 164, UNION = 165, UPDATE = 166, USE = 167, USING = 168, + UUID = 169, VALUES = 170, VIEW = 171, VOLUME = 172, WATCH = 173, WEEK = 174, + WHEN = 175, WHERE = 176, WITH = 177, YEAR = 178, JSON_FALSE = 179, JSON_TRUE = 180, + IDENTIFIER = 181, FLOATING_LITERAL = 182, OCTAL_LITERAL = 183, DECIMAL_LITERAL = 184, + HEXADECIMAL_LITERAL = 185, STRING_LITERAL = 186, ARROW = 187, ASTERISK = 188, + BACKQUOTE = 189, BACKSLASH = 190, COLON = 191, COMMA = 192, CONCAT = 193, + DASH = 194, DOT = 195, EQ_DOUBLE = 196, EQ_SINGLE = 197, GE = 198, GT = 199, + LBRACE = 200, LBRACKET = 201, LE = 202, LPAREN = 203, LT = 204, NOT_EQ = 205, + PERCENT = 206, PLUS = 207, QUERY = 208, QUOTE_DOUBLE = 209, QUOTE_SINGLE = 210, + RBRACE = 211, RBRACKET = 212, RPAREN = 213, SEMICOLON = 214, SLASH = 215, + UNDERSCORE = 216, MULTI_LINE_COMMENT = 217, SINGLE_LINE_COMMENT = 218, + WHITESPACE = 219 + }; + + ClickHouseLexer(antlr4::CharStream *input); + ~ClickHouseLexer(); + + virtual std::string getGrammarFileName() const override; + virtual const std::vector& getRuleNames() const override; + + virtual const std::vector& getChannelNames() const override; + virtual const std::vector& getModeNames() const override; + virtual const std::vector& getTokenNames() const override; // deprecated, use vocabulary instead + virtual antlr4::dfa::Vocabulary& getVocabulary() const override; + + virtual const std::vector getSerializedATN() const override; + virtual const antlr4::atn::ATN& getATN() const override; + +private: + static std::vector _decisionToDFA; + static antlr4::atn::PredictionContextCache _sharedContextCache; + static std::vector _ruleNames; + static std::vector _tokenNames; + static std::vector _channelNames; + static std::vector _modeNames; + + static std::vector _literalNames; + static std::vector _symbolicNames; + static antlr4::dfa::Vocabulary _vocabulary; + static antlr4::atn::ATN _atn; + static std::vector _serializedATN; + + + // Individual action functions triggered by action() above. + + // Individual semantic predicate functions triggered by sempred() above. + + struct Initializer { + Initializer(); + }; + static Initializer _init; +}; + +} // namespace DB diff --git a/src/Parsers/New/ClickHouseParser.cpp b/src/Parsers/New/ClickHouseParser.cpp new file mode 100644 index 00000000000..45985422161 --- /dev/null +++ b/src/Parsers/New/ClickHouseParser.cpp @@ -0,0 +1,19317 @@ + +// Generated from ClickHouseParser.g4 by ANTLR 4.7.2 + + +#include "ClickHouseParserVisitor.h" + +#include "ClickHouseParser.h" + + +using namespace antlrcpp; +using namespace DB; +using namespace antlr4; + +ClickHouseParser::ClickHouseParser(TokenStream *input) : Parser(input) { + _interpreter = new atn::ParserATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); +} + +ClickHouseParser::~ClickHouseParser() { + delete _interpreter; +} + +std::string ClickHouseParser::getGrammarFileName() const { + return "ClickHouseParser.g4"; +} + +const std::vector& ClickHouseParser::getRuleNames() const { + return _ruleNames; +} + +dfa::Vocabulary& ClickHouseParser::getVocabulary() const { + return _vocabulary; +} + + +//----------------- QueryStmtContext ------------------------------------------------------------------ + +ClickHouseParser::QueryStmtContext::QueryStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::QueryContext* ClickHouseParser::QueryStmtContext::query() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::QueryStmtContext::INTO() { + return getToken(ClickHouseParser::INTO, 0); +} + +tree::TerminalNode* ClickHouseParser::QueryStmtContext::OUTFILE() { + return getToken(ClickHouseParser::OUTFILE, 0); +} + +tree::TerminalNode* ClickHouseParser::QueryStmtContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::QueryStmtContext::FORMAT() { + return getToken(ClickHouseParser::FORMAT, 0); +} + +ClickHouseParser::IdentifierOrNullContext* ClickHouseParser::QueryStmtContext::identifierOrNull() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::QueryStmtContext::SEMICOLON() { + return getToken(ClickHouseParser::SEMICOLON, 0); +} + +ClickHouseParser::InsertStmtContext* ClickHouseParser::QueryStmtContext::insertStmt() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::QueryStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleQueryStmt; +} + +antlrcpp::Any ClickHouseParser::QueryStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitQueryStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::QueryStmtContext* ClickHouseParser::queryStmt() { + QueryStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 0, ClickHouseParser::RuleQueryStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(226); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::ALTER: + case ClickHouseParser::ATTACH: + case ClickHouseParser::CHECK: + case ClickHouseParser::CREATE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DROP: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::KILL: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::RENAME: + case ClickHouseParser::SELECT: + case ClickHouseParser::SET: + case ClickHouseParser::SHOW: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::USE: + case ClickHouseParser::WATCH: + case ClickHouseParser::WITH: + case ClickHouseParser::LPAREN: { + enterOuterAlt(_localctx, 1); + setState(212); + query(); + setState(216); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::INTO) { + setState(213); + match(ClickHouseParser::INTO); + setState(214); + match(ClickHouseParser::OUTFILE); + setState(215); + match(ClickHouseParser::STRING_LITERAL); + } + setState(220); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FORMAT) { + setState(218); + match(ClickHouseParser::FORMAT); + setState(219); + identifierOrNull(); + } + setState(223); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::SEMICOLON) { + setState(222); + match(ClickHouseParser::SEMICOLON); + } + break; + } + + case ClickHouseParser::INSERT: { + enterOuterAlt(_localctx, 2); + setState(225); + insertStmt(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- QueryContext ------------------------------------------------------------------ + +ClickHouseParser::QueryContext::QueryContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::AlterStmtContext* ClickHouseParser::QueryContext::alterStmt() { + return getRuleContext(0); +} + +ClickHouseParser::AttachStmtContext* ClickHouseParser::QueryContext::attachStmt() { + return getRuleContext(0); +} + +ClickHouseParser::CheckStmtContext* ClickHouseParser::QueryContext::checkStmt() { + return getRuleContext(0); +} + +ClickHouseParser::CreateStmtContext* ClickHouseParser::QueryContext::createStmt() { + return getRuleContext(0); +} + +ClickHouseParser::DescribeStmtContext* ClickHouseParser::QueryContext::describeStmt() { + return getRuleContext(0); +} + +ClickHouseParser::DropStmtContext* ClickHouseParser::QueryContext::dropStmt() { + return getRuleContext(0); +} + +ClickHouseParser::ExistsStmtContext* ClickHouseParser::QueryContext::existsStmt() { + return getRuleContext(0); +} + +ClickHouseParser::ExplainStmtContext* ClickHouseParser::QueryContext::explainStmt() { + return getRuleContext(0); +} + +ClickHouseParser::KillStmtContext* ClickHouseParser::QueryContext::killStmt() { + return getRuleContext(0); +} + +ClickHouseParser::OptimizeStmtContext* ClickHouseParser::QueryContext::optimizeStmt() { + return getRuleContext(0); +} + +ClickHouseParser::RenameStmtContext* ClickHouseParser::QueryContext::renameStmt() { + return getRuleContext(0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::QueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +ClickHouseParser::SetStmtContext* ClickHouseParser::QueryContext::setStmt() { + return getRuleContext(0); +} + +ClickHouseParser::ShowStmtContext* ClickHouseParser::QueryContext::showStmt() { + return getRuleContext(0); +} + +ClickHouseParser::SystemStmtContext* ClickHouseParser::QueryContext::systemStmt() { + return getRuleContext(0); +} + +ClickHouseParser::TruncateStmtContext* ClickHouseParser::QueryContext::truncateStmt() { + return getRuleContext(0); +} + +ClickHouseParser::UseStmtContext* ClickHouseParser::QueryContext::useStmt() { + return getRuleContext(0); +} + +ClickHouseParser::WatchStmtContext* ClickHouseParser::QueryContext::watchStmt() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::QueryContext::getRuleIndex() const { + return ClickHouseParser::RuleQuery; +} + +antlrcpp::Any ClickHouseParser::QueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitQuery(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::QueryContext* ClickHouseParser::query() { + QueryContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 2, ClickHouseParser::RuleQuery); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(246); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 4, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(228); + alterStmt(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(229); + attachStmt(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(230); + checkStmt(); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(231); + createStmt(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(232); + describeStmt(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(233); + dropStmt(); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(234); + existsStmt(); + break; + } + + case 8: { + enterOuterAlt(_localctx, 8); + setState(235); + explainStmt(); + break; + } + + case 9: { + enterOuterAlt(_localctx, 9); + setState(236); + killStmt(); + break; + } + + case 10: { + enterOuterAlt(_localctx, 10); + setState(237); + optimizeStmt(); + break; + } + + case 11: { + enterOuterAlt(_localctx, 11); + setState(238); + renameStmt(); + break; + } + + case 12: { + enterOuterAlt(_localctx, 12); + setState(239); + selectUnionStmt(); + break; + } + + case 13: { + enterOuterAlt(_localctx, 13); + setState(240); + setStmt(); + break; + } + + case 14: { + enterOuterAlt(_localctx, 14); + setState(241); + showStmt(); + break; + } + + case 15: { + enterOuterAlt(_localctx, 15); + setState(242); + systemStmt(); + break; + } + + case 16: { + enterOuterAlt(_localctx, 16); + setState(243); + truncateStmt(); + break; + } + + case 17: { + enterOuterAlt(_localctx, 17); + setState(244); + useStmt(); + break; + } + + case 18: { + enterOuterAlt(_localctx, 18); + setState(245); + watchStmt(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AlterStmtContext ------------------------------------------------------------------ + +ClickHouseParser::AlterStmtContext::AlterStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::AlterStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleAlterStmt; +} + +void ClickHouseParser::AlterStmtContext::copyFrom(AlterStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- AlterTableStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableStmtContext::ALTER() { + return getToken(ClickHouseParser::ALTER, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::AlterTableStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::AlterTableStmtContext::alterTableClause() { + return getRuleContexts(); +} + +ClickHouseParser::AlterTableClauseContext* ClickHouseParser::AlterTableStmtContext::alterTableClause(size_t i) { + return getRuleContext(i); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::AlterTableStmtContext::clusterClause() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::AlterTableStmtContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::AlterTableStmtContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::AlterTableStmtContext::AlterTableStmtContext(AlterStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::AlterStmtContext* ClickHouseParser::alterStmt() { + AlterStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 4, ClickHouseParser::RuleAlterStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(248); + match(ClickHouseParser::ALTER); + setState(249); + match(ClickHouseParser::TABLE); + setState(250); + tableIdentifier(); + setState(252); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(251); + clusterClause(); + } + setState(254); + alterTableClause(); + setState(259); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(255); + match(ClickHouseParser::COMMA); + setState(256); + alterTableClause(); + setState(261); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AlterTableClauseContext ------------------------------------------------------------------ + +ClickHouseParser::AlterTableClauseContext::AlterTableClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::AlterTableClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleAlterTableClause; +} + +void ClickHouseParser::AlterTableClauseContext::copyFrom(AlterTableClauseContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- AlterTableClauseReplaceContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseReplaceContext::REPLACE() { + return getToken(ClickHouseParser::REPLACE, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseReplaceContext::partitionClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseReplaceContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::AlterTableClauseReplaceContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseReplaceContext::AlterTableClauseReplaceContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseReplaceContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseReplace(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseRenameContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRenameContext::RENAME() { + return getToken(ClickHouseParser::RENAME, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRenameContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +std::vector ClickHouseParser::AlterTableClauseRenameContext::nestedIdentifier() { + return getRuleContexts(); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseRenameContext::nestedIdentifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRenameContext::TO() { + return getToken(ClickHouseParser::TO, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRenameContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRenameContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseRenameContext::AlterTableClauseRenameContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseRenameContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseRename(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseFreezePartitionContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseFreezePartitionContext::FREEZE() { + return getToken(ClickHouseParser::FREEZE, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseFreezePartitionContext::partitionClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseFreezePartitionContext::AlterTableClauseFreezePartitionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseFreezePartitionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseFreezePartition(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::TableColumnDfntContext* ClickHouseParser::AlterTableClauseModifyContext::tableColumnDfnt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseModifyContext::AlterTableClauseModifyContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModify(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyOrderByContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyOrderByContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyOrderByContext::ORDER() { + return getToken(ClickHouseParser::ORDER, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyOrderByContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::AlterTableClauseModifyOrderByContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseModifyOrderByContext::AlterTableClauseModifyOrderByContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyOrderByContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModifyOrderBy(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseRemoveTTLContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRemoveTTLContext::REMOVE() { + return getToken(ClickHouseParser::REMOVE, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseRemoveTTLContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + +ClickHouseParser::AlterTableClauseRemoveTTLContext::AlterTableClauseRemoveTTLContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseRemoveTTLContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseRemoveTTL(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseUpdateContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseUpdateContext::UPDATE() { + return getToken(ClickHouseParser::UPDATE, 0); +} + +ClickHouseParser::AssignmentExprListContext* ClickHouseParser::AlterTableClauseUpdateContext::assignmentExprList() { + return getRuleContext(0); +} + +ClickHouseParser::WhereClauseContext* ClickHouseParser::AlterTableClauseUpdateContext::whereClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseUpdateContext::AlterTableClauseUpdateContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseUpdateContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseUpdate(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyRemoveContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyRemoveContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyRemoveContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseModifyRemoveContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyRemoveContext::REMOVE() { + return getToken(ClickHouseParser::REMOVE, 0); +} + +ClickHouseParser::TableColumnPropertyTypeContext* ClickHouseParser::AlterTableClauseModifyRemoveContext::tableColumnPropertyType() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyRemoveContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyRemoveContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseModifyRemoveContext::AlterTableClauseModifyRemoveContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyRemoveContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModifyRemove(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseDeleteContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDeleteContext::DELETE() { + return getToken(ClickHouseParser::DELETE, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDeleteContext::WHERE() { + return getToken(ClickHouseParser::WHERE, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::AlterTableClauseDeleteContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseDeleteContext::AlterTableClauseDeleteContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseDeleteContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseDelete(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyCodecContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCodecContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCodecContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseModifyCodecContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::CodecExprContext* ClickHouseParser::AlterTableClauseModifyCodecContext::codecExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCodecContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCodecContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseModifyCodecContext::AlterTableClauseModifyCodecContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyCodecContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModifyCodec(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseCommentContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseCommentContext::COMMENT() { + return getToken(ClickHouseParser::COMMENT, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseCommentContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseCommentContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseCommentContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseCommentContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseCommentContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseCommentContext::AlterTableClauseCommentContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseCommentContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseComment(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseAttachContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAttachContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseAttachContext::partitionClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAttachContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::AlterTableClauseAttachContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseAttachContext::AlterTableClauseAttachContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseAttachContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseAttach(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseDropColumnContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropColumnContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropColumnContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseDropColumnContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropColumnContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropColumnContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseDropColumnContext::AlterTableClauseDropColumnContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseDropColumnContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseDropColumn(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseClearContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseClearContext::CLEAR() { + return getToken(ClickHouseParser::CLEAR, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseClearContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseClearContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseClearContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseClearContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseClearContext::IN() { + return getToken(ClickHouseParser::IN, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseClearContext::partitionClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseClearContext::AlterTableClauseClearContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseClearContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseClear(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseDetachContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDetachContext::DETACH() { + return getToken(ClickHouseParser::DETACH, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseDetachContext::partitionClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseDetachContext::AlterTableClauseDetachContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseDetachContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseDetach(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseDropIndexContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropIndexContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropIndexContext::INDEX() { + return getToken(ClickHouseParser::INDEX, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseDropIndexContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropIndexContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropIndexContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseDropIndexContext::AlterTableClauseDropIndexContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseDropIndexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseDropIndex(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseAddIndexContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::ADD() { + return getToken(ClickHouseParser::ADD, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::INDEX() { + return getToken(ClickHouseParser::INDEX, 0); +} + +ClickHouseParser::TableIndexDfntContext* ClickHouseParser::AlterTableClauseAddIndexContext::tableIndexDfnt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddIndexContext::AFTER() { + return getToken(ClickHouseParser::AFTER, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseAddIndexContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseAddIndexContext::AlterTableClauseAddIndexContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseAddIndexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseAddIndex(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseDropPartitionContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseDropPartitionContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseDropPartitionContext::partitionClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseDropPartitionContext::AlterTableClauseDropPartitionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseDropPartitionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseDropPartition(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyCommentContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseModifyCommentContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::COMMENT() { + return getToken(ClickHouseParser::COMMENT, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyCommentContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::AlterTableClauseModifyCommentContext::AlterTableClauseModifyCommentContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyCommentContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModifyComment(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseModifyTTLContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseModifyTTLContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +ClickHouseParser::TtlClauseContext* ClickHouseParser::AlterTableClauseModifyTTLContext::ttlClause() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseModifyTTLContext::AlterTableClauseModifyTTLContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseModifyTTLContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseModifyTTL(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseMovePartitionContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::MOVE() { + return getToken(ClickHouseParser::MOVE, 0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseMovePartitionContext::partitionClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::TO() { + return getToken(ClickHouseParser::TO, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::DISK() { + return getToken(ClickHouseParser::DISK, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::VOLUME() { + return getToken(ClickHouseParser::VOLUME, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseMovePartitionContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::AlterTableClauseMovePartitionContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseMovePartitionContext::AlterTableClauseMovePartitionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseMovePartitionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseMovePartition(this); + else + return visitor->visitChildren(this); +} +//----------------- AlterTableClauseAddColumnContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::ADD() { + return getToken(ClickHouseParser::ADD, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +ClickHouseParser::TableColumnDfntContext* ClickHouseParser::AlterTableClauseAddColumnContext::tableColumnDfnt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +tree::TerminalNode* ClickHouseParser::AlterTableClauseAddColumnContext::AFTER() { + return getToken(ClickHouseParser::AFTER, 0); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseAddColumnContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::AlterTableClauseAddColumnContext::AlterTableClauseAddColumnContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AlterTableClauseAddColumnContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlterTableClauseAddColumn(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::AlterTableClauseContext* ClickHouseParser::alterTableClause() { + AlterTableClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 6, ClickHouseParser::RuleAlterTableClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(413); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 24, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(262); + match(ClickHouseParser::ADD); + setState(263); + match(ClickHouseParser::COLUMN); + setState(267); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 7, _ctx)) { + case 1: { + setState(264); + match(ClickHouseParser::IF); + setState(265); + match(ClickHouseParser::NOT); + setState(266); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(269); + tableColumnDfnt(); + setState(272); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::AFTER) { + setState(270); + match(ClickHouseParser::AFTER); + setState(271); + nestedIdentifier(); + } + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(274); + match(ClickHouseParser::ADD); + setState(275); + match(ClickHouseParser::INDEX); + setState(279); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 9, _ctx)) { + case 1: { + setState(276); + match(ClickHouseParser::IF); + setState(277); + match(ClickHouseParser::NOT); + setState(278); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(281); + tableIndexDfnt(); + setState(284); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::AFTER) { + setState(282); + match(ClickHouseParser::AFTER); + setState(283); + nestedIdentifier(); + } + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(286); + match(ClickHouseParser::ATTACH); + setState(287); + partitionClause(); + setState(290); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FROM) { + setState(288); + match(ClickHouseParser::FROM); + setState(289); + tableIdentifier(); + } + break; + } + + case 4: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 4); + setState(292); + match(ClickHouseParser::CLEAR); + setState(293); + match(ClickHouseParser::COLUMN); + setState(296); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 12, _ctx)) { + case 1: { + setState(294); + match(ClickHouseParser::IF); + setState(295); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(298); + nestedIdentifier(); + setState(301); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::IN) { + setState(299); + match(ClickHouseParser::IN); + setState(300); + partitionClause(); + } + break; + } + + case 5: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 5); + setState(303); + match(ClickHouseParser::COMMENT); + setState(304); + match(ClickHouseParser::COLUMN); + setState(307); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 14, _ctx)) { + case 1: { + setState(305); + match(ClickHouseParser::IF); + setState(306); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(309); + nestedIdentifier(); + setState(310); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 6: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 6); + setState(312); + match(ClickHouseParser::DELETE); + setState(313); + match(ClickHouseParser::WHERE); + setState(314); + columnExpr(0); + break; + } + + case 7: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 7); + setState(315); + match(ClickHouseParser::DETACH); + setState(316); + partitionClause(); + break; + } + + case 8: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 8); + setState(317); + match(ClickHouseParser::DROP); + setState(318); + match(ClickHouseParser::COLUMN); + setState(321); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 15, _ctx)) { + case 1: { + setState(319); + match(ClickHouseParser::IF); + setState(320); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(323); + nestedIdentifier(); + break; + } + + case 9: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 9); + setState(324); + match(ClickHouseParser::DROP); + setState(325); + match(ClickHouseParser::INDEX); + setState(328); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 16, _ctx)) { + case 1: { + setState(326); + match(ClickHouseParser::IF); + setState(327); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(330); + nestedIdentifier(); + break; + } + + case 10: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 10); + setState(331); + match(ClickHouseParser::DROP); + setState(332); + partitionClause(); + break; + } + + case 11: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 11); + setState(333); + match(ClickHouseParser::FREEZE); + setState(335); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::PARTITION) { + setState(334); + partitionClause(); + } + break; + } + + case 12: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 12); + setState(337); + match(ClickHouseParser::MODIFY); + setState(338); + match(ClickHouseParser::COLUMN); + setState(341); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 18, _ctx)) { + case 1: { + setState(339); + match(ClickHouseParser::IF); + setState(340); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(343); + nestedIdentifier(); + setState(344); + codecExpr(); + break; + } + + case 13: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 13); + setState(346); + match(ClickHouseParser::MODIFY); + setState(347); + match(ClickHouseParser::COLUMN); + setState(350); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 19, _ctx)) { + case 1: { + setState(348); + match(ClickHouseParser::IF); + setState(349); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(352); + nestedIdentifier(); + setState(353); + match(ClickHouseParser::COMMENT); + setState(354); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 14: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 14); + setState(356); + match(ClickHouseParser::MODIFY); + setState(357); + match(ClickHouseParser::COLUMN); + setState(360); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 20, _ctx)) { + case 1: { + setState(358); + match(ClickHouseParser::IF); + setState(359); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(362); + nestedIdentifier(); + setState(363); + match(ClickHouseParser::REMOVE); + setState(364); + tableColumnPropertyType(); + break; + } + + case 15: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 15); + setState(366); + match(ClickHouseParser::MODIFY); + setState(367); + match(ClickHouseParser::COLUMN); + setState(370); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 21, _ctx)) { + case 1: { + setState(368); + match(ClickHouseParser::IF); + setState(369); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(372); + tableColumnDfnt(); + break; + } + + case 16: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 16); + setState(373); + match(ClickHouseParser::MODIFY); + setState(374); + match(ClickHouseParser::ORDER); + setState(375); + match(ClickHouseParser::BY); + setState(376); + columnExpr(0); + break; + } + + case 17: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 17); + setState(377); + match(ClickHouseParser::MODIFY); + setState(378); + ttlClause(); + break; + } + + case 18: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 18); + setState(379); + match(ClickHouseParser::MOVE); + setState(380); + partitionClause(); + setState(390); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 22, _ctx)) { + case 1: { + setState(381); + match(ClickHouseParser::TO); + setState(382); + match(ClickHouseParser::DISK); + setState(383); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 2: { + setState(384); + match(ClickHouseParser::TO); + setState(385); + match(ClickHouseParser::VOLUME); + setState(386); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 3: { + setState(387); + match(ClickHouseParser::TO); + setState(388); + match(ClickHouseParser::TABLE); + setState(389); + tableIdentifier(); + break; + } + + } + break; + } + + case 19: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 19); + setState(392); + match(ClickHouseParser::REMOVE); + setState(393); + match(ClickHouseParser::TTL); + break; + } + + case 20: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 20); + setState(394); + match(ClickHouseParser::RENAME); + setState(395); + match(ClickHouseParser::COLUMN); + setState(398); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 23, _ctx)) { + case 1: { + setState(396); + match(ClickHouseParser::IF); + setState(397); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(400); + nestedIdentifier(); + setState(401); + match(ClickHouseParser::TO); + setState(402); + nestedIdentifier(); + break; + } + + case 21: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 21); + setState(404); + match(ClickHouseParser::REPLACE); + setState(405); + partitionClause(); + setState(406); + match(ClickHouseParser::FROM); + setState(407); + tableIdentifier(); + break; + } + + case 22: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 22); + setState(409); + match(ClickHouseParser::UPDATE); + setState(410); + assignmentExprList(); + setState(411); + whereClause(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AssignmentExprListContext ------------------------------------------------------------------ + +ClickHouseParser::AssignmentExprListContext::AssignmentExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::AssignmentExprListContext::assignmentExpr() { + return getRuleContexts(); +} + +ClickHouseParser::AssignmentExprContext* ClickHouseParser::AssignmentExprListContext::assignmentExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::AssignmentExprListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::AssignmentExprListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::AssignmentExprListContext::getRuleIndex() const { + return ClickHouseParser::RuleAssignmentExprList; +} + +antlrcpp::Any ClickHouseParser::AssignmentExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAssignmentExprList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::AssignmentExprListContext* ClickHouseParser::assignmentExprList() { + AssignmentExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 8, ClickHouseParser::RuleAssignmentExprList); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(415); + assignmentExpr(); + setState(420); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(416); + match(ClickHouseParser::COMMA); + setState(417); + assignmentExpr(); + setState(422); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AssignmentExprContext ------------------------------------------------------------------ + +ClickHouseParser::AssignmentExprContext::AssignmentExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AssignmentExprContext::nestedIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::AssignmentExprContext::EQ_SINGLE() { + return getToken(ClickHouseParser::EQ_SINGLE, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::AssignmentExprContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::AssignmentExprContext::getRuleIndex() const { + return ClickHouseParser::RuleAssignmentExpr; +} + +antlrcpp::Any ClickHouseParser::AssignmentExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAssignmentExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::AssignmentExprContext* ClickHouseParser::assignmentExpr() { + AssignmentExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 10, ClickHouseParser::RuleAssignmentExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(423); + nestedIdentifier(); + setState(424); + match(ClickHouseParser::EQ_SINGLE); + setState(425); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableColumnPropertyTypeContext ------------------------------------------------------------------ + +ClickHouseParser::TableColumnPropertyTypeContext::TableColumnPropertyTypeContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::ALIAS() { + return getToken(ClickHouseParser::ALIAS, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::CODEC() { + return getToken(ClickHouseParser::CODEC, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::COMMENT() { + return getToken(ClickHouseParser::COMMENT, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::DEFAULT() { + return getToken(ClickHouseParser::DEFAULT, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::MATERIALIZED() { + return getToken(ClickHouseParser::MATERIALIZED, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyTypeContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + + +size_t ClickHouseParser::TableColumnPropertyTypeContext::getRuleIndex() const { + return ClickHouseParser::RuleTableColumnPropertyType; +} + +antlrcpp::Any ClickHouseParser::TableColumnPropertyTypeContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableColumnPropertyType(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableColumnPropertyTypeContext* ClickHouseParser::tableColumnPropertyType() { + TableColumnPropertyTypeContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 12, ClickHouseParser::RuleTableColumnPropertyType); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(427); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::DEFAULT))) != 0) || _la == ClickHouseParser::MATERIALIZED || _la == ClickHouseParser::TTL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PartitionClauseContext ------------------------------------------------------------------ + +ClickHouseParser::PartitionClauseContext::PartitionClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::PartitionClauseContext::PARTITION() { + return getToken(ClickHouseParser::PARTITION, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::PartitionClauseContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::PartitionClauseContext::ID() { + return getToken(ClickHouseParser::ID, 0); +} + +tree::TerminalNode* ClickHouseParser::PartitionClauseContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + + +size_t ClickHouseParser::PartitionClauseContext::getRuleIndex() const { + return ClickHouseParser::RulePartitionClause; +} + +antlrcpp::Any ClickHouseParser::PartitionClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPartitionClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::partitionClause() { + PartitionClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 14, ClickHouseParser::RulePartitionClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(434); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 26, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(429); + match(ClickHouseParser::PARTITION); + setState(430); + columnExpr(0); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(431); + match(ClickHouseParser::PARTITION); + setState(432); + match(ClickHouseParser::ID); + setState(433); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AttachStmtContext ------------------------------------------------------------------ + +ClickHouseParser::AttachStmtContext::AttachStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::AttachStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleAttachStmt; +} + +void ClickHouseParser::AttachStmtContext::copyFrom(AttachStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- AttachDictionaryStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::AttachDictionaryStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::AttachDictionaryStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::AttachDictionaryStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::AttachDictionaryStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::AttachDictionaryStmtContext::AttachDictionaryStmtContext(AttachStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::AttachDictionaryStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAttachDictionaryStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::AttachStmtContext* ClickHouseParser::attachStmt() { + AttachStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 16, ClickHouseParser::RuleAttachStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(436); + match(ClickHouseParser::ATTACH); + setState(437); + match(ClickHouseParser::DICTIONARY); + setState(438); + tableIdentifier(); + setState(440); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(439); + clusterClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CheckStmtContext ------------------------------------------------------------------ + +ClickHouseParser::CheckStmtContext::CheckStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::CheckStmtContext::CHECK() { + return getToken(ClickHouseParser::CHECK, 0); +} + +tree::TerminalNode* ClickHouseParser::CheckStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CheckStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::CheckStmtContext::partitionClause() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::CheckStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleCheckStmt; +} + +antlrcpp::Any ClickHouseParser::CheckStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCheckStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::CheckStmtContext* ClickHouseParser::checkStmt() { + CheckStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 18, ClickHouseParser::RuleCheckStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(442); + match(ClickHouseParser::CHECK); + setState(443); + match(ClickHouseParser::TABLE); + setState(444); + tableIdentifier(); + setState(446); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::PARTITION) { + setState(445); + partitionClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CreateStmtContext ------------------------------------------------------------------ + +ClickHouseParser::CreateStmtContext::CreateStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::CreateStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleCreateStmt; +} + +void ClickHouseParser::CreateStmtContext::copyFrom(CreateStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- CreateViewStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::VIEW() { + return getToken(ClickHouseParser::VIEW, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CreateViewStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::SubqueryClauseContext* ClickHouseParser::CreateViewStmtContext::subqueryClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::OR() { + return getToken(ClickHouseParser::OR, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::REPLACE() { + return getToken(ClickHouseParser::REPLACE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateViewStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::CreateViewStmtContext::uuidClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateViewStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::TableSchemaClauseContext* ClickHouseParser::CreateViewStmtContext::tableSchemaClause() { + return getRuleContext(0); +} + +ClickHouseParser::CreateViewStmtContext::CreateViewStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateViewStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateViewStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- CreateDictionaryStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CreateDictionaryStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::DictionarySchemaClauseContext* ClickHouseParser::CreateDictionaryStmtContext::dictionarySchemaClause() { + return getRuleContext(0); +} + +ClickHouseParser::DictionaryEngineClauseContext* ClickHouseParser::CreateDictionaryStmtContext::dictionaryEngineClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDictionaryStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::CreateDictionaryStmtContext::uuidClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateDictionaryStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::CreateDictionaryStmtContext::CreateDictionaryStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateDictionaryStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateDictionaryStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- CreateDatabaseStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::DATABASE() { + return getToken(ClickHouseParser::DATABASE, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::CreateDatabaseStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateDatabaseStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateDatabaseStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::EngineExprContext* ClickHouseParser::CreateDatabaseStmtContext::engineExpr() { + return getRuleContext(0); +} + +ClickHouseParser::CreateDatabaseStmtContext::CreateDatabaseStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateDatabaseStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateDatabaseStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- CreateLiveViewStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::LIVE() { + return getToken(ClickHouseParser::LIVE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::VIEW() { + return getToken(ClickHouseParser::VIEW, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CreateLiveViewStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::SubqueryClauseContext* ClickHouseParser::CreateLiveViewStmtContext::subqueryClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::CreateLiveViewStmtContext::uuidClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateLiveViewStmtContext::clusterClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::WITH() { + return getToken(ClickHouseParser::WITH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::TIMEOUT() { + return getToken(ClickHouseParser::TIMEOUT, 0); +} + +ClickHouseParser::DestinationClauseContext* ClickHouseParser::CreateLiveViewStmtContext::destinationClause() { + return getRuleContext(0); +} + +ClickHouseParser::TableSchemaClauseContext* ClickHouseParser::CreateLiveViewStmtContext::tableSchemaClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateLiveViewStmtContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + +ClickHouseParser::CreateLiveViewStmtContext::CreateLiveViewStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateLiveViewStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateLiveViewStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- CreateMaterializedViewStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::MATERIALIZED() { + return getToken(ClickHouseParser::MATERIALIZED, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::VIEW() { + return getToken(ClickHouseParser::VIEW, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CreateMaterializedViewStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::SubqueryClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::subqueryClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +ClickHouseParser::DestinationClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::destinationClause() { + return getRuleContext(0); +} + +ClickHouseParser::EngineClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::engineClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::uuidClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::TableSchemaClauseContext* ClickHouseParser::CreateMaterializedViewStmtContext::tableSchemaClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateMaterializedViewStmtContext::POPULATE() { + return getToken(ClickHouseParser::POPULATE, 0); +} + +ClickHouseParser::CreateMaterializedViewStmtContext::CreateMaterializedViewStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateMaterializedViewStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateMaterializedViewStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- CreateTableStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::CreateTableStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::CreateTableStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::CreateTableStmtContext::uuidClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::CreateTableStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::TableSchemaClauseContext* ClickHouseParser::CreateTableStmtContext::tableSchemaClause() { + return getRuleContext(0); +} + +ClickHouseParser::EngineClauseContext* ClickHouseParser::CreateTableStmtContext::engineClause() { + return getRuleContext(0); +} + +ClickHouseParser::SubqueryClauseContext* ClickHouseParser::CreateTableStmtContext::subqueryClause() { + return getRuleContext(0); +} + +ClickHouseParser::CreateTableStmtContext::CreateTableStmtContext(CreateStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::CreateTableStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCreateTableStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::CreateStmtContext* ClickHouseParser::createStmt() { + CreateStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 20, ClickHouseParser::RuleCreateStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(585); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 60, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(448); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(449); + match(ClickHouseParser::DATABASE); + setState(453); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 29, _ctx)) { + case 1: { + setState(450); + match(ClickHouseParser::IF); + setState(451); + match(ClickHouseParser::NOT); + setState(452); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(455); + databaseIdentifier(); + setState(457); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(456); + clusterClause(); + } + setState(460); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ENGINE) { + setState(459); + engineExpr(); + } + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(462); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(463); + match(ClickHouseParser::DICTIONARY); + setState(467); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 32, _ctx)) { + case 1: { + setState(464); + match(ClickHouseParser::IF); + setState(465); + match(ClickHouseParser::NOT); + setState(466); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(469); + tableIdentifier(); + setState(471); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::UUID) { + setState(470); + uuidClause(); + } + setState(474); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(473); + clusterClause(); + } + setState(476); + dictionarySchemaClause(); + setState(477); + dictionaryEngineClause(); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(479); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(480); + match(ClickHouseParser::LIVE); + setState(481); + match(ClickHouseParser::VIEW); + setState(485); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 35, _ctx)) { + case 1: { + setState(482); + match(ClickHouseParser::IF); + setState(483); + match(ClickHouseParser::NOT); + setState(484); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(487); + tableIdentifier(); + setState(489); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::UUID) { + setState(488); + uuidClause(); + } + setState(492); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(491); + clusterClause(); + } + setState(499); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::WITH) { + setState(494); + match(ClickHouseParser::WITH); + setState(495); + match(ClickHouseParser::TIMEOUT); + setState(497); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::DECIMAL_LITERAL) { + setState(496); + match(ClickHouseParser::DECIMAL_LITERAL); + } + } + setState(502); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TO) { + setState(501); + destinationClause(); + } + setState(505); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 41, _ctx)) { + case 1: { + setState(504); + tableSchemaClause(); + break; + } + + } + setState(507); + subqueryClause(); + break; + } + + case 4: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 4); + setState(509); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(510); + match(ClickHouseParser::MATERIALIZED); + setState(511); + match(ClickHouseParser::VIEW); + setState(515); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 42, _ctx)) { + case 1: { + setState(512); + match(ClickHouseParser::IF); + setState(513); + match(ClickHouseParser::NOT); + setState(514); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(517); + tableIdentifier(); + setState(519); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::UUID) { + setState(518); + uuidClause(); + } + setState(522); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(521); + clusterClause(); + } + setState(525); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::AS || _la == ClickHouseParser::LPAREN) { + setState(524); + tableSchemaClause(); + } + setState(532); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::TO: { + setState(527); + destinationClause(); + break; + } + + case ClickHouseParser::ENGINE: { + setState(528); + engineClause(); + setState(530); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::POPULATE) { + setState(529); + match(ClickHouseParser::POPULATE); + } + break; + } + + default: + throw NoViableAltException(this); + } + setState(534); + subqueryClause(); + break; + } + + case 5: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 5); + setState(536); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(538); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TEMPORARY) { + setState(537); + match(ClickHouseParser::TEMPORARY); + } + setState(540); + match(ClickHouseParser::TABLE); + setState(544); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 49, _ctx)) { + case 1: { + setState(541); + match(ClickHouseParser::IF); + setState(542); + match(ClickHouseParser::NOT); + setState(543); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(546); + tableIdentifier(); + setState(548); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::UUID) { + setState(547); + uuidClause(); + } + setState(551); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(550); + clusterClause(); + } + setState(554); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 52, _ctx)) { + case 1: { + setState(553); + tableSchemaClause(); + break; + } + + } + setState(557); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ENGINE) { + setState(556); + engineClause(); + } + setState(560); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::AS) { + setState(559); + subqueryClause(); + } + break; + } + + case 6: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 6); + setState(562); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ATTACH + + || _la == ClickHouseParser::CREATE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(565); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OR) { + setState(563); + match(ClickHouseParser::OR); + setState(564); + match(ClickHouseParser::REPLACE); + } + setState(567); + match(ClickHouseParser::VIEW); + setState(571); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 56, _ctx)) { + case 1: { + setState(568); + match(ClickHouseParser::IF); + setState(569); + match(ClickHouseParser::NOT); + setState(570); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(573); + tableIdentifier(); + setState(575); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::UUID) { + setState(574); + uuidClause(); + } + setState(578); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(577); + clusterClause(); + } + setState(581); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 59, _ctx)) { + case 1: { + setState(580); + tableSchemaClause(); + break; + } + + } + setState(583); + subqueryClause(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionarySchemaClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DictionarySchemaClauseContext::DictionarySchemaClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::DictionarySchemaClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::DictionarySchemaClauseContext::dictionaryAttrDfnt() { + return getRuleContexts(); +} + +ClickHouseParser::DictionaryAttrDfntContext* ClickHouseParser::DictionarySchemaClauseContext::dictionaryAttrDfnt(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::DictionarySchemaClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::DictionarySchemaClauseContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::DictionarySchemaClauseContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::DictionarySchemaClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionarySchemaClause; +} + +antlrcpp::Any ClickHouseParser::DictionarySchemaClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionarySchemaClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionarySchemaClauseContext* ClickHouseParser::dictionarySchemaClause() { + DictionarySchemaClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 22, ClickHouseParser::RuleDictionarySchemaClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(587); + match(ClickHouseParser::LPAREN); + setState(588); + dictionaryAttrDfnt(); + setState(593); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(589); + match(ClickHouseParser::COMMA); + setState(590); + dictionaryAttrDfnt(); + setState(595); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(596); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionaryAttrDfntContext ------------------------------------------------------------------ + +ClickHouseParser::DictionaryAttrDfntContext::DictionaryAttrDfntContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::DictionaryAttrDfntContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::DictionaryAttrDfntContext::columnTypeExpr() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::DEFAULT() { + return getTokens(ClickHouseParser::DEFAULT); +} + +tree::TerminalNode* ClickHouseParser::DictionaryAttrDfntContext::DEFAULT(size_t i) { + return getToken(ClickHouseParser::DEFAULT, i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::literal() { + return getRuleContexts(); +} + +ClickHouseParser::LiteralContext* ClickHouseParser::DictionaryAttrDfntContext::literal(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::EXPRESSION() { + return getTokens(ClickHouseParser::EXPRESSION); +} + +tree::TerminalNode* ClickHouseParser::DictionaryAttrDfntContext::EXPRESSION(size_t i) { + return getToken(ClickHouseParser::EXPRESSION, i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::DictionaryAttrDfntContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::HIERARCHICAL() { + return getTokens(ClickHouseParser::HIERARCHICAL); +} + +tree::TerminalNode* ClickHouseParser::DictionaryAttrDfntContext::HIERARCHICAL(size_t i) { + return getToken(ClickHouseParser::HIERARCHICAL, i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::INJECTIVE() { + return getTokens(ClickHouseParser::INJECTIVE); +} + +tree::TerminalNode* ClickHouseParser::DictionaryAttrDfntContext::INJECTIVE(size_t i) { + return getToken(ClickHouseParser::INJECTIVE, i); +} + +std::vector ClickHouseParser::DictionaryAttrDfntContext::IS_OBJECT_ID() { + return getTokens(ClickHouseParser::IS_OBJECT_ID); +} + +tree::TerminalNode* ClickHouseParser::DictionaryAttrDfntContext::IS_OBJECT_ID(size_t i) { + return getToken(ClickHouseParser::IS_OBJECT_ID, i); +} + + +size_t ClickHouseParser::DictionaryAttrDfntContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionaryAttrDfnt; +} + +antlrcpp::Any ClickHouseParser::DictionaryAttrDfntContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionaryAttrDfnt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionaryAttrDfntContext* ClickHouseParser::dictionaryAttrDfnt() { + DictionaryAttrDfntContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 24, ClickHouseParser::RuleDictionaryAttrDfnt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(598); + identifier(); + setState(599); + columnTypeExpr(); + setState(621); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(619); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 62, _ctx)) { + case 1: { + setState(600); + + if (!(!_localctx->attrs.count("default"))) throw FailedPredicateException(this, "!$attrs.count(\"default\")"); + setState(601); + match(ClickHouseParser::DEFAULT); + setState(602); + literal(); + _localctx->attrs.insert("default"); + break; + } + + case 2: { + setState(605); + + if (!(!_localctx->attrs.count("expression"))) throw FailedPredicateException(this, "!$attrs.count(\"expression\")"); + setState(606); + match(ClickHouseParser::EXPRESSION); + setState(607); + columnExpr(0); + _localctx->attrs.insert("expression"); + break; + } + + case 3: { + setState(610); + + if (!(!_localctx->attrs.count("hierarchical"))) throw FailedPredicateException(this, "!$attrs.count(\"hierarchical\")"); + setState(611); + match(ClickHouseParser::HIERARCHICAL); + _localctx->attrs.insert("hierarchical"); + break; + } + + case 4: { + setState(613); + + if (!(!_localctx->attrs.count("injective"))) throw FailedPredicateException(this, "!$attrs.count(\"injective\")"); + setState(614); + match(ClickHouseParser::INJECTIVE); + _localctx->attrs.insert("injective"); + break; + } + + case 5: { + setState(616); + + if (!(!_localctx->attrs.count("is_object_id"))) throw FailedPredicateException(this, "!$attrs.count(\"is_object_id\")"); + setState(617); + match(ClickHouseParser::IS_OBJECT_ID); + _localctx->attrs.insert("is_object_id"); + break; + } + + } + } + setState(623); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 63, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionaryEngineClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DictionaryEngineClauseContext::DictionaryEngineClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::DictionaryPrimaryKeyClauseContext* ClickHouseParser::DictionaryEngineClauseContext::dictionaryPrimaryKeyClause() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::DictionaryEngineClauseContext::sourceClause() { + return getRuleContexts(); +} + +ClickHouseParser::SourceClauseContext* ClickHouseParser::DictionaryEngineClauseContext::sourceClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryEngineClauseContext::lifetimeClause() { + return getRuleContexts(); +} + +ClickHouseParser::LifetimeClauseContext* ClickHouseParser::DictionaryEngineClauseContext::lifetimeClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryEngineClauseContext::layoutClause() { + return getRuleContexts(); +} + +ClickHouseParser::LayoutClauseContext* ClickHouseParser::DictionaryEngineClauseContext::layoutClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryEngineClauseContext::rangeClause() { + return getRuleContexts(); +} + +ClickHouseParser::RangeClauseContext* ClickHouseParser::DictionaryEngineClauseContext::rangeClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::DictionaryEngineClauseContext::dictionarySettingsClause() { + return getRuleContexts(); +} + +ClickHouseParser::DictionarySettingsClauseContext* ClickHouseParser::DictionaryEngineClauseContext::dictionarySettingsClause(size_t i) { + return getRuleContext(i); +} + + +size_t ClickHouseParser::DictionaryEngineClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionaryEngineClause; +} + +antlrcpp::Any ClickHouseParser::DictionaryEngineClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionaryEngineClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionaryEngineClauseContext* ClickHouseParser::dictionaryEngineClause() { + DictionaryEngineClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 26, ClickHouseParser::RuleDictionaryEngineClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(625); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 64, _ctx)) { + case 1: { + setState(624); + dictionaryPrimaryKeyClause(); + break; + } + + } + setState(649); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 66, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(647); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 65, _ctx)) { + case 1: { + setState(627); + + if (!(!_localctx->clauses.count("source"))) throw FailedPredicateException(this, "!$clauses.count(\"source\")"); + setState(628); + sourceClause(); + _localctx->clauses.insert("source"); + break; + } + + case 2: { + setState(631); + + if (!(!_localctx->clauses.count("lifetime"))) throw FailedPredicateException(this, "!$clauses.count(\"lifetime\")"); + setState(632); + lifetimeClause(); + _localctx->clauses.insert("lifetime"); + break; + } + + case 3: { + setState(635); + + if (!(!_localctx->clauses.count("layout"))) throw FailedPredicateException(this, "!$clauses.count(\"layout\")"); + setState(636); + layoutClause(); + _localctx->clauses.insert("layout"); + break; + } + + case 4: { + setState(639); + + if (!(!_localctx->clauses.count("range"))) throw FailedPredicateException(this, "!$clauses.count(\"range\")"); + setState(640); + rangeClause(); + _localctx->clauses.insert("range"); + break; + } + + case 5: { + setState(643); + + if (!(!_localctx->clauses.count("settings"))) throw FailedPredicateException(this, "!$clauses.count(\"settings\")"); + setState(644); + dictionarySettingsClause(); + _localctx->clauses.insert("settings"); + break; + } + + } + } + setState(651); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 66, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionaryPrimaryKeyClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DictionaryPrimaryKeyClauseContext::DictionaryPrimaryKeyClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::DictionaryPrimaryKeyClauseContext::PRIMARY() { + return getToken(ClickHouseParser::PRIMARY, 0); +} + +tree::TerminalNode* ClickHouseParser::DictionaryPrimaryKeyClauseContext::KEY() { + return getToken(ClickHouseParser::KEY, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::DictionaryPrimaryKeyClauseContext::columnExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::DictionaryPrimaryKeyClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionaryPrimaryKeyClause; +} + +antlrcpp::Any ClickHouseParser::DictionaryPrimaryKeyClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionaryPrimaryKeyClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionaryPrimaryKeyClauseContext* ClickHouseParser::dictionaryPrimaryKeyClause() { + DictionaryPrimaryKeyClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 28, ClickHouseParser::RuleDictionaryPrimaryKeyClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(652); + match(ClickHouseParser::PRIMARY); + setState(653); + match(ClickHouseParser::KEY); + setState(654); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionaryArgExprContext ------------------------------------------------------------------ + +ClickHouseParser::DictionaryArgExprContext::DictionaryArgExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::DictionaryArgExprContext::identifier() { + return getRuleContexts(); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::DictionaryArgExprContext::identifier(size_t i) { + return getRuleContext(i); +} + +ClickHouseParser::LiteralContext* ClickHouseParser::DictionaryArgExprContext::literal() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DictionaryArgExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::DictionaryArgExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + + +size_t ClickHouseParser::DictionaryArgExprContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionaryArgExpr; +} + +antlrcpp::Any ClickHouseParser::DictionaryArgExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionaryArgExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionaryArgExprContext* ClickHouseParser::dictionaryArgExpr() { + DictionaryArgExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 30, ClickHouseParser::RuleDictionaryArgExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(656); + identifier(); + setState(663); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::AFTER: + case ClickHouseParser::ALIAS: + case ClickHouseParser::ALL: + case ClickHouseParser::ALTER: + case ClickHouseParser::AND: + case ClickHouseParser::ANTI: + case ClickHouseParser::ANY: + case ClickHouseParser::ARRAY: + case ClickHouseParser::AS: + case ClickHouseParser::ASCENDING: + case ClickHouseParser::ASOF: + case ClickHouseParser::ASYNC: + case ClickHouseParser::ATTACH: + case ClickHouseParser::BETWEEN: + case ClickHouseParser::BOTH: + case ClickHouseParser::BY: + case ClickHouseParser::CASE: + case ClickHouseParser::CAST: + case ClickHouseParser::CHECK: + case ClickHouseParser::CLEAR: + case ClickHouseParser::CLUSTER: + case ClickHouseParser::CODEC: + case ClickHouseParser::COLLATE: + case ClickHouseParser::COLUMN: + case ClickHouseParser::COMMENT: + case ClickHouseParser::CONSTRAINT: + case ClickHouseParser::CREATE: + case ClickHouseParser::CROSS: + case ClickHouseParser::CUBE: + case ClickHouseParser::DATABASE: + case ClickHouseParser::DATABASES: + case ClickHouseParser::DATE: + case ClickHouseParser::DAY: + case ClickHouseParser::DEDUPLICATE: + case ClickHouseParser::DEFAULT: + case ClickHouseParser::DELAY: + case ClickHouseParser::DELETE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCENDING: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DICTIONARIES: + case ClickHouseParser::DICTIONARY: + case ClickHouseParser::DISK: + case ClickHouseParser::DISTINCT: + case ClickHouseParser::DISTRIBUTED: + case ClickHouseParser::DROP: + case ClickHouseParser::ELSE: + case ClickHouseParser::END: + case ClickHouseParser::ENGINE: + case ClickHouseParser::EVENTS: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::EXPRESSION: + case ClickHouseParser::EXTRACT: + case ClickHouseParser::FETCHES: + case ClickHouseParser::FINAL: + case ClickHouseParser::FIRST: + case ClickHouseParser::FLUSH: + case ClickHouseParser::FOR: + case ClickHouseParser::FORMAT: + case ClickHouseParser::FREEZE: + case ClickHouseParser::FROM: + case ClickHouseParser::FULL: + case ClickHouseParser::FUNCTION: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::GRANULARITY: + case ClickHouseParser::GROUP: + case ClickHouseParser::HAVING: + case ClickHouseParser::HIERARCHICAL: + case ClickHouseParser::HOUR: + case ClickHouseParser::ID: + case ClickHouseParser::IF: + case ClickHouseParser::ILIKE: + case ClickHouseParser::IN: + case ClickHouseParser::INDEX: + case ClickHouseParser::INJECTIVE: + case ClickHouseParser::INNER: + case ClickHouseParser::INSERT: + case ClickHouseParser::INTERVAL: + case ClickHouseParser::INTO: + case ClickHouseParser::IS: + case ClickHouseParser::IS_OBJECT_ID: + case ClickHouseParser::JOIN: + case ClickHouseParser::KEY: + case ClickHouseParser::KILL: + case ClickHouseParser::LAST: + case ClickHouseParser::LAYOUT: + case ClickHouseParser::LEADING: + case ClickHouseParser::LEFT: + case ClickHouseParser::LIFETIME: + case ClickHouseParser::LIKE: + case ClickHouseParser::LIMIT: + case ClickHouseParser::LIVE: + case ClickHouseParser::LOCAL: + case ClickHouseParser::LOGS: + case ClickHouseParser::MATERIALIZED: + case ClickHouseParser::MAX: + case ClickHouseParser::MERGES: + case ClickHouseParser::MIN: + case ClickHouseParser::MINUTE: + case ClickHouseParser::MODIFY: + case ClickHouseParser::MONTH: + case ClickHouseParser::MOVE: + case ClickHouseParser::MUTATION: + case ClickHouseParser::NO: + case ClickHouseParser::NOT: + case ClickHouseParser::NULLS: + case ClickHouseParser::OFFSET: + case ClickHouseParser::ON: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::OR: + case ClickHouseParser::ORDER: + case ClickHouseParser::OUTER: + case ClickHouseParser::OUTFILE: + case ClickHouseParser::PARTITION: + case ClickHouseParser::POPULATE: + case ClickHouseParser::PREWHERE: + case ClickHouseParser::PRIMARY: + case ClickHouseParser::QUARTER: + case ClickHouseParser::RANGE: + case ClickHouseParser::RELOAD: + case ClickHouseParser::REMOVE: + case ClickHouseParser::RENAME: + case ClickHouseParser::REPLACE: + case ClickHouseParser::REPLICA: + case ClickHouseParser::REPLICATED: + case ClickHouseParser::RIGHT: + case ClickHouseParser::ROLLUP: + case ClickHouseParser::SAMPLE: + case ClickHouseParser::SECOND: + case ClickHouseParser::SELECT: + case ClickHouseParser::SEMI: + case ClickHouseParser::SENDS: + case ClickHouseParser::SET: + case ClickHouseParser::SETTINGS: + case ClickHouseParser::SHOW: + case ClickHouseParser::SOURCE: + case ClickHouseParser::START: + case ClickHouseParser::STOP: + case ClickHouseParser::SUBSTRING: + case ClickHouseParser::SYNC: + case ClickHouseParser::SYNTAX: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TABLE: + case ClickHouseParser::TABLES: + case ClickHouseParser::TEMPORARY: + case ClickHouseParser::TEST: + case ClickHouseParser::THEN: + case ClickHouseParser::TIES: + case ClickHouseParser::TIMEOUT: + case ClickHouseParser::TIMESTAMP: + case ClickHouseParser::TO: + case ClickHouseParser::TOP: + case ClickHouseParser::TOTALS: + case ClickHouseParser::TRAILING: + case ClickHouseParser::TRIM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::TTL: + case ClickHouseParser::TYPE: + case ClickHouseParser::UNION: + case ClickHouseParser::UPDATE: + case ClickHouseParser::USE: + case ClickHouseParser::USING: + case ClickHouseParser::UUID: + case ClickHouseParser::VALUES: + case ClickHouseParser::VIEW: + case ClickHouseParser::VOLUME: + case ClickHouseParser::WATCH: + case ClickHouseParser::WEEK: + case ClickHouseParser::WHEN: + case ClickHouseParser::WHERE: + case ClickHouseParser::WITH: + case ClickHouseParser::YEAR: + case ClickHouseParser::JSON_FALSE: + case ClickHouseParser::JSON_TRUE: + case ClickHouseParser::IDENTIFIER: { + setState(657); + identifier(); + setState(660); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::LPAREN) { + setState(658); + match(ClickHouseParser::LPAREN); + setState(659); + match(ClickHouseParser::RPAREN); + } + break; + } + + case ClickHouseParser::INF: + case ClickHouseParser::NAN_SQL: + case ClickHouseParser::NULL_SQL: + case ClickHouseParser::FLOATING_LITERAL: + case ClickHouseParser::OCTAL_LITERAL: + case ClickHouseParser::DECIMAL_LITERAL: + case ClickHouseParser::HEXADECIMAL_LITERAL: + case ClickHouseParser::STRING_LITERAL: + case ClickHouseParser::DASH: + case ClickHouseParser::DOT: + case ClickHouseParser::PLUS: { + setState(662); + literal(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SourceClauseContext ------------------------------------------------------------------ + +ClickHouseParser::SourceClauseContext::SourceClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SourceClauseContext::SOURCE() { + return getToken(ClickHouseParser::SOURCE, 0); +} + +std::vector ClickHouseParser::SourceClauseContext::LPAREN() { + return getTokens(ClickHouseParser::LPAREN); +} + +tree::TerminalNode* ClickHouseParser::SourceClauseContext::LPAREN(size_t i) { + return getToken(ClickHouseParser::LPAREN, i); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::SourceClauseContext::identifier() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::SourceClauseContext::RPAREN() { + return getTokens(ClickHouseParser::RPAREN); +} + +tree::TerminalNode* ClickHouseParser::SourceClauseContext::RPAREN(size_t i) { + return getToken(ClickHouseParser::RPAREN, i); +} + +std::vector ClickHouseParser::SourceClauseContext::dictionaryArgExpr() { + return getRuleContexts(); +} + +ClickHouseParser::DictionaryArgExprContext* ClickHouseParser::SourceClauseContext::dictionaryArgExpr(size_t i) { + return getRuleContext(i); +} + + +size_t ClickHouseParser::SourceClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleSourceClause; +} + +antlrcpp::Any ClickHouseParser::SourceClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSourceClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SourceClauseContext* ClickHouseParser::sourceClause() { + SourceClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 32, ClickHouseParser::RuleSourceClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(665); + match(ClickHouseParser::SOURCE); + setState(666); + match(ClickHouseParser::LPAREN); + setState(667); + identifier(); + setState(668); + match(ClickHouseParser::LPAREN); + setState(672); + _errHandler->sync(this); + _la = _input->LA(1); + while ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)))) != 0)) { + setState(669); + dictionaryArgExpr(); + setState(674); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(675); + match(ClickHouseParser::RPAREN); + setState(676); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LifetimeClauseContext ------------------------------------------------------------------ + +ClickHouseParser::LifetimeClauseContext::LifetimeClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::LIFETIME() { + return getToken(ClickHouseParser::LIFETIME, 0); +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::LifetimeClauseContext::DECIMAL_LITERAL() { + return getTokens(ClickHouseParser::DECIMAL_LITERAL); +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::DECIMAL_LITERAL(size_t i) { + return getToken(ClickHouseParser::DECIMAL_LITERAL, i); +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::MIN() { + return getToken(ClickHouseParser::MIN, 0); +} + +tree::TerminalNode* ClickHouseParser::LifetimeClauseContext::MAX() { + return getToken(ClickHouseParser::MAX, 0); +} + + +size_t ClickHouseParser::LifetimeClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleLifetimeClause; +} + +antlrcpp::Any ClickHouseParser::LifetimeClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLifetimeClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LifetimeClauseContext* ClickHouseParser::lifetimeClause() { + LifetimeClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 34, ClickHouseParser::RuleLifetimeClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(678); + match(ClickHouseParser::LIFETIME); + setState(679); + match(ClickHouseParser::LPAREN); + setState(689); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::DECIMAL_LITERAL: { + setState(680); + match(ClickHouseParser::DECIMAL_LITERAL); + break; + } + + case ClickHouseParser::MIN: { + setState(681); + match(ClickHouseParser::MIN); + setState(682); + match(ClickHouseParser::DECIMAL_LITERAL); + setState(683); + match(ClickHouseParser::MAX); + setState(684); + match(ClickHouseParser::DECIMAL_LITERAL); + break; + } + + case ClickHouseParser::MAX: { + setState(685); + match(ClickHouseParser::MAX); + setState(686); + match(ClickHouseParser::DECIMAL_LITERAL); + setState(687); + match(ClickHouseParser::MIN); + setState(688); + match(ClickHouseParser::DECIMAL_LITERAL); + break; + } + + default: + throw NoViableAltException(this); + } + setState(691); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LayoutClauseContext ------------------------------------------------------------------ + +ClickHouseParser::LayoutClauseContext::LayoutClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::LayoutClauseContext::LAYOUT() { + return getToken(ClickHouseParser::LAYOUT, 0); +} + +std::vector ClickHouseParser::LayoutClauseContext::LPAREN() { + return getTokens(ClickHouseParser::LPAREN); +} + +tree::TerminalNode* ClickHouseParser::LayoutClauseContext::LPAREN(size_t i) { + return getToken(ClickHouseParser::LPAREN, i); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::LayoutClauseContext::identifier() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::LayoutClauseContext::RPAREN() { + return getTokens(ClickHouseParser::RPAREN); +} + +tree::TerminalNode* ClickHouseParser::LayoutClauseContext::RPAREN(size_t i) { + return getToken(ClickHouseParser::RPAREN, i); +} + +std::vector ClickHouseParser::LayoutClauseContext::dictionaryArgExpr() { + return getRuleContexts(); +} + +ClickHouseParser::DictionaryArgExprContext* ClickHouseParser::LayoutClauseContext::dictionaryArgExpr(size_t i) { + return getRuleContext(i); +} + + +size_t ClickHouseParser::LayoutClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleLayoutClause; +} + +antlrcpp::Any ClickHouseParser::LayoutClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLayoutClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LayoutClauseContext* ClickHouseParser::layoutClause() { + LayoutClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 36, ClickHouseParser::RuleLayoutClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(693); + match(ClickHouseParser::LAYOUT); + setState(694); + match(ClickHouseParser::LPAREN); + setState(695); + identifier(); + setState(696); + match(ClickHouseParser::LPAREN); + setState(700); + _errHandler->sync(this); + _la = _input->LA(1); + while ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)))) != 0)) { + setState(697); + dictionaryArgExpr(); + setState(702); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(703); + match(ClickHouseParser::RPAREN); + setState(704); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RangeClauseContext ------------------------------------------------------------------ + +ClickHouseParser::RangeClauseContext::RangeClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::RangeClauseContext::RANGE() { + return getToken(ClickHouseParser::RANGE, 0); +} + +tree::TerminalNode* ClickHouseParser::RangeClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::RangeClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::RangeClauseContext::MIN() { + return getToken(ClickHouseParser::MIN, 0); +} + +std::vector ClickHouseParser::RangeClauseContext::identifier() { + return getRuleContexts(); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::RangeClauseContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::RangeClauseContext::MAX() { + return getToken(ClickHouseParser::MAX, 0); +} + + +size_t ClickHouseParser::RangeClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleRangeClause; +} + +antlrcpp::Any ClickHouseParser::RangeClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitRangeClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::RangeClauseContext* ClickHouseParser::rangeClause() { + RangeClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 38, ClickHouseParser::RuleRangeClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(706); + match(ClickHouseParser::RANGE); + setState(707); + match(ClickHouseParser::LPAREN); + setState(718); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::MIN: { + setState(708); + match(ClickHouseParser::MIN); + setState(709); + identifier(); + setState(710); + match(ClickHouseParser::MAX); + setState(711); + identifier(); + break; + } + + case ClickHouseParser::MAX: { + setState(713); + match(ClickHouseParser::MAX); + setState(714); + identifier(); + setState(715); + match(ClickHouseParser::MIN); + setState(716); + identifier(); + break; + } + + default: + throw NoViableAltException(this); + } + setState(720); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DictionarySettingsClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DictionarySettingsClauseContext::DictionarySettingsClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::DictionarySettingsClauseContext::SETTINGS() { + return getToken(ClickHouseParser::SETTINGS, 0); +} + +tree::TerminalNode* ClickHouseParser::DictionarySettingsClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::SettingExprListContext* ClickHouseParser::DictionarySettingsClauseContext::settingExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DictionarySettingsClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + + +size_t ClickHouseParser::DictionarySettingsClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDictionarySettingsClause; +} + +antlrcpp::Any ClickHouseParser::DictionarySettingsClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDictionarySettingsClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DictionarySettingsClauseContext* ClickHouseParser::dictionarySettingsClause() { + DictionarySettingsClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 40, ClickHouseParser::RuleDictionarySettingsClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(722); + match(ClickHouseParser::SETTINGS); + setState(723); + match(ClickHouseParser::LPAREN); + setState(724); + settingExprList(); + setState(725); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ClusterClauseContext ------------------------------------------------------------------ + +ClickHouseParser::ClusterClauseContext::ClusterClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ClusterClauseContext::ON() { + return getToken(ClickHouseParser::ON, 0); +} + +tree::TerminalNode* ClickHouseParser::ClusterClauseContext::CLUSTER() { + return getToken(ClickHouseParser::CLUSTER, 0); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::ClusterClauseContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ClusterClauseContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + + +size_t ClickHouseParser::ClusterClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleClusterClause; +} + +antlrcpp::Any ClickHouseParser::ClusterClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitClusterClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::clusterClause() { + ClusterClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 42, ClickHouseParser::RuleClusterClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(727); + match(ClickHouseParser::ON); + setState(728); + match(ClickHouseParser::CLUSTER); + setState(731); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::AFTER: + case ClickHouseParser::ALIAS: + case ClickHouseParser::ALL: + case ClickHouseParser::ALTER: + case ClickHouseParser::AND: + case ClickHouseParser::ANTI: + case ClickHouseParser::ANY: + case ClickHouseParser::ARRAY: + case ClickHouseParser::AS: + case ClickHouseParser::ASCENDING: + case ClickHouseParser::ASOF: + case ClickHouseParser::ASYNC: + case ClickHouseParser::ATTACH: + case ClickHouseParser::BETWEEN: + case ClickHouseParser::BOTH: + case ClickHouseParser::BY: + case ClickHouseParser::CASE: + case ClickHouseParser::CAST: + case ClickHouseParser::CHECK: + case ClickHouseParser::CLEAR: + case ClickHouseParser::CLUSTER: + case ClickHouseParser::CODEC: + case ClickHouseParser::COLLATE: + case ClickHouseParser::COLUMN: + case ClickHouseParser::COMMENT: + case ClickHouseParser::CONSTRAINT: + case ClickHouseParser::CREATE: + case ClickHouseParser::CROSS: + case ClickHouseParser::CUBE: + case ClickHouseParser::DATABASE: + case ClickHouseParser::DATABASES: + case ClickHouseParser::DATE: + case ClickHouseParser::DAY: + case ClickHouseParser::DEDUPLICATE: + case ClickHouseParser::DEFAULT: + case ClickHouseParser::DELAY: + case ClickHouseParser::DELETE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCENDING: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DICTIONARIES: + case ClickHouseParser::DICTIONARY: + case ClickHouseParser::DISK: + case ClickHouseParser::DISTINCT: + case ClickHouseParser::DISTRIBUTED: + case ClickHouseParser::DROP: + case ClickHouseParser::ELSE: + case ClickHouseParser::END: + case ClickHouseParser::ENGINE: + case ClickHouseParser::EVENTS: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::EXPRESSION: + case ClickHouseParser::EXTRACT: + case ClickHouseParser::FETCHES: + case ClickHouseParser::FINAL: + case ClickHouseParser::FIRST: + case ClickHouseParser::FLUSH: + case ClickHouseParser::FOR: + case ClickHouseParser::FORMAT: + case ClickHouseParser::FREEZE: + case ClickHouseParser::FROM: + case ClickHouseParser::FULL: + case ClickHouseParser::FUNCTION: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::GRANULARITY: + case ClickHouseParser::GROUP: + case ClickHouseParser::HAVING: + case ClickHouseParser::HIERARCHICAL: + case ClickHouseParser::HOUR: + case ClickHouseParser::ID: + case ClickHouseParser::IF: + case ClickHouseParser::ILIKE: + case ClickHouseParser::IN: + case ClickHouseParser::INDEX: + case ClickHouseParser::INJECTIVE: + case ClickHouseParser::INNER: + case ClickHouseParser::INSERT: + case ClickHouseParser::INTERVAL: + case ClickHouseParser::INTO: + case ClickHouseParser::IS: + case ClickHouseParser::IS_OBJECT_ID: + case ClickHouseParser::JOIN: + case ClickHouseParser::KEY: + case ClickHouseParser::KILL: + case ClickHouseParser::LAST: + case ClickHouseParser::LAYOUT: + case ClickHouseParser::LEADING: + case ClickHouseParser::LEFT: + case ClickHouseParser::LIFETIME: + case ClickHouseParser::LIKE: + case ClickHouseParser::LIMIT: + case ClickHouseParser::LIVE: + case ClickHouseParser::LOCAL: + case ClickHouseParser::LOGS: + case ClickHouseParser::MATERIALIZED: + case ClickHouseParser::MAX: + case ClickHouseParser::MERGES: + case ClickHouseParser::MIN: + case ClickHouseParser::MINUTE: + case ClickHouseParser::MODIFY: + case ClickHouseParser::MONTH: + case ClickHouseParser::MOVE: + case ClickHouseParser::MUTATION: + case ClickHouseParser::NO: + case ClickHouseParser::NOT: + case ClickHouseParser::NULLS: + case ClickHouseParser::OFFSET: + case ClickHouseParser::ON: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::OR: + case ClickHouseParser::ORDER: + case ClickHouseParser::OUTER: + case ClickHouseParser::OUTFILE: + case ClickHouseParser::PARTITION: + case ClickHouseParser::POPULATE: + case ClickHouseParser::PREWHERE: + case ClickHouseParser::PRIMARY: + case ClickHouseParser::QUARTER: + case ClickHouseParser::RANGE: + case ClickHouseParser::RELOAD: + case ClickHouseParser::REMOVE: + case ClickHouseParser::RENAME: + case ClickHouseParser::REPLACE: + case ClickHouseParser::REPLICA: + case ClickHouseParser::REPLICATED: + case ClickHouseParser::RIGHT: + case ClickHouseParser::ROLLUP: + case ClickHouseParser::SAMPLE: + case ClickHouseParser::SECOND: + case ClickHouseParser::SELECT: + case ClickHouseParser::SEMI: + case ClickHouseParser::SENDS: + case ClickHouseParser::SET: + case ClickHouseParser::SETTINGS: + case ClickHouseParser::SHOW: + case ClickHouseParser::SOURCE: + case ClickHouseParser::START: + case ClickHouseParser::STOP: + case ClickHouseParser::SUBSTRING: + case ClickHouseParser::SYNC: + case ClickHouseParser::SYNTAX: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TABLE: + case ClickHouseParser::TABLES: + case ClickHouseParser::TEMPORARY: + case ClickHouseParser::TEST: + case ClickHouseParser::THEN: + case ClickHouseParser::TIES: + case ClickHouseParser::TIMEOUT: + case ClickHouseParser::TIMESTAMP: + case ClickHouseParser::TO: + case ClickHouseParser::TOP: + case ClickHouseParser::TOTALS: + case ClickHouseParser::TRAILING: + case ClickHouseParser::TRIM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::TTL: + case ClickHouseParser::TYPE: + case ClickHouseParser::UNION: + case ClickHouseParser::UPDATE: + case ClickHouseParser::USE: + case ClickHouseParser::USING: + case ClickHouseParser::UUID: + case ClickHouseParser::VALUES: + case ClickHouseParser::VIEW: + case ClickHouseParser::VOLUME: + case ClickHouseParser::WATCH: + case ClickHouseParser::WEEK: + case ClickHouseParser::WHEN: + case ClickHouseParser::WHERE: + case ClickHouseParser::WITH: + case ClickHouseParser::YEAR: + case ClickHouseParser::JSON_FALSE: + case ClickHouseParser::JSON_TRUE: + case ClickHouseParser::IDENTIFIER: { + setState(729); + identifier(); + break; + } + + case ClickHouseParser::STRING_LITERAL: { + setState(730); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UuidClauseContext ------------------------------------------------------------------ + +ClickHouseParser::UuidClauseContext::UuidClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::UuidClauseContext::UUID() { + return getToken(ClickHouseParser::UUID, 0); +} + +tree::TerminalNode* ClickHouseParser::UuidClauseContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + + +size_t ClickHouseParser::UuidClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleUuidClause; +} + +antlrcpp::Any ClickHouseParser::UuidClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitUuidClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::UuidClauseContext* ClickHouseParser::uuidClause() { + UuidClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 44, ClickHouseParser::RuleUuidClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(733); + match(ClickHouseParser::UUID); + setState(734); + match(ClickHouseParser::STRING_LITERAL); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DestinationClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DestinationClauseContext::DestinationClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::DestinationClauseContext::TO() { + return getToken(ClickHouseParser::TO, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::DestinationClauseContext::tableIdentifier() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::DestinationClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDestinationClause; +} + +antlrcpp::Any ClickHouseParser::DestinationClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDestinationClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DestinationClauseContext* ClickHouseParser::destinationClause() { + DestinationClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 46, ClickHouseParser::RuleDestinationClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(736); + match(ClickHouseParser::TO); + setState(737); + tableIdentifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SubqueryClauseContext ------------------------------------------------------------------ + +ClickHouseParser::SubqueryClauseContext::SubqueryClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SubqueryClauseContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::SubqueryClauseContext::selectUnionStmt() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::SubqueryClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleSubqueryClause; +} + +antlrcpp::Any ClickHouseParser::SubqueryClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSubqueryClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SubqueryClauseContext* ClickHouseParser::subqueryClause() { + SubqueryClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 48, ClickHouseParser::RuleSubqueryClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(739); + match(ClickHouseParser::AS); + setState(740); + selectUnionStmt(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableSchemaClauseContext ------------------------------------------------------------------ + +ClickHouseParser::TableSchemaClauseContext::TableSchemaClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::TableSchemaClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleTableSchemaClause; +} + +void ClickHouseParser::TableSchemaClauseContext::copyFrom(TableSchemaClauseContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- SchemaAsTableClauseContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::SchemaAsTableClauseContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::SchemaAsTableClauseContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::SchemaAsTableClauseContext::SchemaAsTableClauseContext(TableSchemaClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::SchemaAsTableClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSchemaAsTableClause(this); + else + return visitor->visitChildren(this); +} +//----------------- SchemaAsFunctionClauseContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::SchemaAsFunctionClauseContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::TableFunctionExprContext* ClickHouseParser::SchemaAsFunctionClauseContext::tableFunctionExpr() { + return getRuleContext(0); +} + +ClickHouseParser::SchemaAsFunctionClauseContext::SchemaAsFunctionClauseContext(TableSchemaClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::SchemaAsFunctionClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSchemaAsFunctionClause(this); + else + return visitor->visitChildren(this); +} +//----------------- SchemaDescriptionClauseContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::SchemaDescriptionClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::SchemaDescriptionClauseContext::tableElementExpr() { + return getRuleContexts(); +} + +ClickHouseParser::TableElementExprContext* ClickHouseParser::SchemaDescriptionClauseContext::tableElementExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::SchemaDescriptionClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::SchemaDescriptionClauseContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::SchemaDescriptionClauseContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::SchemaDescriptionClauseContext::SchemaDescriptionClauseContext(TableSchemaClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::SchemaDescriptionClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSchemaDescriptionClause(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::TableSchemaClauseContext* ClickHouseParser::tableSchemaClause() { + TableSchemaClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 50, ClickHouseParser::RuleTableSchemaClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(757); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 75, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(742); + match(ClickHouseParser::LPAREN); + setState(743); + tableElementExpr(); + setState(748); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(744); + match(ClickHouseParser::COMMA); + setState(745); + tableElementExpr(); + setState(750); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(751); + match(ClickHouseParser::RPAREN); + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(753); + match(ClickHouseParser::AS); + setState(754); + tableIdentifier(); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(755); + match(ClickHouseParser::AS); + setState(756); + tableFunctionExpr(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EngineClauseContext ------------------------------------------------------------------ + +ClickHouseParser::EngineClauseContext::EngineClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::EngineExprContext* ClickHouseParser::EngineClauseContext::engineExpr() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::EngineClauseContext::orderByClause() { + return getRuleContexts(); +} + +ClickHouseParser::OrderByClauseContext* ClickHouseParser::EngineClauseContext::orderByClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::EngineClauseContext::partitionByClause() { + return getRuleContexts(); +} + +ClickHouseParser::PartitionByClauseContext* ClickHouseParser::EngineClauseContext::partitionByClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::EngineClauseContext::primaryKeyClause() { + return getRuleContexts(); +} + +ClickHouseParser::PrimaryKeyClauseContext* ClickHouseParser::EngineClauseContext::primaryKeyClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::EngineClauseContext::sampleByClause() { + return getRuleContexts(); +} + +ClickHouseParser::SampleByClauseContext* ClickHouseParser::EngineClauseContext::sampleByClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::EngineClauseContext::ttlClause() { + return getRuleContexts(); +} + +ClickHouseParser::TtlClauseContext* ClickHouseParser::EngineClauseContext::ttlClause(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::EngineClauseContext::settingsClause() { + return getRuleContexts(); +} + +ClickHouseParser::SettingsClauseContext* ClickHouseParser::EngineClauseContext::settingsClause(size_t i) { + return getRuleContext(i); +} + + +size_t ClickHouseParser::EngineClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleEngineClause; +} + +antlrcpp::Any ClickHouseParser::EngineClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitEngineClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::EngineClauseContext* ClickHouseParser::engineClause() { + EngineClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 52, ClickHouseParser::RuleEngineClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(759); + engineExpr(); + setState(786); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 77, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(784); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 76, _ctx)) { + case 1: { + setState(760); + + if (!(!_localctx->clauses.count("orderByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"orderByClause\")"); + setState(761); + orderByClause(); + _localctx->clauses.insert("orderByClause"); + break; + } + + case 2: { + setState(764); + + if (!(!_localctx->clauses.count("partitionByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"partitionByClause\")"); + setState(765); + partitionByClause(); + _localctx->clauses.insert("partitionByClause"); + break; + } + + case 3: { + setState(768); + + if (!(!_localctx->clauses.count("primaryKeyClause"))) throw FailedPredicateException(this, "!$clauses.count(\"primaryKeyClause\")"); + setState(769); + primaryKeyClause(); + _localctx->clauses.insert("primaryKeyClause"); + break; + } + + case 4: { + setState(772); + + if (!(!_localctx->clauses.count("sampleByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"sampleByClause\")"); + setState(773); + sampleByClause(); + _localctx->clauses.insert("sampleByClause"); + break; + } + + case 5: { + setState(776); + + if (!(!_localctx->clauses.count("ttlClause"))) throw FailedPredicateException(this, "!$clauses.count(\"ttlClause\")"); + setState(777); + ttlClause(); + _localctx->clauses.insert("ttlClause"); + break; + } + + case 6: { + setState(780); + + if (!(!_localctx->clauses.count("settingsClause"))) throw FailedPredicateException(this, "!$clauses.count(\"settingsClause\")"); + setState(781); + settingsClause(); + _localctx->clauses.insert("settingsClause"); + break; + } + + } + } + setState(788); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 77, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PartitionByClauseContext ------------------------------------------------------------------ + +ClickHouseParser::PartitionByClauseContext::PartitionByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::PartitionByClauseContext::PARTITION() { + return getToken(ClickHouseParser::PARTITION, 0); +} + +tree::TerminalNode* ClickHouseParser::PartitionByClauseContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::PartitionByClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::PartitionByClauseContext::getRuleIndex() const { + return ClickHouseParser::RulePartitionByClause; +} + +antlrcpp::Any ClickHouseParser::PartitionByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPartitionByClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::PartitionByClauseContext* ClickHouseParser::partitionByClause() { + PartitionByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 54, ClickHouseParser::RulePartitionByClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(789); + match(ClickHouseParser::PARTITION); + setState(790); + match(ClickHouseParser::BY); + setState(791); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PrimaryKeyClauseContext ------------------------------------------------------------------ + +ClickHouseParser::PrimaryKeyClauseContext::PrimaryKeyClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::PrimaryKeyClauseContext::PRIMARY() { + return getToken(ClickHouseParser::PRIMARY, 0); +} + +tree::TerminalNode* ClickHouseParser::PrimaryKeyClauseContext::KEY() { + return getToken(ClickHouseParser::KEY, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::PrimaryKeyClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::PrimaryKeyClauseContext::getRuleIndex() const { + return ClickHouseParser::RulePrimaryKeyClause; +} + +antlrcpp::Any ClickHouseParser::PrimaryKeyClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPrimaryKeyClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::PrimaryKeyClauseContext* ClickHouseParser::primaryKeyClause() { + PrimaryKeyClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 56, ClickHouseParser::RulePrimaryKeyClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(793); + match(ClickHouseParser::PRIMARY); + setState(794); + match(ClickHouseParser::KEY); + setState(795); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SampleByClauseContext ------------------------------------------------------------------ + +ClickHouseParser::SampleByClauseContext::SampleByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SampleByClauseContext::SAMPLE() { + return getToken(ClickHouseParser::SAMPLE, 0); +} + +tree::TerminalNode* ClickHouseParser::SampleByClauseContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::SampleByClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::SampleByClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleSampleByClause; +} + +antlrcpp::Any ClickHouseParser::SampleByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSampleByClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SampleByClauseContext* ClickHouseParser::sampleByClause() { + SampleByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 58, ClickHouseParser::RuleSampleByClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(797); + match(ClickHouseParser::SAMPLE); + setState(798); + match(ClickHouseParser::BY); + setState(799); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TtlClauseContext ------------------------------------------------------------------ + +ClickHouseParser::TtlClauseContext::TtlClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::TtlClauseContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + +std::vector ClickHouseParser::TtlClauseContext::ttlExpr() { + return getRuleContexts(); +} + +ClickHouseParser::TtlExprContext* ClickHouseParser::TtlClauseContext::ttlExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::TtlClauseContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::TtlClauseContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::TtlClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleTtlClause; +} + +antlrcpp::Any ClickHouseParser::TtlClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTtlClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TtlClauseContext* ClickHouseParser::ttlClause() { + TtlClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 60, ClickHouseParser::RuleTtlClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(801); + match(ClickHouseParser::TTL); + setState(802); + ttlExpr(); + setState(807); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 78, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(803); + match(ClickHouseParser::COMMA); + setState(804); + ttlExpr(); + } + setState(809); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 78, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EngineExprContext ------------------------------------------------------------------ + +ClickHouseParser::EngineExprContext::EngineExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::EngineExprContext::ENGINE() { + return getToken(ClickHouseParser::ENGINE, 0); +} + +ClickHouseParser::IdentifierOrNullContext* ClickHouseParser::EngineExprContext::identifierOrNull() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::EngineExprContext::EQ_SINGLE() { + return getToken(ClickHouseParser::EQ_SINGLE, 0); +} + +tree::TerminalNode* ClickHouseParser::EngineExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::EngineExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::EngineExprContext::columnExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::EngineExprContext::getRuleIndex() const { + return ClickHouseParser::RuleEngineExpr; +} + +antlrcpp::Any ClickHouseParser::EngineExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitEngineExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::EngineExprContext* ClickHouseParser::engineExpr() { + EngineExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 62, ClickHouseParser::RuleEngineExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(810); + match(ClickHouseParser::ENGINE); + setState(812); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::EQ_SINGLE) { + setState(811); + match(ClickHouseParser::EQ_SINGLE); + } + setState(814); + identifierOrNull(); + setState(820); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 81, _ctx)) { + case 1: { + setState(815); + match(ClickHouseParser::LPAREN); + setState(817); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(816); + columnExprList(); + } + setState(819); + match(ClickHouseParser::RPAREN); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableElementExprContext ------------------------------------------------------------------ + +ClickHouseParser::TableElementExprContext::TableElementExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::TableElementExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTableElementExpr; +} + +void ClickHouseParser::TableElementExprContext::copyFrom(TableElementExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- TableElementExprConstraintContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::TableElementExprConstraintContext::CONSTRAINT() { + return getToken(ClickHouseParser::CONSTRAINT, 0); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::TableElementExprConstraintContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableElementExprConstraintContext::CHECK() { + return getToken(ClickHouseParser::CHECK, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::TableElementExprConstraintContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::TableElementExprConstraintContext::TableElementExprConstraintContext(TableElementExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableElementExprConstraintContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableElementExprConstraint(this); + else + return visitor->visitChildren(this); +} +//----------------- TableElementExprColumnContext ------------------------------------------------------------------ + +ClickHouseParser::TableColumnDfntContext* ClickHouseParser::TableElementExprColumnContext::tableColumnDfnt() { + return getRuleContext(0); +} + +ClickHouseParser::TableElementExprColumnContext::TableElementExprColumnContext(TableElementExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableElementExprColumnContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableElementExprColumn(this); + else + return visitor->visitChildren(this); +} +//----------------- TableElementExprIndexContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::TableElementExprIndexContext::INDEX() { + return getToken(ClickHouseParser::INDEX, 0); +} + +ClickHouseParser::TableIndexDfntContext* ClickHouseParser::TableElementExprIndexContext::tableIndexDfnt() { + return getRuleContext(0); +} + +ClickHouseParser::TableElementExprIndexContext::TableElementExprIndexContext(TableElementExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableElementExprIndexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableElementExprIndex(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::TableElementExprContext* ClickHouseParser::tableElementExpr() { + TableElementExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 64, ClickHouseParser::RuleTableElementExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(830); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 82, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(822); + tableColumnDfnt(); + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(823); + match(ClickHouseParser::CONSTRAINT); + setState(824); + identifier(); + setState(825); + match(ClickHouseParser::CHECK); + setState(826); + columnExpr(0); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(828); + match(ClickHouseParser::INDEX); + setState(829); + tableIndexDfnt(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableColumnDfntContext ------------------------------------------------------------------ + +ClickHouseParser::TableColumnDfntContext::TableColumnDfntContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::TableColumnDfntContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::TableColumnDfntContext::columnTypeExpr() { + return getRuleContext(0); +} + +ClickHouseParser::TableColumnPropertyExprContext* ClickHouseParser::TableColumnDfntContext::tableColumnPropertyExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnDfntContext::COMMENT() { + return getToken(ClickHouseParser::COMMENT, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnDfntContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +ClickHouseParser::CodecExprContext* ClickHouseParser::TableColumnDfntContext::codecExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnDfntContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::TableColumnDfntContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::TableColumnDfntContext::getRuleIndex() const { + return ClickHouseParser::RuleTableColumnDfnt; +} + +antlrcpp::Any ClickHouseParser::TableColumnDfntContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableColumnDfnt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableColumnDfntContext* ClickHouseParser::tableColumnDfnt() { + TableColumnDfntContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 66, ClickHouseParser::RuleTableColumnDfnt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(864); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 91, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(832); + nestedIdentifier(); + setState(833); + columnTypeExpr(); + setState(835); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ALIAS + + || _la == ClickHouseParser::DEFAULT || _la == ClickHouseParser::MATERIALIZED) { + setState(834); + tableColumnPropertyExpr(); + } + setState(839); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::COMMENT) { + setState(837); + match(ClickHouseParser::COMMENT); + setState(838); + match(ClickHouseParser::STRING_LITERAL); + } + setState(842); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::CODEC) { + setState(841); + codecExpr(); + } + setState(846); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TTL) { + setState(844); + match(ClickHouseParser::TTL); + setState(845); + columnExpr(0); + } + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(848); + nestedIdentifier(); + setState(850); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 87, _ctx)) { + case 1: { + setState(849); + columnTypeExpr(); + break; + } + + } + setState(852); + tableColumnPropertyExpr(); + setState(855); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::COMMENT) { + setState(853); + match(ClickHouseParser::COMMENT); + setState(854); + match(ClickHouseParser::STRING_LITERAL); + } + setState(858); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::CODEC) { + setState(857); + codecExpr(); + } + setState(862); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TTL) { + setState(860); + match(ClickHouseParser::TTL); + setState(861); + columnExpr(0); + } + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableColumnPropertyExprContext ------------------------------------------------------------------ + +ClickHouseParser::TableColumnPropertyExprContext::TableColumnPropertyExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::TableColumnPropertyExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyExprContext::DEFAULT() { + return getToken(ClickHouseParser::DEFAULT, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyExprContext::MATERIALIZED() { + return getToken(ClickHouseParser::MATERIALIZED, 0); +} + +tree::TerminalNode* ClickHouseParser::TableColumnPropertyExprContext::ALIAS() { + return getToken(ClickHouseParser::ALIAS, 0); +} + + +size_t ClickHouseParser::TableColumnPropertyExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTableColumnPropertyExpr; +} + +antlrcpp::Any ClickHouseParser::TableColumnPropertyExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableColumnPropertyExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableColumnPropertyExprContext* ClickHouseParser::tableColumnPropertyExpr() { + TableColumnPropertyExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 68, ClickHouseParser::RuleTableColumnPropertyExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(866); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ALIAS + + || _la == ClickHouseParser::DEFAULT || _la == ClickHouseParser::MATERIALIZED)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(867); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableIndexDfntContext ------------------------------------------------------------------ + +ClickHouseParser::TableIndexDfntContext::TableIndexDfntContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::TableIndexDfntContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::TableIndexDfntContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableIndexDfntContext::TYPE() { + return getToken(ClickHouseParser::TYPE, 0); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::TableIndexDfntContext::columnTypeExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableIndexDfntContext::GRANULARITY() { + return getToken(ClickHouseParser::GRANULARITY, 0); +} + +tree::TerminalNode* ClickHouseParser::TableIndexDfntContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + + +size_t ClickHouseParser::TableIndexDfntContext::getRuleIndex() const { + return ClickHouseParser::RuleTableIndexDfnt; +} + +antlrcpp::Any ClickHouseParser::TableIndexDfntContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableIndexDfnt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableIndexDfntContext* ClickHouseParser::tableIndexDfnt() { + TableIndexDfntContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 70, ClickHouseParser::RuleTableIndexDfnt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(869); + nestedIdentifier(); + setState(870); + columnExpr(0); + setState(871); + match(ClickHouseParser::TYPE); + setState(872); + columnTypeExpr(); + setState(873); + match(ClickHouseParser::GRANULARITY); + setState(874); + match(ClickHouseParser::DECIMAL_LITERAL); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CodecExprContext ------------------------------------------------------------------ + +ClickHouseParser::CodecExprContext::CodecExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::CodecExprContext::CODEC() { + return getToken(ClickHouseParser::CODEC, 0); +} + +tree::TerminalNode* ClickHouseParser::CodecExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::CodecExprContext::codecArgExpr() { + return getRuleContexts(); +} + +ClickHouseParser::CodecArgExprContext* ClickHouseParser::CodecExprContext::codecArgExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::CodecExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::CodecExprContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::CodecExprContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::CodecExprContext::getRuleIndex() const { + return ClickHouseParser::RuleCodecExpr; +} + +antlrcpp::Any ClickHouseParser::CodecExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCodecExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::CodecExprContext* ClickHouseParser::codecExpr() { + CodecExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 72, ClickHouseParser::RuleCodecExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(876); + match(ClickHouseParser::CODEC); + setState(877); + match(ClickHouseParser::LPAREN); + setState(878); + codecArgExpr(); + setState(883); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(879); + match(ClickHouseParser::COMMA); + setState(880); + codecArgExpr(); + setState(885); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(886); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- CodecArgExprContext ------------------------------------------------------------------ + +ClickHouseParser::CodecArgExprContext::CodecArgExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::CodecArgExprContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::CodecArgExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::CodecArgExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::CodecArgExprContext::columnExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::CodecArgExprContext::getRuleIndex() const { + return ClickHouseParser::RuleCodecArgExpr; +} + +antlrcpp::Any ClickHouseParser::CodecArgExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitCodecArgExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::CodecArgExprContext* ClickHouseParser::codecArgExpr() { + CodecArgExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 74, ClickHouseParser::RuleCodecArgExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(888); + identifier(); + setState(894); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::LPAREN) { + setState(889); + match(ClickHouseParser::LPAREN); + setState(891); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(890); + columnExprList(); + } + setState(893); + match(ClickHouseParser::RPAREN); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TtlExprContext ------------------------------------------------------------------ + +ClickHouseParser::TtlExprContext::TtlExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::TtlExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TtlExprContext::DELETE() { + return getToken(ClickHouseParser::DELETE, 0); +} + +tree::TerminalNode* ClickHouseParser::TtlExprContext::TO() { + return getToken(ClickHouseParser::TO, 0); +} + +tree::TerminalNode* ClickHouseParser::TtlExprContext::DISK() { + return getToken(ClickHouseParser::DISK, 0); +} + +tree::TerminalNode* ClickHouseParser::TtlExprContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::TtlExprContext::VOLUME() { + return getToken(ClickHouseParser::VOLUME, 0); +} + + +size_t ClickHouseParser::TtlExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTtlExpr; +} + +antlrcpp::Any ClickHouseParser::TtlExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTtlExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TtlExprContext* ClickHouseParser::ttlExpr() { + TtlExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 76, ClickHouseParser::RuleTtlExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(896); + columnExpr(0); + setState(904); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 95, _ctx)) { + case 1: { + setState(897); + match(ClickHouseParser::DELETE); + break; + } + + case 2: { + setState(898); + match(ClickHouseParser::TO); + setState(899); + match(ClickHouseParser::DISK); + setState(900); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 3: { + setState(901); + match(ClickHouseParser::TO); + setState(902); + match(ClickHouseParser::VOLUME); + setState(903); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DescribeStmtContext ------------------------------------------------------------------ + +ClickHouseParser::DescribeStmtContext::DescribeStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::TableExprContext* ClickHouseParser::DescribeStmtContext::tableExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DescribeStmtContext::DESCRIBE() { + return getToken(ClickHouseParser::DESCRIBE, 0); +} + +tree::TerminalNode* ClickHouseParser::DescribeStmtContext::DESC() { + return getToken(ClickHouseParser::DESC, 0); +} + +tree::TerminalNode* ClickHouseParser::DescribeStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + + +size_t ClickHouseParser::DescribeStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleDescribeStmt; +} + +antlrcpp::Any ClickHouseParser::DescribeStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDescribeStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DescribeStmtContext* ClickHouseParser::describeStmt() { + DescribeStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 78, ClickHouseParser::RuleDescribeStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(906); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::DESC + + || _la == ClickHouseParser::DESCRIBE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(908); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 96, _ctx)) { + case 1: { + setState(907); + match(ClickHouseParser::TABLE); + break; + } + + } + setState(910); + tableExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DropStmtContext ------------------------------------------------------------------ + +ClickHouseParser::DropStmtContext::DropStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::DropStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleDropStmt; +} + +void ClickHouseParser::DropStmtContext::copyFrom(DropStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- DropDatabaseStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::DropDatabaseStmtContext::DATABASE() { + return getToken(ClickHouseParser::DATABASE, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::DropDatabaseStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DropDatabaseStmtContext::DETACH() { + return getToken(ClickHouseParser::DETACH, 0); +} + +tree::TerminalNode* ClickHouseParser::DropDatabaseStmtContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +tree::TerminalNode* ClickHouseParser::DropDatabaseStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::DropDatabaseStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::DropDatabaseStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::DropDatabaseStmtContext::DropDatabaseStmtContext(DropStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::DropDatabaseStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDropDatabaseStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- DropTableStmtContext ------------------------------------------------------------------ + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::DropTableStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::DETACH() { + return getToken(ClickHouseParser::DETACH, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::DropTableStmtContext::clusterClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::NO() { + return getToken(ClickHouseParser::NO, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::DELAY() { + return getToken(ClickHouseParser::DELAY, 0); +} + +tree::TerminalNode* ClickHouseParser::DropTableStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +ClickHouseParser::DropTableStmtContext::DropTableStmtContext(DropStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::DropTableStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDropTableStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::DropStmtContext* ClickHouseParser::dropStmt() { + DropStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 80, ClickHouseParser::RuleDropStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(942); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 104, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(912); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::DETACH + + || _la == ClickHouseParser::DROP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(913); + match(ClickHouseParser::DATABASE); + setState(916); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 97, _ctx)) { + case 1: { + setState(914); + match(ClickHouseParser::IF); + setState(915); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(918); + databaseIdentifier(); + setState(920); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(919); + clusterClause(); + } + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(922); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::DETACH + + || _la == ClickHouseParser::DROP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(928); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::DICTIONARY: { + setState(923); + match(ClickHouseParser::DICTIONARY); + break; + } + + case ClickHouseParser::TABLE: + case ClickHouseParser::TEMPORARY: { + setState(925); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TEMPORARY) { + setState(924); + match(ClickHouseParser::TEMPORARY); + } + setState(927); + match(ClickHouseParser::TABLE); + break; + } + + default: + throw NoViableAltException(this); + } + setState(932); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 101, _ctx)) { + case 1: { + setState(930); + match(ClickHouseParser::IF); + setState(931); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(934); + tableIdentifier(); + setState(936); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(935); + clusterClause(); + } + setState(940); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::NO) { + setState(938); + match(ClickHouseParser::NO); + setState(939); + match(ClickHouseParser::DELAY); + } + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExistsStmtContext ------------------------------------------------------------------ + +ClickHouseParser::ExistsStmtContext::ExistsStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ExistsStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ExistsStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ExistsStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +tree::TerminalNode* ClickHouseParser::ExistsStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +tree::TerminalNode* ClickHouseParser::ExistsStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + + +size_t ClickHouseParser::ExistsStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleExistsStmt; +} + +antlrcpp::Any ClickHouseParser::ExistsStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitExistsStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ExistsStmtContext* ClickHouseParser::existsStmt() { + ExistsStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 82, ClickHouseParser::RuleExistsStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(944); + match(ClickHouseParser::EXISTS); + setState(950); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 106, _ctx)) { + case 1: { + setState(945); + match(ClickHouseParser::DICTIONARY); + break; + } + + case 2: { + setState(947); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TEMPORARY) { + setState(946); + match(ClickHouseParser::TEMPORARY); + } + setState(949); + match(ClickHouseParser::TABLE); + break; + } + + } + setState(952); + tableIdentifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExplainStmtContext ------------------------------------------------------------------ + +ClickHouseParser::ExplainStmtContext::ExplainStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ExplainStmtContext::EXPLAIN() { + return getToken(ClickHouseParser::EXPLAIN, 0); +} + +tree::TerminalNode* ClickHouseParser::ExplainStmtContext::SYNTAX() { + return getToken(ClickHouseParser::SYNTAX, 0); +} + +ClickHouseParser::QueryContext* ClickHouseParser::ExplainStmtContext::query() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::ExplainStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleExplainStmt; +} + +antlrcpp::Any ClickHouseParser::ExplainStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitExplainStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ExplainStmtContext* ClickHouseParser::explainStmt() { + ExplainStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 84, ClickHouseParser::RuleExplainStmt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(954); + match(ClickHouseParser::EXPLAIN); + setState(955); + match(ClickHouseParser::SYNTAX); + setState(956); + query(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- InsertStmtContext ------------------------------------------------------------------ + +ClickHouseParser::InsertStmtContext::InsertStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::InsertStmtContext::INSERT() { + return getToken(ClickHouseParser::INSERT, 0); +} + +tree::TerminalNode* ClickHouseParser::InsertStmtContext::INTO() { + return getToken(ClickHouseParser::INTO, 0); +} + +ClickHouseParser::DataClauseContext* ClickHouseParser::InsertStmtContext::dataClause() { + return getRuleContext(0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::InsertStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::InsertStmtContext::FUNCTION() { + return getToken(ClickHouseParser::FUNCTION, 0); +} + +ClickHouseParser::TableFunctionExprContext* ClickHouseParser::InsertStmtContext::tableFunctionExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::InsertStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::ColumnsClauseContext* ClickHouseParser::InsertStmtContext::columnsClause() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::InsertStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleInsertStmt; +} + +antlrcpp::Any ClickHouseParser::InsertStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitInsertStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::InsertStmtContext* ClickHouseParser::insertStmt() { + InsertStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 86, ClickHouseParser::RuleInsertStmt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(958); + match(ClickHouseParser::INSERT); + setState(959); + match(ClickHouseParser::INTO); + setState(961); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 107, _ctx)) { + case 1: { + setState(960); + match(ClickHouseParser::TABLE); + break; + } + + } + setState(966); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 108, _ctx)) { + case 1: { + setState(963); + tableIdentifier(); + break; + } + + case 2: { + setState(964); + match(ClickHouseParser::FUNCTION); + setState(965); + tableFunctionExpr(); + break; + } + + } + setState(969); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 109, _ctx)) { + case 1: { + setState(968); + columnsClause(); + break; + } + + } + setState(971); + dataClause(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnsClauseContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnsClauseContext::ColumnsClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ColumnsClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnsClauseContext::nestedIdentifier() { + return getRuleContexts(); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::ColumnsClauseContext::nestedIdentifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnsClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::ColumnsClauseContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnsClauseContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::ColumnsClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnsClause; +} + +antlrcpp::Any ClickHouseParser::ColumnsClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnsClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnsClauseContext* ClickHouseParser::columnsClause() { + ColumnsClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 88, ClickHouseParser::RuleColumnsClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(973); + match(ClickHouseParser::LPAREN); + setState(974); + nestedIdentifier(); + setState(979); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(975); + match(ClickHouseParser::COMMA); + setState(976); + nestedIdentifier(); + setState(981); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(982); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DataClauseContext ------------------------------------------------------------------ + +ClickHouseParser::DataClauseContext::DataClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::DataClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleDataClause; +} + +void ClickHouseParser::DataClauseContext::copyFrom(DataClauseContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- DataClauseValuesContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::DataClauseValuesContext::VALUES() { + return getToken(ClickHouseParser::VALUES, 0); +} + +ClickHouseParser::DataClauseValuesContext::DataClauseValuesContext(DataClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::DataClauseValuesContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDataClauseValues(this); + else + return visitor->visitChildren(this); +} +//----------------- DataClauseFormatContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::DataClauseFormatContext::FORMAT() { + return getToken(ClickHouseParser::FORMAT, 0); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::DataClauseFormatContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::DataClauseFormatContext::DataClauseFormatContext(DataClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::DataClauseFormatContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDataClauseFormat(this); + else + return visitor->visitChildren(this); +} +//----------------- DataClauseSelectContext ------------------------------------------------------------------ + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::DataClauseSelectContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::DataClauseSelectContext::EOF() { + return getToken(ClickHouseParser::EOF, 0); +} + +tree::TerminalNode* ClickHouseParser::DataClauseSelectContext::SEMICOLON() { + return getToken(ClickHouseParser::SEMICOLON, 0); +} + +ClickHouseParser::DataClauseSelectContext::DataClauseSelectContext(DataClauseContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::DataClauseSelectContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDataClauseSelect(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::DataClauseContext* ClickHouseParser::dataClause() { + DataClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 90, ClickHouseParser::RuleDataClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(993); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::FORMAT: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(984); + match(ClickHouseParser::FORMAT); + setState(985); + identifier(); + break; + } + + case ClickHouseParser::VALUES: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(986); + match(ClickHouseParser::VALUES); + break; + } + + case ClickHouseParser::SELECT: + case ClickHouseParser::WITH: + case ClickHouseParser::LPAREN: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(987); + selectUnionStmt(); + setState(989); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::SEMICOLON) { + setState(988); + match(ClickHouseParser::SEMICOLON); + } + setState(991); + match(ClickHouseParser::EOF); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- KillStmtContext ------------------------------------------------------------------ + +ClickHouseParser::KillStmtContext::KillStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::KillStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleKillStmt; +} + +void ClickHouseParser::KillStmtContext::copyFrom(KillStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- KillMutationStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::KillMutationStmtContext::KILL() { + return getToken(ClickHouseParser::KILL, 0); +} + +tree::TerminalNode* ClickHouseParser::KillMutationStmtContext::MUTATION() { + return getToken(ClickHouseParser::MUTATION, 0); +} + +ClickHouseParser::WhereClauseContext* ClickHouseParser::KillMutationStmtContext::whereClause() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::KillMutationStmtContext::clusterClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::KillMutationStmtContext::SYNC() { + return getToken(ClickHouseParser::SYNC, 0); +} + +tree::TerminalNode* ClickHouseParser::KillMutationStmtContext::ASYNC() { + return getToken(ClickHouseParser::ASYNC, 0); +} + +tree::TerminalNode* ClickHouseParser::KillMutationStmtContext::TEST() { + return getToken(ClickHouseParser::TEST, 0); +} + +ClickHouseParser::KillMutationStmtContext::KillMutationStmtContext(KillStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::KillMutationStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitKillMutationStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::KillStmtContext* ClickHouseParser::killStmt() { + KillStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 92, ClickHouseParser::RuleKillStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(995); + match(ClickHouseParser::KILL); + setState(996); + match(ClickHouseParser::MUTATION); + setState(998); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(997); + clusterClause(); + } + setState(1000); + whereClause(); + setState(1002); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ASYNC || _la == ClickHouseParser::SYNC + + || _la == ClickHouseParser::TEST) { + setState(1001); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ASYNC || _la == ClickHouseParser::SYNC + + || _la == ClickHouseParser::TEST)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OptimizeStmtContext ------------------------------------------------------------------ + +ClickHouseParser::OptimizeStmtContext::OptimizeStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::OptimizeStmtContext::OPTIMIZE() { + return getToken(ClickHouseParser::OPTIMIZE, 0); +} + +tree::TerminalNode* ClickHouseParser::OptimizeStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::OptimizeStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::OptimizeStmtContext::clusterClause() { + return getRuleContext(0); +} + +ClickHouseParser::PartitionClauseContext* ClickHouseParser::OptimizeStmtContext::partitionClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::OptimizeStmtContext::FINAL() { + return getToken(ClickHouseParser::FINAL, 0); +} + +tree::TerminalNode* ClickHouseParser::OptimizeStmtContext::DEDUPLICATE() { + return getToken(ClickHouseParser::DEDUPLICATE, 0); +} + + +size_t ClickHouseParser::OptimizeStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleOptimizeStmt; +} + +antlrcpp::Any ClickHouseParser::OptimizeStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOptimizeStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::OptimizeStmtContext* ClickHouseParser::optimizeStmt() { + OptimizeStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 94, ClickHouseParser::RuleOptimizeStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1004); + match(ClickHouseParser::OPTIMIZE); + setState(1005); + match(ClickHouseParser::TABLE); + setState(1006); + tableIdentifier(); + setState(1008); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(1007); + clusterClause(); + } + setState(1011); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::PARTITION) { + setState(1010); + partitionClause(); + } + setState(1014); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FINAL) { + setState(1013); + match(ClickHouseParser::FINAL); + } + setState(1017); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::DEDUPLICATE) { + setState(1016); + match(ClickHouseParser::DEDUPLICATE); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RenameStmtContext ------------------------------------------------------------------ + +ClickHouseParser::RenameStmtContext::RenameStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::RenameStmtContext::RENAME() { + return getToken(ClickHouseParser::RENAME, 0); +} + +tree::TerminalNode* ClickHouseParser::RenameStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +std::vector ClickHouseParser::RenameStmtContext::tableIdentifier() { + return getRuleContexts(); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::RenameStmtContext::tableIdentifier(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::RenameStmtContext::TO() { + return getTokens(ClickHouseParser::TO); +} + +tree::TerminalNode* ClickHouseParser::RenameStmtContext::TO(size_t i) { + return getToken(ClickHouseParser::TO, i); +} + +std::vector ClickHouseParser::RenameStmtContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::RenameStmtContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::RenameStmtContext::clusterClause() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::RenameStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleRenameStmt; +} + +antlrcpp::Any ClickHouseParser::RenameStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitRenameStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::RenameStmtContext* ClickHouseParser::renameStmt() { + RenameStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 96, ClickHouseParser::RuleRenameStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1019); + match(ClickHouseParser::RENAME); + setState(1020); + match(ClickHouseParser::TABLE); + setState(1021); + tableIdentifier(); + setState(1022); + match(ClickHouseParser::TO); + setState(1023); + tableIdentifier(); + setState(1031); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1024); + match(ClickHouseParser::COMMA); + setState(1025); + tableIdentifier(); + setState(1026); + match(ClickHouseParser::TO); + setState(1027); + tableIdentifier(); + setState(1033); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1035); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(1034); + clusterClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SelectUnionStmtContext ------------------------------------------------------------------ + +ClickHouseParser::SelectUnionStmtContext::SelectUnionStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::SelectUnionStmtContext::selectStmtWithParens() { + return getRuleContexts(); +} + +ClickHouseParser::SelectStmtWithParensContext* ClickHouseParser::SelectUnionStmtContext::selectStmtWithParens(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::SelectUnionStmtContext::UNION() { + return getTokens(ClickHouseParser::UNION); +} + +tree::TerminalNode* ClickHouseParser::SelectUnionStmtContext::UNION(size_t i) { + return getToken(ClickHouseParser::UNION, i); +} + +std::vector ClickHouseParser::SelectUnionStmtContext::ALL() { + return getTokens(ClickHouseParser::ALL); +} + +tree::TerminalNode* ClickHouseParser::SelectUnionStmtContext::ALL(size_t i) { + return getToken(ClickHouseParser::ALL, i); +} + + +size_t ClickHouseParser::SelectUnionStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleSelectUnionStmt; +} + +antlrcpp::Any ClickHouseParser::SelectUnionStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectUnionStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::selectUnionStmt() { + SelectUnionStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 98, ClickHouseParser::RuleSelectUnionStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1037); + selectStmtWithParens(); + setState(1043); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::UNION) { + setState(1038); + match(ClickHouseParser::UNION); + setState(1039); + match(ClickHouseParser::ALL); + setState(1040); + selectStmtWithParens(); + setState(1045); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SelectStmtWithParensContext ------------------------------------------------------------------ + +ClickHouseParser::SelectStmtWithParensContext::SelectStmtWithParensContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::SelectStmtContext* ClickHouseParser::SelectStmtWithParensContext::selectStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtWithParensContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::SelectStmtWithParensContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtWithParensContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + + +size_t ClickHouseParser::SelectStmtWithParensContext::getRuleIndex() const { + return ClickHouseParser::RuleSelectStmtWithParens; +} + +antlrcpp::Any ClickHouseParser::SelectStmtWithParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectStmtWithParens(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SelectStmtWithParensContext* ClickHouseParser::selectStmtWithParens() { + SelectStmtWithParensContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 100, ClickHouseParser::RuleSelectStmtWithParens); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1051); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::SELECT: + case ClickHouseParser::WITH: { + enterOuterAlt(_localctx, 1); + setState(1046); + selectStmt(); + break; + } + + case ClickHouseParser::LPAREN: { + enterOuterAlt(_localctx, 2); + setState(1047); + match(ClickHouseParser::LPAREN); + setState(1048); + selectUnionStmt(); + setState(1049); + match(ClickHouseParser::RPAREN); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SelectStmtContext ------------------------------------------------------------------ + +ClickHouseParser::SelectStmtContext::SelectStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::SELECT() { + return getToken(ClickHouseParser::SELECT, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::SelectStmtContext::columnExprList() { + return getRuleContext(0); +} + +ClickHouseParser::WithClauseContext* ClickHouseParser::SelectStmtContext::withClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::DISTINCT() { + return getToken(ClickHouseParser::DISTINCT, 0); +} + +ClickHouseParser::TopClauseContext* ClickHouseParser::SelectStmtContext::topClause() { + return getRuleContext(0); +} + +ClickHouseParser::FromClauseContext* ClickHouseParser::SelectStmtContext::fromClause() { + return getRuleContext(0); +} + +ClickHouseParser::ArrayJoinClauseContext* ClickHouseParser::SelectStmtContext::arrayJoinClause() { + return getRuleContext(0); +} + +ClickHouseParser::PrewhereClauseContext* ClickHouseParser::SelectStmtContext::prewhereClause() { + return getRuleContext(0); +} + +ClickHouseParser::WhereClauseContext* ClickHouseParser::SelectStmtContext::whereClause() { + return getRuleContext(0); +} + +ClickHouseParser::GroupByClauseContext* ClickHouseParser::SelectStmtContext::groupByClause() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::SelectStmtContext::WITH() { + return getTokens(ClickHouseParser::WITH); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::WITH(size_t i) { + return getToken(ClickHouseParser::WITH, i); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::TOTALS() { + return getToken(ClickHouseParser::TOTALS, 0); +} + +ClickHouseParser::HavingClauseContext* ClickHouseParser::SelectStmtContext::havingClause() { + return getRuleContext(0); +} + +ClickHouseParser::OrderByClauseContext* ClickHouseParser::SelectStmtContext::orderByClause() { + return getRuleContext(0); +} + +ClickHouseParser::LimitByClauseContext* ClickHouseParser::SelectStmtContext::limitByClause() { + return getRuleContext(0); +} + +ClickHouseParser::LimitClauseContext* ClickHouseParser::SelectStmtContext::limitClause() { + return getRuleContext(0); +} + +ClickHouseParser::SettingsClauseContext* ClickHouseParser::SelectStmtContext::settingsClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::CUBE() { + return getToken(ClickHouseParser::CUBE, 0); +} + +tree::TerminalNode* ClickHouseParser::SelectStmtContext::ROLLUP() { + return getToken(ClickHouseParser::ROLLUP, 0); +} + + +size_t ClickHouseParser::SelectStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleSelectStmt; +} + +antlrcpp::Any ClickHouseParser::SelectStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SelectStmtContext* ClickHouseParser::selectStmt() { + SelectStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 102, ClickHouseParser::RuleSelectStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1054); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::WITH) { + setState(1053); + withClause(); + } + setState(1056); + match(ClickHouseParser::SELECT); + setState(1058); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 124, _ctx)) { + case 1: { + setState(1057); + match(ClickHouseParser::DISTINCT); + break; + } + + } + setState(1061); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 125, _ctx)) { + case 1: { + setState(1060); + topClause(); + break; + } + + } + setState(1063); + columnExprList(); + setState(1065); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FROM) { + setState(1064); + fromClause(); + } + setState(1068); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ARRAY || _la == ClickHouseParser::INNER + + || _la == ClickHouseParser::LEFT) { + setState(1067); + arrayJoinClause(); + } + setState(1071); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::PREWHERE) { + setState(1070); + prewhereClause(); + } + setState(1074); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::WHERE) { + setState(1073); + whereClause(); + } + setState(1077); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::GROUP) { + setState(1076); + groupByClause(); + } + setState(1081); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 131, _ctx)) { + case 1: { + setState(1079); + match(ClickHouseParser::WITH); + setState(1080); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::CUBE || _la == ClickHouseParser::ROLLUP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + setState(1085); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::WITH) { + setState(1083); + match(ClickHouseParser::WITH); + setState(1084); + match(ClickHouseParser::TOTALS); + } + setState(1088); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::HAVING) { + setState(1087); + havingClause(); + } + setState(1091); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ORDER) { + setState(1090); + orderByClause(); + } + setState(1094); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 135, _ctx)) { + case 1: { + setState(1093); + limitByClause(); + break; + } + + } + setState(1097); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::LIMIT) { + setState(1096); + limitClause(); + } + setState(1100); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::SETTINGS) { + setState(1099); + settingsClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WithClauseContext ------------------------------------------------------------------ + +ClickHouseParser::WithClauseContext::WithClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::WithClauseContext::WITH() { + return getToken(ClickHouseParser::WITH, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::WithClauseContext::columnExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::WithClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleWithClause; +} + +antlrcpp::Any ClickHouseParser::WithClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWithClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::WithClauseContext* ClickHouseParser::withClause() { + WithClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 104, ClickHouseParser::RuleWithClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1102); + match(ClickHouseParser::WITH); + setState(1103); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TopClauseContext ------------------------------------------------------------------ + +ClickHouseParser::TopClauseContext::TopClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::TopClauseContext::TOP() { + return getToken(ClickHouseParser::TOP, 0); +} + +tree::TerminalNode* ClickHouseParser::TopClauseContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::TopClauseContext::WITH() { + return getToken(ClickHouseParser::WITH, 0); +} + +tree::TerminalNode* ClickHouseParser::TopClauseContext::TIES() { + return getToken(ClickHouseParser::TIES, 0); +} + + +size_t ClickHouseParser::TopClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleTopClause; +} + +antlrcpp::Any ClickHouseParser::TopClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTopClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TopClauseContext* ClickHouseParser::topClause() { + TopClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 106, ClickHouseParser::RuleTopClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1105); + match(ClickHouseParser::TOP); + setState(1106); + match(ClickHouseParser::DECIMAL_LITERAL); + setState(1109); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 138, _ctx)) { + case 1: { + setState(1107); + match(ClickHouseParser::WITH); + setState(1108); + match(ClickHouseParser::TIES); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FromClauseContext ------------------------------------------------------------------ + +ClickHouseParser::FromClauseContext::FromClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::FromClauseContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::FromClauseContext::joinExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::FromClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleFromClause; +} + +antlrcpp::Any ClickHouseParser::FromClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFromClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::FromClauseContext* ClickHouseParser::fromClause() { + FromClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 108, ClickHouseParser::RuleFromClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1111); + match(ClickHouseParser::FROM); + setState(1112); + joinExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ArrayJoinClauseContext ------------------------------------------------------------------ + +ClickHouseParser::ArrayJoinClauseContext::ArrayJoinClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ArrayJoinClauseContext::ARRAY() { + return getToken(ClickHouseParser::ARRAY, 0); +} + +tree::TerminalNode* ClickHouseParser::ArrayJoinClauseContext::JOIN() { + return getToken(ClickHouseParser::JOIN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::ArrayJoinClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ArrayJoinClauseContext::LEFT() { + return getToken(ClickHouseParser::LEFT, 0); +} + +tree::TerminalNode* ClickHouseParser::ArrayJoinClauseContext::INNER() { + return getToken(ClickHouseParser::INNER, 0); +} + + +size_t ClickHouseParser::ArrayJoinClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleArrayJoinClause; +} + +antlrcpp::Any ClickHouseParser::ArrayJoinClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitArrayJoinClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ArrayJoinClauseContext* ClickHouseParser::arrayJoinClause() { + ArrayJoinClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 110, ClickHouseParser::RuleArrayJoinClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1115); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::INNER + + || _la == ClickHouseParser::LEFT) { + setState(1114); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::INNER + + || _la == ClickHouseParser::LEFT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1117); + match(ClickHouseParser::ARRAY); + setState(1118); + match(ClickHouseParser::JOIN); + setState(1119); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- PrewhereClauseContext ------------------------------------------------------------------ + +ClickHouseParser::PrewhereClauseContext::PrewhereClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::PrewhereClauseContext::PREWHERE() { + return getToken(ClickHouseParser::PREWHERE, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::PrewhereClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::PrewhereClauseContext::getRuleIndex() const { + return ClickHouseParser::RulePrewhereClause; +} + +antlrcpp::Any ClickHouseParser::PrewhereClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPrewhereClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::PrewhereClauseContext* ClickHouseParser::prewhereClause() { + PrewhereClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 112, ClickHouseParser::RulePrewhereClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1121); + match(ClickHouseParser::PREWHERE); + setState(1122); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WhereClauseContext ------------------------------------------------------------------ + +ClickHouseParser::WhereClauseContext::WhereClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::WhereClauseContext::WHERE() { + return getToken(ClickHouseParser::WHERE, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::WhereClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::WhereClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleWhereClause; +} + +antlrcpp::Any ClickHouseParser::WhereClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWhereClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::WhereClauseContext* ClickHouseParser::whereClause() { + WhereClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 114, ClickHouseParser::RuleWhereClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1124); + match(ClickHouseParser::WHERE); + setState(1125); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- GroupByClauseContext ------------------------------------------------------------------ + +ClickHouseParser::GroupByClauseContext::GroupByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::GROUP() { + return getToken(ClickHouseParser::GROUP, 0); +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::GroupByClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::CUBE() { + return getToken(ClickHouseParser::CUBE, 0); +} + +tree::TerminalNode* ClickHouseParser::GroupByClauseContext::ROLLUP() { + return getToken(ClickHouseParser::ROLLUP, 0); +} + + +size_t ClickHouseParser::GroupByClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleGroupByClause; +} + +antlrcpp::Any ClickHouseParser::GroupByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitGroupByClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::GroupByClauseContext* ClickHouseParser::groupByClause() { + GroupByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 116, ClickHouseParser::RuleGroupByClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1127); + match(ClickHouseParser::GROUP); + setState(1128); + match(ClickHouseParser::BY); + setState(1135); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 140, _ctx)) { + case 1: { + setState(1129); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::CUBE || _la == ClickHouseParser::ROLLUP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1130); + match(ClickHouseParser::LPAREN); + setState(1131); + columnExprList(); + setState(1132); + match(ClickHouseParser::RPAREN); + break; + } + + case 2: { + setState(1134); + columnExprList(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- HavingClauseContext ------------------------------------------------------------------ + +ClickHouseParser::HavingClauseContext::HavingClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::HavingClauseContext::HAVING() { + return getToken(ClickHouseParser::HAVING, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::HavingClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::HavingClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleHavingClause; +} + +antlrcpp::Any ClickHouseParser::HavingClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitHavingClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::HavingClauseContext* ClickHouseParser::havingClause() { + HavingClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 118, ClickHouseParser::RuleHavingClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1137); + match(ClickHouseParser::HAVING); + setState(1138); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OrderByClauseContext ------------------------------------------------------------------ + +ClickHouseParser::OrderByClauseContext::OrderByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::OrderByClauseContext::ORDER() { + return getToken(ClickHouseParser::ORDER, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderByClauseContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +ClickHouseParser::OrderExprListContext* ClickHouseParser::OrderByClauseContext::orderExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::OrderByClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleOrderByClause; +} + +antlrcpp::Any ClickHouseParser::OrderByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderByClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::OrderByClauseContext* ClickHouseParser::orderByClause() { + OrderByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 120, ClickHouseParser::RuleOrderByClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1140); + match(ClickHouseParser::ORDER); + setState(1141); + match(ClickHouseParser::BY); + setState(1142); + orderExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LimitByClauseContext ------------------------------------------------------------------ + +ClickHouseParser::LimitByClauseContext::LimitByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::LimitByClauseContext::LIMIT() { + return getToken(ClickHouseParser::LIMIT, 0); +} + +ClickHouseParser::LimitExprContext* ClickHouseParser::LimitByClauseContext::limitExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::LimitByClauseContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::LimitByClauseContext::columnExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::LimitByClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleLimitByClause; +} + +antlrcpp::Any ClickHouseParser::LimitByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLimitByClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LimitByClauseContext* ClickHouseParser::limitByClause() { + LimitByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 122, ClickHouseParser::RuleLimitByClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1144); + match(ClickHouseParser::LIMIT); + setState(1145); + limitExpr(); + setState(1146); + match(ClickHouseParser::BY); + setState(1147); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LimitClauseContext ------------------------------------------------------------------ + +ClickHouseParser::LimitClauseContext::LimitClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::LimitClauseContext::LIMIT() { + return getToken(ClickHouseParser::LIMIT, 0); +} + +ClickHouseParser::LimitExprContext* ClickHouseParser::LimitClauseContext::limitExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::LimitClauseContext::WITH() { + return getToken(ClickHouseParser::WITH, 0); +} + +tree::TerminalNode* ClickHouseParser::LimitClauseContext::TIES() { + return getToken(ClickHouseParser::TIES, 0); +} + + +size_t ClickHouseParser::LimitClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleLimitClause; +} + +antlrcpp::Any ClickHouseParser::LimitClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLimitClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LimitClauseContext* ClickHouseParser::limitClause() { + LimitClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 124, ClickHouseParser::RuleLimitClause); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1149); + match(ClickHouseParser::LIMIT); + setState(1150); + limitExpr(); + setState(1153); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::WITH) { + setState(1151); + match(ClickHouseParser::WITH); + setState(1152); + match(ClickHouseParser::TIES); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SettingsClauseContext ------------------------------------------------------------------ + +ClickHouseParser::SettingsClauseContext::SettingsClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SettingsClauseContext::SETTINGS() { + return getToken(ClickHouseParser::SETTINGS, 0); +} + +ClickHouseParser::SettingExprListContext* ClickHouseParser::SettingsClauseContext::settingExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::SettingsClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleSettingsClause; +} + +antlrcpp::Any ClickHouseParser::SettingsClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingsClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SettingsClauseContext* ClickHouseParser::settingsClause() { + SettingsClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 126, ClickHouseParser::RuleSettingsClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1155); + match(ClickHouseParser::SETTINGS); + setState(1156); + settingExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JoinExprContext ------------------------------------------------------------------ + +ClickHouseParser::JoinExprContext::JoinExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::JoinExprContext::getRuleIndex() const { + return ClickHouseParser::RuleJoinExpr; +} + +void ClickHouseParser::JoinExprContext::copyFrom(JoinExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- JoinExprOpContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::JoinExprOpContext::joinExpr() { + return getRuleContexts(); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::JoinExprOpContext::joinExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::JoinExprOpContext::JOIN() { + return getToken(ClickHouseParser::JOIN, 0); +} + +ClickHouseParser::JoinConstraintClauseContext* ClickHouseParser::JoinExprOpContext::joinConstraintClause() { + return getRuleContext(0); +} + +ClickHouseParser::JoinOpContext* ClickHouseParser::JoinExprOpContext::joinOp() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::JoinExprOpContext::GLOBAL() { + return getToken(ClickHouseParser::GLOBAL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinExprOpContext::LOCAL() { + return getToken(ClickHouseParser::LOCAL, 0); +} + +ClickHouseParser::JoinExprOpContext::JoinExprOpContext(JoinExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinExprOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprOp(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprTableContext ------------------------------------------------------------------ + +ClickHouseParser::TableExprContext* ClickHouseParser::JoinExprTableContext::tableExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::JoinExprTableContext::FINAL() { + return getToken(ClickHouseParser::FINAL, 0); +} + +ClickHouseParser::SampleClauseContext* ClickHouseParser::JoinExprTableContext::sampleClause() { + return getRuleContext(0); +} + +ClickHouseParser::JoinExprTableContext::JoinExprTableContext(JoinExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinExprTableContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprTable(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprParensContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::JoinExprParensContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::JoinExprParensContext::joinExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::JoinExprParensContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::JoinExprParensContext::JoinExprParensContext(JoinExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinExprParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprParens(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprCrossOpContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::JoinExprCrossOpContext::joinExpr() { + return getRuleContexts(); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::JoinExprCrossOpContext::joinExpr(size_t i) { + return getRuleContext(i); +} + +ClickHouseParser::JoinOpCrossContext* ClickHouseParser::JoinExprCrossOpContext::joinOpCross() { + return getRuleContext(0); +} + +ClickHouseParser::JoinExprCrossOpContext::JoinExprCrossOpContext(JoinExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinExprCrossOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprCrossOp(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::joinExpr() { + return joinExpr(0); +} + +ClickHouseParser::JoinExprContext* ClickHouseParser::joinExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + ClickHouseParser::JoinExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + ClickHouseParser::JoinExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 128; + enterRecursionRule(_localctx, 128, ClickHouseParser::RuleJoinExpr, precedence); + + size_t _la = 0; + + auto onExit = finally([=] { + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1170); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 144, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(1159); + tableExpr(0); + setState(1161); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 142, _ctx)) { + case 1: { + setState(1160); + match(ClickHouseParser::FINAL); + break; + } + + } + setState(1164); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 143, _ctx)) { + case 1: { + setState(1163); + sampleClause(); + break; + } + + } + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1166); + match(ClickHouseParser::LPAREN); + setState(1167); + joinExpr(0); + setState(1168); + match(ClickHouseParser::RPAREN); + break; + } + + } + _ctx->stop = _input->LT(-1); + setState(1189); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 148, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(1187); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 147, _ctx)) { + case 1: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleJoinExpr); + setState(1172); + + if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(1173); + joinOpCross(); + setState(1174); + joinExpr(4); + break; + } + + case 2: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleJoinExpr); + setState(1176); + + if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); + setState(1178); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::GLOBAL + + || _la == ClickHouseParser::LOCAL) { + setState(1177); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::GLOBAL + + || _la == ClickHouseParser::LOCAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1181); + _errHandler->sync(this); + + _la = _input->LA(1); + if (((((_la - 4) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 4)) & ((1ULL << (ClickHouseParser::ALL - 4)) + | (1ULL << (ClickHouseParser::ANTI - 4)) + | (1ULL << (ClickHouseParser::ANY - 4)) + | (1ULL << (ClickHouseParser::ASOF - 4)) + | (1ULL << (ClickHouseParser::FULL - 4)))) != 0) || ((((_la - 80) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 80)) & ((1ULL << (ClickHouseParser::INNER - 80)) + | (1ULL << (ClickHouseParser::LEFT - 80)) + | (1ULL << (ClickHouseParser::RIGHT - 80)) + | (1ULL << (ClickHouseParser::SEMI - 80)))) != 0)) { + setState(1180); + joinOp(); + } + setState(1183); + match(ClickHouseParser::JOIN); + setState(1184); + joinExpr(0); + setState(1185); + joinConstraintClause(); + break; + } + + } + } + setState(1191); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 148, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- JoinOpContext ------------------------------------------------------------------ + +ClickHouseParser::JoinOpContext::JoinOpContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::JoinOpContext::getRuleIndex() const { + return ClickHouseParser::RuleJoinOp; +} + +void ClickHouseParser::JoinOpContext::copyFrom(JoinOpContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- JoinOpFullContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::JoinOpFullContext::FULL() { + return getToken(ClickHouseParser::FULL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpFullContext::OUTER() { + return getToken(ClickHouseParser::OUTER, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpFullContext::ALL() { + return getToken(ClickHouseParser::ALL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpFullContext::ANY() { + return getToken(ClickHouseParser::ANY, 0); +} + +ClickHouseParser::JoinOpFullContext::JoinOpFullContext(JoinOpContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinOpFullContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpFull(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinOpInnerContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::JoinOpInnerContext::INNER() { + return getToken(ClickHouseParser::INNER, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpInnerContext::ALL() { + return getToken(ClickHouseParser::ALL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpInnerContext::ANY() { + return getToken(ClickHouseParser::ANY, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpInnerContext::ASOF() { + return getToken(ClickHouseParser::ASOF, 0); +} + +ClickHouseParser::JoinOpInnerContext::JoinOpInnerContext(JoinOpContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinOpInnerContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpInner(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinOpLeftRightContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::LEFT() { + return getToken(ClickHouseParser::LEFT, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::RIGHT() { + return getToken(ClickHouseParser::RIGHT, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::OUTER() { + return getToken(ClickHouseParser::OUTER, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::SEMI() { + return getToken(ClickHouseParser::SEMI, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::ALL() { + return getToken(ClickHouseParser::ALL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::ANTI() { + return getToken(ClickHouseParser::ANTI, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::ANY() { + return getToken(ClickHouseParser::ANY, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpLeftRightContext::ASOF() { + return getToken(ClickHouseParser::ASOF, 0); +} + +ClickHouseParser::JoinOpLeftRightContext::JoinOpLeftRightContext(JoinOpContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::JoinOpLeftRightContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpLeftRight(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::JoinOpContext* ClickHouseParser::joinOp() { + JoinOpContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 130, ClickHouseParser::RuleJoinOp); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1235); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 162, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(1201); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 151, _ctx)) { + case 1: { + setState(1193); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0)) { + setState(1192); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1195); + match(ClickHouseParser::INNER); + break; + } + + case 2: { + setState(1196); + match(ClickHouseParser::INNER); + setState(1198); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0)) { + setState(1197); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + case 3: { + setState(1200); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(1217); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 156, _ctx)) { + case 1: { + setState(1204); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0) || _la == ClickHouseParser::SEMI) { + setState(1203); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0) || _la == ClickHouseParser::SEMI)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1206); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::LEFT + + || _la == ClickHouseParser::RIGHT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1208); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OUTER) { + setState(1207); + match(ClickHouseParser::OUTER); + } + break; + } + + case 2: { + setState(1210); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::LEFT + + || _la == ClickHouseParser::RIGHT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1212); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OUTER) { + setState(1211); + match(ClickHouseParser::OUTER); + } + setState(1215); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0) || _la == ClickHouseParser::SEMI) { + setState(1214); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ASOF))) != 0) || _la == ClickHouseParser::SEMI)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + } + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(1233); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 161, _ctx)) { + case 1: { + setState(1220); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ALL + + || _la == ClickHouseParser::ANY) { + setState(1219); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ALL + + || _la == ClickHouseParser::ANY)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1222); + match(ClickHouseParser::FULL); + setState(1224); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OUTER) { + setState(1223); + match(ClickHouseParser::OUTER); + } + break; + } + + case 2: { + setState(1226); + match(ClickHouseParser::FULL); + setState(1228); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OUTER) { + setState(1227); + match(ClickHouseParser::OUTER); + } + setState(1231); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ALL + + || _la == ClickHouseParser::ANY) { + setState(1230); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ALL + + || _la == ClickHouseParser::ANY)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + } + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JoinOpCrossContext ------------------------------------------------------------------ + +ClickHouseParser::JoinOpCrossContext::JoinOpCrossContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::JoinOpCrossContext::CROSS() { + return getToken(ClickHouseParser::CROSS, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpCrossContext::JOIN() { + return getToken(ClickHouseParser::JOIN, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpCrossContext::GLOBAL() { + return getToken(ClickHouseParser::GLOBAL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpCrossContext::LOCAL() { + return getToken(ClickHouseParser::LOCAL, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinOpCrossContext::COMMA() { + return getToken(ClickHouseParser::COMMA, 0); +} + + +size_t ClickHouseParser::JoinOpCrossContext::getRuleIndex() const { + return ClickHouseParser::RuleJoinOpCross; +} + +antlrcpp::Any ClickHouseParser::JoinOpCrossContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpCross(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::JoinOpCrossContext* ClickHouseParser::joinOpCross() { + JoinOpCrossContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 132, ClickHouseParser::RuleJoinOpCross); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1243); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::CROSS: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::LOCAL: { + enterOuterAlt(_localctx, 1); + setState(1238); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::GLOBAL + + || _la == ClickHouseParser::LOCAL) { + setState(1237); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::GLOBAL + + || _la == ClickHouseParser::LOCAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1240); + match(ClickHouseParser::CROSS); + setState(1241); + match(ClickHouseParser::JOIN); + break; + } + + case ClickHouseParser::COMMA: { + enterOuterAlt(_localctx, 2); + setState(1242); + match(ClickHouseParser::COMMA); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JoinConstraintClauseContext ------------------------------------------------------------------ + +ClickHouseParser::JoinConstraintClauseContext::JoinConstraintClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::JoinConstraintClauseContext::ON() { + return getToken(ClickHouseParser::ON, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::JoinConstraintClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::JoinConstraintClauseContext::USING() { + return getToken(ClickHouseParser::USING, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinConstraintClauseContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::JoinConstraintClauseContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + + +size_t ClickHouseParser::JoinConstraintClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleJoinConstraintClause; +} + +antlrcpp::Any ClickHouseParser::JoinConstraintClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinConstraintClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::JoinConstraintClauseContext* ClickHouseParser::joinConstraintClause() { + JoinConstraintClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 134, ClickHouseParser::RuleJoinConstraintClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1254); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 165, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1245); + match(ClickHouseParser::ON); + setState(1246); + columnExprList(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1247); + match(ClickHouseParser::USING); + setState(1248); + match(ClickHouseParser::LPAREN); + setState(1249); + columnExprList(); + setState(1250); + match(ClickHouseParser::RPAREN); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1252); + match(ClickHouseParser::USING); + setState(1253); + columnExprList(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SampleClauseContext ------------------------------------------------------------------ + +ClickHouseParser::SampleClauseContext::SampleClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SampleClauseContext::SAMPLE() { + return getToken(ClickHouseParser::SAMPLE, 0); +} + +std::vector ClickHouseParser::SampleClauseContext::ratioExpr() { + return getRuleContexts(); +} + +ClickHouseParser::RatioExprContext* ClickHouseParser::SampleClauseContext::ratioExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::SampleClauseContext::OFFSET() { + return getToken(ClickHouseParser::OFFSET, 0); +} + + +size_t ClickHouseParser::SampleClauseContext::getRuleIndex() const { + return ClickHouseParser::RuleSampleClause; +} + +antlrcpp::Any ClickHouseParser::SampleClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSampleClause(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SampleClauseContext* ClickHouseParser::sampleClause() { + SampleClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 136, ClickHouseParser::RuleSampleClause); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1256); + match(ClickHouseParser::SAMPLE); + setState(1257); + ratioExpr(); + setState(1260); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 166, _ctx)) { + case 1: { + setState(1258); + match(ClickHouseParser::OFFSET); + setState(1259); + ratioExpr(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LimitExprContext ------------------------------------------------------------------ + +ClickHouseParser::LimitExprContext::LimitExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::LimitExprContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::LimitExprContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::LimitExprContext::COMMA() { + return getToken(ClickHouseParser::COMMA, 0); +} + +tree::TerminalNode* ClickHouseParser::LimitExprContext::OFFSET() { + return getToken(ClickHouseParser::OFFSET, 0); +} + + +size_t ClickHouseParser::LimitExprContext::getRuleIndex() const { + return ClickHouseParser::RuleLimitExpr; +} + +antlrcpp::Any ClickHouseParser::LimitExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLimitExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LimitExprContext* ClickHouseParser::limitExpr() { + LimitExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 138, ClickHouseParser::RuleLimitExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1262); + columnExpr(0); + setState(1265); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::OFFSET || _la == ClickHouseParser::COMMA) { + setState(1263); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::OFFSET || _la == ClickHouseParser::COMMA)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1264); + columnExpr(0); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OrderExprListContext ------------------------------------------------------------------ + +ClickHouseParser::OrderExprListContext::OrderExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::OrderExprListContext::orderExpr() { + return getRuleContexts(); +} + +ClickHouseParser::OrderExprContext* ClickHouseParser::OrderExprListContext::orderExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::OrderExprListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::OrderExprListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::OrderExprListContext::getRuleIndex() const { + return ClickHouseParser::RuleOrderExprList; +} + +antlrcpp::Any ClickHouseParser::OrderExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderExprList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::OrderExprListContext* ClickHouseParser::orderExprList() { + OrderExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 140, ClickHouseParser::RuleOrderExprList); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1267); + orderExpr(); + setState(1272); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 168, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1268); + match(ClickHouseParser::COMMA); + setState(1269); + orderExpr(); + } + setState(1274); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 168, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OrderExprContext ------------------------------------------------------------------ + +ClickHouseParser::OrderExprContext::OrderExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::OrderExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::NULLS() { + return getToken(ClickHouseParser::NULLS, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::COLLATE() { + return getToken(ClickHouseParser::COLLATE, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::ASCENDING() { + return getToken(ClickHouseParser::ASCENDING, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::DESCENDING() { + return getToken(ClickHouseParser::DESCENDING, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::DESC() { + return getToken(ClickHouseParser::DESC, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::FIRST() { + return getToken(ClickHouseParser::FIRST, 0); +} + +tree::TerminalNode* ClickHouseParser::OrderExprContext::LAST() { + return getToken(ClickHouseParser::LAST, 0); +} + + +size_t ClickHouseParser::OrderExprContext::getRuleIndex() const { + return ClickHouseParser::RuleOrderExpr; +} + +antlrcpp::Any ClickHouseParser::OrderExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::OrderExprContext* ClickHouseParser::orderExpr() { + OrderExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 142, ClickHouseParser::RuleOrderExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1275); + columnExpr(0); + setState(1277); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 169, _ctx)) { + case 1: { + setState(1276); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + setState(1281); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 170, _ctx)) { + case 1: { + setState(1279); + match(ClickHouseParser::NULLS); + setState(1280); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::FIRST + + || _la == ClickHouseParser::LAST)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + setState(1285); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 171, _ctx)) { + case 1: { + setState(1283); + match(ClickHouseParser::COLLATE); + setState(1284); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RatioExprContext ------------------------------------------------------------------ + +ClickHouseParser::RatioExprContext::RatioExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::RatioExprContext::numberLiteral() { + return getRuleContexts(); +} + +ClickHouseParser::NumberLiteralContext* ClickHouseParser::RatioExprContext::numberLiteral(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::RatioExprContext::SLASH() { + return getToken(ClickHouseParser::SLASH, 0); +} + + +size_t ClickHouseParser::RatioExprContext::getRuleIndex() const { + return ClickHouseParser::RuleRatioExpr; +} + +antlrcpp::Any ClickHouseParser::RatioExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitRatioExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::RatioExprContext* ClickHouseParser::ratioExpr() { + RatioExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 144, ClickHouseParser::RuleRatioExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1287); + numberLiteral(); + setState(1290); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 172, _ctx)) { + case 1: { + setState(1288); + match(ClickHouseParser::SLASH); + setState(1289); + numberLiteral(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SettingExprListContext ------------------------------------------------------------------ + +ClickHouseParser::SettingExprListContext::SettingExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::SettingExprListContext::settingExpr() { + return getRuleContexts(); +} + +ClickHouseParser::SettingExprContext* ClickHouseParser::SettingExprListContext::settingExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::SettingExprListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::SettingExprListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::SettingExprListContext::getRuleIndex() const { + return ClickHouseParser::RuleSettingExprList; +} + +antlrcpp::Any ClickHouseParser::SettingExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingExprList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SettingExprListContext* ClickHouseParser::settingExprList() { + SettingExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 146, ClickHouseParser::RuleSettingExprList); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1292); + settingExpr(); + setState(1297); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 173, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1293); + match(ClickHouseParser::COMMA); + setState(1294); + settingExpr(); + } + setState(1299); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 173, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SettingExprContext ------------------------------------------------------------------ + +ClickHouseParser::SettingExprContext::SettingExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::SettingExprContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SettingExprContext::EQ_SINGLE() { + return getToken(ClickHouseParser::EQ_SINGLE, 0); +} + +ClickHouseParser::LiteralContext* ClickHouseParser::SettingExprContext::literal() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::SettingExprContext::getRuleIndex() const { + return ClickHouseParser::RuleSettingExpr; +} + +antlrcpp::Any ClickHouseParser::SettingExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SettingExprContext* ClickHouseParser::settingExpr() { + SettingExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 148, ClickHouseParser::RuleSettingExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1300); + identifier(); + setState(1301); + match(ClickHouseParser::EQ_SINGLE); + setState(1302); + literal(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SetStmtContext ------------------------------------------------------------------ + +ClickHouseParser::SetStmtContext::SetStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SetStmtContext::SET() { + return getToken(ClickHouseParser::SET, 0); +} + +ClickHouseParser::SettingExprListContext* ClickHouseParser::SetStmtContext::settingExprList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::SetStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleSetStmt; +} + +antlrcpp::Any ClickHouseParser::SetStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSetStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SetStmtContext* ClickHouseParser::setStmt() { + SetStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 150, ClickHouseParser::RuleSetStmt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1304); + match(ClickHouseParser::SET); + setState(1305); + settingExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ShowStmtContext ------------------------------------------------------------------ + +ClickHouseParser::ShowStmtContext::ShowStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::ShowStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleShowStmt; +} + +void ClickHouseParser::ShowStmtContext::copyFrom(ShowStmtContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ShowCreateDatabaseStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowCreateDatabaseStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateDatabaseStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateDatabaseStmtContext::DATABASE() { + return getToken(ClickHouseParser::DATABASE, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::ShowCreateDatabaseStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ShowCreateDatabaseStmtContext::ShowCreateDatabaseStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowCreateDatabaseStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowCreateDatabaseStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- ShowDatabasesStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowDatabasesStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowDatabasesStmtContext::DATABASES() { + return getToken(ClickHouseParser::DATABASES, 0); +} + +ClickHouseParser::ShowDatabasesStmtContext::ShowDatabasesStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowDatabasesStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowDatabasesStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- ShowCreateTableStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowCreateTableStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateTableStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ShowCreateTableStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateTableStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateTableStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +ClickHouseParser::ShowCreateTableStmtContext::ShowCreateTableStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowCreateTableStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowCreateTableStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- ShowTablesStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::TABLES() { + return getToken(ClickHouseParser::TABLES, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::ShowTablesStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::LIKE() { + return getToken(ClickHouseParser::LIKE, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +ClickHouseParser::WhereClauseContext* ClickHouseParser::ShowTablesStmtContext::whereClause() { + return getRuleContext(0); +} + +ClickHouseParser::LimitClauseContext* ClickHouseParser::ShowTablesStmtContext::limitClause() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowTablesStmtContext::IN() { + return getToken(ClickHouseParser::IN, 0); +} + +ClickHouseParser::ShowTablesStmtContext::ShowTablesStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowTablesStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowTablesStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- ShowDictionariesStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowDictionariesStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowDictionariesStmtContext::DICTIONARIES() { + return getToken(ClickHouseParser::DICTIONARIES, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowDictionariesStmtContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::ShowDictionariesStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ShowDictionariesStmtContext::ShowDictionariesStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowDictionariesStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowDictionariesStmt(this); + else + return visitor->visitChildren(this); +} +//----------------- ShowCreateDictionaryStmtContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ShowCreateDictionaryStmtContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateDictionaryStmtContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::ShowCreateDictionaryStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ShowCreateDictionaryStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ShowCreateDictionaryStmtContext::ShowCreateDictionaryStmtContext(ShowStmtContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ShowCreateDictionaryStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShowCreateDictionaryStmt(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::ShowStmtContext* ClickHouseParser::showStmt() { + ShowStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 152, ClickHouseParser::RuleShowStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1349); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 181, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(1307); + match(ClickHouseParser::SHOW); + setState(1308); + match(ClickHouseParser::CREATE); + setState(1309); + match(ClickHouseParser::DATABASE); + setState(1310); + databaseIdentifier(); + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(1311); + match(ClickHouseParser::SHOW); + setState(1312); + match(ClickHouseParser::CREATE); + setState(1313); + match(ClickHouseParser::DICTIONARY); + setState(1314); + tableIdentifier(); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(1315); + match(ClickHouseParser::SHOW); + setState(1316); + match(ClickHouseParser::CREATE); + setState(1318); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 174, _ctx)) { + case 1: { + setState(1317); + match(ClickHouseParser::TEMPORARY); + break; + } + + } + setState(1321); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 175, _ctx)) { + case 1: { + setState(1320); + match(ClickHouseParser::TABLE); + break; + } + + } + setState(1323); + tableIdentifier(); + break; + } + + case 4: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 4); + setState(1324); + match(ClickHouseParser::SHOW); + setState(1325); + match(ClickHouseParser::DATABASES); + break; + } + + case 5: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 5); + setState(1326); + match(ClickHouseParser::SHOW); + setState(1327); + match(ClickHouseParser::DICTIONARIES); + setState(1330); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FROM) { + setState(1328); + match(ClickHouseParser::FROM); + setState(1329); + databaseIdentifier(); + } + break; + } + + case 6: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 6); + setState(1332); + match(ClickHouseParser::SHOW); + setState(1334); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TEMPORARY) { + setState(1333); + match(ClickHouseParser::TEMPORARY); + } + setState(1336); + match(ClickHouseParser::TABLES); + setState(1339); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FROM + + || _la == ClickHouseParser::IN) { + setState(1337); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::FROM + + || _la == ClickHouseParser::IN)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1338); + databaseIdentifier(); + } + setState(1344); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::LIKE: { + setState(1341); + match(ClickHouseParser::LIKE); + setState(1342); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case ClickHouseParser::WHERE: { + setState(1343); + whereClause(); + break; + } + + case ClickHouseParser::EOF: + case ClickHouseParser::FORMAT: + case ClickHouseParser::INTO: + case ClickHouseParser::LIMIT: + case ClickHouseParser::SEMICOLON: { + break; + } + + default: + break; + } + setState(1347); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::LIMIT) { + setState(1346); + limitClause(); + } + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SystemStmtContext ------------------------------------------------------------------ + +ClickHouseParser::SystemStmtContext::SystemStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::SYSTEM() { + return getToken(ClickHouseParser::SYSTEM, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::FLUSH() { + return getToken(ClickHouseParser::FLUSH, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::DISTRIBUTED() { + return getToken(ClickHouseParser::DISTRIBUTED, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::SystemStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::LOGS() { + return getToken(ClickHouseParser::LOGS, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::RELOAD() { + return getToken(ClickHouseParser::RELOAD, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::DICTIONARIES() { + return getToken(ClickHouseParser::DICTIONARIES, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::START() { + return getToken(ClickHouseParser::START, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::STOP() { + return getToken(ClickHouseParser::STOP, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::SENDS() { + return getToken(ClickHouseParser::SENDS, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::FETCHES() { + return getToken(ClickHouseParser::FETCHES, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::MERGES() { + return getToken(ClickHouseParser::MERGES, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::REPLICATED() { + return getToken(ClickHouseParser::REPLICATED, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::SYNC() { + return getToken(ClickHouseParser::SYNC, 0); +} + +tree::TerminalNode* ClickHouseParser::SystemStmtContext::REPLICA() { + return getToken(ClickHouseParser::REPLICA, 0); +} + + +size_t ClickHouseParser::SystemStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleSystemStmt; +} + +antlrcpp::Any ClickHouseParser::SystemStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSystemStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::SystemStmtContext* ClickHouseParser::systemStmt() { + SystemStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 154, ClickHouseParser::RuleSystemStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1385); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 184, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1351); + match(ClickHouseParser::SYSTEM); + setState(1352); + match(ClickHouseParser::FLUSH); + setState(1353); + match(ClickHouseParser::DISTRIBUTED); + setState(1354); + tableIdentifier(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1355); + match(ClickHouseParser::SYSTEM); + setState(1356); + match(ClickHouseParser::FLUSH); + setState(1357); + match(ClickHouseParser::LOGS); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1358); + match(ClickHouseParser::SYSTEM); + setState(1359); + match(ClickHouseParser::RELOAD); + setState(1360); + match(ClickHouseParser::DICTIONARIES); + break; + } + + case 4: { + enterOuterAlt(_localctx, 4); + setState(1361); + match(ClickHouseParser::SYSTEM); + setState(1362); + match(ClickHouseParser::RELOAD); + setState(1363); + match(ClickHouseParser::DICTIONARY); + setState(1364); + tableIdentifier(); + break; + } + + case 5: { + enterOuterAlt(_localctx, 5); + setState(1365); + match(ClickHouseParser::SYSTEM); + setState(1366); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::START + + || _la == ClickHouseParser::STOP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1374); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::DISTRIBUTED: { + setState(1367); + match(ClickHouseParser::DISTRIBUTED); + setState(1368); + match(ClickHouseParser::SENDS); + break; + } + + case ClickHouseParser::FETCHES: { + setState(1369); + match(ClickHouseParser::FETCHES); + break; + } + + case ClickHouseParser::MERGES: + case ClickHouseParser::TTL: { + setState(1371); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::TTL) { + setState(1370); + match(ClickHouseParser::TTL); + } + setState(1373); + match(ClickHouseParser::MERGES); + break; + } + + default: + throw NoViableAltException(this); + } + setState(1376); + tableIdentifier(); + break; + } + + case 6: { + enterOuterAlt(_localctx, 6); + setState(1377); + match(ClickHouseParser::SYSTEM); + setState(1378); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::START + + || _la == ClickHouseParser::STOP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1379); + match(ClickHouseParser::REPLICATED); + setState(1380); + match(ClickHouseParser::SENDS); + break; + } + + case 7: { + enterOuterAlt(_localctx, 7); + setState(1381); + match(ClickHouseParser::SYSTEM); + setState(1382); + match(ClickHouseParser::SYNC); + setState(1383); + match(ClickHouseParser::REPLICA); + setState(1384); + tableIdentifier(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TruncateStmtContext ------------------------------------------------------------------ + +ClickHouseParser::TruncateStmtContext::TruncateStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::TruncateStmtContext::TRUNCATE() { + return getToken(ClickHouseParser::TRUNCATE, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::TruncateStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TruncateStmtContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +tree::TerminalNode* ClickHouseParser::TruncateStmtContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +tree::TerminalNode* ClickHouseParser::TruncateStmtContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::TruncateStmtContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +ClickHouseParser::ClusterClauseContext* ClickHouseParser::TruncateStmtContext::clusterClause() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::TruncateStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleTruncateStmt; +} + +antlrcpp::Any ClickHouseParser::TruncateStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTruncateStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TruncateStmtContext* ClickHouseParser::truncateStmt() { + TruncateStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 156, ClickHouseParser::RuleTruncateStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1387); + match(ClickHouseParser::TRUNCATE); + setState(1389); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 185, _ctx)) { + case 1: { + setState(1388); + match(ClickHouseParser::TEMPORARY); + break; + } + + } + setState(1392); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 186, _ctx)) { + case 1: { + setState(1391); + match(ClickHouseParser::TABLE); + break; + } + + } + setState(1396); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 187, _ctx)) { + case 1: { + setState(1394); + match(ClickHouseParser::IF); + setState(1395); + match(ClickHouseParser::EXISTS); + break; + } + + } + setState(1398); + tableIdentifier(); + setState(1400); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ON) { + setState(1399); + clusterClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- UseStmtContext ------------------------------------------------------------------ + +ClickHouseParser::UseStmtContext::UseStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::UseStmtContext::USE() { + return getToken(ClickHouseParser::USE, 0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::UseStmtContext::databaseIdentifier() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::UseStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleUseStmt; +} + +antlrcpp::Any ClickHouseParser::UseStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitUseStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::UseStmtContext* ClickHouseParser::useStmt() { + UseStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 158, ClickHouseParser::RuleUseStmt); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1402); + match(ClickHouseParser::USE); + setState(1403); + databaseIdentifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WatchStmtContext ------------------------------------------------------------------ + +ClickHouseParser::WatchStmtContext::WatchStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::WatchStmtContext::WATCH() { + return getToken(ClickHouseParser::WATCH, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::WatchStmtContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::WatchStmtContext::EVENTS() { + return getToken(ClickHouseParser::EVENTS, 0); +} + +tree::TerminalNode* ClickHouseParser::WatchStmtContext::LIMIT() { + return getToken(ClickHouseParser::LIMIT, 0); +} + +tree::TerminalNode* ClickHouseParser::WatchStmtContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + + +size_t ClickHouseParser::WatchStmtContext::getRuleIndex() const { + return ClickHouseParser::RuleWatchStmt; +} + +antlrcpp::Any ClickHouseParser::WatchStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWatchStmt(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::WatchStmtContext* ClickHouseParser::watchStmt() { + WatchStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 160, ClickHouseParser::RuleWatchStmt); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1405); + match(ClickHouseParser::WATCH); + setState(1406); + tableIdentifier(); + setState(1408); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::EVENTS) { + setState(1407); + match(ClickHouseParser::EVENTS); + } + setState(1412); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::LIMIT) { + setState(1410); + match(ClickHouseParser::LIMIT); + setState(1411); + match(ClickHouseParser::DECIMAL_LITERAL); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnTypeExprContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnTypeExprContext::ColumnTypeExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::ColumnTypeExprContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnTypeExpr; +} + +void ClickHouseParser::ColumnTypeExprContext::copyFrom(ColumnTypeExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ColumnTypeExprNestedContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnTypeExprNestedContext::identifier() { + return getRuleContexts(); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnTypeExprNestedContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprNestedContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprNestedContext::columnTypeExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::ColumnTypeExprNestedContext::columnTypeExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprNestedContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprNestedContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprNestedContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::ColumnTypeExprNestedContext::ColumnTypeExprNestedContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnTypeExprNestedContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprNested(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprParamContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnTypeExprParamContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprParamContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprParamContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::ColumnTypeExprParamContext::columnExprList() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnTypeExprParamContext::ColumnTypeExprParamContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnTypeExprParamContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprParam(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprSimpleContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnTypeExprSimpleContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnTypeExprSimpleContext::ColumnTypeExprSimpleContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnTypeExprSimpleContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprSimple(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprComplexContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnTypeExprComplexContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprComplexContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprComplexContext::columnTypeExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::ColumnTypeExprComplexContext::columnTypeExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprComplexContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprComplexContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprComplexContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::ColumnTypeExprComplexContext::ColumnTypeExprComplexContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnTypeExprComplexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprComplex(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprEnumContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnTypeExprEnumContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprEnumContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprEnumContext::enumValue() { + return getRuleContexts(); +} + +ClickHouseParser::EnumValueContext* ClickHouseParser::ColumnTypeExprEnumContext::enumValue(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprEnumContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::ColumnTypeExprEnumContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnTypeExprEnumContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + +ClickHouseParser::ColumnTypeExprEnumContext::ColumnTypeExprEnumContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnTypeExprEnumContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprEnum(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::columnTypeExpr() { + ColumnTypeExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 162, ClickHouseParser::RuleColumnTypeExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1461); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 195, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(1414); + identifier(); + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(1415); + identifier(); + setState(1416); + match(ClickHouseParser::LPAREN); + setState(1417); + identifier(); + setState(1418); + columnTypeExpr(); + setState(1425); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1419); + match(ClickHouseParser::COMMA); + setState(1420); + identifier(); + setState(1421); + columnTypeExpr(); + setState(1427); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1428); + match(ClickHouseParser::RPAREN); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(1430); + identifier(); + setState(1431); + match(ClickHouseParser::LPAREN); + setState(1432); + enumValue(); + setState(1437); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1433); + match(ClickHouseParser::COMMA); + setState(1434); + enumValue(); + setState(1439); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1440); + match(ClickHouseParser::RPAREN); + break; + } + + case 4: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 4); + setState(1442); + identifier(); + setState(1443); + match(ClickHouseParser::LPAREN); + setState(1444); + columnTypeExpr(); + setState(1449); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1445); + match(ClickHouseParser::COMMA); + setState(1446); + columnTypeExpr(); + setState(1451); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1452); + match(ClickHouseParser::RPAREN); + break; + } + + case 5: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 5); + setState(1454); + identifier(); + setState(1455); + match(ClickHouseParser::LPAREN); + setState(1457); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(1456); + columnExprList(); + } + setState(1459); + match(ClickHouseParser::RPAREN); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnExprListContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprListContext::ColumnExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::ColumnExprListContext::columnsExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnsExprContext* ClickHouseParser::ColumnExprListContext::columnsExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::ColumnExprListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::ColumnExprListContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnExprList; +} + +antlrcpp::Any ClickHouseParser::ColumnExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::columnExprList() { + ColumnExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 164, ClickHouseParser::RuleColumnExprList); + + auto onExit = finally([=] { + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1463); + columnsExpr(); + setState(1468); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 196, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(1464); + match(ClickHouseParser::COMMA); + setState(1465); + columnsExpr(); + } + setState(1470); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 196, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnsExprContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnsExprContext::ColumnsExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::ColumnsExprContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnsExpr; +} + +void ClickHouseParser::ColumnsExprContext::copyFrom(ColumnsExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ColumnsExprColumnContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnsExprColumnContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnsExprColumnContext::ColumnsExprColumnContext(ColumnsExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnsExprColumnContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnsExprColumn(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnsExprAsteriskContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnsExprAsteriskContext::ASTERISK() { + return getToken(ClickHouseParser::ASTERISK, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ColumnsExprAsteriskContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnsExprAsteriskContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + +ClickHouseParser::ColumnsExprAsteriskContext::ColumnsExprAsteriskContext(ColumnsExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnsExprAsteriskContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnsExprAsterisk(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnsExprSubqueryContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnsExprSubqueryContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::ColumnsExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnsExprSubqueryContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnsExprSubqueryContext::ColumnsExprSubqueryContext(ColumnsExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnsExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnsExprSubquery(this); + else + return visitor->visitChildren(this); +} +ClickHouseParser::ColumnsExprContext* ClickHouseParser::columnsExpr() { + ColumnsExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 166, ClickHouseParser::RuleColumnsExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1482); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 198, _ctx)) { + case 1: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 1); + setState(1474); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)))) != 0)) { + setState(1471); + tableIdentifier(); + setState(1472); + match(ClickHouseParser::DOT); + } + setState(1476); + match(ClickHouseParser::ASTERISK); + break; + } + + case 2: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 2); + setState(1477); + match(ClickHouseParser::LPAREN); + setState(1478); + selectUnionStmt(); + setState(1479); + match(ClickHouseParser::RPAREN); + break; + } + + case 3: { + _localctx = dynamic_cast(_tracker.createInstance(_localctx)); + enterOuterAlt(_localctx, 3); + setState(1481); + columnExpr(0); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnExprContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprContext::ColumnExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::ColumnExprContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnExpr; +} + +void ClickHouseParser::ColumnExprContext::copyFrom(ColumnExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ColumnExprTernaryOpContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprTernaryOpContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprTernaryOpContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTernaryOpContext::QUERY() { + return getToken(ClickHouseParser::QUERY, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTernaryOpContext::COLON() { + return getToken(ClickHouseParser::COLON, 0); +} + +ClickHouseParser::ColumnExprTernaryOpContext::ColumnExprTernaryOpContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprTernaryOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTernaryOp(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAliasContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprAliasContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::AliasContext* ClickHouseParser::ColumnExprAliasContext::alias() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprAliasContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnExprAliasContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprAliasContext::ColumnExprAliasContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAlias(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprExtractContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprExtractContext::EXTRACT() { + return getToken(ClickHouseParser::EXTRACT, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprExtractContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::IntervalContext* ClickHouseParser::ColumnExprExtractContext::interval() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprExtractContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprExtractContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprExtractContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprExtractContext::ColumnExprExtractContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprExtractContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprExtract(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprNegateContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprNegateContext::DASH() { + return getToken(ClickHouseParser::DASH, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprNegateContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprNegateContext::ColumnExprNegateContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprNegateContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprNegate(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprSubqueryContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprSubqueryContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::ColumnExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprSubqueryContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprSubqueryContext::ColumnExprSubqueryContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprSubquery(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprLiteralContext ------------------------------------------------------------------ + +ClickHouseParser::LiteralContext* ClickHouseParser::ColumnExprLiteralContext::literal() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprLiteralContext::ColumnExprLiteralContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprLiteral(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprArrayContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprArrayContext::LBRACKET() { + return getToken(ClickHouseParser::LBRACKET, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprArrayContext::RBRACKET() { + return getToken(ClickHouseParser::RBRACKET, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::ColumnExprArrayContext::columnExprList() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprArrayContext::ColumnExprArrayContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprArrayContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprArray(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprSubstringContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprSubstringContext::SUBSTRING() { + return getToken(ClickHouseParser::SUBSTRING, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprSubstringContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnExprSubstringContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprSubstringContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprSubstringContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprSubstringContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprSubstringContext::FOR() { + return getToken(ClickHouseParser::FOR, 0); +} + +ClickHouseParser::ColumnExprSubstringContext::ColumnExprSubstringContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprSubstringContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprSubstring(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprCastContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprCastContext::CAST() { + return getToken(ClickHouseParser::CAST, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCastContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprCastContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCastContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::ColumnTypeExprContext* ClickHouseParser::ColumnExprCastContext::columnTypeExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCastContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprCastContext::ColumnExprCastContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprCastContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprCast(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprOrContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprOrContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprOrContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprOrContext::OR() { + return getToken(ClickHouseParser::OR, 0); +} + +ClickHouseParser::ColumnExprOrContext::ColumnExprOrContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprOrContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprOr(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence1Context ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprPrecedence1Context::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprPrecedence1Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence1Context::ASTERISK() { + return getToken(ClickHouseParser::ASTERISK, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence1Context::SLASH() { + return getToken(ClickHouseParser::SLASH, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence1Context::PERCENT() { + return getToken(ClickHouseParser::PERCENT, 0); +} + +ClickHouseParser::ColumnExprPrecedence1Context::ColumnExprPrecedence1Context(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprPrecedence1Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence1(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence2Context ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprPrecedence2Context::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprPrecedence2Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence2Context::PLUS() { + return getToken(ClickHouseParser::PLUS, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence2Context::DASH() { + return getToken(ClickHouseParser::DASH, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence2Context::CONCAT() { + return getToken(ClickHouseParser::CONCAT, 0); +} + +ClickHouseParser::ColumnExprPrecedence2Context::ColumnExprPrecedence2Context(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprPrecedence2Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence2(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence3Context ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprPrecedence3Context::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprPrecedence3Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::EQ_DOUBLE() { + return getToken(ClickHouseParser::EQ_DOUBLE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::EQ_SINGLE() { + return getToken(ClickHouseParser::EQ_SINGLE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::NOT_EQ() { + return getToken(ClickHouseParser::NOT_EQ, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::LE() { + return getToken(ClickHouseParser::LE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::GE() { + return getToken(ClickHouseParser::GE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::LT() { + return getToken(ClickHouseParser::LT, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::GT() { + return getToken(ClickHouseParser::GT, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::IN() { + return getToken(ClickHouseParser::IN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::LIKE() { + return getToken(ClickHouseParser::LIKE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::ILIKE() { + return getToken(ClickHouseParser::ILIKE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::GLOBAL() { + return getToken(ClickHouseParser::GLOBAL, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprPrecedence3Context::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +ClickHouseParser::ColumnExprPrecedence3Context::ColumnExprPrecedence3Context(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprPrecedence3Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence3(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIntervalContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprIntervalContext::INTERVAL() { + return getToken(ClickHouseParser::INTERVAL, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprIntervalContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::IntervalContext* ClickHouseParser::ColumnExprIntervalContext::interval() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprIntervalContext::ColumnExprIntervalContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprIntervalContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprInterval(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIsNullContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprIsNullContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprIsNullContext::IS() { + return getToken(ClickHouseParser::IS, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprIsNullContext::NULL_SQL() { + return getToken(ClickHouseParser::NULL_SQL, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprIsNullContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +ClickHouseParser::ColumnExprIsNullContext::ColumnExprIsNullContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprIsNullContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprIsNull(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTrimContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::TRIM() { + return getToken(ClickHouseParser::TRIM, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprTrimContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::BOTH() { + return getToken(ClickHouseParser::BOTH, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::LEADING() { + return getToken(ClickHouseParser::LEADING, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTrimContext::TRAILING() { + return getToken(ClickHouseParser::TRAILING, 0); +} + +ClickHouseParser::ColumnExprTrimContext::ColumnExprTrimContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprTrimContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTrim(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTupleContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprTupleContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::ColumnExprTupleContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTupleContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprTupleContext::ColumnExprTupleContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprTupleContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTuple(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprArrayAccessContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprArrayAccessContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprArrayAccessContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprArrayAccessContext::LBRACKET() { + return getToken(ClickHouseParser::LBRACKET, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprArrayAccessContext::RBRACKET() { + return getToken(ClickHouseParser::RBRACKET, 0); +} + +ClickHouseParser::ColumnExprArrayAccessContext::ColumnExprArrayAccessContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprArrayAccessContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprArrayAccess(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprBetweenContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprBetweenContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprBetweenContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprBetweenContext::BETWEEN() { + return getToken(ClickHouseParser::BETWEEN, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprBetweenContext::AND() { + return getToken(ClickHouseParser::AND, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprBetweenContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +ClickHouseParser::ColumnExprBetweenContext::ColumnExprBetweenContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprBetweenContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprBetween(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprParensContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprParensContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprParensContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprParensContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::ColumnExprParensContext::ColumnExprParensContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprParens(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTimestampContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprTimestampContext::TIMESTAMP() { + return getToken(ClickHouseParser::TIMESTAMP, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTimestampContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +ClickHouseParser::ColumnExprTimestampContext::ColumnExprTimestampContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprTimestampContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTimestamp(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAndContext ------------------------------------------------------------------ + +std::vector ClickHouseParser::ColumnExprAndContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprAndContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprAndContext::AND() { + return getToken(ClickHouseParser::AND, 0); +} + +ClickHouseParser::ColumnExprAndContext::ColumnExprAndContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprAndContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAnd(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTupleAccessContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprTupleAccessContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTupleAccessContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprTupleAccessContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + +ClickHouseParser::ColumnExprTupleAccessContext::ColumnExprTupleAccessContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprTupleAccessContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTupleAccess(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprCaseContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprCaseContext::CASE() { + return getToken(ClickHouseParser::CASE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCaseContext::END() { + return getToken(ClickHouseParser::END, 0); +} + +std::vector ClickHouseParser::ColumnExprCaseContext::columnExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprCaseContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::ColumnExprCaseContext::WHEN() { + return getTokens(ClickHouseParser::WHEN); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCaseContext::WHEN(size_t i) { + return getToken(ClickHouseParser::WHEN, i); +} + +std::vector ClickHouseParser::ColumnExprCaseContext::THEN() { + return getTokens(ClickHouseParser::THEN); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCaseContext::THEN(size_t i) { + return getToken(ClickHouseParser::THEN, i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprCaseContext::ELSE() { + return getToken(ClickHouseParser::ELSE, 0); +} + +ClickHouseParser::ColumnExprCaseContext::ColumnExprCaseContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprCaseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprCase(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprDateContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprDateContext::DATE() { + return getToken(ClickHouseParser::DATE, 0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprDateContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +ClickHouseParser::ColumnExprDateContext::ColumnExprDateContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprDateContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprDate(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprNotContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprNotContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnExprNotContext::columnExpr() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprNotContext::ColumnExprNotContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprNotContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprNot(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnIdentifierContext* ClickHouseParser::ColumnExprIdentifierContext::columnIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprIdentifierContext::ColumnExprIdentifierContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprIdentifier(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprFunctionContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnExprFunctionContext::identifier() { + return getRuleContext(0); +} + +std::vector ClickHouseParser::ColumnExprFunctionContext::LPAREN() { + return getTokens(ClickHouseParser::LPAREN); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprFunctionContext::LPAREN(size_t i) { + return getToken(ClickHouseParser::LPAREN, i); +} + +std::vector ClickHouseParser::ColumnExprFunctionContext::RPAREN() { + return getTokens(ClickHouseParser::RPAREN); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprFunctionContext::RPAREN(size_t i) { + return getToken(ClickHouseParser::RPAREN, i); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprFunctionContext::DISTINCT() { + return getToken(ClickHouseParser::DISTINCT, 0); +} + +ClickHouseParser::ColumnArgListContext* ClickHouseParser::ColumnExprFunctionContext::columnArgList() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprListContext* ClickHouseParser::ColumnExprFunctionContext::columnExprList() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprFunctionContext::ColumnExprFunctionContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprFunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprFunction(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAsteriskContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::ColumnExprAsteriskContext::ASTERISK() { + return getToken(ClickHouseParser::ASTERISK, 0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ColumnExprAsteriskContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnExprAsteriskContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + +ClickHouseParser::ColumnExprAsteriskContext::ColumnExprAsteriskContext(ColumnExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::ColumnExprAsteriskContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAsterisk(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::columnExpr() { + return columnExpr(0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::columnExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + ClickHouseParser::ColumnExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + ClickHouseParser::ColumnExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 168; + enterRecursionRule(_localctx, 168, ClickHouseParser::RuleColumnExpr, precedence); + + size_t _la = 0; + + auto onExit = finally([=] { + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1591); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 209, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(1485); + match(ClickHouseParser::CASE); + setState(1487); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 199, _ctx)) { + case 1: { + setState(1486); + columnExpr(0); + break; + } + + } + setState(1494); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(1489); + match(ClickHouseParser::WHEN); + setState(1490); + columnExpr(0); + setState(1491); + match(ClickHouseParser::THEN); + setState(1492); + columnExpr(0); + setState(1496); + _errHandler->sync(this); + _la = _input->LA(1); + } while (_la == ClickHouseParser::WHEN); + setState(1500); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::ELSE) { + setState(1498); + match(ClickHouseParser::ELSE); + setState(1499); + columnExpr(0); + } + setState(1502); + match(ClickHouseParser::END); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1504); + match(ClickHouseParser::CAST); + setState(1505); + match(ClickHouseParser::LPAREN); + setState(1506); + columnExpr(0); + setState(1507); + match(ClickHouseParser::AS); + setState(1508); + columnTypeExpr(); + setState(1509); + match(ClickHouseParser::RPAREN); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1511); + match(ClickHouseParser::DATE); + setState(1512); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 4: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1513); + match(ClickHouseParser::EXTRACT); + setState(1514); + match(ClickHouseParser::LPAREN); + setState(1515); + interval(); + setState(1516); + match(ClickHouseParser::FROM); + setState(1517); + columnExpr(0); + setState(1518); + match(ClickHouseParser::RPAREN); + break; + } + + case 5: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1520); + match(ClickHouseParser::INTERVAL); + setState(1521); + columnExpr(0); + setState(1522); + interval(); + break; + } + + case 6: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1524); + match(ClickHouseParser::SUBSTRING); + setState(1525); + match(ClickHouseParser::LPAREN); + setState(1526); + columnExpr(0); + setState(1527); + match(ClickHouseParser::FROM); + setState(1528); + columnExpr(0); + setState(1531); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::FOR) { + setState(1529); + match(ClickHouseParser::FOR); + setState(1530); + columnExpr(0); + } + setState(1533); + match(ClickHouseParser::RPAREN); + break; + } + + case 7: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1535); + match(ClickHouseParser::TIMESTAMP); + setState(1536); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case 8: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1537); + match(ClickHouseParser::TRIM); + setState(1538); + match(ClickHouseParser::LPAREN); + setState(1539); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::BOTH || _la == ClickHouseParser::LEADING || _la == ClickHouseParser::TRAILING)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1540); + match(ClickHouseParser::STRING_LITERAL); + setState(1541); + match(ClickHouseParser::FROM); + setState(1542); + columnExpr(0); + setState(1543); + match(ClickHouseParser::RPAREN); + break; + } + + case 9: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1545); + identifier(); + setState(1551); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 204, _ctx)) { + case 1: { + setState(1546); + match(ClickHouseParser::LPAREN); + setState(1548); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(1547); + columnExprList(); + } + setState(1550); + match(ClickHouseParser::RPAREN); + break; + } + + } + setState(1553); + match(ClickHouseParser::LPAREN); + setState(1555); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 205, _ctx)) { + case 1: { + setState(1554); + match(ClickHouseParser::DISTINCT); + break; + } + + } + setState(1558); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(1557); + columnArgList(); + } + setState(1560); + match(ClickHouseParser::RPAREN); + break; + } + + case 10: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1562); + literal(); + break; + } + + case 11: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1563); + match(ClickHouseParser::DASH); + setState(1564); + columnExpr(17); + break; + } + + case 12: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1565); + match(ClickHouseParser::NOT); + setState(1566); + columnExpr(12); + break; + } + + case 13: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1570); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)))) != 0)) { + setState(1567); + tableIdentifier(); + setState(1568); + match(ClickHouseParser::DOT); + } + setState(1572); + match(ClickHouseParser::ASTERISK); + break; + } + + case 14: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1573); + match(ClickHouseParser::LPAREN); + setState(1574); + selectUnionStmt(); + setState(1575); + match(ClickHouseParser::RPAREN); + break; + } + + case 15: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1577); + match(ClickHouseParser::LPAREN); + setState(1578); + columnExpr(0); + setState(1579); + match(ClickHouseParser::RPAREN); + break; + } + + case 16: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1581); + match(ClickHouseParser::LPAREN); + setState(1582); + columnExprList(); + setState(1583); + match(ClickHouseParser::RPAREN); + break; + } + + case 17: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1585); + match(ClickHouseParser::LBRACKET); + setState(1587); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::ASTERISK - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::LBRACKET - 194)) + | (1ULL << (ClickHouseParser::LPAREN - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(1586); + columnExprList(); + } + setState(1589); + match(ClickHouseParser::RBRACKET); + break; + } + + case 18: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1590); + columnIdentifier(); + break; + } + + } + _ctx->stop = _input->LT(-1); + setState(1664); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 218, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(1662); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 217, _ctx)) { + case 1: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1593); + + if (!(precpred(_ctx, 16))) throw FailedPredicateException(this, "precpred(_ctx, 16)"); + setState(1594); + _la = _input->LA(1); + if (!(((((_la - 188) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 188)) & ((1ULL << (ClickHouseParser::ASTERISK - 188)) + | (1ULL << (ClickHouseParser::PERCENT - 188)) + | (1ULL << (ClickHouseParser::SLASH - 188)))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1595); + columnExpr(17); + break; + } + + case 2: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1596); + + if (!(precpred(_ctx, 15))) throw FailedPredicateException(this, "precpred(_ctx, 15)"); + setState(1597); + _la = _input->LA(1); + if (!(((((_la - 193) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 193)) & ((1ULL << (ClickHouseParser::CONCAT - 193)) + | (1ULL << (ClickHouseParser::DASH - 193)) + | (1ULL << (ClickHouseParser::PLUS - 193)))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(1598); + columnExpr(16); + break; + } + + case 3: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1599); + + if (!(precpred(_ctx, 14))) throw FailedPredicateException(this, "precpred(_ctx, 14)"); + setState(1618); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 213, _ctx)) { + case 1: { + setState(1600); + match(ClickHouseParser::EQ_DOUBLE); + break; + } + + case 2: { + setState(1601); + match(ClickHouseParser::EQ_SINGLE); + break; + } + + case 3: { + setState(1602); + match(ClickHouseParser::NOT_EQ); + break; + } + + case 4: { + setState(1603); + match(ClickHouseParser::LE); + break; + } + + case 5: { + setState(1604); + match(ClickHouseParser::GE); + break; + } + + case 6: { + setState(1605); + match(ClickHouseParser::LT); + break; + } + + case 7: { + setState(1606); + match(ClickHouseParser::GT); + break; + } + + case 8: { + setState(1608); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::GLOBAL) { + setState(1607); + match(ClickHouseParser::GLOBAL); + } + setState(1611); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::NOT) { + setState(1610); + match(ClickHouseParser::NOT); + } + setState(1613); + match(ClickHouseParser::IN); + break; + } + + case 9: { + setState(1615); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::NOT) { + setState(1614); + match(ClickHouseParser::NOT); + } + setState(1617); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::ILIKE + + || _la == ClickHouseParser::LIKE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + setState(1620); + columnExpr(15); + break; + } + + case 4: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1621); + + if (!(precpred(_ctx, 11))) throw FailedPredicateException(this, "precpred(_ctx, 11)"); + setState(1622); + match(ClickHouseParser::AND); + setState(1623); + columnExpr(12); + break; + } + + case 5: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1624); + + if (!(precpred(_ctx, 10))) throw FailedPredicateException(this, "precpred(_ctx, 10)"); + setState(1625); + match(ClickHouseParser::OR); + setState(1626); + columnExpr(11); + break; + } + + case 6: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1627); + + if (!(precpred(_ctx, 9))) throw FailedPredicateException(this, "precpred(_ctx, 9)"); + setState(1629); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::NOT) { + setState(1628); + match(ClickHouseParser::NOT); + } + setState(1631); + match(ClickHouseParser::BETWEEN); + setState(1632); + columnExpr(0); + setState(1633); + match(ClickHouseParser::AND); + setState(1634); + columnExpr(10); + break; + } + + case 7: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1636); + + if (!(precpred(_ctx, 8))) throw FailedPredicateException(this, "precpred(_ctx, 8)"); + setState(1637); + match(ClickHouseParser::QUERY); + setState(1638); + columnExpr(0); + setState(1639); + match(ClickHouseParser::COLON); + setState(1640); + columnExpr(8); + break; + } + + case 8: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1642); + + if (!(precpred(_ctx, 19))) throw FailedPredicateException(this, "precpred(_ctx, 19)"); + setState(1643); + match(ClickHouseParser::LBRACKET); + setState(1644); + columnExpr(0); + setState(1645); + match(ClickHouseParser::RBRACKET); + break; + } + + case 9: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1647); + + if (!(precpred(_ctx, 18))) throw FailedPredicateException(this, "precpred(_ctx, 18)"); + setState(1648); + match(ClickHouseParser::DOT); + setState(1649); + match(ClickHouseParser::DECIMAL_LITERAL); + break; + } + + case 10: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1650); + + if (!(precpred(_ctx, 13))) throw FailedPredicateException(this, "precpred(_ctx, 13)"); + setState(1651); + match(ClickHouseParser::IS); + setState(1653); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::NOT) { + setState(1652); + match(ClickHouseParser::NOT); + } + setState(1655); + match(ClickHouseParser::NULL_SQL); + break; + } + + case 11: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(1656); + + if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(1660); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::DATE: + case ClickHouseParser::FIRST: + case ClickHouseParser::ID: + case ClickHouseParser::KEY: + case ClickHouseParser::IDENTIFIER: { + setState(1657); + alias(); + break; + } + + case ClickHouseParser::AS: { + setState(1658); + match(ClickHouseParser::AS); + setState(1659); + identifier(); + break; + } + + default: + throw NoViableAltException(this); + } + break; + } + + } + } + setState(1666); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 218, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- ColumnArgListContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnArgListContext::ColumnArgListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::ColumnArgListContext::columnArgExpr() { + return getRuleContexts(); +} + +ClickHouseParser::ColumnArgExprContext* ClickHouseParser::ColumnArgListContext::columnArgExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::ColumnArgListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnArgListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::ColumnArgListContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnArgList; +} + +antlrcpp::Any ClickHouseParser::ColumnArgListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnArgList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnArgListContext* ClickHouseParser::columnArgList() { + ColumnArgListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 170, ClickHouseParser::RuleColumnArgList); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1667); + columnArgExpr(); + setState(1672); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1668); + match(ClickHouseParser::COMMA); + setState(1669); + columnArgExpr(); + setState(1674); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnArgExprContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnArgExprContext::ColumnArgExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::ColumnLambdaExprContext* ClickHouseParser::ColumnArgExprContext::columnLambdaExpr() { + return getRuleContext(0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnArgExprContext::columnExpr() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::ColumnArgExprContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnArgExpr; +} + +antlrcpp::Any ClickHouseParser::ColumnArgExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnArgExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnArgExprContext* ClickHouseParser::columnArgExpr() { + ColumnArgExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 172, ClickHouseParser::RuleColumnArgExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1677); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 220, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1675); + columnLambdaExpr(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1676); + columnExpr(0); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnLambdaExprContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnLambdaExprContext::ColumnLambdaExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::ColumnLambdaExprContext::ARROW() { + return getToken(ClickHouseParser::ARROW, 0); +} + +ClickHouseParser::ColumnExprContext* ClickHouseParser::ColumnLambdaExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnLambdaExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +std::vector ClickHouseParser::ColumnLambdaExprContext::identifier() { + return getRuleContexts(); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::ColumnLambdaExprContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::ColumnLambdaExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +std::vector ClickHouseParser::ColumnLambdaExprContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::ColumnLambdaExprContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::ColumnLambdaExprContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnLambdaExpr; +} + +antlrcpp::Any ClickHouseParser::ColumnLambdaExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnLambdaExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnLambdaExprContext* ClickHouseParser::columnLambdaExpr() { + ColumnLambdaExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 174, ClickHouseParser::RuleColumnLambdaExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1698); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::LPAREN: { + setState(1679); + match(ClickHouseParser::LPAREN); + setState(1680); + identifier(); + setState(1685); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1681); + match(ClickHouseParser::COMMA); + setState(1682); + identifier(); + setState(1687); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(1688); + match(ClickHouseParser::RPAREN); + break; + } + + case ClickHouseParser::AFTER: + case ClickHouseParser::ALIAS: + case ClickHouseParser::ALL: + case ClickHouseParser::ALTER: + case ClickHouseParser::AND: + case ClickHouseParser::ANTI: + case ClickHouseParser::ANY: + case ClickHouseParser::ARRAY: + case ClickHouseParser::AS: + case ClickHouseParser::ASCENDING: + case ClickHouseParser::ASOF: + case ClickHouseParser::ASYNC: + case ClickHouseParser::ATTACH: + case ClickHouseParser::BETWEEN: + case ClickHouseParser::BOTH: + case ClickHouseParser::BY: + case ClickHouseParser::CASE: + case ClickHouseParser::CAST: + case ClickHouseParser::CHECK: + case ClickHouseParser::CLEAR: + case ClickHouseParser::CLUSTER: + case ClickHouseParser::CODEC: + case ClickHouseParser::COLLATE: + case ClickHouseParser::COLUMN: + case ClickHouseParser::COMMENT: + case ClickHouseParser::CONSTRAINT: + case ClickHouseParser::CREATE: + case ClickHouseParser::CROSS: + case ClickHouseParser::CUBE: + case ClickHouseParser::DATABASE: + case ClickHouseParser::DATABASES: + case ClickHouseParser::DATE: + case ClickHouseParser::DAY: + case ClickHouseParser::DEDUPLICATE: + case ClickHouseParser::DEFAULT: + case ClickHouseParser::DELAY: + case ClickHouseParser::DELETE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCENDING: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DICTIONARIES: + case ClickHouseParser::DICTIONARY: + case ClickHouseParser::DISK: + case ClickHouseParser::DISTINCT: + case ClickHouseParser::DISTRIBUTED: + case ClickHouseParser::DROP: + case ClickHouseParser::ELSE: + case ClickHouseParser::END: + case ClickHouseParser::ENGINE: + case ClickHouseParser::EVENTS: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::EXPRESSION: + case ClickHouseParser::EXTRACT: + case ClickHouseParser::FETCHES: + case ClickHouseParser::FINAL: + case ClickHouseParser::FIRST: + case ClickHouseParser::FLUSH: + case ClickHouseParser::FOR: + case ClickHouseParser::FORMAT: + case ClickHouseParser::FREEZE: + case ClickHouseParser::FROM: + case ClickHouseParser::FULL: + case ClickHouseParser::FUNCTION: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::GRANULARITY: + case ClickHouseParser::GROUP: + case ClickHouseParser::HAVING: + case ClickHouseParser::HIERARCHICAL: + case ClickHouseParser::HOUR: + case ClickHouseParser::ID: + case ClickHouseParser::IF: + case ClickHouseParser::ILIKE: + case ClickHouseParser::IN: + case ClickHouseParser::INDEX: + case ClickHouseParser::INJECTIVE: + case ClickHouseParser::INNER: + case ClickHouseParser::INSERT: + case ClickHouseParser::INTERVAL: + case ClickHouseParser::INTO: + case ClickHouseParser::IS: + case ClickHouseParser::IS_OBJECT_ID: + case ClickHouseParser::JOIN: + case ClickHouseParser::KEY: + case ClickHouseParser::KILL: + case ClickHouseParser::LAST: + case ClickHouseParser::LAYOUT: + case ClickHouseParser::LEADING: + case ClickHouseParser::LEFT: + case ClickHouseParser::LIFETIME: + case ClickHouseParser::LIKE: + case ClickHouseParser::LIMIT: + case ClickHouseParser::LIVE: + case ClickHouseParser::LOCAL: + case ClickHouseParser::LOGS: + case ClickHouseParser::MATERIALIZED: + case ClickHouseParser::MAX: + case ClickHouseParser::MERGES: + case ClickHouseParser::MIN: + case ClickHouseParser::MINUTE: + case ClickHouseParser::MODIFY: + case ClickHouseParser::MONTH: + case ClickHouseParser::MOVE: + case ClickHouseParser::MUTATION: + case ClickHouseParser::NO: + case ClickHouseParser::NOT: + case ClickHouseParser::NULLS: + case ClickHouseParser::OFFSET: + case ClickHouseParser::ON: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::OR: + case ClickHouseParser::ORDER: + case ClickHouseParser::OUTER: + case ClickHouseParser::OUTFILE: + case ClickHouseParser::PARTITION: + case ClickHouseParser::POPULATE: + case ClickHouseParser::PREWHERE: + case ClickHouseParser::PRIMARY: + case ClickHouseParser::QUARTER: + case ClickHouseParser::RANGE: + case ClickHouseParser::RELOAD: + case ClickHouseParser::REMOVE: + case ClickHouseParser::RENAME: + case ClickHouseParser::REPLACE: + case ClickHouseParser::REPLICA: + case ClickHouseParser::REPLICATED: + case ClickHouseParser::RIGHT: + case ClickHouseParser::ROLLUP: + case ClickHouseParser::SAMPLE: + case ClickHouseParser::SECOND: + case ClickHouseParser::SELECT: + case ClickHouseParser::SEMI: + case ClickHouseParser::SENDS: + case ClickHouseParser::SET: + case ClickHouseParser::SETTINGS: + case ClickHouseParser::SHOW: + case ClickHouseParser::SOURCE: + case ClickHouseParser::START: + case ClickHouseParser::STOP: + case ClickHouseParser::SUBSTRING: + case ClickHouseParser::SYNC: + case ClickHouseParser::SYNTAX: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TABLE: + case ClickHouseParser::TABLES: + case ClickHouseParser::TEMPORARY: + case ClickHouseParser::TEST: + case ClickHouseParser::THEN: + case ClickHouseParser::TIES: + case ClickHouseParser::TIMEOUT: + case ClickHouseParser::TIMESTAMP: + case ClickHouseParser::TO: + case ClickHouseParser::TOP: + case ClickHouseParser::TOTALS: + case ClickHouseParser::TRAILING: + case ClickHouseParser::TRIM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::TTL: + case ClickHouseParser::TYPE: + case ClickHouseParser::UNION: + case ClickHouseParser::UPDATE: + case ClickHouseParser::USE: + case ClickHouseParser::USING: + case ClickHouseParser::UUID: + case ClickHouseParser::VALUES: + case ClickHouseParser::VIEW: + case ClickHouseParser::VOLUME: + case ClickHouseParser::WATCH: + case ClickHouseParser::WEEK: + case ClickHouseParser::WHEN: + case ClickHouseParser::WHERE: + case ClickHouseParser::WITH: + case ClickHouseParser::YEAR: + case ClickHouseParser::JSON_FALSE: + case ClickHouseParser::JSON_TRUE: + case ClickHouseParser::IDENTIFIER: { + setState(1690); + identifier(); + setState(1695); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1691); + match(ClickHouseParser::COMMA); + setState(1692); + identifier(); + setState(1697); + _errHandler->sync(this); + _la = _input->LA(1); + } + break; + } + + default: + throw NoViableAltException(this); + } + setState(1700); + match(ClickHouseParser::ARROW); + setState(1701); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::ColumnIdentifierContext::ColumnIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::ColumnIdentifierContext::nestedIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::ColumnIdentifierContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::ColumnIdentifierContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + + +size_t ClickHouseParser::ColumnIdentifierContext::getRuleIndex() const { + return ClickHouseParser::RuleColumnIdentifier; +} + +antlrcpp::Any ClickHouseParser::ColumnIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnIdentifier(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::ColumnIdentifierContext* ClickHouseParser::columnIdentifier() { + ColumnIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 176, ClickHouseParser::RuleColumnIdentifier); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1706); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 224, _ctx)) { + case 1: { + setState(1703); + tableIdentifier(); + setState(1704); + match(ClickHouseParser::DOT); + break; + } + + } + setState(1708); + nestedIdentifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NestedIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::NestedIdentifierContext::NestedIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::NestedIdentifierContext::identifier() { + return getRuleContexts(); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::NestedIdentifierContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ClickHouseParser::NestedIdentifierContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + + +size_t ClickHouseParser::NestedIdentifierContext::getRuleIndex() const { + return ClickHouseParser::RuleNestedIdentifier; +} + +antlrcpp::Any ClickHouseParser::NestedIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNestedIdentifier(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::NestedIdentifierContext* ClickHouseParser::nestedIdentifier() { + NestedIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 178, ClickHouseParser::RuleNestedIdentifier); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1710); + identifier(); + setState(1713); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 225, _ctx)) { + case 1: { + setState(1711); + match(ClickHouseParser::DOT); + setState(1712); + identifier(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableExprContext ------------------------------------------------------------------ + +ClickHouseParser::TableExprContext::TableExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ClickHouseParser::TableExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTableExpr; +} + +void ClickHouseParser::TableExprContext::copyFrom(TableExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- TableExprIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::TableExprIdentifierContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::TableExprIdentifierContext::TableExprIdentifierContext(TableExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableExprIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprIdentifier(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprSubqueryContext ------------------------------------------------------------------ + +tree::TerminalNode* ClickHouseParser::TableExprSubqueryContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +ClickHouseParser::SelectUnionStmtContext* ClickHouseParser::TableExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableExprSubqueryContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::TableExprSubqueryContext::TableExprSubqueryContext(TableExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprSubquery(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprAliasContext ------------------------------------------------------------------ + +ClickHouseParser::TableExprContext* ClickHouseParser::TableExprAliasContext::tableExpr() { + return getRuleContext(0); +} + +ClickHouseParser::AliasContext* ClickHouseParser::TableExprAliasContext::alias() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableExprAliasContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::TableExprAliasContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::TableExprAliasContext::TableExprAliasContext(TableExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableExprAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprAlias(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprFunctionContext ------------------------------------------------------------------ + +ClickHouseParser::TableFunctionExprContext* ClickHouseParser::TableExprFunctionContext::tableFunctionExpr() { + return getRuleContext(0); +} + +ClickHouseParser::TableExprFunctionContext::TableExprFunctionContext(TableExprContext *ctx) { copyFrom(ctx); } + +antlrcpp::Any ClickHouseParser::TableExprFunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprFunction(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableExprContext* ClickHouseParser::tableExpr() { + return tableExpr(0); +} + +ClickHouseParser::TableExprContext* ClickHouseParser::tableExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + ClickHouseParser::TableExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + ClickHouseParser::TableExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 180; + enterRecursionRule(_localctx, 180, ClickHouseParser::RuleTableExpr, precedence); + + + + auto onExit = finally([=] { + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(1722); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 226, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(1716); + tableIdentifier(); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1717); + tableFunctionExpr(); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(1718); + match(ClickHouseParser::LPAREN); + setState(1719); + selectUnionStmt(); + setState(1720); + match(ClickHouseParser::RPAREN); + break; + } + + } + _ctx->stop = _input->LT(-1); + setState(1732); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 228, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleTableExpr); + setState(1724); + + if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(1728); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::DATE: + case ClickHouseParser::FIRST: + case ClickHouseParser::ID: + case ClickHouseParser::KEY: + case ClickHouseParser::IDENTIFIER: { + setState(1725); + alias(); + break; + } + + case ClickHouseParser::AS: { + setState(1726); + match(ClickHouseParser::AS); + setState(1727); + identifier(); + break; + } + + default: + throw NoViableAltException(this); + } + } + setState(1734); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 228, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- TableFunctionExprContext ------------------------------------------------------------------ + +ClickHouseParser::TableFunctionExprContext::TableFunctionExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::TableFunctionExprContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableFunctionExprContext::LPAREN() { + return getToken(ClickHouseParser::LPAREN, 0); +} + +tree::TerminalNode* ClickHouseParser::TableFunctionExprContext::RPAREN() { + return getToken(ClickHouseParser::RPAREN, 0); +} + +ClickHouseParser::TableArgListContext* ClickHouseParser::TableFunctionExprContext::tableArgList() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::TableFunctionExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTableFunctionExpr; +} + +antlrcpp::Any ClickHouseParser::TableFunctionExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableFunctionExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableFunctionExprContext* ClickHouseParser::tableFunctionExpr() { + TableFunctionExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 182, ClickHouseParser::RuleTableFunctionExpr); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1735); + identifier(); + setState(1736); + match(ClickHouseParser::LPAREN); + setState(1738); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DAY) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::HOUR - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INF - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MINUTE - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MONTH - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NAN_SQL - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULL_SQL - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::QUARTER - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SECOND - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WEEK - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::YEAR - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)) + | (1ULL << (ClickHouseParser::IDENTIFIER - 128)) + | (1ULL << (ClickHouseParser::FLOATING_LITERAL - 128)) + | (1ULL << (ClickHouseParser::OCTAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::DECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::HEXADECIMAL_LITERAL - 128)) + | (1ULL << (ClickHouseParser::STRING_LITERAL - 128)))) != 0) || ((((_la - 194) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 194)) & ((1ULL << (ClickHouseParser::DASH - 194)) + | (1ULL << (ClickHouseParser::DOT - 194)) + | (1ULL << (ClickHouseParser::PLUS - 194)))) != 0)) { + setState(1737); + tableArgList(); + } + setState(1740); + match(ClickHouseParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::TableIdentifierContext::TableIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::TableIdentifierContext::identifier() { + return getRuleContext(0); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::TableIdentifierContext::databaseIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::TableIdentifierContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + + +size_t ClickHouseParser::TableIdentifierContext::getRuleIndex() const { + return ClickHouseParser::RuleTableIdentifier; +} + +antlrcpp::Any ClickHouseParser::TableIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableIdentifier(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::tableIdentifier() { + TableIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 184, ClickHouseParser::RuleTableIdentifier); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1745); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 230, _ctx)) { + case 1: { + setState(1742); + databaseIdentifier(); + setState(1743); + match(ClickHouseParser::DOT); + break; + } + + } + setState(1747); + identifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableArgListContext ------------------------------------------------------------------ + +ClickHouseParser::TableArgListContext::TableArgListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector ClickHouseParser::TableArgListContext::tableArgExpr() { + return getRuleContexts(); +} + +ClickHouseParser::TableArgExprContext* ClickHouseParser::TableArgListContext::tableArgExpr(size_t i) { + return getRuleContext(i); +} + +std::vector ClickHouseParser::TableArgListContext::COMMA() { + return getTokens(ClickHouseParser::COMMA); +} + +tree::TerminalNode* ClickHouseParser::TableArgListContext::COMMA(size_t i) { + return getToken(ClickHouseParser::COMMA, i); +} + + +size_t ClickHouseParser::TableArgListContext::getRuleIndex() const { + return ClickHouseParser::RuleTableArgList; +} + +antlrcpp::Any ClickHouseParser::TableArgListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableArgList(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableArgListContext* ClickHouseParser::tableArgList() { + TableArgListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 186, ClickHouseParser::RuleTableArgList); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1749); + tableArgExpr(); + setState(1754); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ClickHouseParser::COMMA) { + setState(1750); + match(ClickHouseParser::COMMA); + setState(1751); + tableArgExpr(); + setState(1756); + _errHandler->sync(this); + _la = _input->LA(1); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableArgExprContext ------------------------------------------------------------------ + +ClickHouseParser::TableArgExprContext::TableArgExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::TableIdentifierContext* ClickHouseParser::TableArgExprContext::tableIdentifier() { + return getRuleContext(0); +} + +ClickHouseParser::TableFunctionExprContext* ClickHouseParser::TableArgExprContext::tableFunctionExpr() { + return getRuleContext(0); +} + +ClickHouseParser::LiteralContext* ClickHouseParser::TableArgExprContext::literal() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::TableArgExprContext::getRuleIndex() const { + return ClickHouseParser::RuleTableArgExpr; +} + +antlrcpp::Any ClickHouseParser::TableArgExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableArgExpr(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::TableArgExprContext* ClickHouseParser::tableArgExpr() { + TableArgExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 188, ClickHouseParser::RuleTableArgExpr); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1760); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 232, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(1757); + tableIdentifier(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(1758); + tableFunctionExpr(); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(1759); + literal(); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- DatabaseIdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::DatabaseIdentifierContext::DatabaseIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::DatabaseIdentifierContext::identifier() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::DatabaseIdentifierContext::getRuleIndex() const { + return ClickHouseParser::RuleDatabaseIdentifier; +} + +antlrcpp::Any ClickHouseParser::DatabaseIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDatabaseIdentifier(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::databaseIdentifier() { + DatabaseIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 190, ClickHouseParser::RuleDatabaseIdentifier); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1762); + identifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FloatingLiteralContext ------------------------------------------------------------------ + +ClickHouseParser::FloatingLiteralContext::FloatingLiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::FloatingLiteralContext::FLOATING_LITERAL() { + return getToken(ClickHouseParser::FLOATING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::FloatingLiteralContext::DOT() { + return getToken(ClickHouseParser::DOT, 0); +} + +std::vector ClickHouseParser::FloatingLiteralContext::DECIMAL_LITERAL() { + return getTokens(ClickHouseParser::DECIMAL_LITERAL); +} + +tree::TerminalNode* ClickHouseParser::FloatingLiteralContext::DECIMAL_LITERAL(size_t i) { + return getToken(ClickHouseParser::DECIMAL_LITERAL, i); +} + +tree::TerminalNode* ClickHouseParser::FloatingLiteralContext::OCTAL_LITERAL() { + return getToken(ClickHouseParser::OCTAL_LITERAL, 0); +} + + +size_t ClickHouseParser::FloatingLiteralContext::getRuleIndex() const { + return ClickHouseParser::RuleFloatingLiteral; +} + +antlrcpp::Any ClickHouseParser::FloatingLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFloatingLiteral(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::FloatingLiteralContext* ClickHouseParser::floatingLiteral() { + FloatingLiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 192, ClickHouseParser::RuleFloatingLiteral); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1772); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::FLOATING_LITERAL: { + enterOuterAlt(_localctx, 1); + setState(1764); + match(ClickHouseParser::FLOATING_LITERAL); + break; + } + + case ClickHouseParser::DOT: { + enterOuterAlt(_localctx, 2); + setState(1765); + match(ClickHouseParser::DOT); + setState(1766); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::OCTAL_LITERAL + + || _la == ClickHouseParser::DECIMAL_LITERAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + case ClickHouseParser::DECIMAL_LITERAL: { + enterOuterAlt(_localctx, 3); + setState(1767); + match(ClickHouseParser::DECIMAL_LITERAL); + setState(1768); + match(ClickHouseParser::DOT); + setState(1770); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 233, _ctx)) { + case 1: { + setState(1769); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::OCTAL_LITERAL + + || _la == ClickHouseParser::DECIMAL_LITERAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + } + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NumberLiteralContext ------------------------------------------------------------------ + +ClickHouseParser::NumberLiteralContext::NumberLiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::FloatingLiteralContext* ClickHouseParser::NumberLiteralContext::floatingLiteral() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::OCTAL_LITERAL() { + return getToken(ClickHouseParser::OCTAL_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::DECIMAL_LITERAL() { + return getToken(ClickHouseParser::DECIMAL_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::HEXADECIMAL_LITERAL() { + return getToken(ClickHouseParser::HEXADECIMAL_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::INF() { + return getToken(ClickHouseParser::INF, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::NAN_SQL() { + return getToken(ClickHouseParser::NAN_SQL, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::PLUS() { + return getToken(ClickHouseParser::PLUS, 0); +} + +tree::TerminalNode* ClickHouseParser::NumberLiteralContext::DASH() { + return getToken(ClickHouseParser::DASH, 0); +} + + +size_t ClickHouseParser::NumberLiteralContext::getRuleIndex() const { + return ClickHouseParser::RuleNumberLiteral; +} + +antlrcpp::Any ClickHouseParser::NumberLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNumberLiteral(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::NumberLiteralContext* ClickHouseParser::numberLiteral() { + NumberLiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 194, ClickHouseParser::RuleNumberLiteral); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1775); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ClickHouseParser::DASH + + || _la == ClickHouseParser::PLUS) { + setState(1774); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::DASH + + || _la == ClickHouseParser::PLUS)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(1783); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 236, _ctx)) { + case 1: { + setState(1777); + floatingLiteral(); + break; + } + + case 2: { + setState(1778); + match(ClickHouseParser::OCTAL_LITERAL); + break; + } + + case 3: { + setState(1779); + match(ClickHouseParser::DECIMAL_LITERAL); + break; + } + + case 4: { + setState(1780); + match(ClickHouseParser::HEXADECIMAL_LITERAL); + break; + } + + case 5: { + setState(1781); + match(ClickHouseParser::INF); + break; + } + + case 6: { + setState(1782); + match(ClickHouseParser::NAN_SQL); + break; + } + + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LiteralContext ------------------------------------------------------------------ + +ClickHouseParser::LiteralContext::LiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::NumberLiteralContext* ClickHouseParser::LiteralContext::numberLiteral() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::LiteralContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::LiteralContext::NULL_SQL() { + return getToken(ClickHouseParser::NULL_SQL, 0); +} + + +size_t ClickHouseParser::LiteralContext::getRuleIndex() const { + return ClickHouseParser::RuleLiteral; +} + +antlrcpp::Any ClickHouseParser::LiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLiteral(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::LiteralContext* ClickHouseParser::literal() { + LiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 196, ClickHouseParser::RuleLiteral); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1788); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::INF: + case ClickHouseParser::NAN_SQL: + case ClickHouseParser::FLOATING_LITERAL: + case ClickHouseParser::OCTAL_LITERAL: + case ClickHouseParser::DECIMAL_LITERAL: + case ClickHouseParser::HEXADECIMAL_LITERAL: + case ClickHouseParser::DASH: + case ClickHouseParser::DOT: + case ClickHouseParser::PLUS: { + enterOuterAlt(_localctx, 1); + setState(1785); + numberLiteral(); + break; + } + + case ClickHouseParser::STRING_LITERAL: { + enterOuterAlt(_localctx, 2); + setState(1786); + match(ClickHouseParser::STRING_LITERAL); + break; + } + + case ClickHouseParser::NULL_SQL: { + enterOuterAlt(_localctx, 3); + setState(1787); + match(ClickHouseParser::NULL_SQL); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- IntervalContext ------------------------------------------------------------------ + +ClickHouseParser::IntervalContext::IntervalContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::SECOND() { + return getToken(ClickHouseParser::SECOND, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::MINUTE() { + return getToken(ClickHouseParser::MINUTE, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::HOUR() { + return getToken(ClickHouseParser::HOUR, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::DAY() { + return getToken(ClickHouseParser::DAY, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::WEEK() { + return getToken(ClickHouseParser::WEEK, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::MONTH() { + return getToken(ClickHouseParser::MONTH, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::QUARTER() { + return getToken(ClickHouseParser::QUARTER, 0); +} + +tree::TerminalNode* ClickHouseParser::IntervalContext::YEAR() { + return getToken(ClickHouseParser::YEAR, 0); +} + + +size_t ClickHouseParser::IntervalContext::getRuleIndex() const { + return ClickHouseParser::RuleInterval; +} + +antlrcpp::Any ClickHouseParser::IntervalContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitInterval(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::IntervalContext* ClickHouseParser::interval() { + IntervalContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 198, ClickHouseParser::RuleInterval); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1790); + _la = _input->LA(1); + if (!(_la == ClickHouseParser::DAY || ((((_la - 72) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 72)) & ((1ULL << (ClickHouseParser::HOUR - 72)) + | (1ULL << (ClickHouseParser::MINUTE - 72)) + | (1ULL << (ClickHouseParser::MONTH - 72)) + | (1ULL << (ClickHouseParser::QUARTER - 72)) + | (1ULL << (ClickHouseParser::SECOND - 72)))) != 0) || _la == ClickHouseParser::WEEK + + || _la == ClickHouseParser::YEAR)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- KeywordContext ------------------------------------------------------------------ + +ClickHouseParser::KeywordContext::KeywordContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::AFTER() { + return getToken(ClickHouseParser::AFTER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ALIAS() { + return getToken(ClickHouseParser::ALIAS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ALL() { + return getToken(ClickHouseParser::ALL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ALTER() { + return getToken(ClickHouseParser::ALTER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::AND() { + return getToken(ClickHouseParser::AND, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ANTI() { + return getToken(ClickHouseParser::ANTI, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ANY() { + return getToken(ClickHouseParser::ANY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ARRAY() { + return getToken(ClickHouseParser::ARRAY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::AS() { + return getToken(ClickHouseParser::AS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ASCENDING() { + return getToken(ClickHouseParser::ASCENDING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ASOF() { + return getToken(ClickHouseParser::ASOF, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ASYNC() { + return getToken(ClickHouseParser::ASYNC, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ATTACH() { + return getToken(ClickHouseParser::ATTACH, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::BETWEEN() { + return getToken(ClickHouseParser::BETWEEN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::BOTH() { + return getToken(ClickHouseParser::BOTH, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::BY() { + return getToken(ClickHouseParser::BY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CASE() { + return getToken(ClickHouseParser::CASE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CAST() { + return getToken(ClickHouseParser::CAST, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CHECK() { + return getToken(ClickHouseParser::CHECK, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CLEAR() { + return getToken(ClickHouseParser::CLEAR, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CLUSTER() { + return getToken(ClickHouseParser::CLUSTER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CODEC() { + return getToken(ClickHouseParser::CODEC, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::COLLATE() { + return getToken(ClickHouseParser::COLLATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::COLUMN() { + return getToken(ClickHouseParser::COLUMN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::COMMENT() { + return getToken(ClickHouseParser::COMMENT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CONSTRAINT() { + return getToken(ClickHouseParser::CONSTRAINT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CREATE() { + return getToken(ClickHouseParser::CREATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CROSS() { + return getToken(ClickHouseParser::CROSS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::CUBE() { + return getToken(ClickHouseParser::CUBE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DATABASE() { + return getToken(ClickHouseParser::DATABASE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DATABASES() { + return getToken(ClickHouseParser::DATABASES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DATE() { + return getToken(ClickHouseParser::DATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DEDUPLICATE() { + return getToken(ClickHouseParser::DEDUPLICATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DEFAULT() { + return getToken(ClickHouseParser::DEFAULT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DELAY() { + return getToken(ClickHouseParser::DELAY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DELETE() { + return getToken(ClickHouseParser::DELETE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DESCRIBE() { + return getToken(ClickHouseParser::DESCRIBE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DESC() { + return getToken(ClickHouseParser::DESC, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DESCENDING() { + return getToken(ClickHouseParser::DESCENDING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DETACH() { + return getToken(ClickHouseParser::DETACH, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DICTIONARIES() { + return getToken(ClickHouseParser::DICTIONARIES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DICTIONARY() { + return getToken(ClickHouseParser::DICTIONARY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DISK() { + return getToken(ClickHouseParser::DISK, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DISTINCT() { + return getToken(ClickHouseParser::DISTINCT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DISTRIBUTED() { + return getToken(ClickHouseParser::DISTRIBUTED, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::DROP() { + return getToken(ClickHouseParser::DROP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ELSE() { + return getToken(ClickHouseParser::ELSE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::END() { + return getToken(ClickHouseParser::END, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ENGINE() { + return getToken(ClickHouseParser::ENGINE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::EVENTS() { + return getToken(ClickHouseParser::EVENTS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::EXISTS() { + return getToken(ClickHouseParser::EXISTS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::EXPLAIN() { + return getToken(ClickHouseParser::EXPLAIN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::EXPRESSION() { + return getToken(ClickHouseParser::EXPRESSION, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::EXTRACT() { + return getToken(ClickHouseParser::EXTRACT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FETCHES() { + return getToken(ClickHouseParser::FETCHES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FINAL() { + return getToken(ClickHouseParser::FINAL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FIRST() { + return getToken(ClickHouseParser::FIRST, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FLUSH() { + return getToken(ClickHouseParser::FLUSH, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FOR() { + return getToken(ClickHouseParser::FOR, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FORMAT() { + return getToken(ClickHouseParser::FORMAT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FREEZE() { + return getToken(ClickHouseParser::FREEZE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FROM() { + return getToken(ClickHouseParser::FROM, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FULL() { + return getToken(ClickHouseParser::FULL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::FUNCTION() { + return getToken(ClickHouseParser::FUNCTION, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::GLOBAL() { + return getToken(ClickHouseParser::GLOBAL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::GRANULARITY() { + return getToken(ClickHouseParser::GRANULARITY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::GROUP() { + return getToken(ClickHouseParser::GROUP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::HAVING() { + return getToken(ClickHouseParser::HAVING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::HIERARCHICAL() { + return getToken(ClickHouseParser::HIERARCHICAL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ID() { + return getToken(ClickHouseParser::ID, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::IF() { + return getToken(ClickHouseParser::IF, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ILIKE() { + return getToken(ClickHouseParser::ILIKE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::IN() { + return getToken(ClickHouseParser::IN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INDEX() { + return getToken(ClickHouseParser::INDEX, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INJECTIVE() { + return getToken(ClickHouseParser::INJECTIVE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INNER() { + return getToken(ClickHouseParser::INNER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INSERT() { + return getToken(ClickHouseParser::INSERT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INTERVAL() { + return getToken(ClickHouseParser::INTERVAL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::INTO() { + return getToken(ClickHouseParser::INTO, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::IS() { + return getToken(ClickHouseParser::IS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::IS_OBJECT_ID() { + return getToken(ClickHouseParser::IS_OBJECT_ID, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::JOIN() { + return getToken(ClickHouseParser::JOIN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::JSON_FALSE() { + return getToken(ClickHouseParser::JSON_FALSE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::JSON_TRUE() { + return getToken(ClickHouseParser::JSON_TRUE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::KEY() { + return getToken(ClickHouseParser::KEY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::KILL() { + return getToken(ClickHouseParser::KILL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LAST() { + return getToken(ClickHouseParser::LAST, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LAYOUT() { + return getToken(ClickHouseParser::LAYOUT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LEADING() { + return getToken(ClickHouseParser::LEADING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LEFT() { + return getToken(ClickHouseParser::LEFT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LIFETIME() { + return getToken(ClickHouseParser::LIFETIME, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LIKE() { + return getToken(ClickHouseParser::LIKE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LIMIT() { + return getToken(ClickHouseParser::LIMIT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LIVE() { + return getToken(ClickHouseParser::LIVE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LOCAL() { + return getToken(ClickHouseParser::LOCAL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::LOGS() { + return getToken(ClickHouseParser::LOGS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MATERIALIZED() { + return getToken(ClickHouseParser::MATERIALIZED, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MAX() { + return getToken(ClickHouseParser::MAX, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MERGES() { + return getToken(ClickHouseParser::MERGES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MIN() { + return getToken(ClickHouseParser::MIN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MODIFY() { + return getToken(ClickHouseParser::MODIFY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MOVE() { + return getToken(ClickHouseParser::MOVE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::MUTATION() { + return getToken(ClickHouseParser::MUTATION, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::NO() { + return getToken(ClickHouseParser::NO, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::NOT() { + return getToken(ClickHouseParser::NOT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::NULLS() { + return getToken(ClickHouseParser::NULLS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::OFFSET() { + return getToken(ClickHouseParser::OFFSET, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ON() { + return getToken(ClickHouseParser::ON, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::OPTIMIZE() { + return getToken(ClickHouseParser::OPTIMIZE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::OR() { + return getToken(ClickHouseParser::OR, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ORDER() { + return getToken(ClickHouseParser::ORDER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::OUTER() { + return getToken(ClickHouseParser::OUTER, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::OUTFILE() { + return getToken(ClickHouseParser::OUTFILE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::PARTITION() { + return getToken(ClickHouseParser::PARTITION, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::POPULATE() { + return getToken(ClickHouseParser::POPULATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::PREWHERE() { + return getToken(ClickHouseParser::PREWHERE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::PRIMARY() { + return getToken(ClickHouseParser::PRIMARY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::RANGE() { + return getToken(ClickHouseParser::RANGE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::RELOAD() { + return getToken(ClickHouseParser::RELOAD, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::REMOVE() { + return getToken(ClickHouseParser::REMOVE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::RENAME() { + return getToken(ClickHouseParser::RENAME, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::REPLACE() { + return getToken(ClickHouseParser::REPLACE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::REPLICA() { + return getToken(ClickHouseParser::REPLICA, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::REPLICATED() { + return getToken(ClickHouseParser::REPLICATED, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::RIGHT() { + return getToken(ClickHouseParser::RIGHT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::ROLLUP() { + return getToken(ClickHouseParser::ROLLUP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SAMPLE() { + return getToken(ClickHouseParser::SAMPLE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SELECT() { + return getToken(ClickHouseParser::SELECT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SEMI() { + return getToken(ClickHouseParser::SEMI, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SENDS() { + return getToken(ClickHouseParser::SENDS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SET() { + return getToken(ClickHouseParser::SET, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SETTINGS() { + return getToken(ClickHouseParser::SETTINGS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SHOW() { + return getToken(ClickHouseParser::SHOW, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SOURCE() { + return getToken(ClickHouseParser::SOURCE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::START() { + return getToken(ClickHouseParser::START, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::STOP() { + return getToken(ClickHouseParser::STOP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SUBSTRING() { + return getToken(ClickHouseParser::SUBSTRING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SYNC() { + return getToken(ClickHouseParser::SYNC, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SYNTAX() { + return getToken(ClickHouseParser::SYNTAX, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::SYSTEM() { + return getToken(ClickHouseParser::SYSTEM, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TABLE() { + return getToken(ClickHouseParser::TABLE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TABLES() { + return getToken(ClickHouseParser::TABLES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TEMPORARY() { + return getToken(ClickHouseParser::TEMPORARY, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TEST() { + return getToken(ClickHouseParser::TEST, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::THEN() { + return getToken(ClickHouseParser::THEN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TIES() { + return getToken(ClickHouseParser::TIES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TIMEOUT() { + return getToken(ClickHouseParser::TIMEOUT, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TIMESTAMP() { + return getToken(ClickHouseParser::TIMESTAMP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TOTALS() { + return getToken(ClickHouseParser::TOTALS, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TRAILING() { + return getToken(ClickHouseParser::TRAILING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TRIM() { + return getToken(ClickHouseParser::TRIM, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TRUNCATE() { + return getToken(ClickHouseParser::TRUNCATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TO() { + return getToken(ClickHouseParser::TO, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TOP() { + return getToken(ClickHouseParser::TOP, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TTL() { + return getToken(ClickHouseParser::TTL, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::TYPE() { + return getToken(ClickHouseParser::TYPE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::UNION() { + return getToken(ClickHouseParser::UNION, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::UPDATE() { + return getToken(ClickHouseParser::UPDATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::USE() { + return getToken(ClickHouseParser::USE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::USING() { + return getToken(ClickHouseParser::USING, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::UUID() { + return getToken(ClickHouseParser::UUID, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::VALUES() { + return getToken(ClickHouseParser::VALUES, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::VIEW() { + return getToken(ClickHouseParser::VIEW, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::VOLUME() { + return getToken(ClickHouseParser::VOLUME, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::WATCH() { + return getToken(ClickHouseParser::WATCH, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::WHEN() { + return getToken(ClickHouseParser::WHEN, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::WHERE() { + return getToken(ClickHouseParser::WHERE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordContext::WITH() { + return getToken(ClickHouseParser::WITH, 0); +} + + +size_t ClickHouseParser::KeywordContext::getRuleIndex() const { + return ClickHouseParser::RuleKeyword; +} + +antlrcpp::Any ClickHouseParser::KeywordContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitKeyword(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::KeywordContext* ClickHouseParser::keyword() { + KeywordContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 200, ClickHouseParser::RuleKeyword); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1792); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & ((1ULL << ClickHouseParser::AFTER) + | (1ULL << ClickHouseParser::ALIAS) + | (1ULL << ClickHouseParser::ALL) + | (1ULL << ClickHouseParser::ALTER) + | (1ULL << ClickHouseParser::AND) + | (1ULL << ClickHouseParser::ANTI) + | (1ULL << ClickHouseParser::ANY) + | (1ULL << ClickHouseParser::ARRAY) + | (1ULL << ClickHouseParser::AS) + | (1ULL << ClickHouseParser::ASCENDING) + | (1ULL << ClickHouseParser::ASOF) + | (1ULL << ClickHouseParser::ASYNC) + | (1ULL << ClickHouseParser::ATTACH) + | (1ULL << ClickHouseParser::BETWEEN) + | (1ULL << ClickHouseParser::BOTH) + | (1ULL << ClickHouseParser::BY) + | (1ULL << ClickHouseParser::CASE) + | (1ULL << ClickHouseParser::CAST) + | (1ULL << ClickHouseParser::CHECK) + | (1ULL << ClickHouseParser::CLEAR) + | (1ULL << ClickHouseParser::CLUSTER) + | (1ULL << ClickHouseParser::CODEC) + | (1ULL << ClickHouseParser::COLLATE) + | (1ULL << ClickHouseParser::COLUMN) + | (1ULL << ClickHouseParser::COMMENT) + | (1ULL << ClickHouseParser::CONSTRAINT) + | (1ULL << ClickHouseParser::CREATE) + | (1ULL << ClickHouseParser::CROSS) + | (1ULL << ClickHouseParser::CUBE) + | (1ULL << ClickHouseParser::DATABASE) + | (1ULL << ClickHouseParser::DATABASES) + | (1ULL << ClickHouseParser::DATE) + | (1ULL << ClickHouseParser::DEDUPLICATE) + | (1ULL << ClickHouseParser::DEFAULT) + | (1ULL << ClickHouseParser::DELAY) + | (1ULL << ClickHouseParser::DELETE) + | (1ULL << ClickHouseParser::DESC) + | (1ULL << ClickHouseParser::DESCENDING) + | (1ULL << ClickHouseParser::DESCRIBE) + | (1ULL << ClickHouseParser::DETACH) + | (1ULL << ClickHouseParser::DICTIONARIES) + | (1ULL << ClickHouseParser::DICTIONARY) + | (1ULL << ClickHouseParser::DISK) + | (1ULL << ClickHouseParser::DISTINCT) + | (1ULL << ClickHouseParser::DISTRIBUTED) + | (1ULL << ClickHouseParser::DROP) + | (1ULL << ClickHouseParser::ELSE) + | (1ULL << ClickHouseParser::END) + | (1ULL << ClickHouseParser::ENGINE) + | (1ULL << ClickHouseParser::EVENTS) + | (1ULL << ClickHouseParser::EXISTS) + | (1ULL << ClickHouseParser::EXPLAIN) + | (1ULL << ClickHouseParser::EXPRESSION) + | (1ULL << ClickHouseParser::EXTRACT) + | (1ULL << ClickHouseParser::FETCHES) + | (1ULL << ClickHouseParser::FINAL) + | (1ULL << ClickHouseParser::FIRST) + | (1ULL << ClickHouseParser::FLUSH) + | (1ULL << ClickHouseParser::FOR) + | (1ULL << ClickHouseParser::FORMAT) + | (1ULL << ClickHouseParser::FREEZE))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FROM - 64)) + | (1ULL << (ClickHouseParser::FULL - 64)) + | (1ULL << (ClickHouseParser::FUNCTION - 64)) + | (1ULL << (ClickHouseParser::GLOBAL - 64)) + | (1ULL << (ClickHouseParser::GRANULARITY - 64)) + | (1ULL << (ClickHouseParser::GROUP - 64)) + | (1ULL << (ClickHouseParser::HAVING - 64)) + | (1ULL << (ClickHouseParser::HIERARCHICAL - 64)) + | (1ULL << (ClickHouseParser::ID - 64)) + | (1ULL << (ClickHouseParser::IF - 64)) + | (1ULL << (ClickHouseParser::ILIKE - 64)) + | (1ULL << (ClickHouseParser::IN - 64)) + | (1ULL << (ClickHouseParser::INDEX - 64)) + | (1ULL << (ClickHouseParser::INJECTIVE - 64)) + | (1ULL << (ClickHouseParser::INNER - 64)) + | (1ULL << (ClickHouseParser::INSERT - 64)) + | (1ULL << (ClickHouseParser::INTERVAL - 64)) + | (1ULL << (ClickHouseParser::INTO - 64)) + | (1ULL << (ClickHouseParser::IS - 64)) + | (1ULL << (ClickHouseParser::IS_OBJECT_ID - 64)) + | (1ULL << (ClickHouseParser::JOIN - 64)) + | (1ULL << (ClickHouseParser::KEY - 64)) + | (1ULL << (ClickHouseParser::KILL - 64)) + | (1ULL << (ClickHouseParser::LAST - 64)) + | (1ULL << (ClickHouseParser::LAYOUT - 64)) + | (1ULL << (ClickHouseParser::LEADING - 64)) + | (1ULL << (ClickHouseParser::LEFT - 64)) + | (1ULL << (ClickHouseParser::LIFETIME - 64)) + | (1ULL << (ClickHouseParser::LIKE - 64)) + | (1ULL << (ClickHouseParser::LIMIT - 64)) + | (1ULL << (ClickHouseParser::LIVE - 64)) + | (1ULL << (ClickHouseParser::LOCAL - 64)) + | (1ULL << (ClickHouseParser::LOGS - 64)) + | (1ULL << (ClickHouseParser::MATERIALIZED - 64)) + | (1ULL << (ClickHouseParser::MAX - 64)) + | (1ULL << (ClickHouseParser::MERGES - 64)) + | (1ULL << (ClickHouseParser::MIN - 64)) + | (1ULL << (ClickHouseParser::MODIFY - 64)) + | (1ULL << (ClickHouseParser::MOVE - 64)) + | (1ULL << (ClickHouseParser::MUTATION - 64)) + | (1ULL << (ClickHouseParser::NO - 64)) + | (1ULL << (ClickHouseParser::NOT - 64)) + | (1ULL << (ClickHouseParser::NULLS - 64)) + | (1ULL << (ClickHouseParser::OFFSET - 64)) + | (1ULL << (ClickHouseParser::ON - 64)) + | (1ULL << (ClickHouseParser::OPTIMIZE - 64)) + | (1ULL << (ClickHouseParser::OR - 64)) + | (1ULL << (ClickHouseParser::ORDER - 64)) + | (1ULL << (ClickHouseParser::OUTER - 64)) + | (1ULL << (ClickHouseParser::OUTFILE - 64)) + | (1ULL << (ClickHouseParser::PARTITION - 64)) + | (1ULL << (ClickHouseParser::POPULATE - 64)) + | (1ULL << (ClickHouseParser::PREWHERE - 64)) + | (1ULL << (ClickHouseParser::PRIMARY - 64)) + | (1ULL << (ClickHouseParser::RANGE - 64)) + | (1ULL << (ClickHouseParser::RELOAD - 64)) + | (1ULL << (ClickHouseParser::REMOVE - 64)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RENAME - 128)) + | (1ULL << (ClickHouseParser::REPLACE - 128)) + | (1ULL << (ClickHouseParser::REPLICA - 128)) + | (1ULL << (ClickHouseParser::REPLICATED - 128)) + | (1ULL << (ClickHouseParser::RIGHT - 128)) + | (1ULL << (ClickHouseParser::ROLLUP - 128)) + | (1ULL << (ClickHouseParser::SAMPLE - 128)) + | (1ULL << (ClickHouseParser::SELECT - 128)) + | (1ULL << (ClickHouseParser::SEMI - 128)) + | (1ULL << (ClickHouseParser::SENDS - 128)) + | (1ULL << (ClickHouseParser::SET - 128)) + | (1ULL << (ClickHouseParser::SETTINGS - 128)) + | (1ULL << (ClickHouseParser::SHOW - 128)) + | (1ULL << (ClickHouseParser::SOURCE - 128)) + | (1ULL << (ClickHouseParser::START - 128)) + | (1ULL << (ClickHouseParser::STOP - 128)) + | (1ULL << (ClickHouseParser::SUBSTRING - 128)) + | (1ULL << (ClickHouseParser::SYNC - 128)) + | (1ULL << (ClickHouseParser::SYNTAX - 128)) + | (1ULL << (ClickHouseParser::SYSTEM - 128)) + | (1ULL << (ClickHouseParser::TABLE - 128)) + | (1ULL << (ClickHouseParser::TABLES - 128)) + | (1ULL << (ClickHouseParser::TEMPORARY - 128)) + | (1ULL << (ClickHouseParser::TEST - 128)) + | (1ULL << (ClickHouseParser::THEN - 128)) + | (1ULL << (ClickHouseParser::TIES - 128)) + | (1ULL << (ClickHouseParser::TIMEOUT - 128)) + | (1ULL << (ClickHouseParser::TIMESTAMP - 128)) + | (1ULL << (ClickHouseParser::TO - 128)) + | (1ULL << (ClickHouseParser::TOP - 128)) + | (1ULL << (ClickHouseParser::TOTALS - 128)) + | (1ULL << (ClickHouseParser::TRAILING - 128)) + | (1ULL << (ClickHouseParser::TRIM - 128)) + | (1ULL << (ClickHouseParser::TRUNCATE - 128)) + | (1ULL << (ClickHouseParser::TTL - 128)) + | (1ULL << (ClickHouseParser::TYPE - 128)) + | (1ULL << (ClickHouseParser::UNION - 128)) + | (1ULL << (ClickHouseParser::UPDATE - 128)) + | (1ULL << (ClickHouseParser::USE - 128)) + | (1ULL << (ClickHouseParser::USING - 128)) + | (1ULL << (ClickHouseParser::UUID - 128)) + | (1ULL << (ClickHouseParser::VALUES - 128)) + | (1ULL << (ClickHouseParser::VIEW - 128)) + | (1ULL << (ClickHouseParser::VOLUME - 128)) + | (1ULL << (ClickHouseParser::WATCH - 128)) + | (1ULL << (ClickHouseParser::WHEN - 128)) + | (1ULL << (ClickHouseParser::WHERE - 128)) + | (1ULL << (ClickHouseParser::WITH - 128)) + | (1ULL << (ClickHouseParser::JSON_FALSE - 128)) + | (1ULL << (ClickHouseParser::JSON_TRUE - 128)))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- KeywordForAliasContext ------------------------------------------------------------------ + +ClickHouseParser::KeywordForAliasContext::KeywordForAliasContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::KeywordForAliasContext::DATE() { + return getToken(ClickHouseParser::DATE, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordForAliasContext::FIRST() { + return getToken(ClickHouseParser::FIRST, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordForAliasContext::ID() { + return getToken(ClickHouseParser::ID, 0); +} + +tree::TerminalNode* ClickHouseParser::KeywordForAliasContext::KEY() { + return getToken(ClickHouseParser::KEY, 0); +} + + +size_t ClickHouseParser::KeywordForAliasContext::getRuleIndex() const { + return ClickHouseParser::RuleKeywordForAlias; +} + +antlrcpp::Any ClickHouseParser::KeywordForAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitKeywordForAlias(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::KeywordForAliasContext* ClickHouseParser::keywordForAlias() { + KeywordForAliasContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 202, ClickHouseParser::RuleKeywordForAlias); + size_t _la = 0; + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1794); + _la = _input->LA(1); + if (!(((((_la - 33) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 33)) & ((1ULL << (ClickHouseParser::DATE - 33)) + | (1ULL << (ClickHouseParser::FIRST - 33)) + | (1ULL << (ClickHouseParser::ID - 33)) + | (1ULL << (ClickHouseParser::KEY - 33)))) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- AliasContext ------------------------------------------------------------------ + +ClickHouseParser::AliasContext::AliasContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::AliasContext::IDENTIFIER() { + return getToken(ClickHouseParser::IDENTIFIER, 0); +} + +ClickHouseParser::KeywordForAliasContext* ClickHouseParser::AliasContext::keywordForAlias() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::AliasContext::getRuleIndex() const { + return ClickHouseParser::RuleAlias; +} + +antlrcpp::Any ClickHouseParser::AliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlias(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::AliasContext* ClickHouseParser::alias() { + AliasContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 204, ClickHouseParser::RuleAlias); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1798); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::IDENTIFIER: { + enterOuterAlt(_localctx, 1); + setState(1796); + match(ClickHouseParser::IDENTIFIER); + break; + } + + case ClickHouseParser::DATE: + case ClickHouseParser::FIRST: + case ClickHouseParser::ID: + case ClickHouseParser::KEY: { + enterOuterAlt(_localctx, 2); + setState(1797); + keywordForAlias(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- IdentifierContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierContext::IdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::IdentifierContext::IDENTIFIER() { + return getToken(ClickHouseParser::IDENTIFIER, 0); +} + +ClickHouseParser::IntervalContext* ClickHouseParser::IdentifierContext::interval() { + return getRuleContext(0); +} + +ClickHouseParser::KeywordContext* ClickHouseParser::IdentifierContext::keyword() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::IdentifierContext::getRuleIndex() const { + return ClickHouseParser::RuleIdentifier; +} + +antlrcpp::Any ClickHouseParser::IdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitIdentifier(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::identifier() { + IdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 206, ClickHouseParser::RuleIdentifier); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1803); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::IDENTIFIER: { + enterOuterAlt(_localctx, 1); + setState(1800); + match(ClickHouseParser::IDENTIFIER); + break; + } + + case ClickHouseParser::DAY: + case ClickHouseParser::HOUR: + case ClickHouseParser::MINUTE: + case ClickHouseParser::MONTH: + case ClickHouseParser::QUARTER: + case ClickHouseParser::SECOND: + case ClickHouseParser::WEEK: + case ClickHouseParser::YEAR: { + enterOuterAlt(_localctx, 2); + setState(1801); + interval(); + break; + } + + case ClickHouseParser::AFTER: + case ClickHouseParser::ALIAS: + case ClickHouseParser::ALL: + case ClickHouseParser::ALTER: + case ClickHouseParser::AND: + case ClickHouseParser::ANTI: + case ClickHouseParser::ANY: + case ClickHouseParser::ARRAY: + case ClickHouseParser::AS: + case ClickHouseParser::ASCENDING: + case ClickHouseParser::ASOF: + case ClickHouseParser::ASYNC: + case ClickHouseParser::ATTACH: + case ClickHouseParser::BETWEEN: + case ClickHouseParser::BOTH: + case ClickHouseParser::BY: + case ClickHouseParser::CASE: + case ClickHouseParser::CAST: + case ClickHouseParser::CHECK: + case ClickHouseParser::CLEAR: + case ClickHouseParser::CLUSTER: + case ClickHouseParser::CODEC: + case ClickHouseParser::COLLATE: + case ClickHouseParser::COLUMN: + case ClickHouseParser::COMMENT: + case ClickHouseParser::CONSTRAINT: + case ClickHouseParser::CREATE: + case ClickHouseParser::CROSS: + case ClickHouseParser::CUBE: + case ClickHouseParser::DATABASE: + case ClickHouseParser::DATABASES: + case ClickHouseParser::DATE: + case ClickHouseParser::DEDUPLICATE: + case ClickHouseParser::DEFAULT: + case ClickHouseParser::DELAY: + case ClickHouseParser::DELETE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCENDING: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DICTIONARIES: + case ClickHouseParser::DICTIONARY: + case ClickHouseParser::DISK: + case ClickHouseParser::DISTINCT: + case ClickHouseParser::DISTRIBUTED: + case ClickHouseParser::DROP: + case ClickHouseParser::ELSE: + case ClickHouseParser::END: + case ClickHouseParser::ENGINE: + case ClickHouseParser::EVENTS: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::EXPRESSION: + case ClickHouseParser::EXTRACT: + case ClickHouseParser::FETCHES: + case ClickHouseParser::FINAL: + case ClickHouseParser::FIRST: + case ClickHouseParser::FLUSH: + case ClickHouseParser::FOR: + case ClickHouseParser::FORMAT: + case ClickHouseParser::FREEZE: + case ClickHouseParser::FROM: + case ClickHouseParser::FULL: + case ClickHouseParser::FUNCTION: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::GRANULARITY: + case ClickHouseParser::GROUP: + case ClickHouseParser::HAVING: + case ClickHouseParser::HIERARCHICAL: + case ClickHouseParser::ID: + case ClickHouseParser::IF: + case ClickHouseParser::ILIKE: + case ClickHouseParser::IN: + case ClickHouseParser::INDEX: + case ClickHouseParser::INJECTIVE: + case ClickHouseParser::INNER: + case ClickHouseParser::INSERT: + case ClickHouseParser::INTERVAL: + case ClickHouseParser::INTO: + case ClickHouseParser::IS: + case ClickHouseParser::IS_OBJECT_ID: + case ClickHouseParser::JOIN: + case ClickHouseParser::KEY: + case ClickHouseParser::KILL: + case ClickHouseParser::LAST: + case ClickHouseParser::LAYOUT: + case ClickHouseParser::LEADING: + case ClickHouseParser::LEFT: + case ClickHouseParser::LIFETIME: + case ClickHouseParser::LIKE: + case ClickHouseParser::LIMIT: + case ClickHouseParser::LIVE: + case ClickHouseParser::LOCAL: + case ClickHouseParser::LOGS: + case ClickHouseParser::MATERIALIZED: + case ClickHouseParser::MAX: + case ClickHouseParser::MERGES: + case ClickHouseParser::MIN: + case ClickHouseParser::MODIFY: + case ClickHouseParser::MOVE: + case ClickHouseParser::MUTATION: + case ClickHouseParser::NO: + case ClickHouseParser::NOT: + case ClickHouseParser::NULLS: + case ClickHouseParser::OFFSET: + case ClickHouseParser::ON: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::OR: + case ClickHouseParser::ORDER: + case ClickHouseParser::OUTER: + case ClickHouseParser::OUTFILE: + case ClickHouseParser::PARTITION: + case ClickHouseParser::POPULATE: + case ClickHouseParser::PREWHERE: + case ClickHouseParser::PRIMARY: + case ClickHouseParser::RANGE: + case ClickHouseParser::RELOAD: + case ClickHouseParser::REMOVE: + case ClickHouseParser::RENAME: + case ClickHouseParser::REPLACE: + case ClickHouseParser::REPLICA: + case ClickHouseParser::REPLICATED: + case ClickHouseParser::RIGHT: + case ClickHouseParser::ROLLUP: + case ClickHouseParser::SAMPLE: + case ClickHouseParser::SELECT: + case ClickHouseParser::SEMI: + case ClickHouseParser::SENDS: + case ClickHouseParser::SET: + case ClickHouseParser::SETTINGS: + case ClickHouseParser::SHOW: + case ClickHouseParser::SOURCE: + case ClickHouseParser::START: + case ClickHouseParser::STOP: + case ClickHouseParser::SUBSTRING: + case ClickHouseParser::SYNC: + case ClickHouseParser::SYNTAX: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TABLE: + case ClickHouseParser::TABLES: + case ClickHouseParser::TEMPORARY: + case ClickHouseParser::TEST: + case ClickHouseParser::THEN: + case ClickHouseParser::TIES: + case ClickHouseParser::TIMEOUT: + case ClickHouseParser::TIMESTAMP: + case ClickHouseParser::TO: + case ClickHouseParser::TOP: + case ClickHouseParser::TOTALS: + case ClickHouseParser::TRAILING: + case ClickHouseParser::TRIM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::TTL: + case ClickHouseParser::TYPE: + case ClickHouseParser::UNION: + case ClickHouseParser::UPDATE: + case ClickHouseParser::USE: + case ClickHouseParser::USING: + case ClickHouseParser::UUID: + case ClickHouseParser::VALUES: + case ClickHouseParser::VIEW: + case ClickHouseParser::VOLUME: + case ClickHouseParser::WATCH: + case ClickHouseParser::WHEN: + case ClickHouseParser::WHERE: + case ClickHouseParser::WITH: + case ClickHouseParser::JSON_FALSE: + case ClickHouseParser::JSON_TRUE: { + enterOuterAlt(_localctx, 3); + setState(1802); + keyword(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- IdentifierOrNullContext ------------------------------------------------------------------ + +ClickHouseParser::IdentifierOrNullContext::IdentifierOrNullContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ClickHouseParser::IdentifierContext* ClickHouseParser::IdentifierOrNullContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* ClickHouseParser::IdentifierOrNullContext::NULL_SQL() { + return getToken(ClickHouseParser::NULL_SQL, 0); +} + + +size_t ClickHouseParser::IdentifierOrNullContext::getRuleIndex() const { + return ClickHouseParser::RuleIdentifierOrNull; +} + +antlrcpp::Any ClickHouseParser::IdentifierOrNullContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitIdentifierOrNull(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::IdentifierOrNullContext* ClickHouseParser::identifierOrNull() { + IdentifierOrNullContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 208, ClickHouseParser::RuleIdentifierOrNull); + + auto onExit = finally([=] { + exitRule(); + }); + try { + setState(1807); + _errHandler->sync(this); + switch (_input->LA(1)) { + case ClickHouseParser::AFTER: + case ClickHouseParser::ALIAS: + case ClickHouseParser::ALL: + case ClickHouseParser::ALTER: + case ClickHouseParser::AND: + case ClickHouseParser::ANTI: + case ClickHouseParser::ANY: + case ClickHouseParser::ARRAY: + case ClickHouseParser::AS: + case ClickHouseParser::ASCENDING: + case ClickHouseParser::ASOF: + case ClickHouseParser::ASYNC: + case ClickHouseParser::ATTACH: + case ClickHouseParser::BETWEEN: + case ClickHouseParser::BOTH: + case ClickHouseParser::BY: + case ClickHouseParser::CASE: + case ClickHouseParser::CAST: + case ClickHouseParser::CHECK: + case ClickHouseParser::CLEAR: + case ClickHouseParser::CLUSTER: + case ClickHouseParser::CODEC: + case ClickHouseParser::COLLATE: + case ClickHouseParser::COLUMN: + case ClickHouseParser::COMMENT: + case ClickHouseParser::CONSTRAINT: + case ClickHouseParser::CREATE: + case ClickHouseParser::CROSS: + case ClickHouseParser::CUBE: + case ClickHouseParser::DATABASE: + case ClickHouseParser::DATABASES: + case ClickHouseParser::DATE: + case ClickHouseParser::DAY: + case ClickHouseParser::DEDUPLICATE: + case ClickHouseParser::DEFAULT: + case ClickHouseParser::DELAY: + case ClickHouseParser::DELETE: + case ClickHouseParser::DESC: + case ClickHouseParser::DESCENDING: + case ClickHouseParser::DESCRIBE: + case ClickHouseParser::DETACH: + case ClickHouseParser::DICTIONARIES: + case ClickHouseParser::DICTIONARY: + case ClickHouseParser::DISK: + case ClickHouseParser::DISTINCT: + case ClickHouseParser::DISTRIBUTED: + case ClickHouseParser::DROP: + case ClickHouseParser::ELSE: + case ClickHouseParser::END: + case ClickHouseParser::ENGINE: + case ClickHouseParser::EVENTS: + case ClickHouseParser::EXISTS: + case ClickHouseParser::EXPLAIN: + case ClickHouseParser::EXPRESSION: + case ClickHouseParser::EXTRACT: + case ClickHouseParser::FETCHES: + case ClickHouseParser::FINAL: + case ClickHouseParser::FIRST: + case ClickHouseParser::FLUSH: + case ClickHouseParser::FOR: + case ClickHouseParser::FORMAT: + case ClickHouseParser::FREEZE: + case ClickHouseParser::FROM: + case ClickHouseParser::FULL: + case ClickHouseParser::FUNCTION: + case ClickHouseParser::GLOBAL: + case ClickHouseParser::GRANULARITY: + case ClickHouseParser::GROUP: + case ClickHouseParser::HAVING: + case ClickHouseParser::HIERARCHICAL: + case ClickHouseParser::HOUR: + case ClickHouseParser::ID: + case ClickHouseParser::IF: + case ClickHouseParser::ILIKE: + case ClickHouseParser::IN: + case ClickHouseParser::INDEX: + case ClickHouseParser::INJECTIVE: + case ClickHouseParser::INNER: + case ClickHouseParser::INSERT: + case ClickHouseParser::INTERVAL: + case ClickHouseParser::INTO: + case ClickHouseParser::IS: + case ClickHouseParser::IS_OBJECT_ID: + case ClickHouseParser::JOIN: + case ClickHouseParser::KEY: + case ClickHouseParser::KILL: + case ClickHouseParser::LAST: + case ClickHouseParser::LAYOUT: + case ClickHouseParser::LEADING: + case ClickHouseParser::LEFT: + case ClickHouseParser::LIFETIME: + case ClickHouseParser::LIKE: + case ClickHouseParser::LIMIT: + case ClickHouseParser::LIVE: + case ClickHouseParser::LOCAL: + case ClickHouseParser::LOGS: + case ClickHouseParser::MATERIALIZED: + case ClickHouseParser::MAX: + case ClickHouseParser::MERGES: + case ClickHouseParser::MIN: + case ClickHouseParser::MINUTE: + case ClickHouseParser::MODIFY: + case ClickHouseParser::MONTH: + case ClickHouseParser::MOVE: + case ClickHouseParser::MUTATION: + case ClickHouseParser::NO: + case ClickHouseParser::NOT: + case ClickHouseParser::NULLS: + case ClickHouseParser::OFFSET: + case ClickHouseParser::ON: + case ClickHouseParser::OPTIMIZE: + case ClickHouseParser::OR: + case ClickHouseParser::ORDER: + case ClickHouseParser::OUTER: + case ClickHouseParser::OUTFILE: + case ClickHouseParser::PARTITION: + case ClickHouseParser::POPULATE: + case ClickHouseParser::PREWHERE: + case ClickHouseParser::PRIMARY: + case ClickHouseParser::QUARTER: + case ClickHouseParser::RANGE: + case ClickHouseParser::RELOAD: + case ClickHouseParser::REMOVE: + case ClickHouseParser::RENAME: + case ClickHouseParser::REPLACE: + case ClickHouseParser::REPLICA: + case ClickHouseParser::REPLICATED: + case ClickHouseParser::RIGHT: + case ClickHouseParser::ROLLUP: + case ClickHouseParser::SAMPLE: + case ClickHouseParser::SECOND: + case ClickHouseParser::SELECT: + case ClickHouseParser::SEMI: + case ClickHouseParser::SENDS: + case ClickHouseParser::SET: + case ClickHouseParser::SETTINGS: + case ClickHouseParser::SHOW: + case ClickHouseParser::SOURCE: + case ClickHouseParser::START: + case ClickHouseParser::STOP: + case ClickHouseParser::SUBSTRING: + case ClickHouseParser::SYNC: + case ClickHouseParser::SYNTAX: + case ClickHouseParser::SYSTEM: + case ClickHouseParser::TABLE: + case ClickHouseParser::TABLES: + case ClickHouseParser::TEMPORARY: + case ClickHouseParser::TEST: + case ClickHouseParser::THEN: + case ClickHouseParser::TIES: + case ClickHouseParser::TIMEOUT: + case ClickHouseParser::TIMESTAMP: + case ClickHouseParser::TO: + case ClickHouseParser::TOP: + case ClickHouseParser::TOTALS: + case ClickHouseParser::TRAILING: + case ClickHouseParser::TRIM: + case ClickHouseParser::TRUNCATE: + case ClickHouseParser::TTL: + case ClickHouseParser::TYPE: + case ClickHouseParser::UNION: + case ClickHouseParser::UPDATE: + case ClickHouseParser::USE: + case ClickHouseParser::USING: + case ClickHouseParser::UUID: + case ClickHouseParser::VALUES: + case ClickHouseParser::VIEW: + case ClickHouseParser::VOLUME: + case ClickHouseParser::WATCH: + case ClickHouseParser::WEEK: + case ClickHouseParser::WHEN: + case ClickHouseParser::WHERE: + case ClickHouseParser::WITH: + case ClickHouseParser::YEAR: + case ClickHouseParser::JSON_FALSE: + case ClickHouseParser::JSON_TRUE: + case ClickHouseParser::IDENTIFIER: { + enterOuterAlt(_localctx, 1); + setState(1805); + identifier(); + break; + } + + case ClickHouseParser::NULL_SQL: { + enterOuterAlt(_localctx, 2); + setState(1806); + match(ClickHouseParser::NULL_SQL); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- EnumValueContext ------------------------------------------------------------------ + +ClickHouseParser::EnumValueContext::EnumValueContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ClickHouseParser::EnumValueContext::STRING_LITERAL() { + return getToken(ClickHouseParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* ClickHouseParser::EnumValueContext::EQ_SINGLE() { + return getToken(ClickHouseParser::EQ_SINGLE, 0); +} + +ClickHouseParser::NumberLiteralContext* ClickHouseParser::EnumValueContext::numberLiteral() { + return getRuleContext(0); +} + + +size_t ClickHouseParser::EnumValueContext::getRuleIndex() const { + return ClickHouseParser::RuleEnumValue; +} + +antlrcpp::Any ClickHouseParser::EnumValueContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitEnumValue(this); + else + return visitor->visitChildren(this); +} + +ClickHouseParser::EnumValueContext* ClickHouseParser::enumValue() { + EnumValueContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 210, ClickHouseParser::RuleEnumValue); + + auto onExit = finally([=] { + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(1809); + match(ClickHouseParser::STRING_LITERAL); + setState(1810); + match(ClickHouseParser::EQ_SINGLE); + setState(1811); + numberLiteral(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +bool ClickHouseParser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { + switch (ruleIndex) { + case 12: return dictionaryAttrDfntSempred(dynamic_cast(context), predicateIndex); + case 13: return dictionaryEngineClauseSempred(dynamic_cast(context), predicateIndex); + case 26: return engineClauseSempred(dynamic_cast(context), predicateIndex); + case 64: return joinExprSempred(dynamic_cast(context), predicateIndex); + case 84: return columnExprSempred(dynamic_cast(context), predicateIndex); + case 90: return tableExprSempred(dynamic_cast(context), predicateIndex); + + default: + break; + } + return true; +} + +bool ClickHouseParser::dictionaryAttrDfntSempred(DictionaryAttrDfntContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 0: return !_localctx->attrs.count("default"); + case 1: return !_localctx->attrs.count("expression"); + case 2: return !_localctx->attrs.count("hierarchical"); + case 3: return !_localctx->attrs.count("injective"); + case 4: return !_localctx->attrs.count("is_object_id"); + + default: + break; + } + return true; +} + +bool ClickHouseParser::dictionaryEngineClauseSempred(DictionaryEngineClauseContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 5: return !_localctx->clauses.count("source"); + case 6: return !_localctx->clauses.count("lifetime"); + case 7: return !_localctx->clauses.count("layout"); + case 8: return !_localctx->clauses.count("range"); + case 9: return !_localctx->clauses.count("settings"); + + default: + break; + } + return true; +} + +bool ClickHouseParser::engineClauseSempred(EngineClauseContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 10: return !_localctx->clauses.count("orderByClause"); + case 11: return !_localctx->clauses.count("partitionByClause"); + case 12: return !_localctx->clauses.count("primaryKeyClause"); + case 13: return !_localctx->clauses.count("sampleByClause"); + case 14: return !_localctx->clauses.count("ttlClause"); + case 15: return !_localctx->clauses.count("settingsClause"); + + default: + break; + } + return true; +} + +bool ClickHouseParser::joinExprSempred(JoinExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 16: return precpred(_ctx, 3); + case 17: return precpred(_ctx, 4); + + default: + break; + } + return true; +} + +bool ClickHouseParser::columnExprSempred(ColumnExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 18: return precpred(_ctx, 16); + case 19: return precpred(_ctx, 15); + case 20: return precpred(_ctx, 14); + case 21: return precpred(_ctx, 11); + case 22: return precpred(_ctx, 10); + case 23: return precpred(_ctx, 9); + case 24: return precpred(_ctx, 8); + case 25: return precpred(_ctx, 19); + case 26: return precpred(_ctx, 18); + case 27: return precpred(_ctx, 13); + case 28: return precpred(_ctx, 7); + + default: + break; + } + return true; +} + +bool ClickHouseParser::tableExprSempred(TableExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 29: return precpred(_ctx, 1); + + default: + break; + } + return true; +} + +// Static vars and initialization. +std::vector ClickHouseParser::_decisionToDFA; +atn::PredictionContextCache ClickHouseParser::_sharedContextCache; + +// We own the ATN which in turn owns the ATN states. +atn::ATN ClickHouseParser::_atn; +std::vector ClickHouseParser::_serializedATN; + +std::vector ClickHouseParser::_ruleNames = { + "queryStmt", "query", "alterStmt", "alterTableClause", "assignmentExprList", + "assignmentExpr", "tableColumnPropertyType", "partitionClause", "attachStmt", + "checkStmt", "createStmt", "dictionarySchemaClause", "dictionaryAttrDfnt", + "dictionaryEngineClause", "dictionaryPrimaryKeyClause", "dictionaryArgExpr", + "sourceClause", "lifetimeClause", "layoutClause", "rangeClause", "dictionarySettingsClause", + "clusterClause", "uuidClause", "destinationClause", "subqueryClause", + "tableSchemaClause", "engineClause", "partitionByClause", "primaryKeyClause", + "sampleByClause", "ttlClause", "engineExpr", "tableElementExpr", "tableColumnDfnt", + "tableColumnPropertyExpr", "tableIndexDfnt", "codecExpr", "codecArgExpr", + "ttlExpr", "describeStmt", "dropStmt", "existsStmt", "explainStmt", "insertStmt", + "columnsClause", "dataClause", "killStmt", "optimizeStmt", "renameStmt", + "selectUnionStmt", "selectStmtWithParens", "selectStmt", "withClause", + "topClause", "fromClause", "arrayJoinClause", "prewhereClause", "whereClause", + "groupByClause", "havingClause", "orderByClause", "limitByClause", "limitClause", + "settingsClause", "joinExpr", "joinOp", "joinOpCross", "joinConstraintClause", + "sampleClause", "limitExpr", "orderExprList", "orderExpr", "ratioExpr", + "settingExprList", "settingExpr", "setStmt", "showStmt", "systemStmt", + "truncateStmt", "useStmt", "watchStmt", "columnTypeExpr", "columnExprList", + "columnsExpr", "columnExpr", "columnArgList", "columnArgExpr", "columnLambdaExpr", + "columnIdentifier", "nestedIdentifier", "tableExpr", "tableFunctionExpr", + "tableIdentifier", "tableArgList", "tableArgExpr", "databaseIdentifier", + "floatingLiteral", "numberLiteral", "literal", "interval", "keyword", + "keywordForAlias", "alias", "identifier", "identifierOrNull", "enumValue" +}; + +std::vector ClickHouseParser::_literalNames = { + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "'false'", + "'true'", "", "", "", "", "", "", "'->'", "'*'", "'`'", "'\\'", "':'", + "','", "'||'", "'-'", "'.'", "'=='", "'='", "'>='", "'>'", "'{'", "'['", + "'<='", "'('", "'<'", "", "'%'", "'+'", "'?'", "'\"'", "'''", "'}'", "']'", + "')'", "';'", "'/'", "'_'" +}; + +std::vector ClickHouseParser::_symbolicNames = { + "", "ADD", "AFTER", "ALIAS", "ALL", "ALTER", "AND", "ANTI", "ANY", "ARRAY", + "AS", "ASCENDING", "ASOF", "ASYNC", "ATTACH", "BETWEEN", "BOTH", "BY", + "CASE", "CAST", "CHECK", "CLEAR", "CLUSTER", "CODEC", "COLLATE", "COLUMN", + "COMMENT", "CONSTRAINT", "CREATE", "CROSS", "CUBE", "DATABASE", "DATABASES", + "DATE", "DAY", "DEDUPLICATE", "DEFAULT", "DELAY", "DELETE", "DESC", "DESCENDING", + "DESCRIBE", "DETACH", "DICTIONARIES", "DICTIONARY", "DISK", "DISTINCT", + "DISTRIBUTED", "DROP", "ELSE", "END", "ENGINE", "EVENTS", "EXISTS", "EXPLAIN", + "EXPRESSION", "EXTRACT", "FETCHES", "FINAL", "FIRST", "FLUSH", "FOR", + "FORMAT", "FREEZE", "FROM", "FULL", "FUNCTION", "GLOBAL", "GRANULARITY", + "GROUP", "HAVING", "HIERARCHICAL", "HOUR", "ID", "IF", "ILIKE", "IN", + "INDEX", "INF", "INJECTIVE", "INNER", "INSERT", "INTERVAL", "INTO", "IS", + "IS_OBJECT_ID", "JOIN", "KEY", "KILL", "LAST", "LAYOUT", "LEADING", "LEFT", + "LIFETIME", "LIKE", "LIMIT", "LIVE", "LOCAL", "LOGS", "MATERIALIZED", + "MAX", "MERGES", "MIN", "MINUTE", "MODIFY", "MONTH", "MOVE", "MUTATION", + "NAN_SQL", "NO", "NOT", "NULL_SQL", "NULLS", "OFFSET", "ON", "OPTIMIZE", + "OR", "ORDER", "OUTER", "OUTFILE", "PARTITION", "POPULATE", "PREWHERE", + "PRIMARY", "QUARTER", "RANGE", "RELOAD", "REMOVE", "RENAME", "REPLACE", + "REPLICA", "REPLICATED", "RIGHT", "ROLLUP", "SAMPLE", "SECOND", "SELECT", + "SEMI", "SENDS", "SET", "SETTINGS", "SHOW", "SOURCE", "START", "STOP", + "SUBSTRING", "SYNC", "SYNTAX", "SYSTEM", "TABLE", "TABLES", "TEMPORARY", + "TEST", "THEN", "TIES", "TIMEOUT", "TIMESTAMP", "TO", "TOP", "TOTALS", + "TRAILING", "TRIM", "TRUNCATE", "TTL", "TYPE", "UNION", "UPDATE", "USE", + "USING", "UUID", "VALUES", "VIEW", "VOLUME", "WATCH", "WEEK", "WHEN", + "WHERE", "WITH", "YEAR", "JSON_FALSE", "JSON_TRUE", "IDENTIFIER", "FLOATING_LITERAL", + "OCTAL_LITERAL", "DECIMAL_LITERAL", "HEXADECIMAL_LITERAL", "STRING_LITERAL", + "ARROW", "ASTERISK", "BACKQUOTE", "BACKSLASH", "COLON", "COMMA", "CONCAT", + "DASH", "DOT", "EQ_DOUBLE", "EQ_SINGLE", "GE", "GT", "LBRACE", "LBRACKET", + "LE", "LPAREN", "LT", "NOT_EQ", "PERCENT", "PLUS", "QUERY", "QUOTE_DOUBLE", + "QUOTE_SINGLE", "RBRACE", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", + "UNDERSCORE", "MULTI_LINE_COMMENT", "SINGLE_LINE_COMMENT", "WHITESPACE" +}; + +dfa::Vocabulary ClickHouseParser::_vocabulary(_literalNames, _symbolicNames); + +std::vector ClickHouseParser::_tokenNames; + +ClickHouseParser::Initializer::Initializer() { + for (size_t i = 0; i < _symbolicNames.size(); ++i) { + std::string name = _vocabulary.getLiteralName(i); + if (name.empty()) { + name = _vocabulary.getSymbolicName(i); + } + + if (name.empty()) { + _tokenNames.push_back(""); + } else { + _tokenNames.push_back(name); + } + } + + _serializedATN = { + 0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964, + 0x3, 0xdd, 0x718, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4, 0x4, + 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 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, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, + 0x32, 0x3, 0x32, 0x7, 0x32, 0x408, 0xa, 0x32, 0xc, 0x32, 0xe, 0x32, + 0x40b, 0xb, 0x32, 0x3, 0x32, 0x5, 0x32, 0x40e, 0xa, 0x32, 0x3, 0x33, + 0x3, 0x33, 0x3, 0x33, 0x3, 0x33, 0x7, 0x33, 0x414, 0xa, 0x33, 0xc, 0x33, + 0xe, 0x33, 0x417, 0xb, 0x33, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, + 0x3, 0x34, 0x5, 0x34, 0x41e, 0xa, 0x34, 0x3, 0x35, 0x5, 0x35, 0x421, + 0xa, 0x35, 0x3, 0x35, 0x3, 0x35, 0x5, 0x35, 0x425, 0xa, 0x35, 0x3, 0x35, + 0x5, 0x35, 0x428, 0xa, 0x35, 0x3, 0x35, 0x3, 0x35, 0x5, 0x35, 0x42c, + 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, 0x42f, 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, + 0x432, 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, 0x435, 0xa, 0x35, 0x3, 0x35, + 0x5, 0x35, 0x438, 0xa, 0x35, 0x3, 0x35, 0x3, 0x35, 0x5, 0x35, 0x43c, + 0xa, 0x35, 0x3, 0x35, 0x3, 0x35, 0x5, 0x35, 0x440, 0xa, 0x35, 0x3, 0x35, + 0x5, 0x35, 0x443, 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, 0x446, 0xa, 0x35, + 0x3, 0x35, 0x5, 0x35, 0x449, 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, 0x44c, + 0xa, 0x35, 0x3, 0x35, 0x5, 0x35, 0x44f, 0xa, 0x35, 0x3, 0x36, 0x3, 0x36, + 0x3, 0x36, 0x3, 0x37, 0x3, 0x37, 0x3, 0x37, 0x3, 0x37, 0x5, 0x37, 0x458, + 0xa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0x5, 0x43, 0x4b4, 0xa, 0x43, 0x3, 0x43, 0x5, 0x43, + 0x4b7, 0xa, 0x43, 0x3, 0x43, 0x3, 0x43, 0x5, 0x43, 0x4bb, 0xa, 0x43, + 0x3, 0x43, 0x3, 0x43, 0x5, 0x43, 0x4bf, 0xa, 0x43, 0x3, 0x43, 0x5, 0x43, + 0x4c2, 0xa, 0x43, 0x5, 0x43, 0x4c4, 0xa, 0x43, 0x3, 0x43, 0x5, 0x43, + 0x4c7, 0xa, 0x43, 0x3, 0x43, 0x3, 0x43, 0x5, 0x43, 0x4cb, 0xa, 0x43, + 0x3, 0x43, 0x3, 0x43, 0x5, 0x43, 0x4cf, 0xa, 0x43, 0x3, 0x43, 0x5, 0x43, + 0x4d2, 0xa, 0x43, 0x5, 0x43, 0x4d4, 0xa, 0x43, 0x5, 0x43, 0x4d6, 0xa, + 0x43, 0x3, 0x44, 0x5, 0x44, 0x4d9, 0xa, 0x44, 0x3, 0x44, 0x3, 0x44, + 0x3, 0x44, 0x5, 0x44, 0x4de, 0xa, 0x44, 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, + 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, 0x5, + 0x45, 0x4e9, 0xa, 0x45, 0x3, 0x46, 0x3, 0x46, 0x3, 0x46, 0x3, 0x46, + 0x5, 0x46, 0x4ef, 0xa, 0x46, 0x3, 0x47, 0x3, 0x47, 0x3, 0x47, 0x5, 0x47, + 0x4f4, 0xa, 0x47, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x7, 0x48, 0x4f9, + 0xa, 0x48, 0xc, 0x48, 0xe, 0x48, 0x4fc, 0xb, 0x48, 0x3, 0x49, 0x3, 0x49, + 0x5, 0x49, 0x500, 0xa, 0x49, 0x3, 0x49, 0x3, 0x49, 0x5, 0x49, 0x504, + 0xa, 0x49, 0x3, 0x49, 0x3, 0x49, 0x5, 0x49, 0x508, 0xa, 0x49, 0x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x3, 0x4f, 0x5, 0x4f, 0x561, 0xa, 0x4f, 0x3, + 0x4f, 0x3, 0x4f, 0x3, 0x4f, 0x3, 0x4f, 0x3, 0x4f, 0x3, 0x4f, 0x3, 0x4f, + 0x3, 0x4f, 0x3, 0x4f, 0x5, 0x4f, 0x56c, 0xa, 0x4f, 0x3, 0x50, 0x3, 0x50, + 0x5, 0x50, 0x570, 0xa, 0x50, 0x3, 0x50, 0x5, 0x50, 0x573, 0xa, 0x50, + 0x3, 0x50, 0x3, 0x50, 0x5, 0x50, 0x577, 0xa, 0x50, 0x3, 0x50, 0x3, 0x50, + 0x5, 0x50, 0x57b, 0xa, 0x50, 0x3, 0x51, 0x3, 0x51, 0x3, 0x51, 0x3, 0x52, + 0x3, 0x52, 0x3, 0x52, 0x5, 0x52, 0x583, 0xa, 0x52, 0x3, 0x52, 0x3, 0x52, + 0x5, 0x52, 0x587, 0xa, 0x52, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, + 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x7, 0x53, 0x592, + 0xa, 0x53, 0xc, 0x53, 0xe, 0x53, 0x595, 0xb, 0x53, 0x3, 0x53, 0x3, 0x53, + 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x7, 0x53, 0x59e, + 0xa, 0x53, 0xc, 0x53, 0xe, 0x53, 0x5a1, 0xb, 0x53, 0x3, 0x53, 0x3, 0x53, + 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x7, 0x53, 0x5aa, + 0xa, 0x53, 0xc, 0x53, 0xe, 0x53, 0x5ad, 0xb, 0x53, 0x3, 0x53, 0x3, 0x53, + 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x5, 0x53, 0x5b4, 0xa, 0x53, 0x3, 0x53, + 0x3, 0x53, 0x5, 0x53, 0x5b8, 0xa, 0x53, 0x3, 0x54, 0x3, 0x54, 0x3, 0x54, + 0x7, 0x54, 0x5bd, 0xa, 0x54, 0xc, 0x54, 0xe, 0x54, 0x5c0, 0xb, 0x54, + 0x3, 0x55, 0x3, 0x55, 0x3, 0x55, 0x5, 0x55, 0x5c5, 0xa, 0x55, 0x3, 0x55, + 0x3, 0x55, 0x3, 0x55, 0x3, 0x55, 0x3, 0x55, 0x3, 0x55, 0x5, 0x55, 0x5cd, + 0xa, 0x55, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x5d2, 0xa, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x6, 0x56, 0x5d9, + 0xa, 0x56, 0xd, 0x56, 0xe, 0x56, 0x5da, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, + 0x5df, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x5fe, + 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x60f, 0xa, 0x56, 0x3, 0x56, + 0x5, 0x56, 0x612, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x616, + 0xa, 0x56, 0x3, 0x56, 0x5, 0x56, 0x619, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x5, 0x56, 0x625, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x5, 0x56, 0x636, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x63a, + 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x64b, 0xa, 0x56, 0x3, 0x56, + 0x5, 0x56, 0x64e, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x652, + 0xa, 0x56, 0x3, 0x56, 0x5, 0x56, 0x655, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x5, 0x56, 0x660, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, + 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, + 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 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0x2, 0x101, 0x102, 0x7, 0xc2, 0x2, 0x2, 0x102, 0x104, 0x5, + 0x8, 0x5, 0x2, 0x103, 0x101, 0x3, 0x2, 0x2, 0x2, 0x104, 0x107, 0x3, + 0x2, 0x2, 0x2, 0x105, 0x103, 0x3, 0x2, 0x2, 0x2, 0x105, 0x106, 0x3, + 0x2, 0x2, 0x2, 0x106, 0x7, 0x3, 0x2, 0x2, 0x2, 0x107, 0x105, 0x3, 0x2, + 0x2, 0x2, 0x108, 0x109, 0x7, 0x3, 0x2, 0x2, 0x109, 0x10d, 0x7, 0x1b, + 0x2, 0x2, 0x10a, 0x10b, 0x7, 0x4c, 0x2, 0x2, 0x10b, 0x10c, 0x7, 0x70, + 0x2, 0x2, 0x10c, 0x10e, 0x7, 0x37, 0x2, 0x2, 0x10d, 0x10a, 0x3, 0x2, + 0x2, 0x2, 0x10d, 0x10e, 0x3, 0x2, 0x2, 0x2, 0x10e, 0x10f, 0x3, 0x2, + 0x2, 0x2, 0x10f, 0x112, 0x5, 0x44, 0x23, 0x2, 0x110, 0x111, 0x7, 0x4, + 0x2, 0x2, 0x111, 0x113, 0x5, 0xb4, 0x5b, 0x2, 0x112, 0x110, 0x3, 0x2, + 0x2, 0x2, 0x112, 0x113, 0x3, 0x2, 0x2, 0x2, 0x113, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x114, 0x115, 0x7, 0x3, 0x2, 0x2, 0x115, 0x119, 0x7, 0x4f, + 0x2, 0x2, 0x116, 0x117, 0x7, 0x4c, 0x2, 0x2, 0x117, 0x118, 0x7, 0x70, + 0x2, 0x2, 0x118, 0x11a, 0x7, 0x37, 0x2, 0x2, 0x119, 0x116, 0x3, 0x2, + 0x2, 0x2, 0x119, 0x11a, 0x3, 0x2, 0x2, 0x2, 0x11a, 0x11b, 0x3, 0x2, + 0x2, 0x2, 0x11b, 0x11e, 0x5, 0x48, 0x25, 0x2, 0x11c, 0x11d, 0x7, 0x4, + 0x2, 0x2, 0x11d, 0x11f, 0x5, 0xb4, 0x5b, 0x2, 0x11e, 0x11c, 0x3, 0x2, + 0x2, 0x2, 0x11e, 0x11f, 0x3, 0x2, 0x2, 0x2, 0x11f, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x120, 0x121, 0x7, 0x10, 0x2, 0x2, 0x121, 0x124, 0x5, 0x10, + 0x9, 0x2, 0x122, 0x123, 0x7, 0x42, 0x2, 0x2, 0x123, 0x125, 0x5, 0xba, + 0x5e, 0x2, 0x124, 0x122, 0x3, 0x2, 0x2, 0x2, 0x124, 0x125, 0x3, 0x2, + 0x2, 0x2, 0x125, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x126, 0x127, 0x7, 0x17, + 0x2, 0x2, 0x127, 0x12a, 0x7, 0x1b, 0x2, 0x2, 0x128, 0x129, 0x7, 0x4c, + 0x2, 0x2, 0x129, 0x12b, 0x7, 0x37, 0x2, 0x2, 0x12a, 0x128, 0x3, 0x2, + 0x2, 0x2, 0x12a, 0x12b, 0x3, 0x2, 0x2, 0x2, 0x12b, 0x12c, 0x3, 0x2, + 0x2, 0x2, 0x12c, 0x12f, 0x5, 0xb4, 0x5b, 0x2, 0x12d, 0x12e, 0x7, 0x4e, + 0x2, 0x2, 0x12e, 0x130, 0x5, 0x10, 0x9, 0x2, 0x12f, 0x12d, 0x3, 0x2, + 0x2, 0x2, 0x12f, 0x130, 0x3, 0x2, 0x2, 0x2, 0x130, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x131, 0x132, 0x7, 0x1c, 0x2, 0x2, 0x132, 0x135, 0x7, 0x1b, + 0x2, 0x2, 0x133, 0x134, 0x7, 0x4c, 0x2, 0x2, 0x134, 0x136, 0x7, 0x37, + 0x2, 0x2, 0x135, 0x133, 0x3, 0x2, 0x2, 0x2, 0x135, 0x136, 0x3, 0x2, + 0x2, 0x2, 0x136, 0x137, 0x3, 0x2, 0x2, 0x2, 0x137, 0x138, 0x5, 0xb4, + 0x5b, 0x2, 0x138, 0x139, 0x7, 0xbc, 0x2, 0x2, 0x139, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x13a, 0x13b, 0x7, 0x28, 0x2, 0x2, 0x13b, 0x13c, 0x7, 0xb2, + 0x2, 0x2, 0x13c, 0x1a0, 0x5, 0xaa, 0x56, 0x2, 0x13d, 0x13e, 0x7, 0x2c, + 0x2, 0x2, 0x13e, 0x1a0, 0x5, 0x10, 0x9, 0x2, 0x13f, 0x140, 0x7, 0x32, + 0x2, 0x2, 0x140, 0x143, 0x7, 0x1b, 0x2, 0x2, 0x141, 0x142, 0x7, 0x4c, + 0x2, 0x2, 0x142, 0x144, 0x7, 0x37, 0x2, 0x2, 0x143, 0x141, 0x3, 0x2, + 0x2, 0x2, 0x143, 0x144, 0x3, 0x2, 0x2, 0x2, 0x144, 0x145, 0x3, 0x2, + 0x2, 0x2, 0x145, 0x1a0, 0x5, 0xb4, 0x5b, 0x2, 0x146, 0x147, 0x7, 0x32, + 0x2, 0x2, 0x147, 0x14a, 0x7, 0x4f, 0x2, 0x2, 0x148, 0x149, 0x7, 0x4c, + 0x2, 0x2, 0x149, 0x14b, 0x7, 0x37, 0x2, 0x2, 0x14a, 0x148, 0x3, 0x2, + 0x2, 0x2, 0x14a, 0x14b, 0x3, 0x2, 0x2, 0x2, 0x14b, 0x14c, 0x3, 0x2, + 0x2, 0x2, 0x14c, 0x1a0, 0x5, 0xb4, 0x5b, 0x2, 0x14d, 0x14e, 0x7, 0x32, + 0x2, 0x2, 0x14e, 0x1a0, 0x5, 0x10, 0x9, 0x2, 0x14f, 0x151, 0x7, 0x41, + 0x2, 0x2, 0x150, 0x152, 0x5, 0x10, 0x9, 0x2, 0x151, 0x150, 0x3, 0x2, + 0x2, 0x2, 0x151, 0x152, 0x3, 0x2, 0x2, 0x2, 0x152, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x153, 0x154, 0x7, 0x6a, 0x2, 0x2, 0x154, 0x157, 0x7, 0x1b, + 0x2, 0x2, 0x155, 0x156, 0x7, 0x4c, 0x2, 0x2, 0x156, 0x158, 0x7, 0x37, + 0x2, 0x2, 0x157, 0x155, 0x3, 0x2, 0x2, 0x2, 0x157, 0x158, 0x3, 0x2, + 0x2, 0x2, 0x158, 0x159, 0x3, 0x2, 0x2, 0x2, 0x159, 0x15a, 0x5, 0xb4, + 0x5b, 0x2, 0x15a, 0x15b, 0x5, 0x4a, 0x26, 0x2, 0x15b, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x15c, 0x15d, 0x7, 0x6a, 0x2, 0x2, 0x15d, 0x160, 0x7, 0x1b, + 0x2, 0x2, 0x15e, 0x15f, 0x7, 0x4c, 0x2, 0x2, 0x15f, 0x161, 0x7, 0x37, + 0x2, 0x2, 0x160, 0x15e, 0x3, 0x2, 0x2, 0x2, 0x160, 0x161, 0x3, 0x2, + 0x2, 0x2, 0x161, 0x162, 0x3, 0x2, 0x2, 0x2, 0x162, 0x163, 0x5, 0xb4, + 0x5b, 0x2, 0x163, 0x164, 0x7, 0x1c, 0x2, 0x2, 0x164, 0x165, 0x7, 0xbc, + 0x2, 0x2, 0x165, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x166, 0x167, 0x7, 0x6a, + 0x2, 0x2, 0x167, 0x16a, 0x7, 0x1b, 0x2, 0x2, 0x168, 0x169, 0x7, 0x4c, + 0x2, 0x2, 0x169, 0x16b, 0x7, 0x37, 0x2, 0x2, 0x16a, 0x168, 0x3, 0x2, + 0x2, 0x2, 0x16a, 0x16b, 0x3, 0x2, 0x2, 0x2, 0x16b, 0x16c, 0x3, 0x2, + 0x2, 0x2, 0x16c, 0x16d, 0x5, 0xb4, 0x5b, 0x2, 0x16d, 0x16e, 0x7, 0x81, + 0x2, 0x2, 0x16e, 0x16f, 0x5, 0xe, 0x8, 0x2, 0x16f, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x170, 0x171, 0x7, 0x6a, 0x2, 0x2, 0x171, 0x174, 0x7, 0x1b, + 0x2, 0x2, 0x172, 0x173, 0x7, 0x4c, 0x2, 0x2, 0x173, 0x175, 0x7, 0x37, + 0x2, 0x2, 0x174, 0x172, 0x3, 0x2, 0x2, 0x2, 0x174, 0x175, 0x3, 0x2, + 0x2, 0x2, 0x175, 0x176, 0x3, 0x2, 0x2, 0x2, 0x176, 0x1a0, 0x5, 0x44, + 0x23, 0x2, 0x177, 0x178, 0x7, 0x6a, 0x2, 0x2, 0x178, 0x179, 0x7, 0x77, + 0x2, 0x2, 0x179, 0x17a, 0x7, 0x13, 0x2, 0x2, 0x17a, 0x1a0, 0x5, 0xaa, + 0x56, 0x2, 0x17b, 0x17c, 0x7, 0x6a, 0x2, 0x2, 0x17c, 0x1a0, 0x5, 0x3e, + 0x20, 0x2, 0x17d, 0x17e, 0x7, 0x6c, 0x2, 0x2, 0x17e, 0x188, 0x5, 0x10, + 0x9, 0x2, 0x17f, 0x180, 0x7, 0x9f, 0x2, 0x2, 0x180, 0x181, 0x7, 0x2f, + 0x2, 0x2, 0x181, 0x189, 0x7, 0xbc, 0x2, 0x2, 0x182, 0x183, 0x7, 0x9f, + 0x2, 0x2, 0x183, 0x184, 0x7, 0xae, 0x2, 0x2, 0x184, 0x189, 0x7, 0xbc, + 0x2, 0x2, 0x185, 0x186, 0x7, 0x9f, 0x2, 0x2, 0x186, 0x187, 0x7, 0x97, + 0x2, 0x2, 0x187, 0x189, 0x5, 0xba, 0x5e, 0x2, 0x188, 0x17f, 0x3, 0x2, + 0x2, 0x2, 0x188, 0x182, 0x3, 0x2, 0x2, 0x2, 0x188, 0x185, 0x3, 0x2, + 0x2, 0x2, 0x189, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x18a, 0x18b, 0x7, 0x81, + 0x2, 0x2, 0x18b, 0x1a0, 0x7, 0xa5, 0x2, 0x2, 0x18c, 0x18d, 0x7, 0x82, + 0x2, 0x2, 0x18d, 0x190, 0x7, 0x1b, 0x2, 0x2, 0x18e, 0x18f, 0x7, 0x4c, + 0x2, 0x2, 0x18f, 0x191, 0x7, 0x37, 0x2, 0x2, 0x190, 0x18e, 0x3, 0x2, + 0x2, 0x2, 0x190, 0x191, 0x3, 0x2, 0x2, 0x2, 0x191, 0x192, 0x3, 0x2, + 0x2, 0x2, 0x192, 0x193, 0x5, 0xb4, 0x5b, 0x2, 0x193, 0x194, 0x7, 0x9f, + 0x2, 0x2, 0x194, 0x195, 0x5, 0xb4, 0x5b, 0x2, 0x195, 0x1a0, 0x3, 0x2, + 0x2, 0x2, 0x196, 0x197, 0x7, 0x83, 0x2, 0x2, 0x197, 0x198, 0x5, 0x10, + 0x9, 0x2, 0x198, 0x199, 0x7, 0x42, 0x2, 0x2, 0x199, 0x19a, 0x5, 0xba, + 0x5e, 0x2, 0x19a, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x19b, 0x19c, 0x7, 0xa8, + 0x2, 0x2, 0x19c, 0x19d, 0x5, 0xa, 0x6, 0x2, 0x19d, 0x19e, 0x5, 0x74, + 0x3b, 0x2, 0x19e, 0x1a0, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x108, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x114, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x120, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x126, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x131, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x13a, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x13d, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x13f, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x146, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x14d, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x14f, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x153, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x15c, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x166, 0x3, 0x2, 0x2, 0x2, 0x19f, 0x170, 0x3, 0x2, + 0x2, 0x2, 0x19f, 0x177, 0x3, 0x2, 0x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2, 0x200, 0x201, 0x7, 0x65, 0x2, + 0x2, 0x201, 0x205, 0x7, 0xad, 0x2, 0x2, 0x202, 0x203, 0x7, 0x4c, 0x2, + 0x2, 0x203, 0x204, 0x7, 0x70, 0x2, 0x2, 0x204, 0x206, 0x7, 0x37, 0x2, + 0x2, 0x205, 0x202, 0x3, 0x2, 0x2, 0x2, 0x205, 0x206, 0x3, 0x2, 0x2, + 0x2, 0x206, 0x207, 0x3, 0x2, 0x2, 0x2, 0x207, 0x209, 0x5, 0xba, 0x5e, + 0x2, 0x208, 0x20a, 0x5, 0x2e, 0x18, 0x2, 0x209, 0x208, 0x3, 0x2, 0x2, + 0x2, 0x209, 0x20a, 0x3, 0x2, 0x2, 0x2, 0x20a, 0x20c, 0x3, 0x2, 0x2, + 0x2, 0x20b, 0x20d, 0x5, 0x2c, 0x17, 0x2, 0x20c, 0x20b, 0x3, 0x2, 0x2, + 0x2, 0x20c, 0x20d, 0x3, 0x2, 0x2, 0x2, 0x20d, 0x20f, 0x3, 0x2, 0x2, + 0x2, 0x20e, 0x210, 0x5, 0x34, 0x1b, 0x2, 0x20f, 0x20e, 0x3, 0x2, 0x2, + 0x2, 0x20f, 0x210, 0x3, 0x2, 0x2, 0x2, 0x210, 0x216, 0x3, 0x2, 0x2, + 0x2, 0x211, 0x217, 0x5, 0x30, 0x19, 0x2, 0x212, 0x214, 0x5, 0x36, 0x1c, + 0x2, 0x213, 0x215, 0x7, 0x7b, 0x2, 0x2, 0x214, 0x213, 0x3, 0x2, 0x2, + 0x2, 0x214, 0x215, 0x3, 0x2, 0x2, 0x2, 0x215, 0x217, 0x3, 0x2, 0x2, + 0x2, 0x216, 0x211, 0x3, 0x2, 0x2, 0x2, 0x216, 0x212, 0x3, 0x2, 0x2, + 0x2, 0x217, 0x218, 0x3, 0x2, 0x2, 0x2, 0x218, 0x219, 0x5, 0x32, 0x1a, + 0x2, 0x219, 0x24c, 0x3, 0x2, 0x2, 0x2, 0x21a, 0x21c, 0x9, 0x3, 0x2, + 0x2, 0x21b, 0x21d, 0x7, 0x99, 0x2, 0x2, 0x21c, 0x21b, 0x3, 0x2, 0x2, + 0x2, 0x21c, 0x21d, 0x3, 0x2, 0x2, 0x2, 0x21d, 0x21e, 0x3, 0x2, 0x2, + 0x2, 0x21e, 0x222, 0x7, 0x97, 0x2, 0x2, 0x21f, 0x220, 0x7, 0x4c, 0x2, + 0x2, 0x220, 0x221, 0x7, 0x70, 0x2, 0x2, 0x221, 0x223, 0x7, 0x37, 0x2, + 0x2, 0x222, 0x21f, 0x3, 0x2, 0x2, 0x2, 0x222, 0x223, 0x3, 0x2, 0x2, + 0x2, 0x223, 0x224, 0x3, 0x2, 0x2, 0x2, 0x224, 0x226, 0x5, 0xba, 0x5e, + 0x2, 0x225, 0x227, 0x5, 0x2e, 0x18, 0x2, 0x226, 0x225, 0x3, 0x2, 0x2, + 0x2, 0x226, 0x227, 0x3, 0x2, 0x2, 0x2, 0x227, 0x229, 0x3, 0x2, 0x2, + 0x2, 0x228, 0x22a, 0x5, 0x2c, 0x17, 0x2, 0x229, 0x228, 0x3, 0x2, 0x2, + 0x2, 0x229, 0x22a, 0x3, 0x2, 0x2, 0x2, 0x22a, 0x22c, 0x3, 0x2, 0x2, + 0x2, 0x22b, 0x22d, 0x5, 0x34, 0x1b, 0x2, 0x22c, 0x22b, 0x3, 0x2, 0x2, + 0x2, 0x22c, 0x22d, 0x3, 0x2, 0x2, 0x2, 0x22d, 0x22f, 0x3, 0x2, 0x2, + 0x2, 0x22e, 0x230, 0x5, 0x36, 0x1c, 0x2, 0x22f, 0x22e, 0x3, 0x2, 0x2, + 0x2, 0x22f, 0x230, 0x3, 0x2, 0x2, 0x2, 0x230, 0x232, 0x3, 0x2, 0x2, + 0x2, 0x231, 0x233, 0x5, 0x32, 0x1a, 0x2, 0x232, 0x231, 0x3, 0x2, 0x2, + 0x2, 0x232, 0x233, 0x3, 0x2, 0x2, 0x2, 0x233, 0x24c, 0x3, 0x2, 0x2, + 0x2, 0x234, 0x237, 0x9, 0x3, 0x2, 0x2, 0x235, 0x236, 0x7, 0x76, 0x2, + 0x2, 0x236, 0x238, 0x7, 0x83, 0x2, 0x2, 0x237, 0x235, 0x3, 0x2, 0x2, + 0x2, 0x237, 0x238, 0x3, 0x2, 0x2, 0x2, 0x238, 0x239, 0x3, 0x2, 0x2, + 0x2, 0x239, 0x23d, 0x7, 0xad, 0x2, 0x2, 0x23a, 0x23b, 0x7, 0x4c, 0x2, + 0x2, 0x23b, 0x23c, 0x7, 0x70, 0x2, 0x2, 0x23c, 0x23e, 0x7, 0x37, 0x2, + 0x2, 0x23d, 0x23a, 0x3, 0x2, 0x2, 0x2, 0x23d, 0x23e, 0x3, 0x2, 0x2, + 0x2, 0x23e, 0x23f, 0x3, 0x2, 0x2, 0x2, 0x23f, 0x241, 0x5, 0xba, 0x5e, + 0x2, 0x240, 0x242, 0x5, 0x2e, 0x18, 0x2, 0x241, 0x240, 0x3, 0x2, 0x2, + 0x2, 0x241, 0x242, 0x3, 0x2, 0x2, 0x2, 0x242, 0x244, 0x3, 0x2, 0x2, + 0x2, 0x243, 0x245, 0x5, 0x2c, 0x17, 0x2, 0x244, 0x243, 0x3, 0x2, 0x2, + 0x2, 0x244, 0x245, 0x3, 0x2, 0x2, 0x2, 0x245, 0x247, 0x3, 0x2, 0x2, + 0x2, 0x246, 0x248, 0x5, 0x34, 0x1b, 0x2, 0x247, 0x246, 0x3, 0x2, 0x2, + 0x2, 0x247, 0x248, 0x3, 0x2, 0x2, 0x2, 0x248, 0x249, 0x3, 0x2, 0x2, + 0x2, 0x249, 0x24a, 0x5, 0x32, 0x1a, 0x2, 0x24a, 0x24c, 0x3, 0x2, 0x2, + 0x2, 0x24b, 0x1c2, 0x3, 0x2, 0x2, 0x2, 0x24b, 0x1d0, 0x3, 0x2, 0x2, + 0x2, 0x24b, 0x1e1, 0x3, 0x2, 0x2, 0x2, 0x24b, 0x1ff, 0x3, 0x2, 0x2, + 0x2, 0x24b, 0x21a, 0x3, 0x2, 0x2, 0x2, 0x24b, 0x234, 0x3, 0x2, 0x2, + 0x2, 0x24c, 0x17, 0x3, 0x2, 0x2, 0x2, 0x24d, 0x24e, 0x7, 0xcd, 0x2, + 0x2, 0x24e, 0x253, 0x5, 0x1a, 0xe, 0x2, 0x24f, 0x250, 0x7, 0xc2, 0x2, + 0x2, 0x250, 0x252, 0x5, 0x1a, 0xe, 0x2, 0x251, 0x24f, 0x3, 0x2, 0x2, + 0x2, 0x252, 0x255, 0x3, 0x2, 0x2, 0x2, 0x253, 0x251, 0x3, 0x2, 0x2, + 0x2, 0x253, 0x254, 0x3, 0x2, 0x2, 0x2, 0x254, 0x256, 0x3, 0x2, 0x2, + 0x2, 0x255, 0x253, 0x3, 0x2, 0x2, 0x2, 0x256, 0x257, 0x7, 0xd7, 0x2, + 0x2, 0x257, 0x19, 0x3, 0x2, 0x2, 0x2, 0x258, 0x259, 0x5, 0xd0, 0x69, + 0x2, 0x259, 0x26f, 0x5, 0xa4, 0x53, 0x2, 0x25a, 0x25b, 0x6, 0xe, 0x2, + 0x3, 0x25b, 0x25c, 0x7, 0x26, 0x2, 0x2, 0x25c, 0x25d, 0x5, 0xc6, 0x64, + 0x2, 0x25d, 0x25e, 0x8, 0xe, 0x1, 0x2, 0x25e, 0x26e, 0x3, 0x2, 0x2, + 0x2, 0x25f, 0x260, 0x6, 0xe, 0x3, 0x3, 0x260, 0x261, 0x7, 0x39, 0x2, + 0x2, 0x261, 0x262, 0x5, 0xaa, 0x56, 0x2, 0x262, 0x263, 0x8, 0xe, 0x1, + 0x2, 0x263, 0x26e, 0x3, 0x2, 0x2, 0x2, 0x264, 0x265, 0x6, 0xe, 0x4, + 0x3, 0x265, 0x266, 0x7, 0x49, 0x2, 0x2, 0x266, 0x26e, 0x8, 0xe, 0x1, + 0x2, 0x267, 0x268, 0x6, 0xe, 0x5, 0x3, 0x268, 0x269, 0x7, 0x51, 0x2, + 0x2, 0x269, 0x26e, 0x8, 0xe, 0x1, 0x2, 0x26a, 0x26b, 0x6, 0xe, 0x6, + 0x3, 0x26b, 0x26c, 0x7, 0x57, 0x2, 0x2, 0x26c, 0x26e, 0x8, 0xe, 0x1, + 0x2, 0x26d, 0x25a, 0x3, 0x2, 0x2, 0x2, 0x26d, 0x25f, 0x3, 0x2, 0x2, + 0x2, 0x26d, 0x264, 0x3, 0x2, 0x2, 0x2, 0x26d, 0x267, 0x3, 0x2, 0x2, + 0x2, 0x26d, 0x26a, 0x3, 0x2, 0x2, 0x2, 0x26e, 0x271, 0x3, 0x2, 0x2, + 0x2, 0x26f, 0x26d, 0x3, 0x2, 0x2, 0x2, 0x26f, 0x270, 0x3, 0x2, 0x2, + 0x2, 0x270, 0x1b, 0x3, 0x2, 0x2, 0x2, 0x271, 0x26f, 0x3, 0x2, 0x2, 0x2, + 0x272, 0x274, 0x5, 0x1e, 0x10, 0x2, 0x273, 0x272, 0x3, 0x2, 0x2, 0x2, + 0x273, 0x274, 0x3, 0x2, 0x2, 0x2, 0x274, 0x28b, 0x3, 0x2, 0x2, 0x2, + 0x275, 0x276, 0x6, 0xf, 0x7, 0x3, 0x276, 0x277, 0x5, 0x22, 0x12, 0x2, + 0x277, 0x278, 0x8, 0xf, 0x1, 0x2, 0x278, 0x28a, 0x3, 0x2, 0x2, 0x2, + 0x279, 0x27a, 0x6, 0xf, 0x8, 0x3, 0x27a, 0x27b, 0x5, 0x24, 0x13, 0x2, + 0x27b, 0x27c, 0x8, 0xf, 0x1, 0x2, 0x27c, 0x28a, 0x3, 0x2, 0x2, 0x2, + 0x27d, 0x27e, 0x6, 0xf, 0x9, 0x3, 0x27e, 0x27f, 0x5, 0x26, 0x14, 0x2, + 0x27f, 0x280, 0x8, 0xf, 0x1, 0x2, 0x280, 0x28a, 0x3, 0x2, 0x2, 0x2, + 0x281, 0x282, 0x6, 0xf, 0xa, 0x3, 0x282, 0x283, 0x5, 0x28, 0x15, 0x2, + 0x283, 0x284, 0x8, 0xf, 0x1, 0x2, 0x284, 0x28a, 0x3, 0x2, 0x2, 0x2, + 0x285, 0x286, 0x6, 0xf, 0xb, 0x3, 0x286, 0x287, 0x5, 0x2a, 0x16, 0x2, + 0x287, 0x288, 0x8, 0xf, 0x1, 0x2, 0x288, 0x28a, 0x3, 0x2, 0x2, 0x2, + 0x289, 0x275, 0x3, 0x2, 0x2, 0x2, 0x289, 0x279, 0x3, 0x2, 0x2, 0x2, + 0x289, 0x27d, 0x3, 0x2, 0x2, 0x2, 0x289, 0x281, 0x3, 0x2, 0x2, 0x2, + 0x289, 0x285, 0x3, 0x2, 0x2, 0x2, 0x28a, 0x28d, 0x3, 0x2, 0x2, 0x2, + 0x28b, 0x289, 0x3, 0x2, 0x2, 0x2, 0x28b, 0x28c, 0x3, 0x2, 0x2, 0x2, + 0x28c, 0x1d, 0x3, 0x2, 0x2, 0x2, 0x28d, 0x28b, 0x3, 0x2, 0x2, 0x2, 0x28e, + 0x28f, 0x7, 0x7d, 0x2, 0x2, 0x28f, 0x290, 0x7, 0x59, 0x2, 0x2, 0x290, + 0x291, 0x5, 0xa6, 0x54, 0x2, 0x291, 0x1f, 0x3, 0x2, 0x2, 0x2, 0x292, + 0x299, 0x5, 0xd0, 0x69, 0x2, 0x293, 0x296, 0x5, 0xd0, 0x69, 0x2, 0x294, + 0x295, 0x7, 0xcd, 0x2, 0x2, 0x295, 0x297, 0x7, 0xd7, 0x2, 0x2, 0x296, + 0x294, 0x3, 0x2, 0x2, 0x2, 0x296, 0x297, 0x3, 0x2, 0x2, 0x2, 0x297, + 0x29a, 0x3, 0x2, 0x2, 0x2, 0x298, 0x29a, 0x5, 0xc6, 0x64, 0x2, 0x299, + 0x293, 0x3, 0x2, 0x2, 0x2, 0x299, 0x298, 0x3, 0x2, 0x2, 0x2, 0x29a, + 0x21, 0x3, 0x2, 0x2, 0x2, 0x29b, 0x29c, 0x7, 0x90, 0x2, 0x2, 0x29c, + 0x29d, 0x7, 0xcd, 0x2, 0x2, 0x29d, 0x29e, 0x5, 0xd0, 0x69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 0x1c, 0x1, 0x2, 0x30d, 0x313, 0x3, + 0x2, 0x2, 0x2, 0x30e, 0x30f, 0x6, 0x1c, 0x11, 0x3, 0x30f, 0x310, 0x5, + 0x80, 0x41, 0x2, 0x310, 0x311, 0x8, 0x1c, 0x1, 0x2, 0x311, 0x313, 0x3, + 0x2, 0x2, 0x2, 0x312, 0x2fa, 0x3, 0x2, 0x2, 0x2, 0x312, 0x2fe, 0x3, + 0x2, 0x2, 0x2, 0x312, 0x302, 0x3, 0x2, 0x2, 0x2, 0x312, 0x306, 0x3, + 0x2, 0x2, 0x2, 0x312, 0x30a, 0x3, 0x2, 0x2, 0x2, 0x312, 0x30e, 0x3, + 0x2, 0x2, 0x2, 0x313, 0x316, 0x3, 0x2, 0x2, 0x2, 0x314, 0x312, 0x3, + 0x2, 0x2, 0x2, 0x314, 0x315, 0x3, 0x2, 0x2, 0x2, 0x315, 0x37, 0x3, 0x2, + 0x2, 0x2, 0x316, 0x314, 0x3, 0x2, 0x2, 0x2, 0x317, 0x318, 0x7, 0x7a, + 0x2, 0x2, 0x318, 0x319, 0x7, 0x13, 0x2, 0x2, 0x319, 0x31a, 0x5, 0xaa, + 0x56, 0x2, 0x31a, 0x39, 0x3, 0x2, 0x2, 0x2, 0x31b, 0x31c, 0x7, 0x7d, + 0x2, 0x2, 0x31c, 0x31d, 0x7, 0x59, 0x2, 0x2, 0x31d, 0x31e, 0x5, 0xaa, + 0x56, 0x2, 0x31e, 0x3b, 0x3, 0x2, 0x2, 0x2, 0x31f, 0x320, 0x7, 0x88, + 0x2, 0x2, 0x320, 0x321, 0x7, 0x13, 0x2, 0x2, 0x321, 0x322, 0x5, 0xaa, + 0x56, 0x2, 0x322, 0x3d, 0x3, 0x2, 0x2, 0x2, 0x323, 0x324, 0x7, 0xa5, + 0x2, 0x2, 0x324, 0x329, 0x5, 0x4e, 0x28, 0x2, 0x325, 0x326, 0x7, 0xc2, + 0x2, 0x2, 0x326, 0x328, 0x5, 0x4e, 0x28, 0x2, 0x327, 0x325, 0x3, 0x2, + 0x2, 0x2, 0x328, 0x32b, 0x3, 0x2, 0x2, 0x2, 0x329, 0x327, 0x3, 0x2, + 0x2, 0x2, 0x329, 0x32a, 0x3, 0x2, 0x2, 0x2, 0x32a, 0x3f, 0x3, 0x2, 0x2, + 0x2, 0x32b, 0x329, 0x3, 0x2, 0x2, 0x2, 0x32c, 0x32e, 0x7, 0x35, 0x2, + 0x2, 0x32d, 0x32f, 0x7, 0xc7, 0x2, 0x2, 0x32e, 0x32d, 0x3, 0x2, 0x2, + 0x2, 0x32e, 0x32f, 0x3, 0x2, 0x2, 0x2, 0x32f, 0x330, 0x3, 0x2, 0x2, + 0x2, 0x330, 0x336, 0x5, 0xd2, 0x6a, 0x2, 0x331, 0x333, 0x7, 0xcd, 0x2, + 0x2, 0x332, 0x334, 0x5, 0xa6, 0x54, 0x2, 0x333, 0x332, 0x3, 0x2, 0x2, + 0x2, 0x333, 0x334, 0x3, 0x2, 0x2, 0x2, 0x334, 0x335, 0x3, 0x2, 0x2, + 0x2, 0x335, 0x337, 0x7, 0xd7, 0x2, 0x2, 0x336, 0x331, 0x3, 0x2, 0x2, + 0x2, 0x336, 0x337, 0x3, 0x2, 0x2, 0x2, 0x337, 0x41, 0x3, 0x2, 0x2, 0x2, + 0x338, 0x341, 0x5, 0x44, 0x23, 0x2, 0x339, 0x33a, 0x7, 0x1d, 0x2, 0x2, + 0x33a, 0x33b, 0x5, 0xd0, 0x69, 0x2, 0x33b, 0x33c, 0x7, 0x16, 0x2, 0x2, + 0x33c, 0x33d, 0x5, 0xaa, 0x56, 0x2, 0x33d, 0x341, 0x3, 0x2, 0x2, 0x2, + 0x33e, 0x33f, 0x7, 0x4f, 0x2, 0x2, 0x33f, 0x341, 0x5, 0x48, 0x25, 0x2, + 0x340, 0x338, 0x3, 0x2, 0x2, 0x2, 0x340, 0x339, 0x3, 0x2, 0x2, 0x2, + 0x340, 0x33e, 0x3, 0x2, 0x2, 0x2, 0x341, 0x43, 0x3, 0x2, 0x2, 0x2, 0x342, + 0x343, 0x5, 0xb4, 0x5b, 0x2, 0x343, 0x345, 0x5, 0xa4, 0x53, 0x2, 0x344, + 0x346, 0x5, 0x46, 0x24, 0x2, 0x345, 0x344, 0x3, 0x2, 0x2, 0x2, 0x345, + 0x346, 0x3, 0x2, 0x2, 0x2, 0x346, 0x349, 0x3, 0x2, 0x2, 0x2, 0x347, + 0x348, 0x7, 0x1c, 0x2, 0x2, 0x348, 0x34a, 0x7, 0xbc, 0x2, 0x2, 0x349, + 0x347, 0x3, 0x2, 0x2, 0x2, 0x349, 0x34a, 0x3, 0x2, 0x2, 0x2, 0x34a, + 0x34c, 0x3, 0x2, 0x2, 0x2, 0x34b, 0x34d, 0x5, 0x4a, 0x26, 0x2, 0x34c, + 0x34b, 0x3, 0x2, 0x2, 0x2, 0x34c, 0x34d, 0x3, 0x2, 0x2, 0x2, 0x34d, + 0x350, 0x3, 0x2, 0x2, 0x2, 0x34e, 0x34f, 0x7, 0xa5, 0x2, 0x2, 0x34f, + 0x351, 0x5, 0xaa, 0x56, 0x2, 0x350, 0x34e, 0x3, 0x2, 0x2, 0x2, 0x350, + 0x351, 0x3, 0x2, 0x2, 0x2, 0x351, 0x363, 0x3, 0x2, 0x2, 0x2, 0x352, + 0x354, 0x5, 0xb4, 0x5b, 0x2, 0x353, 0x355, 0x5, 0xa4, 0x53, 0x2, 0x354, + 0x353, 0x3, 0x2, 0x2, 0x2, 0x354, 0x355, 0x3, 0x2, 0x2, 0x2, 0x355, + 0x356, 0x3, 0x2, 0x2, 0x2, 0x356, 0x359, 0x5, 0x46, 0x24, 0x2, 0x357, + 0x358, 0x7, 0x1c, 0x2, 0x2, 0x358, 0x35a, 0x7, 0xbc, 0x2, 0x2, 0x359, + 0x357, 0x3, 0x2, 0x2, 0x2, 0x359, 0x35a, 0x3, 0x2, 0x2, 0x2, 0x35a, + 0x35c, 0x3, 0x2, 0x2, 0x2, 0x35b, 0x35d, 0x5, 0x4a, 0x26, 0x2, 0x35c, + 0x35b, 0x3, 0x2, 0x2, 0x2, 0x35c, 0x35d, 0x3, 0x2, 0x2, 0x2, 0x35d, + 0x360, 0x3, 0x2, 0x2, 0x2, 0x35e, 0x35f, 0x7, 0xa5, 0x2, 0x2, 0x35f, + 0x361, 0x5, 0xaa, 0x56, 0x2, 0x360, 0x35e, 0x3, 0x2, 0x2, 0x2, 0x360, + 0x361, 0x3, 0x2, 0x2, 0x2, 0x361, 0x363, 0x3, 0x2, 0x2, 0x2, 0x362, + 0x342, 0x3, 0x2, 0x2, 0x2, 0x362, 0x352, 0x3, 0x2, 0x2, 0x2, 0x363, + 0x45, 0x3, 0x2, 0x2, 0x2, 0x364, 0x365, 0x9, 0x4, 0x2, 0x2, 0x365, 0x366, + 0x5, 0xaa, 0x56, 0x2, 0x366, 0x47, 0x3, 0x2, 0x2, 0x2, 0x367, 0x368, + 0x5, 0xb4, 0x5b, 0x2, 0x368, 0x369, 0x5, 0xaa, 0x56, 0x2, 0x369, 0x36a, + 0x7, 0xa6, 0x2, 0x2, 0x36a, 0x36b, 0x5, 0xa4, 0x53, 0x2, 0x36b, 0x36c, + 0x7, 0x46, 0x2, 0x2, 0x36c, 0x36d, 0x7, 0xba, 0x2, 0x2, 0x36d, 0x49, + 0x3, 0x2, 0x2, 0x2, 0x36e, 0x36f, 0x7, 0x19, 0x2, 0x2, 0x36f, 0x370, + 0x7, 0xcd, 0x2, 0x2, 0x370, 0x375, 0x5, 0x4c, 0x27, 0x2, 0x371, 0x372, + 0x7, 0xc2, 0x2, 0x2, 0x372, 0x374, 0x5, 0x4c, 0x27, 0x2, 0x373, 0x371, + 0x3, 0x2, 0x2, 0x2, 0x374, 0x377, 0x3, 0x2, 0x2, 0x2, 0x375, 0x373, + 0x3, 0x2, 0x2, 0x2, 0x375, 0x376, 0x3, 0x2, 0x2, 0x2, 0x376, 0x378, + 0x3, 0x2, 0x2, 0x2, 0x377, 0x375, 0x3, 0x2, 0x2, 0x2, 0x378, 0x379, + 0x7, 0xd7, 0x2, 0x2, 0x379, 0x4b, 0x3, 0x2, 0x2, 0x2, 0x37a, 0x380, + 0x5, 0xd0, 0x69, 0x2, 0x37b, 0x37d, 0x7, 0xcd, 0x2, 0x2, 0x37c, 0x37e, + 0x5, 0xa6, 0x54, 0x2, 0x37d, 0x37c, 0x3, 0x2, 0x2, 0x2, 0x37d, 0x37e, + 0x3, 0x2, 0x2, 0x2, 0x37e, 0x37f, 0x3, 0x2, 0x2, 0x2, 0x37f, 0x381, + 0x7, 0xd7, 0x2, 0x2, 0x380, 0x37b, 0x3, 0x2, 0x2, 0x2, 0x380, 0x381, + 0x3, 0x2, 0x2, 0x2, 0x381, 0x4d, 0x3, 0x2, 0x2, 0x2, 0x382, 0x38a, 0x5, + 0xaa, 0x56, 0x2, 0x383, 0x38b, 0x7, 0x28, 0x2, 0x2, 0x384, 0x385, 0x7, + 0x9f, 0x2, 0x2, 0x385, 0x386, 0x7, 0x2f, 0x2, 0x2, 0x386, 0x38b, 0x7, + 0xbc, 0x2, 0x2, 0x387, 0x388, 0x7, 0x9f, 0x2, 0x2, 0x388, 0x389, 0x7, + 0xae, 0x2, 0x2, 0x389, 0x38b, 0x7, 0xbc, 0x2, 0x2, 0x38a, 0x383, 0x3, + 0x2, 0x2, 0x2, 0x38a, 0x384, 0x3, 0x2, 0x2, 0x2, 0x38a, 0x387, 0x3, + 0x2, 0x2, 0x2, 0x38a, 0x38b, 0x3, 0x2, 0x2, 0x2, 0x38b, 0x4f, 0x3, 0x2, + 0x2, 0x2, 0x38c, 0x38e, 0x9, 0x5, 0x2, 0x2, 0x38d, 0x38f, 0x7, 0x97, + 0x2, 0x2, 0x38e, 0x38d, 0x3, 0x2, 0x2, 0x2, 0x38e, 0x38f, 0x3, 0x2, + 0x2, 0x2, 0x38f, 0x390, 0x3, 0x2, 0x2, 0x2, 0x390, 0x391, 0x5, 0xb6, + 0x5c, 0x2, 0x391, 0x51, 0x3, 0x2, 0x2, 0x2, 0x392, 0x393,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, 0x66, 0x34, 0x2, 0x410, 0x411, 0x7, 0xa7, 0x2, 0x2, 0x411, 0x412, + 0x7, 0x6, 0x2, 0x2, 0x412, 0x414, 0x5, 0x66, 0x34, 0x2, 0x413, 0x410, + 0x3, 0x2, 0x2, 0x2, 0x414, 0x417, 0x3, 0x2, 0x2, 0x2, 0x415, 0x413, + 0x3, 0x2, 0x2, 0x2, 0x415, 0x416, 0x3, 0x2, 0x2, 0x2, 0x416, 0x65, 0x3, + 0x2, 0x2, 0x2, 0x417, 0x415, 0x3, 0x2, 0x2, 0x2, 0x418, 0x41e, 0x5, + 0x68, 0x35, 0x2, 0x419, 0x41a, 0x7, 0xcd, 0x2, 0x2, 0x41a, 0x41b, 0x5, + 0x64, 0x33, 0x2, 0x41b, 0x41c, 0x7, 0xd7, 0x2, 0x2, 0x41c, 0x41e, 0x3, + 0x2, 0x2, 0x2, 0x41d, 0x418, 0x3, 0x2, 0x2, 0x2, 0x41d, 0x419, 0x3, + 0x2, 0x2, 0x2, 0x41e, 0x67, 0x3, 0x2, 0x2, 0x2, 0x41f, 0x421, 0x5, 0x6a, + 0x36, 0x2, 0x420, 0x41f, 0x3, 0x2, 0x2, 0x2, 0x420, 0x421, 0x3, 0x2, + 0x2, 0x2, 0x421, 0x422, 0x3, 0x2, 0x2, 0x2, 0x422, 0x424, 0x7, 0x8a, + 0x2, 0x2, 0x423, 0x425, 0x7, 0x30, 0x2, 0x2, 0x424, 0x423, 0x3, 0x2, + 0x2, 0x2, 0x424, 0x425, 0x3, 0x2, 0x2, 0x2, 0x425, 0x427, 0x3, 0x2, + 0x2, 0x2, 0x426, 0x428, 0x5, 0x6c, 0x37, 0x2, 0x427, 0x426, 0x3, 0x2, + 0x2, 0x2, 0x427, 0x428, 0x3, 0x2, 0x2, 0x2, 0x428, 0x429, 0x3, 0x2, + 0x2, 0x2, 0x429, 0x42b, 0x5, 0xa6, 0x54, 0x2, 0x42a, 0x42c, 0x5, 0x6e, + 0x38, 0x2, 0x42b, 0x42a, 0x3, 0x2, 0x2, 0x2, 0x42b, 0x42c, 0x3, 0x2, + 0x2, 0x2, 0x42c, 0x42e, 0x3, 0x2, 0x2, 0x2, 0x42d, 0x42f, 0x5, 0x70, + 0x39, 0x2, 0x42e, 0x42d, 0x3, 0x2, 0x2, 0x2, 0x42e, 0x42f, 0x3, 0x2, + 0x2, 0x2, 0x42f, 0x431, 0x3, 0x2, 0x2, 0x2, 0x430, 0x432, 0x5, 0x72, + 0x3a, 0x2, 0x431, 0x430, 0x3, 0x2, 0x2, 0x2, 0x431, 0x432, 0x3, 0x2, + 0x2, 0x2, 0x432, 0x434, 0x3, 0x2, 0x2, 0x2, 0x433, 0x435, 0x5, 0x74, + 0x3b, 0x2, 0x434, 0x433, 0x3, 0x2, 0x2, 0x2, 0x434, 0x435, 0x3, 0x2, + 0x2, 0x2, 0x435, 0x437, 0x3, 0x2, 0x2, 0x2, 0x436, 0x438, 0x5, 0x76, + 0x3c, 0x2, 0x437, 0x436, 0x3, 0x2, 0x2, 0x2, 0x437, 0x438, 0x3, 0x2, + 0x2, 0x2, 0x438, 0x43b, 0x3, 0x2, 0x2, 0x2, 0x439, 0x43a, 0x7, 0xb3, + 0x2, 0x2, 0x43a, 0x43c, 0x9, 0x8, 0x2, 0x2, 0x43b, 0x439, 0x3, 0x2, + 0x2, 0x2, 0x43b, 0x43c, 0x3, 0x2, 0x2, 0x2, 0x43c, 0x43f, 0x3, 0x2, + 0x2, 0x2, 0x43d, 0x43e, 0x7, 0xb3, 0x2, 0x2, 0x43e, 0x440, 0x7, 0xa1, + 0x2, 0x2, 0x43f, 0x43d, 0x3, 0x2, 0x2, 0x2, 0x43f, 0x440, 0x3, 0x2, + 0x2, 0x2, 0x440, 0x442, 0x3, 0x2, 0x2, 0x2, 0x441, 0x443, 0x5, 0x78, + 0x3d, 0x2, 0x442, 0x441, 0x3, 0x2, 0x2, 0x2, 0x442, 0x443, 0x3, 0x2, + 0x2, 0x2, 0x443, 0x445, 0x3, 0x2, 0x2, 0x2, 0x444, 0x446, 0x5, 0x7a, + 0x3e, 0x2, 0x445, 0x444, 0x3, 0x2, 0x2, 0x2, 0x445, 0x446, 0x3, 0x2, + 0x2, 0x2, 0x446, 0x448, 0x3, 0x2, 0x2, 0x2, 0x447, 0x449, 0x5, 0x7c, + 0x3f, 0x2, 0x448, 0x447, 0x3, 0x2, 0x2, 0x2, 0x448, 0x449, 0x3, 0x2, + 0x2, 0x2, 0x449, 0x44b, 0x3, 0x2, 0x2, 0x2, 0x44a, 0x44c, 0x5, 0x7e, + 0x40, 0x2, 0x44b, 0x44a, 0x3, 0x2, 0x2, 0x2, 0x44b, 0x44c, 0x3, 0x2, + 0x2, 0x2, 0x44c, 0x44e, 0x3, 0x2, 0x2, 0x2, 0x44d, 0x44f, 0x5, 0x80, + 0x41, 0x2, 0x44e, 0x44d, 0x3, 0x2, 0x2, 0x2, 0x44e, 0x44f, 0x3, 0x2, + 0x2, 0x2, 0x44f, 0x69, 0x3, 0x2, 0x2, 0x2, 0x450, 0x451, 0x7, 0xb3, + 0x2, 0x2, 0x451, 0x452, 0x5, 0xa6, 0x54, 0x2, 0x452, 0x6b, 0x3, 0x2, + 0x2, 0x2, 0x453, 0x454, 0x7, 0xa0, 0x2, 0x2, 0x454, 0x457, 0x7, 0xba, + 0x2, 0x2, 0x455, 0x456, 0x7, 0xb3, 0x2, 0x2, 0x456, 0x458, 0x7, 0x9c, + 0x2, 0x2, 0x457, 0x455, 0x3, 0x2, 0x2, 0x2, 0x457, 0x458, 0x3, 0x2, + 0x2, 0x2, 0x458, 0x6d, 0x3, 0x2, 0x2, 0x2, 0x459, 0x45a, 0x7, 0x42, + 0x2, 0x2, 0x45a, 0x45b, 0x5, 0x82, 0x42, 0x2, 0x45b, 0x6f, 0x3, 0x2, + 0x2, 0x2, 0x45c, 0x45e, 0x9, 0x9, 0x2, 0x2, 0x45d, 0x45c, 0x3, 0x2, + 0x2, 0x2, 0x45d, 0x45e, 0x3, 0x2, 0x2, 0x2, 0x45e, 0x45f, 0x3, 0x2, + 0x2, 0x2, 0x45f, 0x460, 0x7, 0xb, 0x2, 0x2, 0x460, 0x461, 0x7, 0x58, + 0x2, 0x2, 0x461, 0x462, 0x5, 0xa6, 0x54, 0x2, 0x462, 0x71, 0x3, 0x2, + 0x2, 0x2, 0x463, 0x464, 0x7, 0x7c, 0x2, 0x2, 0x464, 0x465, 0x5, 0xaa, + 0x56, 0x2, 0x465, 0x73, 0x3, 0x2, 0x2, 0x2, 0x466, 0x467, 0x7, 0xb2, + 0x2, 0x2, 0x467, 0x468, 0x5, 0xaa, 0x56, 0x2, 0x468, 0x75, 0x3, 0x2, + 0x2, 0x2, 0x469, 0x46a, 0x7, 0x47, 0x2, 0x2, 0x46a, 0x471, 0x7, 0x13, + 0x2, 0x2, 0x46b, 0x46c, 0x9, 0x8, 0x2, 0x2, 0x46c, 0x46d, 0x7, 0xcd, + 0x2, 0x2, 0x46d, 0x46e, 0x5, 0xa6, 0x54, 0x2, 0x46e, 0x46f, 0x7, 0xd7, + 0x2, 0x2, 0x46f, 0x472, 0x3, 0x2, 0x2, 0x2, 0x470, 0x472, 0x5, 0xa6, + 0x54, 0x2, 0x471, 0x46b, 0x3, 0x2, 0x2, 0x2, 0x471, 0x470, 0x3, 0x2, + 0x2, 0x2, 0x472, 0x77, 0x3, 0x2, 0x2, 0x2, 0x473, 0x474, 0x7, 0x48, + 0x2, 0x2, 0x474, 0x475, 0x5, 0xaa, 0x56, 0x2, 0x475, 0x79, 0x3, 0x2, + 0x2, 0x2, 0x476, 0x477, 0x7, 0x77, 0x2, 0x2, 0x477, 0x478, 0x7, 0x13, + 0x2, 0x2, 0x478, 0x479, 0x5, 0x8e, 0x48, 0x2, 0x479, 0x7b, 0x3, 0x2, + 0x2, 0x2, 0x47a, 0x47b, 0x7, 0x61, 0x2, 0x2, 0x47b, 0x47c, 0x5, 0x8c, + 0x47, 0x2, 0x47c, 0x47d, 0x7, 0x13, 0x2, 0x2, 0x47d, 0x47e, 0x5, 0xa6, + 0x54, 0x2, 0x47e, 0x7d, 0x3, 0x2, 0x2, 0x2, 0x47f, 0x480, 0x7, 0x61, + 0x2, 0x2, 0x480, 0x483, 0x5, 0x8c, 0x47, 0x2, 0x481, 0x482, 0x7, 0xb3, + 0x2, 0x2, 0x482, 0x484, 0x7, 0x9c, 0x2, 0x2, 0x483, 0x481, 0x3, 0x2, + 0x2, 0x2, 0x483, 0x484, 0x3, 0x2, 0x2, 0x2, 0x484, 0x7f, 0x3, 0x2, 0x2, + 0x2, 0x485, 0x486, 0x7, 0x8e, 0x2, 0x2, 0x486, 0x487, 0x5, 0x94, 0x4b, + 0x2, 0x487, 0x81, 0x3, 0x2, 0x2, 0x2, 0x488, 0x489, 0x8, 0x42, 0x1, + 0x2, 0x489, 0x48b, 0x5, 0xb6, 0x5c, 0x2, 0x48a, 0x48c, 0x7, 0x3c, 0x2, + 0x2, 0x48b, 0x48a, 0x3, 0x2, 0x2, 0x2, 0x48b, 0x48c, 0x3, 0x2, 0x2, + 0x2, 0x48c, 0x48e, 0x3, 0x2, 0x2, 0x2, 0x48d, 0x48f, 0x5, 0x8a, 0x46, + 0x2, 0x48e, 0x48d, 0x3, 0x2, 0x2, 0x2, 0x48e, 0x48f, 0x3, 0x2, 0x2, + 0x2, 0x48f, 0x495, 0x3, 0x2, 0x2, 0x2, 0x490, 0x491, 0x7, 0xcd, 0x2, + 0x2, 0x491, 0x492, 0x5, 0x82, 0x42, 0x2, 0x492, 0x493, 0x7, 0xd7, 0x2, + 0x2, 0x493, 0x495, 0x3, 0x2, 0x2, 0x2, 0x494, 0x488, 0x3, 0x2, 0x2, + 0x2, 0x494, 0x490, 0x3, 0x2, 0x2, 0x2, 0x495, 0x4a7, 0x3, 0x2, 0x2, + 0x2, 0x496, 0x497, 0xc, 0x5, 0x2, 0x2, 0x497, 0x498, 0x5, 0x86, 0x44, + 0x2, 0x498, 0x499, 0x5, 0x82, 0x42, 0x6, 0x499, 0x4a6, 0x3, 0x2, 0x2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, 0x512, + 0x515, 0x3, 0x2, 0x2, 0x2, 0x513, 0x511, 0x3, 0x2, 0x2, 0x2, 0x513, + 0x514, 0x3, 0x2, 0x2, 0x2, 0x514, 0x95, 0x3, 0x2, 0x2, 0x2, 0x515, 0x513, + 0x3, 0x2, 0x2, 0x2, 0x516, 0x517, 0x5, 0xd0, 0x69, 0x2, 0x517, 0x518, + 0x7, 0xc7, 0x2, 0x2, 0x518, 0x519, 0x5, 0xc6, 0x64, 0x2, 0x519, 0x97, + 0x3, 0x2, 0x2, 0x2, 0x51a, 0x51b, 0x7, 0x8d, 0x2, 0x2, 0x51b, 0x51c, + 0x5, 0x94, 0x4b, 0x2, 0x51c, 0x99, 0x3, 0x2, 0x2, 0x2, 0x51d, 0x51e, + 0x7, 0x8f, 0x2, 0x2, 0x51e, 0x51f, 0x7, 0x1e, 0x2, 0x2, 0x51f, 0x520, + 0x7, 0x21, 0x2, 0x2, 0x520, 0x548, 0x5, 0xc0, 0x61, 0x2, 0x521, 0x522, + 0x7, 0x8f, 0x2, 0x2, 0x522, 0x523, 0x7, 0x1e, 0x2, 0x2, 0x523, 0x524, + 0x7, 0x2e, 0x2, 0x2, 0x524, 0x548, 0x5, 0xba, 0x5e, 0x2, 0x525, 0x526, + 0x7, 0x8f, 0x2, 0x2, 0x526, 0x528, 0x7, 0x1e, 0x2, 0x2, 0x527, 0x529, + 0x7, 0x99, 0x2, 0x2, 0x528, 0x527, 0x3, 0x2, 0x2, 0x2, 0x528, 0x529, + 0x3, 0x2, 0x2, 0x2, 0x529, 0x52b, 0x3, 0x2, 0x2, 0x2, 0x52a, 0x52c, + 0x7, 0x97, 0x2, 0x2, 0x52b, 0x52a, 0x3, 0x2, 0x2, 0x2, 0x52b, 0x52c, + 0x3, 0x2, 0x2, 0x2, 0x52c, 0x52d, 0x3, 0x2, 0x2, 0x2, 0x52d, 0x548, + 0x5, 0xba, 0x5e, 0x2, 0x52e, 0x52f, 0x7, 0x8f, 0x2, 0x2, 0x52f, 0x548, + 0x7, 0x22, 0x2, 0x2, 0x530, 0x531, 0x7, 0x8f, 0x2, 0x2, 0x531, 0x534, + 0x7, 0x2d, 0x2, 0x2, 0x532, 0x533, 0x7, 0x42, 0x2, 0x2, 0x533, 0x535, + 0x5, 0xc0, 0x61, 0x2, 0x534, 0x532, 0x3, 0x2, 0x2, 0x2, 0x534, 0x535, + 0x3, 0x2, 0x2, 0x2, 0x535, 0x548, 0x3, 0x2, 0x2, 0x2, 0x536, 0x538, + 0x7, 0x8f, 0x2, 0x2, 0x537, 0x539, 0x7, 0x99, 0x2, 0x2, 0x538, 0x537, + 0x3, 0x2, 0x2, 0x2, 0x538, 0x539, 0x3, 0x2, 0x2, 0x2, 0x539, 0x53a, + 0x3, 0x2, 0x2, 0x2, 0x53a, 0x53d, 0x7, 0x98, 0x2, 0x2, 0x53b, 0x53c, + 0x9, 0x12, 0x2, 0x2, 0x53c, 0x53e, 0x5, 0xc0, 0x61, 0x2, 0x53d, 0x53b, + 0x3, 0x2, 0x2, 0x2, 0x53d, 0x53e, 0x3, 0x2, 0x2, 0x2, 0x53e, 0x542, + 0x3, 0x2, 0x2, 0x2, 0x53f, 0x540, 0x7, 0x60, 0x2, 0x2, 0x540, 0x543, + 0x7, 0xbc, 0x2, 0x2, 0x541, 0x543, 0x5, 0x74, 0x3b, 0x2, 0x542, 0x53f, + 0x3, 0x2, 0x2, 0x2, 0x542, 0x541, 0x3, 0x2, 0x2, 0x2, 0x542, 0x543, + 0x3, 0x2, 0x2, 0x2, 0x543, 0x545, 0x3, 0x2, 0x2, 0x2, 0x544, 0x546, + 0x5, 0x7e, 0x40, 0x2, 0x545, 0x544, 0x3, 0x2, 0x2, 0x2, 0x545, 0x546, + 0x3, 0x2, 0x2, 0x2, 0x546, 0x548, 0x3, 0x2, 0x2, 0x2, 0x547, 0x51d, + 0x3, 0x2, 0x2, 0x2, 0x547, 0x521, 0x3, 0x2, 0x2, 0x2, 0x547, 0x525, + 0x3, 0x2, 0x2, 0x2, 0x547, 0x52e, 0x3, 0x2, 0x2, 0x2, 0x547, 0x530, + 0x3, 0x2, 0x2, 0x2, 0x547, 0x536, 0x3, 0x2, 0x2, 0x2, 0x548, 0x9b, 0x3, + 0x2, 0x2, 0x2, 0x549, 0x54a, 0x7, 0x96, 0x2, 0x2, 0x54a, 0x54b, 0x7, + 0x3e, 0x2, 0x2, 0x54b, 0x54c, 0x7, 0x31, 0x2, 0x2, 0x54c, 0x56c, 0x5, + 0xba, 0x5e, 0x2, 0x54d, 0x54e, 0x7, 0x96, 0x2, 0x2, 0x54e, 0x54f, 0x7, + 0x3e, 0x2, 0x2, 0x54f, 0x56c, 0x7, 0x64, 0x2, 0x2, 0x550, 0x551, 0x7, + 0x96, 0x2, 0x2, 0x551, 0x552, 0x7, 0x80, 0x2, 0x2, 0x552, 0x56c, 0x7, + 0x2d, 0x2, 0x2, 0x553, 0x554, 0x7, 0x96, 0x2, 0x2, 0x554, 0x555, 0x7, + 0x80, 0x2, 0x2, 0x555, 0x556, 0x7, 0x2e, 0x2, 0x2, 0x556, 0x56c, 0x5, + 0xba, 0x5e, 0x2, 0x557, 0x558, 0x7, 0x96, 0x2, 0x2, 0x558, 0x560, 0x9, + 0x13, 0x2, 0x2, 0x559, 0x55a, 0x7, 0x31, 0x2, 0x2, 0x55a, 0x561, 0x7, + 0x8c, 0x2, 0x2, 0x55b, 0x561, 0x7, 0x3b, 0x2, 0x2, 0x55c, 0x55e, 0x7, + 0xa5, 0x2, 0x2, 0x55d, 0x55c, 0x3, 0x2, 0x2, 0x2, 0x55d, 0x55e, 0x3, + 0x2, 0x2, 0x2, 0x55e, 0x55f, 0x3, 0x2, 0x2, 0x2, 0x55f, 0x561, 0x7, + 0x67, 0x2, 0x2, 0x560, 0x559, 0x3, 0x2, 0x2, 0x2, 0x560, 0x55b, 0x3, + 0x2, 0x2, 0x2, 0x560, 0x55d, 0x3, 0x2, 0x2, 0x2, 0x561, 0x562, 0x3, + 0x2, 0x2, 0x2, 0x562, 0x56c, 0x5, 0xba, 0x5e, 0x2, 0x563, 0x564, 0x7, + 0x96, 0x2, 0x2, 0x564, 0x565, 0x9, 0x13, 0x2, 0x2, 0x565, 0x566, 0x7, + 0x85, 0x2, 0x2, 0x566, 0x56c, 0x7, 0x8c, 0x2, 0x2, 0x567, 0x568, 0x7, + 0x96, 0x2, 0x2, 0x568, 0x569, 0x7, 0x94, 0x2, 0x2, 0x569, 0x56a, 0x7, + 0x84, 0x2, 0x2, 0x56a, 0x56c, 0x5, 0xba, 0x5e, 0x2, 0x56b, 0x549, 0x3, + 0x2, 0x2, 0x2, 0x56b, 0x54d, 0x3, 0x2, 0x2, 0x2, 0x56b, 0x550, 0x3, + 0x2, 0x2, 0x2, 0x56b, 0x553, 0x3, 0x2, 0x2, 0x2, 0x56b, 0x557, 0x3, + 0x2, 0x2, 0x2, 0x56b, 0x563, 0x3, 0x2, 0x2, 0x2, 0x56b, 0x567, 0x3, + 0x2, 0x2, 0x2, 0x56c, 0x9d, 0x3, 0x2, 0x2, 0x2, 0x56d, 0x56f, 0x7, 0xa4, + 0x2, 0x2, 0x56e, 0x570, 0x7, 0x99, 0x2, 0x2, 0x56f, 0x56e, 0x3, 0x2, + 0x2, 0x2, 0x56f, 0x570, 0x3, 0x2, 0x2, 0x2, 0x570, 0x572, 0x3, 0x2, + 0x2, 0x2, 0x571, 0x573, 0x7, 0x97, 0x2, 0x2, 0x572, 0x571, 0x3, 0x2, + 0x2, 0x2, 0x572, 0x573, 0x3, 0x2, 0x2, 0x2, 0x573, 0x576, 0x3, 0x2, + 0x2, 0x2, 0x574, 0x575, 0x7, 0x4c, 0x2, 0x2, 0x575, 0x577, 0x7, 0x37, + 0x2, 0x2, 0x576, 0x574, 0x3, 0x2, 0x2, 0x2, 0x576, 0x577, 0x3, 0x2, + 0x2, 0x2, 0x577, 0x578, 0x3, 0x2, 0x2, 0x2, 0x578, 0x57a, 0x5, 0xba, + 0x5e, 0x2, 0x579, 0x57b, 0x5, 0x2c, 0x17, 0x2, 0x57a, 0x579, 0x3, 0x2, + 0x2, 0x2, 0x57a, 0x57b, 0x3, 0x2, 0x2, 0x2, 0x57b, 0x9f, 0x3, 0x2, 0x2, + 0x2, 0x57c, 0x57d, 0x7, 0xa9, 0x2, 0x2, 0x57d, 0x57e, 0x5, 0xc0, 0x61, + 0x2, 0x57e, 0xa1, 0x3, 0x2, 0x2, 0x2, 0x57f, 0x580, 0x7, 0xaf, 0x2, + 0x2, 0x580, 0x582, 0x5, 0xba, 0x5e, 0x2, 0x581, 0x583, 0x7, 0x36, 0x2, + 0x2, 0x582, 0x581, 0x3, 0x2, 0x2, 0x2, 0x582, 0x583, 0x3, 0x2, 0x2, + 0x2, 0x583, 0x586, 0x3, 0x2, 0x2, 0x2, 0x584, 0x585, 0x7, 0x61, 0x2, + 0x2, 0x585, 0x587, 0x7, 0xba, 0x2, 0x2, 0x586, 0x584, 0x3, 0x2, 0x2, + 0x2, 0x586, 0x587, 0x3, 0x2, 0x2, 0x2, 0x587, 0xa3, 0x3, 0x2, 0x2, 0x2, + 0x588, 0x5b8, 0x5, 0xd0, 0x69, 0x2, 0x589, 0x58a, 0x5, 0xd0, 0x69, 0x2, + 0x58a, 0x58b, 0x7, 0xcd, 0x2, 0x2, 0x58b, 0x58c, 0x5, 0xd0, 0x69, 0x2, + 0x58c, 0x593, 0x5, 0xa4, 0x53, 0x2, 0x58d, 0x58e, 0x7, 0xc2, 0x2, 0x2, + 0x58e, 0x58f, 0x5, 0xd0, 0x69, 0x2, 0x58f, 0x590, 0x5, 0xa4, 0x53, 0x2, + 0x590, 0x592, 0x3, 0x2, 0x2, 0x2, 0x591, 0x58d, 0x3, 0x2, 0x2, 0x2, + 0x592, 0x595, 0x3, 0x2, 0x2, 0x2, 0x593, 0x591, 0x3, 0x2, 0x2, 0x2, + 0x593, 0x594, 0x3, 0x2, 0x2, 0x2, 0x594, 0x596, 0x3, 0x2, 0x2, 0x2, + 0x595, 0x593, 0x3, 0x2, 0x2, 0x2, 0x596, 0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fe, 0x5ff, + 0x3, 0x2, 0x2, 0x2, 0x5ff, 0x600, 0x7, 0xd7, 0x2, 0x2, 0x600, 0x63a, + 0x3, 0x2, 0x2, 0x2, 0x601, 0x602, 0x7, 0x9e, 0x2, 0x2, 0x602, 0x63a, + 0x7, 0xbc, 0x2, 0x2, 0x603, 0x604, 0x7, 0xa3, 0x2, 0x2, 0x604, 0x605, + 0x7, 0xcd, 0x2, 0x2, 0x605, 0x606, 0x9, 0x14, 0x2, 0x2, 0x606, 0x607, + 0x7, 0xbc, 0x2, 0x2, 0x607, 0x608, 0x7, 0x42, 0x2, 0x2, 0x608, 0x609, + 0x5, 0xaa, 0x56, 0x2, 0x609, 0x60a, 0x7, 0xd7, 0x2, 0x2, 0x60a, 0x63a, + 0x3, 0x2, 0x2, 0x2, 0x60b, 0x611, 0x5, 0xd0, 0x69, 0x2, 0x60c, 0x60e, + 0x7, 0xcd, 0x2, 0x2, 0x60d, 0x60f, 0x5, 0xa6, 0x54, 0x2, 0x60e, 0x60d, + 0x3, 0x2, 0x2, 0x2, 0x60e, 0x60f, 0x3, 0x2, 0x2, 0x2, 0x60f, 0x610, + 0x3, 0x2, 0x2, 0x2, 0x610, 0x612, 0x7, 0xd7, 0x2, 0x2, 0x611, 0x60c, + 0x3, 0x2, 0x2, 0x2, 0x611, 0x612, 0x3, 0x2, 0x2, 0x2, 0x612, 0x613, + 0x3, 0x2, 0x2, 0x2, 0x613, 0x615, 0x7, 0xcd, 0x2, 0x2, 0x614, 0x616, + 0x7, 0x30, 0x2, 0x2, 0x615, 0x614, 0x3, 0x2, 0x2, 0x2, 0x615, 0x616, + 0x3, 0x2, 0x2, 0x2, 0x616, 0x618, 0x3, 0x2, 0x2, 0x2, 0x617, 0x619, + 0x5, 0xac, 0x57, 0x2, 0x618, 0x617, 0x3, 0x2, 0x2, 0x2, 0x618, 0x619, + 0x3, 0x2, 0x2, 0x2, 0x619, 0x61a, 0x3, 0x2, 0x2, 0x2, 0x61a, 0x61b, + 0x7, 0xd7, 0x2, 0x2, 0x61b, 0x63a, 0x3, 0x2, 0x2, 0x2, 0x61c, 0x63a, + 0x5, 0xc6, 0x64, 0x2, 0x61d, 0x61e, 0x7, 0xc4, 0x2, 0x2, 0x61e, 0x63a, + 0x5, 0xaa, 0x56, 0x13, 0x61f, 0x620, 0x7, 0x70, 0x2, 0x2, 0x620, 0x63a, + 0x5, 0xaa, 0x56, 0xe, 0x621, 0x622, 0x5, 0xba, 0x5e, 0x2, 0x622, 0x623, + 0x7, 0xc5, 0x2, 0x2, 0x623, 0x625, 0x3, 0x2, 0x2, 0x2, 0x624, 0x621, + 0x3, 0x2, 0x2, 0x2, 0x624, 0x625, 0x3, 0x2, 0x2, 0x2, 0x625, 0x626, + 0x3, 0x2, 0x2, 0x2, 0x626, 0x63a, 0x7, 0xbe, 0x2, 0x2, 0x627, 0x628, + 0x7, 0xcd, 0x2, 0x2, 0x628, 0x629, 0x5, 0x64, 0x33, 0x2, 0x629, 0x62a, + 0x7, 0xd7, 0x2, 0x2, 0x62a, 0x63a, 0x3, 0x2, 0x2, 0x2, 0x62b, 0x62c, + 0x7, 0xcd, 0x2, 0x2, 0x62c, 0x62d, 0x5, 0xaa, 0x56, 0x2, 0x62d, 0x62e, + 0x7, 0xd7, 0x2, 0x2, 0x62e, 0x63a, 0x3, 0x2, 0x2, 0x2, 0x62f, 0x630, + 0x7, 0xcd, 0x2, 0x2, 0x630, 0x631, 0x5, 0xa6, 0x54, 0x2, 0x631, 0x632, + 0x7, 0xd7, 0x2, 0x2, 0x632, 0x63a, 0x3, 0x2, 0x2, 0x2, 0x633, 0x635, + 0x7, 0xcb, 0x2, 0x2, 0x634, 0x636, 0x5, 0xa6, 0x54, 0x2, 0x635, 0x634, + 0x3, 0x2, 0x2, 0x2, 0x635, 0x636, 0x3, 0x2, 0x2, 0x2, 0x636, 0x637, + 0x3, 0x2, 0x2, 0x2, 0x637, 0x63a, 0x7, 0xd6, 0x2, 0x2, 0x638, 0x63a, + 0x5, 0xb2, 0x5a, 0x2, 0x639, 0x5ce, 0x3, 0x2, 0x2, 0x2, 0x639, 0x5e2, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x5e9, 0x3, 0x2, 0x2, 0x2, 0x639, 0x5eb, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x5f2, 0x3, 0x2, 0x2, 0x2, 0x639, 0x5f6, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x601, 0x3, 0x2, 0x2, 0x2, 0x639, 0x603, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x60b, 0x3, 0x2, 0x2, 0x2, 0x639, 0x61c, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x61d, 0x3, 0x2, 0x2, 0x2, 0x639, 0x61f, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x624, 0x3, 0x2, 0x2, 0x2, 0x639, 0x627, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x62b, 0x3, 0x2, 0x2, 0x2, 0x639, 0x62f, + 0x3, 0x2, 0x2, 0x2, 0x639, 0x633, 0x3, 0x2, 0x2, 0x2, 0x639, 0x638, + 0x3, 0x2, 0x2, 0x2, 0x63a, 0x682, 0x3, 0x2, 0x2, 0x2, 0x63b, 0x63c, + 0xc, 0x12, 0x2, 0x2, 0x63c, 0x63d, 0x9, 0x15, 0x2, 0x2, 0x63d, 0x681, + 0x5, 0xaa, 0x56, 0x13, 0x63e, 0x63f, 0xc, 0x11, 0x2, 0x2, 0x63f, 0x640, + 0x9, 0x16, 0x2, 0x2, 0x640, 0x681, 0x5, 0xaa, 0x56, 0x12, 0x641, 0x654, + 0xc, 0x10, 0x2, 0x2, 0x642, 0x655, 0x7, 0xc6, 0x2, 0x2, 0x643, 0x655, + 0x7, 0xc7, 0x2, 0x2, 0x644, 0x655, 0x7, 0xcf, 0x2, 0x2, 0x645, 0x655, + 0x7, 0xcc, 0x2, 0x2, 0x646, 0x655, 0x7, 0xc8, 0x2, 0x2, 0x647, 0x655, + 0x7, 0xce, 0x2, 0x2, 0x648, 0x655, 0x7, 0xc9, 0x2, 0x2, 0x649, 0x64b, + 0x7, 0x45, 0x2, 0x2, 0x64a, 0x649, 0x3, 0x2, 0x2, 0x2, 0x64a, 0x64b, + 0x3, 0x2, 0x2, 0x2, 0x64b, 0x64d, 0x3, 0x2, 0x2, 0x2, 0x64c, 0x64e, + 0x7, 0x70, 0x2, 0x2, 0x64d, 0x64c, 0x3, 0x2, 0x2, 0x2, 0x64d, 0x64e, + 0x3, 0x2, 0x2, 0x2, 0x64e, 0x64f, 0x3, 0x2, 0x2, 0x2, 0x64f, 0x655, + 0x7, 0x4e, 0x2, 0x2, 0x650, 0x652, 0x7, 0x70, 0x2, 0x2, 0x651, 0x650, + 0x3, 0x2, 0x2, 0x2, 0x651, 0x652, 0x3, 0x2, 0x2, 0x2, 0x652, 0x653, + 0x3, 0x2, 0x2, 0x2, 0x653, 0x655, 0x9, 0x17, 0x2, 0x2, 0x654, 0x642, + 0x3, 0x2, 0x2, 0x2, 0x654, 0x643, 0x3, 0x2, 0x2, 0x2, 0x654, 0x644, + 0x3, 0x2, 0x2, 0x2, 0x654, 0x645, 0x3, 0x2, 0x2, 0x2, 0x654, 0x646, + 0x3, 0x2, 0x2, 0x2, 0x654, 0x647, 0x3, 0x2, 0x2, 0x2, 0x654, 0x648, + 0x3, 0x2, 0x2, 0x2, 0x654, 0x64a, 0x3, 0x2, 0x2, 0x2, 0x654, 0x651, + 0x3, 0x2, 0x2, 0x2, 0x655, 0x656, 0x3, 0x2, 0x2, 0x2, 0x656, 0x681, + 0x5, 0xaa, 0x56, 0x11, 0x657, 0x658, 0xc, 0xd, 0x2, 0x2, 0x658, 0x659, + 0x7, 0x8, 0x2, 0x2, 0x659, 0x681, 0x5, 0xaa, 0x56, 0xe, 0x65a, 0x65b, + 0xc, 0xc, 0x2, 0x2, 0x65b, 0x65c, 0x7, 0x76, 0x2, 0x2, 0x65c, 0x681, + 0x5, 0xaa, 0x56, 0xd, 0x65d, 0x65f, 0xc, 0xb, 0x2, 0x2, 0x65e, 0x660, + 0x7, 0x70, 0x2, 0x2, 0x65f, 0x65e, 0x3, 0x2, 0x2, 0x2, 0x65f, 0x660, + 0x3, 0x2, 0x2, 0x2, 0x660, 0x661, 0x3, 0x2, 0x2, 0x2, 0x661, 0x662, + 0x7, 0x11, 0x2, 0x2, 0x662, 0x663, 0x5, 0xaa, 0x56, 0x2, 0x663, 0x664, + 0x7, 0x8, 0x2, 0x2, 0x664, 0x665, 0x5, 0xaa, 0x56, 0xc, 0x665, 0x681, + 0x3, 0x2, 0x2, 0x2, 0x666, 0x667, 0xc, 0xa, 0x2, 0x2, 0x667, 0x668, + 0x7, 0xd2, 0x2, 0x2, 0x668, 0x669, 0x5, 0xaa, 0x56, 0x2, 0x669, 0x66a, + 0x7, 0xc1, 0x2, 0x2, 0x66a, 0x66b, 0x5, 0xaa, 0x56, 0xa, 0x66b, 0x681, + 0x3, 0x2, 0x2, 0x2, 0x66c, 0x66d, 0xc, 0x15, 0x2, 0x2, 0x66d, 0x66e, + 0x7, 0xcb, 0x2, 0x2, 0x66e, 0x66f, 0x5, 0xaa, 0x56, 0x2, 0x66f, 0x670, + 0x7, 0xd6, 0x2, 0x2, 0x670, 0x681, 0x3, 0x2, 0x2, 0x2, 0x671, 0x672, + 0xc, 0x14, 0x2, 0x2, 0x672, 0x673, 0x7, 0xc5, 0x2, 0x2, 0x673, 0x681, + 0x7, 0xba, 0x2, 0x2, 0x674, 0x675, 0xc, 0xf, 0x2, 0x2, 0x675, 0x677, + 0x7, 0x56, 0x2, 0x2, 0x676, 0x678, 0x7, 0x70, 0x2, 0x2, 0x677, 0x676, + 0x3, 0x2, 0x2, 0x2, 0x677, 0x678, 0x3, 0x2, 0x2, 0x2, 0x678, 0x679, + 0x3, 0x2, 0x2, 0x2, 0x679, 0x681, 0x7, 0x71, 0x2, 0x2, 0x67a, 0x67e, + 0xc, 0x9, 0x2, 0x2, 0x67b, 0x67f, 0x5, 0xce, 0x68, 0x2, 0x67c, 0x67d, + 0x7, 0xc, 0x2, 0x2, 0x67d, 0x67f, 0x5, 0xd0, 0x69, 0x2, 0x67e, 0x67b, + 0x3, 0x2, 0x2, 0x2, 0x67e, 0x67c, 0x3, 0x2, 0x2, 0x2, 0x67f, 0x681, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x63b, 0x3, 0x2, 0x2, 0x2, 0x680, 0x63e, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x641, 0x3, 0x2, 0x2, 0x2, 0x680, 0x657, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x65a, 0x3, 0x2, 0x2, 0x2, 0x680, 0x65d, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x666, 0x3, 0x2, 0x2, 0x2, 0x680, 0x66c, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x671, 0x3, 0x2, 0x2, 0x2, 0x680, 0x674, + 0x3, 0x2, 0x2, 0x2, 0x680, 0x67a, 0x3, 0x2, 0x2, 0x2, 0x681, 0x684, + 0x3, 0x2, 0x2, 0x2, 0x682, 0x680, 0x3, 0x2, 0x2, 0x2, 0x682, 0x683, + 0x3, 0x2, 0x2, 0x2, 0x683, 0xab, 0x3, 0x2, 0x2, 0x2, 0x684, 0x682, 0x3, + 0x2, 0x2, 0x2, 0x685, 0x68a, 0x5, 0xae, 0x58, 0x2, 0x686, 0x687, 0x7, + 0xc2, 0x2, 0x2, 0x687, 0x689, 0x5, 0xae, 0x58, 0x2, 0x688, 0x686, 0x3, + 0x2, 0x2, 0x2, 0x689, 0x68c, 0x3, 0x2, 0x2, 0x2, 0x68a, 0x688, 0x3, + 0x2, 0x2, 0x2, 0x68a, 0x68b, 0x3, 0x2, 0x2, 0x2, 0x68b, 0xad, 0x3, 0x2, + 0x2, 0x2, 0x68c, 0x68a, 0x3, 0x2, 0x2, 0x2, 0x68d, 0x690, 0x5, 0xb0, + 0x59, 0x2, 0x68e, 0x690, 0x5, 0xaa, 0x56, 0x2, 0x68f, 0x68d, 0x3, 0x2, + 0x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0x70e, 0x5, 0xc8, 0x65, + 0x2, 0x70c, 0x70e, 0x5, 0xca, 0x66, 0x2, 0x70d, 0x70a, 0x3, 0x2, 0x2, + 0x2, 0x70d, 0x70b, 0x3, 0x2, 0x2, 0x2, 0x70d, 0x70c, 0x3, 0x2, 0x2, + 0x2, 0x70e, 0xd1, 0x3, 0x2, 0x2, 0x2, 0x70f, 0x712, 0x5, 0xd0, 0x69, + 0x2, 0x710, 0x712, 0x7, 0x71, 0x2, 0x2, 0x711, 0x70f, 0x3, 0x2, 0x2, + 0x2, 0x711, 0x710, 0x3, 0x2, 0x2, 0x2, 0x712, 0xd3, 0x3, 0x2, 0x2, 0x2, + 0x713, 0x714, 0x7, 0xbc, 0x2, 0x2, 0x714, 0x715, 0x7, 0xc7, 0x2, 0x2, + 0x715, 0x716, 0x5, 0xc4, 0x63, 0x2, 0x716, 0xd5, 0x3, 0x2, 0x2, 0x2, + 0xf3, 0xda, 0xde, 0xe1, 0xe4, 0xf8, 0xfe, 0x105, 0x10d, 0x112, 0x119, + 0x11e, 0x124, 0x12a, 0x12f, 0x135, 0x143, 0x14a, 0x151, 0x157, 0x160, + 0x16a, 0x174, 0x188, 0x190, 0x19f, 0x1a6, 0x1b4, 0x1ba, 0x1c0, 0x1c7, + 0x1cb, 0x1ce, 0x1d5, 0x1d9, 0x1dc, 0x1e7, 0x1eb, 0x1ee, 0x1f3, 0x1f5, + 0x1f8, 0x1fb, 0x205, 0x209, 0x20c, 0x20f, 0x214, 0x216, 0x21c, 0x222, + 0x226, 0x229, 0x22c, 0x22f, 0x232, 0x237, 0x23d, 0x241, 0x244, 0x247, + 0x24b, 0x253, 0x26d, 0x26f, 0x273, 0x289, 0x28b, 0x296, 0x299, 0x2a2, + 0x2b3, 0x2be, 0x2d0, 0x2dd, 0x2ee, 0x2f7, 0x312, 0x314, 0x329, 0x32e, + 0x333, 0x336, 0x340, 0x345, 0x349, 0x34c, 0x350, 0x354, 0x359, 0x35c, + 0x360, 0x362, 0x375, 0x37d, 0x380, 0x38a, 0x38e, 0x396, 0x39a, 0x39f, + 0x3a2, 0x3a6, 0x3aa, 0x3ae, 0x3b0, 0x3b5, 0x3b8, 0x3c3, 0x3c8, 0x3cb, + 0x3d5, 0x3df, 0x3e3, 0x3e8, 0x3ec, 0x3f2, 0x3f5, 0x3f8, 0x3fb, 0x409, + 0x40d, 0x415, 0x41d, 0x420, 0x424, 0x427, 0x42b, 0x42e, 0x431, 0x434, + 0x437, 0x43b, 0x43f, 0x442, 0x445, 0x448, 0x44b, 0x44e, 0x457, 0x45d, + 0x471, 0x483, 0x48b, 0x48e, 0x494, 0x49c, 0x49f, 0x4a5, 0x4a7, 0x4ab, + 0x4b0, 0x4b3, 0x4b6, 0x4ba, 0x4be, 0x4c1, 0x4c3, 0x4c6, 0x4ca, 0x4ce, + 0x4d1, 0x4d3, 0x4d5, 0x4d8, 0x4dd, 0x4e8, 0x4ee, 0x4f3, 0x4fa, 0x4ff, + 0x503, 0x507, 0x50c, 0x513, 0x528, 0x52b, 0x534, 0x538, 0x53d, 0x542, + 0x545, 0x547, 0x55d, 0x560, 0x56b, 0x56f, 0x572, 0x576, 0x57a, 0x582, + 0x586, 0x593, 0x59f, 0x5ab, 0x5b3, 0x5b7, 0x5be, 0x5c4, 0x5cc, 0x5d1, + 0x5da, 0x5de, 0x5fd, 0x60e, 0x611, 0x615, 0x618, 0x624, 0x635, 0x639, + 0x64a, 0x64d, 0x651, 0x654, 0x65f, 0x677, 0x67e, 0x680, 0x682, 0x68a, + 0x68f, 0x697, 0x6a1, 0x6a4, 0x6ac, 0x6b3, 0x6bc, 0x6c2, 0x6c6, 0x6cc, + 0x6d3, 0x6dc, 0x6e2, 0x6ec, 0x6ee, 0x6f1, 0x6f9, 0x6fe, 0x708, 0x70d, + 0x711, + }; + + atn::ATNDeserializer deserializer; + _atn = deserializer.deserialize(_serializedATN); + + size_t count = _atn.getNumberOfDecisions(); + _decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + _decisionToDFA.emplace_back(_atn.getDecisionState(i), i); + } +} + +ClickHouseParser::Initializer ClickHouseParser::_init; diff --git a/src/Parsers/New/ClickHouseParser.g4 b/src/Parsers/New/ClickHouseParser.g4 new file mode 100644 index 00000000000..b5bdaede707 --- /dev/null +++ b/src/Parsers/New/ClickHouseParser.g4 @@ -0,0 +1,449 @@ +parser grammar ClickHouseParser; + +options { + tokenVocab = ClickHouseLexer; +} + +// Top-level statements + +queryStmt: query (INTO OUTFILE STRING_LITERAL)? (FORMAT identifierOrNull)? (SEMICOLON)? | insertStmt; +query + : alterStmt // DDL + | attachStmt // DDL + | checkStmt + | createStmt // DDL + | describeStmt + | dropStmt // DDL + | existsStmt + | explainStmt + | killStmt // DDL + | optimizeStmt // DDL + | renameStmt // DDL + | selectUnionStmt + | setStmt + | showStmt + | systemStmt + | truncateStmt // DDL + | useStmt + | watchStmt + ; + +// ALTER statement + +alterStmt + : ALTER TABLE tableIdentifier clusterClause? alterTableClause (COMMA alterTableClause)* # AlterTableStmt + ; + +alterTableClause + : ADD COLUMN (IF NOT EXISTS)? tableColumnDfnt (AFTER nestedIdentifier)? # AlterTableClauseAddColumn + | ADD INDEX (IF NOT EXISTS)? tableIndexDfnt (AFTER nestedIdentifier)? # AlterTableClauseAddIndex + | ATTACH partitionClause (FROM tableIdentifier)? # AlterTableClauseAttach + | CLEAR COLUMN (IF EXISTS)? nestedIdentifier (IN partitionClause)? # AlterTableClauseClear + | COMMENT COLUMN (IF EXISTS)? nestedIdentifier STRING_LITERAL # AlterTableClauseComment + | DELETE WHERE columnExpr # AlterTableClauseDelete + | DETACH partitionClause # AlterTableClauseDetach + | DROP COLUMN (IF EXISTS)? nestedIdentifier # AlterTableClauseDropColumn + | DROP INDEX (IF EXISTS)? nestedIdentifier # AlterTableClauseDropIndex + | DROP partitionClause # AlterTableClauseDropPartition + | FREEZE partitionClause? # AlterTableClauseFreezePartition + | MODIFY COLUMN (IF EXISTS)? nestedIdentifier codecExpr # AlterTableClauseModifyCodec + | MODIFY COLUMN (IF EXISTS)? nestedIdentifier COMMENT STRING_LITERAL # AlterTableClauseModifyComment + | MODIFY COLUMN (IF EXISTS)? nestedIdentifier REMOVE tableColumnPropertyType # AlterTableClauseModifyRemove + | MODIFY COLUMN (IF EXISTS)? tableColumnDfnt # AlterTableClauseModify + | MODIFY ORDER BY columnExpr # AlterTableClauseModifyOrderBy + | MODIFY ttlClause # AlterTableClauseModifyTTL + | MOVE partitionClause ( TO DISK STRING_LITERAL + | TO VOLUME STRING_LITERAL + | TO TABLE tableIdentifier + ) # AlterTableClauseMovePartition + | REMOVE TTL # AlterTableClauseRemoveTTL + | RENAME COLUMN (IF EXISTS)? nestedIdentifier TO nestedIdentifier # AlterTableClauseRename + | REPLACE partitionClause FROM tableIdentifier # AlterTableClauseReplace + | UPDATE assignmentExprList whereClause # AlterTableClauseUpdate + ; + +assignmentExprList: assignmentExpr (COMMA assignmentExpr)*; +assignmentExpr: nestedIdentifier EQ_SINGLE columnExpr; + +tableColumnPropertyType: ALIAS | CODEC | COMMENT | DEFAULT | MATERIALIZED | TTL; + +partitionClause + : PARTITION columnExpr // actually we expect here any form of tuple of literals + | PARTITION ID STRING_LITERAL + ; + +// ATTACH statement +attachStmt + : ATTACH DICTIONARY tableIdentifier clusterClause? # AttachDictionaryStmt + ; + +// CHECK statement + +checkStmt: CHECK TABLE tableIdentifier partitionClause?; + +// CREATE statement + +createStmt + : (ATTACH | CREATE) DATABASE (IF NOT EXISTS)? databaseIdentifier clusterClause? engineExpr? # CreateDatabaseStmt + | (ATTACH | CREATE) DICTIONARY (IF NOT EXISTS)? tableIdentifier uuidClause? clusterClause? dictionarySchemaClause dictionaryEngineClause # CreateDictionaryStmt + | (ATTACH | CREATE) LIVE VIEW (IF NOT EXISTS)? tableIdentifier uuidClause? clusterClause? (WITH TIMEOUT DECIMAL_LITERAL?)? destinationClause? tableSchemaClause? subqueryClause # CreateLiveViewStmt + | (ATTACH | CREATE) MATERIALIZED VIEW (IF NOT EXISTS)? tableIdentifier uuidClause? clusterClause? tableSchemaClause? (destinationClause | engineClause POPULATE?) subqueryClause # CreateMaterializedViewStmt + | (ATTACH | CREATE) TEMPORARY? TABLE (IF NOT EXISTS)? tableIdentifier uuidClause? clusterClause? tableSchemaClause? engineClause? subqueryClause? # CreateTableStmt + | (ATTACH | CREATE) (OR REPLACE)? VIEW (IF NOT EXISTS)? tableIdentifier uuidClause? clusterClause? tableSchemaClause? subqueryClause # CreateViewStmt + ; + +dictionarySchemaClause: LPAREN dictionaryAttrDfnt (COMMA dictionaryAttrDfnt)* RPAREN; +dictionaryAttrDfnt +locals [std::set attrs]: + identifier columnTypeExpr + ( {!$attrs.count("default")}? DEFAULT literal {$attrs.insert("default");} + | {!$attrs.count("expression")}? EXPRESSION columnExpr {$attrs.insert("expression");} + | {!$attrs.count("hierarchical")}? HIERARCHICAL {$attrs.insert("hierarchical");} + | {!$attrs.count("injective")}? INJECTIVE {$attrs.insert("injective");} + | {!$attrs.count("is_object_id")}? IS_OBJECT_ID {$attrs.insert("is_object_id");} + )* + ; +dictionaryEngineClause +locals [std::set clauses]: + dictionaryPrimaryKeyClause? + ( {!$clauses.count("source")}? sourceClause {$clauses.insert("source");} + | {!$clauses.count("lifetime")}? lifetimeClause {$clauses.insert("lifetime");} + | {!$clauses.count("layout")}? layoutClause {$clauses.insert("layout");} + | {!$clauses.count("range")}? rangeClause {$clauses.insert("range");} + | {!$clauses.count("settings")}? dictionarySettingsClause {$clauses.insert("settings");} + )* + ; +dictionaryPrimaryKeyClause: PRIMARY KEY columnExprList; +dictionaryArgExpr: identifier (identifier (LPAREN RPAREN)? | literal); +sourceClause: SOURCE LPAREN identifier LPAREN dictionaryArgExpr* RPAREN RPAREN; +lifetimeClause: LIFETIME LPAREN ( DECIMAL_LITERAL + | MIN DECIMAL_LITERAL MAX DECIMAL_LITERAL + | MAX DECIMAL_LITERAL MIN DECIMAL_LITERAL + ) RPAREN; +layoutClause: LAYOUT LPAREN identifier LPAREN dictionaryArgExpr* RPAREN RPAREN; +rangeClause: RANGE LPAREN (MIN identifier MAX identifier | MAX identifier MIN identifier) RPAREN; +dictionarySettingsClause: SETTINGS LPAREN settingExprList RPAREN; + +clusterClause: ON CLUSTER (identifier | STRING_LITERAL); +uuidClause: UUID STRING_LITERAL; +destinationClause: TO tableIdentifier; +subqueryClause: AS selectUnionStmt; +tableSchemaClause + : LPAREN tableElementExpr (COMMA tableElementExpr)* RPAREN # SchemaDescriptionClause + | AS tableIdentifier # SchemaAsTableClause + | AS tableFunctionExpr # SchemaAsFunctionClause + ; +engineClause +locals [std::set clauses]: + engineExpr + ( {!$clauses.count("orderByClause")}? orderByClause {$clauses.insert("orderByClause");} + | {!$clauses.count("partitionByClause")}? partitionByClause {$clauses.insert("partitionByClause");} + | {!$clauses.count("primaryKeyClause")}? primaryKeyClause {$clauses.insert("primaryKeyClause");} + | {!$clauses.count("sampleByClause")}? sampleByClause {$clauses.insert("sampleByClause");} + | {!$clauses.count("ttlClause")}? ttlClause {$clauses.insert("ttlClause");} + | {!$clauses.count("settingsClause")}? settingsClause {$clauses.insert("settingsClause");} + )* + ; +partitionByClause: PARTITION BY columnExpr; +primaryKeyClause: PRIMARY KEY columnExpr; +sampleByClause: SAMPLE BY columnExpr; +ttlClause: TTL ttlExpr (COMMA ttlExpr)*; + +engineExpr: ENGINE EQ_SINGLE? identifierOrNull (LPAREN columnExprList? RPAREN)?; +tableElementExpr + : tableColumnDfnt # TableElementExprColumn + | CONSTRAINT identifier CHECK columnExpr # TableElementExprConstraint + | INDEX tableIndexDfnt # TableElementExprIndex + ; +tableColumnDfnt + : nestedIdentifier columnTypeExpr tableColumnPropertyExpr? (COMMENT STRING_LITERAL)? codecExpr? (TTL columnExpr)? + | nestedIdentifier columnTypeExpr? tableColumnPropertyExpr (COMMENT STRING_LITERAL)? codecExpr? (TTL columnExpr)? + ; +tableColumnPropertyExpr: (DEFAULT | MATERIALIZED | ALIAS) columnExpr; +tableIndexDfnt: nestedIdentifier columnExpr TYPE columnTypeExpr GRANULARITY DECIMAL_LITERAL; +codecExpr: CODEC LPAREN codecArgExpr (COMMA codecArgExpr)* RPAREN; +codecArgExpr: identifier (LPAREN columnExprList? RPAREN)?; +ttlExpr: columnExpr (DELETE | TO DISK STRING_LITERAL | TO VOLUME STRING_LITERAL)?; + +// DESCRIBE statement + +describeStmt: (DESCRIBE | DESC) TABLE? tableExpr; + +// DROP statement + +dropStmt + : (DETACH | DROP) DATABASE (IF EXISTS)? databaseIdentifier clusterClause? # DropDatabaseStmt + | (DETACH | DROP) (DICTIONARY | TEMPORARY? TABLE) (IF EXISTS)? tableIdentifier clusterClause? (NO DELAY)? # DropTableStmt + ; + +// EXISTS statement + +existsStmt: EXISTS (DICTIONARY | TEMPORARY? TABLE)? tableIdentifier; + +// EXPLAIN statement + +explainStmt: EXPLAIN SYNTAX query; + +// INSERT statement + +insertStmt: INSERT INTO TABLE? (tableIdentifier | FUNCTION tableFunctionExpr) columnsClause? dataClause; + +columnsClause: LPAREN nestedIdentifier (COMMA nestedIdentifier)* RPAREN; +dataClause + : FORMAT identifier # DataClauseFormat + | VALUES # DataClauseValues + | selectUnionStmt SEMICOLON? EOF # DataClauseSelect + ; + +// KILL statement + +killStmt + : KILL MUTATION clusterClause? whereClause (SYNC | ASYNC | TEST)? # KillMutationStmt + ; + +// OPTIMIZE statement + +optimizeStmt: OPTIMIZE TABLE tableIdentifier clusterClause? partitionClause? FINAL? DEDUPLICATE?; + +// RENAME statement + +renameStmt: RENAME TABLE tableIdentifier TO tableIdentifier (COMMA tableIdentifier TO tableIdentifier)* clusterClause?; + +// SELECT statement + +selectUnionStmt: selectStmtWithParens (UNION ALL selectStmtWithParens)*; +selectStmtWithParens: selectStmt | LPAREN selectUnionStmt RPAREN; +selectStmt: + withClause? + SELECT DISTINCT? topClause? columnExprList + fromClause? + arrayJoinClause? + prewhereClause? + whereClause? + groupByClause? (WITH (CUBE | ROLLUP))? (WITH TOTALS)? + havingClause? + orderByClause? + limitByClause? + limitClause? + settingsClause? + ; + +withClause: WITH columnExprList; +topClause: TOP DECIMAL_LITERAL (WITH TIES)?; +fromClause: FROM joinExpr; +arrayJoinClause: (LEFT | INNER)? ARRAY JOIN columnExprList; +prewhereClause: PREWHERE columnExpr; +whereClause: WHERE columnExpr; +groupByClause: GROUP BY ((CUBE | ROLLUP) LPAREN columnExprList RPAREN | columnExprList); +havingClause: HAVING columnExpr; +orderByClause: ORDER BY orderExprList; +limitByClause: LIMIT limitExpr BY columnExprList; +limitClause: LIMIT limitExpr (WITH TIES)?; +settingsClause: SETTINGS settingExprList; + +joinExpr + : joinExpr (GLOBAL | LOCAL)? joinOp? JOIN joinExpr joinConstraintClause # JoinExprOp + | joinExpr joinOpCross joinExpr # JoinExprCrossOp + | tableExpr FINAL? sampleClause? # JoinExprTable + | LPAREN joinExpr RPAREN # JoinExprParens + ; +joinOp + : ((ALL | ANY | ASOF)? INNER | INNER (ALL | ANY | ASOF)? | (ALL | ANY | ASOF)) # JoinOpInner + | ( (SEMI | ALL | ANTI | ANY | ASOF)? (LEFT | RIGHT) OUTER? + | (LEFT | RIGHT) OUTER? (SEMI | ALL | ANTI | ANY | ASOF)? + ) # JoinOpLeftRight + | ((ALL | ANY)? FULL OUTER? | FULL OUTER? (ALL | ANY)?) # JoinOpFull + ; +joinOpCross + : (GLOBAL|LOCAL)? CROSS JOIN + | COMMA + ; +joinConstraintClause + : ON columnExprList + | USING LPAREN columnExprList RPAREN + | USING columnExprList + ; + +sampleClause: SAMPLE ratioExpr (OFFSET ratioExpr)?; +limitExpr: columnExpr ((COMMA | OFFSET) columnExpr)?; +orderExprList: orderExpr (COMMA orderExpr)*; +orderExpr: columnExpr (ASCENDING | DESCENDING | DESC)? (NULLS (FIRST | LAST))? (COLLATE STRING_LITERAL)?; +ratioExpr: numberLiteral (SLASH numberLiteral)?; +settingExprList: settingExpr (COMMA settingExpr)*; +settingExpr: identifier EQ_SINGLE literal; + +// SET statement + +setStmt: SET settingExprList; + +// SHOW statements + +showStmt + : SHOW CREATE DATABASE databaseIdentifier # showCreateDatabaseStmt + | SHOW CREATE DICTIONARY tableIdentifier # showCreateDictionaryStmt + | SHOW CREATE TEMPORARY? TABLE? tableIdentifier # showCreateTableStmt + | SHOW DATABASES # showDatabasesStmt + | SHOW DICTIONARIES (FROM databaseIdentifier)? # showDictionariesStmt + | SHOW TEMPORARY? TABLES ((FROM | IN) databaseIdentifier)? (LIKE STRING_LITERAL | whereClause)? limitClause? # showTablesStmt + ; + +// SYSTEM statements + +systemStmt + : SYSTEM FLUSH DISTRIBUTED tableIdentifier + | SYSTEM FLUSH LOGS + | SYSTEM RELOAD DICTIONARIES + | SYSTEM RELOAD DICTIONARY tableIdentifier + | SYSTEM (START | STOP) (DISTRIBUTED SENDS | FETCHES | TTL? MERGES) tableIdentifier + | SYSTEM (START | STOP) REPLICATED SENDS + | SYSTEM SYNC REPLICA tableIdentifier + ; + +// TRUNCATE statements + +truncateStmt: TRUNCATE TEMPORARY? TABLE? (IF EXISTS)? tableIdentifier clusterClause?; + +// USE statement + +useStmt: USE databaseIdentifier; + +// WATCH statement + +watchStmt: WATCH tableIdentifier EVENTS? (LIMIT DECIMAL_LITERAL)?; + + + +// Columns + +columnTypeExpr + : identifier # ColumnTypeExprSimple // UInt64 + | identifier LPAREN identifier columnTypeExpr (COMMA identifier columnTypeExpr)* RPAREN # ColumnTypeExprNested // Nested + | identifier LPAREN enumValue (COMMA enumValue)* RPAREN # ColumnTypeExprEnum // Enum + | identifier LPAREN columnTypeExpr (COMMA columnTypeExpr)* RPAREN # ColumnTypeExprComplex // Array, Tuple + | identifier LPAREN columnExprList? RPAREN # ColumnTypeExprParam // FixedString(N) + ; +columnExprList: columnsExpr (COMMA columnsExpr)*; +columnsExpr + : (tableIdentifier DOT)? ASTERISK # ColumnsExprAsterisk + | LPAREN selectUnionStmt RPAREN # ColumnsExprSubquery + // NOTE: asterisk and subquery goes before |columnExpr| so that we can mark them as multi-column expressions. + | columnExpr # ColumnsExprColumn + ; +columnExpr + : CASE columnExpr? (WHEN columnExpr THEN columnExpr)+ (ELSE columnExpr)? END # ColumnExprCase + | CAST LPAREN columnExpr AS columnTypeExpr RPAREN # ColumnExprCast + | DATE STRING_LITERAL # ColumnExprDate + | EXTRACT LPAREN interval FROM columnExpr RPAREN # ColumnExprExtract + | INTERVAL columnExpr interval # ColumnExprInterval + | SUBSTRING LPAREN columnExpr FROM columnExpr (FOR columnExpr)? RPAREN # ColumnExprSubstring + | TIMESTAMP STRING_LITERAL # ColumnExprTimestamp + | TRIM LPAREN (BOTH | LEADING | TRAILING) STRING_LITERAL FROM columnExpr RPAREN # ColumnExprTrim + | identifier (LPAREN columnExprList? RPAREN)? LPAREN DISTINCT? columnArgList? RPAREN # ColumnExprFunction + | literal # ColumnExprLiteral + + // FIXME(ilezhankin): this part looks very ugly, maybe there is another way to express it + | columnExpr LBRACKET columnExpr RBRACKET # ColumnExprArrayAccess + | columnExpr DOT DECIMAL_LITERAL # ColumnExprTupleAccess + | DASH columnExpr # ColumnExprNegate + | columnExpr ( ASTERISK // multiply + | SLASH // divide + | PERCENT // modulo + ) columnExpr # ColumnExprPrecedence1 + | columnExpr ( PLUS // plus + | DASH // minus + | CONCAT // concat + ) columnExpr # ColumnExprPrecedence2 + | columnExpr ( EQ_DOUBLE // equals + | EQ_SINGLE // equals + | NOT_EQ // notEquals + | LE // lessOrEquals + | GE // greaterOrEquals + | LT // less + | GT // greater + | GLOBAL? NOT? IN // in, notIn, globalIn, globalNotIn + | NOT? (LIKE | ILIKE) // like, notLike, ilike, notILike + ) columnExpr # ColumnExprPrecedence3 + | columnExpr IS NOT? NULL_SQL # ColumnExprIsNull + | NOT columnExpr # ColumnExprNot + | columnExpr AND columnExpr # ColumnExprAnd + | columnExpr OR columnExpr # ColumnExprOr + // TODO(ilezhankin): `BETWEEN a AND b AND c` is parsed in a wrong way: `BETWEEN (a AND b) AND c` + | columnExpr NOT? BETWEEN columnExpr AND columnExpr # ColumnExprBetween + | columnExpr QUERY columnExpr COLON columnExpr # ColumnExprTernaryOp + | columnExpr (alias | AS identifier) # ColumnExprAlias + + | (tableIdentifier DOT)? ASTERISK # ColumnExprAsterisk // single-column only + | LPAREN selectUnionStmt RPAREN # ColumnExprSubquery // single-column only + | LPAREN columnExpr RPAREN # ColumnExprParens // single-column only + | LPAREN columnExprList RPAREN # ColumnExprTuple + | LBRACKET columnExprList? RBRACKET # ColumnExprArray + | columnIdentifier # ColumnExprIdentifier + ; +columnArgList: columnArgExpr (COMMA columnArgExpr)*; +columnArgExpr: columnLambdaExpr | columnExpr; +columnLambdaExpr: + ( LPAREN identifier (COMMA identifier)* RPAREN + | identifier (COMMA identifier)* + ) + ARROW columnExpr + ; +columnIdentifier: (tableIdentifier DOT)? nestedIdentifier; +nestedIdentifier: identifier (DOT identifier)?; + +// Tables + +tableExpr + : tableIdentifier # TableExprIdentifier + | tableFunctionExpr # TableExprFunction + | LPAREN selectUnionStmt RPAREN # TableExprSubquery + | tableExpr (alias | AS identifier) # TableExprAlias + ; +tableFunctionExpr: identifier LPAREN tableArgList? RPAREN; +tableIdentifier: (databaseIdentifier DOT)? identifier; +tableArgList: tableArgExpr (COMMA tableArgExpr)*; +tableArgExpr + : tableIdentifier + | tableFunctionExpr + | literal + ; + +// Databases + +databaseIdentifier: identifier; + +// Basics + +floatingLiteral + : FLOATING_LITERAL + | DOT (DECIMAL_LITERAL | OCTAL_LITERAL) + | DECIMAL_LITERAL DOT (DECIMAL_LITERAL | OCTAL_LITERAL)? // can't move this to the lexer or it will break nested tuple access: t.1.2 + ; +numberLiteral: (PLUS | DASH)? (floatingLiteral | OCTAL_LITERAL | DECIMAL_LITERAL | HEXADECIMAL_LITERAL | INF | NAN_SQL); +literal + : numberLiteral + | STRING_LITERAL + | NULL_SQL + ; +interval: SECOND | MINUTE | HOUR | DAY | WEEK | MONTH | QUARTER | YEAR; +keyword + // except NULL_SQL, INF, NAN_SQL + : AFTER | ALIAS | ALL | ALTER | AND | ANTI | ANY | ARRAY | AS | ASCENDING | ASOF | ASYNC | ATTACH | BETWEEN | BOTH | BY | CASE | CAST + | CHECK | CLEAR | CLUSTER | CODEC | COLLATE | COLUMN | COMMENT | CONSTRAINT | CREATE | CROSS | CUBE | DATABASE | DATABASES | DATE + | DEDUPLICATE | DEFAULT | DELAY | DELETE | DESCRIBE | DESC | DESCENDING | DETACH | DICTIONARIES | DICTIONARY | DISK | DISTINCT + | DISTRIBUTED | DROP | ELSE | END | ENGINE | EVENTS | EXISTS | EXPLAIN | EXPRESSION | EXTRACT | FETCHES | FINAL | FIRST | FLUSH | FOR + | FORMAT | FREEZE | FROM | FULL | FUNCTION | GLOBAL | GRANULARITY | GROUP | HAVING | HIERARCHICAL | ID | IF | ILIKE | IN | INDEX + | INJECTIVE | INNER | INSERT | INTERVAL | INTO | IS | IS_OBJECT_ID | JOIN | JSON_FALSE | JSON_TRUE | KEY | KILL | LAST | LAYOUT + | LEADING | LEFT | LIFETIME | LIKE | LIMIT | LIVE | LOCAL | LOGS | MATERIALIZED | MAX | MERGES | MIN | MODIFY | MOVE | MUTATION | NO + | NOT | NULLS | OFFSET | ON | OPTIMIZE | OR | ORDER | OUTER | OUTFILE | PARTITION | POPULATE | PREWHERE | PRIMARY | RANGE | RELOAD + | REMOVE | RENAME | REPLACE | REPLICA | REPLICATED | RIGHT | ROLLUP | SAMPLE | SELECT | SEMI | SENDS | SET | SETTINGS | SHOW | SOURCE + | START | STOP | SUBSTRING | SYNC | SYNTAX | SYSTEM | TABLE | TABLES | TEMPORARY | TEST | THEN | TIES | TIMEOUT | TIMESTAMP | TOTALS + | TRAILING | TRIM | TRUNCATE | TO | TOP | TTL | TYPE | UNION | UPDATE | USE | USING | UUID | VALUES | VIEW | VOLUME | WATCH | WHEN + | WHERE | WITH + ; +keywordForAlias + : DATE | FIRST | ID | KEY + ; +alias: IDENTIFIER | keywordForAlias; // |interval| can't be an alias, otherwise 'INTERVAL 1 SOMETHING' becomes ambiguous. +identifier: IDENTIFIER | interval | keyword; +identifierOrNull: identifier | NULL_SQL; // NULL_SQL can be only 'Null' here. +enumValue: STRING_LITERAL EQ_SINGLE numberLiteral; diff --git a/src/Parsers/New/ClickHouseParser.h b/src/Parsers/New/ClickHouseParser.h new file mode 100644 index 00000000000..7a325befe26 --- /dev/null +++ b/src/Parsers/New/ClickHouseParser.h @@ -0,0 +1,3248 @@ + +// Generated from ClickHouseParser.g4 by ANTLR 4.7.2 + +#pragma once + + +#include "antlr4-runtime.h" + + +namespace DB { + + +class ClickHouseParser : public antlr4::Parser { +public: + enum { + ADD = 1, AFTER = 2, ALIAS = 3, ALL = 4, ALTER = 5, AND = 6, ANTI = 7, + ANY = 8, ARRAY = 9, AS = 10, ASCENDING = 11, ASOF = 12, ASYNC = 13, + ATTACH = 14, BETWEEN = 15, BOTH = 16, BY = 17, CASE = 18, CAST = 19, + CHECK = 20, CLEAR = 21, CLUSTER = 22, CODEC = 23, COLLATE = 24, COLUMN = 25, + COMMENT = 26, CONSTRAINT = 27, CREATE = 28, CROSS = 29, CUBE = 30, DATABASE = 31, + DATABASES = 32, DATE = 33, DAY = 34, DEDUPLICATE = 35, DEFAULT = 36, + DELAY = 37, DELETE = 38, DESC = 39, DESCENDING = 40, DESCRIBE = 41, + DETACH = 42, DICTIONARIES = 43, DICTIONARY = 44, DISK = 45, DISTINCT = 46, + DISTRIBUTED = 47, DROP = 48, ELSE = 49, END = 50, ENGINE = 51, EVENTS = 52, + EXISTS = 53, EXPLAIN = 54, EXPRESSION = 55, EXTRACT = 56, FETCHES = 57, + FINAL = 58, FIRST = 59, FLUSH = 60, FOR = 61, FORMAT = 62, FREEZE = 63, + FROM = 64, FULL = 65, FUNCTION = 66, GLOBAL = 67, GRANULARITY = 68, + GROUP = 69, HAVING = 70, HIERARCHICAL = 71, HOUR = 72, ID = 73, IF = 74, + ILIKE = 75, IN = 76, INDEX = 77, INF = 78, INJECTIVE = 79, INNER = 80, + INSERT = 81, INTERVAL = 82, INTO = 83, IS = 84, IS_OBJECT_ID = 85, JOIN = 86, + KEY = 87, KILL = 88, LAST = 89, LAYOUT = 90, LEADING = 91, LEFT = 92, + LIFETIME = 93, LIKE = 94, LIMIT = 95, LIVE = 96, LOCAL = 97, LOGS = 98, + MATERIALIZED = 99, MAX = 100, MERGES = 101, MIN = 102, MINUTE = 103, + MODIFY = 104, MONTH = 105, MOVE = 106, MUTATION = 107, NAN_SQL = 108, + NO = 109, NOT = 110, NULL_SQL = 111, NULLS = 112, OFFSET = 113, ON = 114, + OPTIMIZE = 115, OR = 116, ORDER = 117, OUTER = 118, OUTFILE = 119, PARTITION = 120, + POPULATE = 121, PREWHERE = 122, PRIMARY = 123, QUARTER = 124, RANGE = 125, + RELOAD = 126, REMOVE = 127, RENAME = 128, REPLACE = 129, REPLICA = 130, + REPLICATED = 131, RIGHT = 132, ROLLUP = 133, SAMPLE = 134, SECOND = 135, + SELECT = 136, SEMI = 137, SENDS = 138, SET = 139, SETTINGS = 140, SHOW = 141, + SOURCE = 142, START = 143, STOP = 144, SUBSTRING = 145, SYNC = 146, + SYNTAX = 147, SYSTEM = 148, TABLE = 149, TABLES = 150, TEMPORARY = 151, + TEST = 152, THEN = 153, TIES = 154, TIMEOUT = 155, TIMESTAMP = 156, + TO = 157, TOP = 158, TOTALS = 159, TRAILING = 160, TRIM = 161, TRUNCATE = 162, + TTL = 163, TYPE = 164, UNION = 165, UPDATE = 166, USE = 167, USING = 168, + UUID = 169, VALUES = 170, VIEW = 171, VOLUME = 172, WATCH = 173, WEEK = 174, + WHEN = 175, WHERE = 176, WITH = 177, YEAR = 178, JSON_FALSE = 179, JSON_TRUE = 180, + IDENTIFIER = 181, FLOATING_LITERAL = 182, OCTAL_LITERAL = 183, DECIMAL_LITERAL = 184, + HEXADECIMAL_LITERAL = 185, STRING_LITERAL = 186, ARROW = 187, ASTERISK = 188, + BACKQUOTE = 189, BACKSLASH = 190, COLON = 191, COMMA = 192, CONCAT = 193, + DASH = 194, DOT = 195, EQ_DOUBLE = 196, EQ_SINGLE = 197, GE = 198, GT = 199, + LBRACE = 200, LBRACKET = 201, LE = 202, LPAREN = 203, LT = 204, NOT_EQ = 205, + PERCENT = 206, PLUS = 207, QUERY = 208, QUOTE_DOUBLE = 209, QUOTE_SINGLE = 210, + RBRACE = 211, RBRACKET = 212, RPAREN = 213, SEMICOLON = 214, SLASH = 215, + UNDERSCORE = 216, MULTI_LINE_COMMENT = 217, SINGLE_LINE_COMMENT = 218, + WHITESPACE = 219 + }; + + enum { + RuleQueryStmt = 0, RuleQuery = 1, RuleAlterStmt = 2, RuleAlterTableClause = 3, + RuleAssignmentExprList = 4, RuleAssignmentExpr = 5, RuleTableColumnPropertyType = 6, + RulePartitionClause = 7, RuleAttachStmt = 8, RuleCheckStmt = 9, RuleCreateStmt = 10, + RuleDictionarySchemaClause = 11, RuleDictionaryAttrDfnt = 12, RuleDictionaryEngineClause = 13, + RuleDictionaryPrimaryKeyClause = 14, RuleDictionaryArgExpr = 15, RuleSourceClause = 16, + RuleLifetimeClause = 17, RuleLayoutClause = 18, RuleRangeClause = 19, + RuleDictionarySettingsClause = 20, RuleClusterClause = 21, RuleUuidClause = 22, + RuleDestinationClause = 23, RuleSubqueryClause = 24, RuleTableSchemaClause = 25, + RuleEngineClause = 26, RulePartitionByClause = 27, RulePrimaryKeyClause = 28, + RuleSampleByClause = 29, RuleTtlClause = 30, RuleEngineExpr = 31, RuleTableElementExpr = 32, + RuleTableColumnDfnt = 33, RuleTableColumnPropertyExpr = 34, RuleTableIndexDfnt = 35, + RuleCodecExpr = 36, RuleCodecArgExpr = 37, RuleTtlExpr = 38, RuleDescribeStmt = 39, + RuleDropStmt = 40, RuleExistsStmt = 41, RuleExplainStmt = 42, RuleInsertStmt = 43, + RuleColumnsClause = 44, RuleDataClause = 45, RuleKillStmt = 46, RuleOptimizeStmt = 47, + RuleRenameStmt = 48, RuleSelectUnionStmt = 49, RuleSelectStmtWithParens = 50, + RuleSelectStmt = 51, RuleWithClause = 52, RuleTopClause = 53, RuleFromClause = 54, + RuleArrayJoinClause = 55, RulePrewhereClause = 56, RuleWhereClause = 57, + RuleGroupByClause = 58, RuleHavingClause = 59, RuleOrderByClause = 60, + RuleLimitByClause = 61, RuleLimitClause = 62, RuleSettingsClause = 63, + RuleJoinExpr = 64, RuleJoinOp = 65, RuleJoinOpCross = 66, RuleJoinConstraintClause = 67, + RuleSampleClause = 68, RuleLimitExpr = 69, RuleOrderExprList = 70, RuleOrderExpr = 71, + RuleRatioExpr = 72, RuleSettingExprList = 73, RuleSettingExpr = 74, + RuleSetStmt = 75, RuleShowStmt = 76, RuleSystemStmt = 77, RuleTruncateStmt = 78, + RuleUseStmt = 79, RuleWatchStmt = 80, RuleColumnTypeExpr = 81, RuleColumnExprList = 82, + RuleColumnsExpr = 83, RuleColumnExpr = 84, RuleColumnArgList = 85, RuleColumnArgExpr = 86, + RuleColumnLambdaExpr = 87, RuleColumnIdentifier = 88, RuleNestedIdentifier = 89, + RuleTableExpr = 90, RuleTableFunctionExpr = 91, RuleTableIdentifier = 92, + RuleTableArgList = 93, RuleTableArgExpr = 94, RuleDatabaseIdentifier = 95, + RuleFloatingLiteral = 96, RuleNumberLiteral = 97, RuleLiteral = 98, + RuleInterval = 99, RuleKeyword = 100, RuleKeywordForAlias = 101, RuleAlias = 102, + RuleIdentifier = 103, RuleIdentifierOrNull = 104, RuleEnumValue = 105 + }; + + ClickHouseParser(antlr4::TokenStream *input); + ~ClickHouseParser(); + + virtual std::string getGrammarFileName() const override; + virtual const antlr4::atn::ATN& getATN() const override { return _atn; }; + virtual const std::vector& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead. + virtual const std::vector& getRuleNames() const override; + virtual antlr4::dfa::Vocabulary& getVocabulary() const override; + + + class QueryStmtContext; + class QueryContext; + class AlterStmtContext; + class AlterTableClauseContext; + class AssignmentExprListContext; + class AssignmentExprContext; + class TableColumnPropertyTypeContext; + class PartitionClauseContext; + class AttachStmtContext; + class CheckStmtContext; + class CreateStmtContext; + class DictionarySchemaClauseContext; + class DictionaryAttrDfntContext; + class DictionaryEngineClauseContext; + class DictionaryPrimaryKeyClauseContext; + class DictionaryArgExprContext; + class SourceClauseContext; + class LifetimeClauseContext; + class LayoutClauseContext; + class RangeClauseContext; + class DictionarySettingsClauseContext; + class ClusterClauseContext; + class UuidClauseContext; + class DestinationClauseContext; + class SubqueryClauseContext; + class TableSchemaClauseContext; + class EngineClauseContext; + class PartitionByClauseContext; + class PrimaryKeyClauseContext; + class SampleByClauseContext; + class TtlClauseContext; + class EngineExprContext; + class TableElementExprContext; + class TableColumnDfntContext; + class TableColumnPropertyExprContext; + class TableIndexDfntContext; + class CodecExprContext; + class CodecArgExprContext; + class TtlExprContext; + class DescribeStmtContext; + class DropStmtContext; + class ExistsStmtContext; + class ExplainStmtContext; + class InsertStmtContext; + class ColumnsClauseContext; + class DataClauseContext; + class KillStmtContext; + class OptimizeStmtContext; + class RenameStmtContext; + class SelectUnionStmtContext; + class SelectStmtWithParensContext; + class SelectStmtContext; + class WithClauseContext; + class TopClauseContext; + class FromClauseContext; + class ArrayJoinClauseContext; + class PrewhereClauseContext; + class WhereClauseContext; + class GroupByClauseContext; + class HavingClauseContext; + class OrderByClauseContext; + class LimitByClauseContext; + class LimitClauseContext; + class SettingsClauseContext; + class JoinExprContext; + class JoinOpContext; + class JoinOpCrossContext; + class JoinConstraintClauseContext; + class SampleClauseContext; + class LimitExprContext; + class OrderExprListContext; + class OrderExprContext; + class RatioExprContext; + class SettingExprListContext; + class SettingExprContext; + class SetStmtContext; + class ShowStmtContext; + class SystemStmtContext; + class TruncateStmtContext; + class UseStmtContext; + class WatchStmtContext; + class ColumnTypeExprContext; + class ColumnExprListContext; + class ColumnsExprContext; + class ColumnExprContext; + class ColumnArgListContext; + class ColumnArgExprContext; + class ColumnLambdaExprContext; + class ColumnIdentifierContext; + class NestedIdentifierContext; + class TableExprContext; + class TableFunctionExprContext; + class TableIdentifierContext; + class TableArgListContext; + class TableArgExprContext; + class DatabaseIdentifierContext; + class FloatingLiteralContext; + class NumberLiteralContext; + class LiteralContext; + class IntervalContext; + class KeywordContext; + class KeywordForAliasContext; + class AliasContext; + class IdentifierContext; + class IdentifierOrNullContext; + class EnumValueContext; + + class QueryStmtContext : public antlr4::ParserRuleContext { + public: + QueryStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + QueryContext *query(); + antlr4::tree::TerminalNode *INTO(); + antlr4::tree::TerminalNode *OUTFILE(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *FORMAT(); + IdentifierOrNullContext *identifierOrNull(); + antlr4::tree::TerminalNode *SEMICOLON(); + InsertStmtContext *insertStmt(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + QueryStmtContext* queryStmt(); + + class QueryContext : public antlr4::ParserRuleContext { + public: + QueryContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + AlterStmtContext *alterStmt(); + AttachStmtContext *attachStmt(); + CheckStmtContext *checkStmt(); + CreateStmtContext *createStmt(); + DescribeStmtContext *describeStmt(); + DropStmtContext *dropStmt(); + ExistsStmtContext *existsStmt(); + ExplainStmtContext *explainStmt(); + KillStmtContext *killStmt(); + OptimizeStmtContext *optimizeStmt(); + RenameStmtContext *renameStmt(); + SelectUnionStmtContext *selectUnionStmt(); + SetStmtContext *setStmt(); + ShowStmtContext *showStmt(); + SystemStmtContext *systemStmt(); + TruncateStmtContext *truncateStmt(); + UseStmtContext *useStmt(); + WatchStmtContext *watchStmt(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + QueryContext* query(); + + class AlterStmtContext : public antlr4::ParserRuleContext { + public: + AlterStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + AlterStmtContext() = default; + void copyFrom(AlterStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class AlterTableStmtContext : public AlterStmtContext { + public: + AlterTableStmtContext(AlterStmtContext *ctx); + + antlr4::tree::TerminalNode *ALTER(); + antlr4::tree::TerminalNode *TABLE(); + TableIdentifierContext *tableIdentifier(); + std::vector alterTableClause(); + AlterTableClauseContext* alterTableClause(size_t i); + ClusterClauseContext *clusterClause(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + AlterStmtContext* alterStmt(); + + class AlterTableClauseContext : public antlr4::ParserRuleContext { + public: + AlterTableClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + AlterTableClauseContext() = default; + void copyFrom(AlterTableClauseContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class AlterTableClauseReplaceContext : public AlterTableClauseContext { + public: + AlterTableClauseReplaceContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *REPLACE(); + PartitionClauseContext *partitionClause(); + antlr4::tree::TerminalNode *FROM(); + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseRenameContext : public AlterTableClauseContext { + public: + AlterTableClauseRenameContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *RENAME(); + antlr4::tree::TerminalNode *COLUMN(); + std::vector nestedIdentifier(); + NestedIdentifierContext* nestedIdentifier(size_t i); + antlr4::tree::TerminalNode *TO(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseFreezePartitionContext : public AlterTableClauseContext { + public: + AlterTableClauseFreezePartitionContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *FREEZE(); + PartitionClauseContext *partitionClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *COLUMN(); + TableColumnDfntContext *tableColumnDfnt(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyOrderByContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyOrderByContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *ORDER(); + antlr4::tree::TerminalNode *BY(); + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseRemoveTTLContext : public AlterTableClauseContext { + public: + AlterTableClauseRemoveTTLContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *REMOVE(); + antlr4::tree::TerminalNode *TTL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseUpdateContext : public AlterTableClauseContext { + public: + AlterTableClauseUpdateContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *UPDATE(); + AssignmentExprListContext *assignmentExprList(); + WhereClauseContext *whereClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyRemoveContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyRemoveContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *REMOVE(); + TableColumnPropertyTypeContext *tableColumnPropertyType(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseDeleteContext : public AlterTableClauseContext { + public: + AlterTableClauseDeleteContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *DELETE(); + antlr4::tree::TerminalNode *WHERE(); + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyCodecContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyCodecContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + CodecExprContext *codecExpr(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseCommentContext : public AlterTableClauseContext { + public: + AlterTableClauseCommentContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *COMMENT(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseAttachContext : public AlterTableClauseContext { + public: + AlterTableClauseAttachContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *ATTACH(); + PartitionClauseContext *partitionClause(); + antlr4::tree::TerminalNode *FROM(); + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseDropColumnContext : public AlterTableClauseContext { + public: + AlterTableClauseDropColumnContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *DROP(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseClearContext : public AlterTableClauseContext { + public: + AlterTableClauseClearContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *CLEAR(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + antlr4::tree::TerminalNode *IN(); + PartitionClauseContext *partitionClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseDetachContext : public AlterTableClauseContext { + public: + AlterTableClauseDetachContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *DETACH(); + PartitionClauseContext *partitionClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseDropIndexContext : public AlterTableClauseContext { + public: + AlterTableClauseDropIndexContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *DROP(); + antlr4::tree::TerminalNode *INDEX(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseAddIndexContext : public AlterTableClauseContext { + public: + AlterTableClauseAddIndexContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *ADD(); + antlr4::tree::TerminalNode *INDEX(); + TableIndexDfntContext *tableIndexDfnt(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + antlr4::tree::TerminalNode *AFTER(); + NestedIdentifierContext *nestedIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseDropPartitionContext : public AlterTableClauseContext { + public: + AlterTableClauseDropPartitionContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *DROP(); + PartitionClauseContext *partitionClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyCommentContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyCommentContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *COLUMN(); + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *COMMENT(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseModifyTTLContext : public AlterTableClauseContext { + public: + AlterTableClauseModifyTTLContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MODIFY(); + TtlClauseContext *ttlClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseMovePartitionContext : public AlterTableClauseContext { + public: + AlterTableClauseMovePartitionContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *MOVE(); + PartitionClauseContext *partitionClause(); + antlr4::tree::TerminalNode *TO(); + antlr4::tree::TerminalNode *DISK(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *VOLUME(); + antlr4::tree::TerminalNode *TABLE(); + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AlterTableClauseAddColumnContext : public AlterTableClauseContext { + public: + AlterTableClauseAddColumnContext(AlterTableClauseContext *ctx); + + antlr4::tree::TerminalNode *ADD(); + antlr4::tree::TerminalNode *COLUMN(); + TableColumnDfntContext *tableColumnDfnt(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + antlr4::tree::TerminalNode *AFTER(); + NestedIdentifierContext *nestedIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + AlterTableClauseContext* alterTableClause(); + + class AssignmentExprListContext : public antlr4::ParserRuleContext { + public: + AssignmentExprListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector assignmentExpr(); + AssignmentExprContext* assignmentExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + AssignmentExprListContext* assignmentExprList(); + + class AssignmentExprContext : public antlr4::ParserRuleContext { + public: + AssignmentExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NestedIdentifierContext *nestedIdentifier(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + AssignmentExprContext* assignmentExpr(); + + class TableColumnPropertyTypeContext : public antlr4::ParserRuleContext { + public: + TableColumnPropertyTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ALIAS(); + antlr4::tree::TerminalNode *CODEC(); + antlr4::tree::TerminalNode *COMMENT(); + antlr4::tree::TerminalNode *DEFAULT(); + antlr4::tree::TerminalNode *MATERIALIZED(); + antlr4::tree::TerminalNode *TTL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableColumnPropertyTypeContext* tableColumnPropertyType(); + + class PartitionClauseContext : public antlr4::ParserRuleContext { + public: + PartitionClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PARTITION(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *ID(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + PartitionClauseContext* partitionClause(); + + class AttachStmtContext : public antlr4::ParserRuleContext { + public: + AttachStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + AttachStmtContext() = default; + void copyFrom(AttachStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class AttachDictionaryStmtContext : public AttachStmtContext { + public: + AttachDictionaryStmtContext(AttachStmtContext *ctx); + + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *DICTIONARY(); + TableIdentifierContext *tableIdentifier(); + ClusterClauseContext *clusterClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + AttachStmtContext* attachStmt(); + + class CheckStmtContext : public antlr4::ParserRuleContext { + public: + CheckStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *CHECK(); + antlr4::tree::TerminalNode *TABLE(); + TableIdentifierContext *tableIdentifier(); + PartitionClauseContext *partitionClause(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + CheckStmtContext* checkStmt(); + + class CreateStmtContext : public antlr4::ParserRuleContext { + public: + CreateStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + CreateStmtContext() = default; + void copyFrom(CreateStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class CreateViewStmtContext : public CreateStmtContext { + public: + CreateViewStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *VIEW(); + TableIdentifierContext *tableIdentifier(); + SubqueryClauseContext *subqueryClause(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *OR(); + antlr4::tree::TerminalNode *REPLACE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + UuidClauseContext *uuidClause(); + ClusterClauseContext *clusterClause(); + TableSchemaClauseContext *tableSchemaClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class CreateDictionaryStmtContext : public CreateStmtContext { + public: + CreateDictionaryStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *DICTIONARY(); + TableIdentifierContext *tableIdentifier(); + DictionarySchemaClauseContext *dictionarySchemaClause(); + DictionaryEngineClauseContext *dictionaryEngineClause(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + UuidClauseContext *uuidClause(); + ClusterClauseContext *clusterClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class CreateDatabaseStmtContext : public CreateStmtContext { + public: + CreateDatabaseStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *DATABASE(); + DatabaseIdentifierContext *databaseIdentifier(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + ClusterClauseContext *clusterClause(); + EngineExprContext *engineExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class CreateLiveViewStmtContext : public CreateStmtContext { + public: + CreateLiveViewStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *LIVE(); + antlr4::tree::TerminalNode *VIEW(); + TableIdentifierContext *tableIdentifier(); + SubqueryClauseContext *subqueryClause(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + UuidClauseContext *uuidClause(); + ClusterClauseContext *clusterClause(); + antlr4::tree::TerminalNode *WITH(); + antlr4::tree::TerminalNode *TIMEOUT(); + DestinationClauseContext *destinationClause(); + TableSchemaClauseContext *tableSchemaClause(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class CreateMaterializedViewStmtContext : public CreateStmtContext { + public: + CreateMaterializedViewStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *MATERIALIZED(); + antlr4::tree::TerminalNode *VIEW(); + TableIdentifierContext *tableIdentifier(); + SubqueryClauseContext *subqueryClause(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + DestinationClauseContext *destinationClause(); + EngineClauseContext *engineClause(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + UuidClauseContext *uuidClause(); + ClusterClauseContext *clusterClause(); + TableSchemaClauseContext *tableSchemaClause(); + antlr4::tree::TerminalNode *POPULATE(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class CreateTableStmtContext : public CreateStmtContext { + public: + CreateTableStmtContext(CreateStmtContext *ctx); + + antlr4::tree::TerminalNode *TABLE(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *TEMPORARY(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *EXISTS(); + UuidClauseContext *uuidClause(); + ClusterClauseContext *clusterClause(); + TableSchemaClauseContext *tableSchemaClause(); + EngineClauseContext *engineClause(); + SubqueryClauseContext *subqueryClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + CreateStmtContext* createStmt(); + + class DictionarySchemaClauseContext : public antlr4::ParserRuleContext { + public: + DictionarySchemaClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LPAREN(); + std::vector dictionaryAttrDfnt(); + DictionaryAttrDfntContext* dictionaryAttrDfnt(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionarySchemaClauseContext* dictionarySchemaClause(); + + class DictionaryAttrDfntContext : public antlr4::ParserRuleContext { + public: + std::set attrs; + DictionaryAttrDfntContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + ColumnTypeExprContext *columnTypeExpr(); + std::vector DEFAULT(); + antlr4::tree::TerminalNode* DEFAULT(size_t i); + std::vector literal(); + LiteralContext* literal(size_t i); + std::vector EXPRESSION(); + antlr4::tree::TerminalNode* EXPRESSION(size_t i); + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + std::vector HIERARCHICAL(); + antlr4::tree::TerminalNode* HIERARCHICAL(size_t i); + std::vector INJECTIVE(); + antlr4::tree::TerminalNode* INJECTIVE(size_t i); + std::vector IS_OBJECT_ID(); + antlr4::tree::TerminalNode* IS_OBJECT_ID(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionaryAttrDfntContext* dictionaryAttrDfnt(); + + class DictionaryEngineClauseContext : public antlr4::ParserRuleContext { + public: + std::set clauses; + DictionaryEngineClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + DictionaryPrimaryKeyClauseContext *dictionaryPrimaryKeyClause(); + std::vector sourceClause(); + SourceClauseContext* sourceClause(size_t i); + std::vector lifetimeClause(); + LifetimeClauseContext* lifetimeClause(size_t i); + std::vector layoutClause(); + LayoutClauseContext* layoutClause(size_t i); + std::vector rangeClause(); + RangeClauseContext* rangeClause(size_t i); + std::vector dictionarySettingsClause(); + DictionarySettingsClauseContext* dictionarySettingsClause(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionaryEngineClauseContext* dictionaryEngineClause(); + + class DictionaryPrimaryKeyClauseContext : public antlr4::ParserRuleContext { + public: + DictionaryPrimaryKeyClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PRIMARY(); + antlr4::tree::TerminalNode *KEY(); + ColumnExprListContext *columnExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionaryPrimaryKeyClauseContext* dictionaryPrimaryKeyClause(); + + class DictionaryArgExprContext : public antlr4::ParserRuleContext { + public: + DictionaryArgExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector identifier(); + IdentifierContext* identifier(size_t i); + LiteralContext *literal(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionaryArgExprContext* dictionaryArgExpr(); + + class SourceClauseContext : public antlr4::ParserRuleContext { + public: + SourceClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SOURCE(); + std::vector LPAREN(); + antlr4::tree::TerminalNode* LPAREN(size_t i); + IdentifierContext *identifier(); + std::vector RPAREN(); + antlr4::tree::TerminalNode* RPAREN(size_t i); + std::vector dictionaryArgExpr(); + DictionaryArgExprContext* dictionaryArgExpr(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SourceClauseContext* sourceClause(); + + class LifetimeClauseContext : public antlr4::ParserRuleContext { + public: + LifetimeClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LIFETIME(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + std::vector DECIMAL_LITERAL(); + antlr4::tree::TerminalNode* DECIMAL_LITERAL(size_t i); + antlr4::tree::TerminalNode *MIN(); + antlr4::tree::TerminalNode *MAX(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LifetimeClauseContext* lifetimeClause(); + + class LayoutClauseContext : public antlr4::ParserRuleContext { + public: + LayoutClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LAYOUT(); + std::vector LPAREN(); + antlr4::tree::TerminalNode* LPAREN(size_t i); + IdentifierContext *identifier(); + std::vector RPAREN(); + antlr4::tree::TerminalNode* RPAREN(size_t i); + std::vector dictionaryArgExpr(); + DictionaryArgExprContext* dictionaryArgExpr(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LayoutClauseContext* layoutClause(); + + class RangeClauseContext : public antlr4::ParserRuleContext { + public: + RangeClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *RANGE(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + antlr4::tree::TerminalNode *MIN(); + std::vector identifier(); + IdentifierContext* identifier(size_t i); + antlr4::tree::TerminalNode *MAX(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + RangeClauseContext* rangeClause(); + + class DictionarySettingsClauseContext : public antlr4::ParserRuleContext { + public: + DictionarySettingsClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SETTINGS(); + antlr4::tree::TerminalNode *LPAREN(); + SettingExprListContext *settingExprList(); + antlr4::tree::TerminalNode *RPAREN(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DictionarySettingsClauseContext* dictionarySettingsClause(); + + class ClusterClauseContext : public antlr4::ParserRuleContext { + public: + ClusterClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ON(); + antlr4::tree::TerminalNode *CLUSTER(); + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ClusterClauseContext* clusterClause(); + + class UuidClauseContext : public antlr4::ParserRuleContext { + public: + UuidClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *UUID(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + UuidClauseContext* uuidClause(); + + class DestinationClauseContext : public antlr4::ParserRuleContext { + public: + DestinationClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *TO(); + TableIdentifierContext *tableIdentifier(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DestinationClauseContext* destinationClause(); + + class SubqueryClauseContext : public antlr4::ParserRuleContext { + public: + SubqueryClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *AS(); + SelectUnionStmtContext *selectUnionStmt(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SubqueryClauseContext* subqueryClause(); + + class TableSchemaClauseContext : public antlr4::ParserRuleContext { + public: + TableSchemaClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + TableSchemaClauseContext() = default; + void copyFrom(TableSchemaClauseContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class SchemaAsTableClauseContext : public TableSchemaClauseContext { + public: + SchemaAsTableClauseContext(TableSchemaClauseContext *ctx); + + antlr4::tree::TerminalNode *AS(); + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class SchemaAsFunctionClauseContext : public TableSchemaClauseContext { + public: + SchemaAsFunctionClauseContext(TableSchemaClauseContext *ctx); + + antlr4::tree::TerminalNode *AS(); + TableFunctionExprContext *tableFunctionExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class SchemaDescriptionClauseContext : public TableSchemaClauseContext { + public: + SchemaDescriptionClauseContext(TableSchemaClauseContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + std::vector tableElementExpr(); + TableElementExprContext* tableElementExpr(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + TableSchemaClauseContext* tableSchemaClause(); + + class EngineClauseContext : public antlr4::ParserRuleContext { + public: + std::set clauses; + EngineClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + EngineExprContext *engineExpr(); + std::vector orderByClause(); + OrderByClauseContext* orderByClause(size_t i); + std::vector partitionByClause(); + PartitionByClauseContext* partitionByClause(size_t i); + std::vector primaryKeyClause(); + PrimaryKeyClauseContext* primaryKeyClause(size_t i); + std::vector sampleByClause(); + SampleByClauseContext* sampleByClause(size_t i); + std::vector ttlClause(); + TtlClauseContext* ttlClause(size_t i); + std::vector settingsClause(); + SettingsClauseContext* settingsClause(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + EngineClauseContext* engineClause(); + + class PartitionByClauseContext : public antlr4::ParserRuleContext { + public: + PartitionByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PARTITION(); + antlr4::tree::TerminalNode *BY(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + PartitionByClauseContext* partitionByClause(); + + class PrimaryKeyClauseContext : public antlr4::ParserRuleContext { + public: + PrimaryKeyClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PRIMARY(); + antlr4::tree::TerminalNode *KEY(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + PrimaryKeyClauseContext* primaryKeyClause(); + + class SampleByClauseContext : public antlr4::ParserRuleContext { + public: + SampleByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SAMPLE(); + antlr4::tree::TerminalNode *BY(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SampleByClauseContext* sampleByClause(); + + class TtlClauseContext : public antlr4::ParserRuleContext { + public: + TtlClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *TTL(); + std::vector ttlExpr(); + TtlExprContext* ttlExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TtlClauseContext* ttlClause(); + + class EngineExprContext : public antlr4::ParserRuleContext { + public: + EngineExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ENGINE(); + IdentifierOrNullContext *identifierOrNull(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + ColumnExprListContext *columnExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + EngineExprContext* engineExpr(); + + class TableElementExprContext : public antlr4::ParserRuleContext { + public: + TableElementExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + TableElementExprContext() = default; + void copyFrom(TableElementExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class TableElementExprConstraintContext : public TableElementExprContext { + public: + TableElementExprConstraintContext(TableElementExprContext *ctx); + + antlr4::tree::TerminalNode *CONSTRAINT(); + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *CHECK(); + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableElementExprColumnContext : public TableElementExprContext { + public: + TableElementExprColumnContext(TableElementExprContext *ctx); + + TableColumnDfntContext *tableColumnDfnt(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableElementExprIndexContext : public TableElementExprContext { + public: + TableElementExprIndexContext(TableElementExprContext *ctx); + + antlr4::tree::TerminalNode *INDEX(); + TableIndexDfntContext *tableIndexDfnt(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + TableElementExprContext* tableElementExpr(); + + class TableColumnDfntContext : public antlr4::ParserRuleContext { + public: + TableColumnDfntContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NestedIdentifierContext *nestedIdentifier(); + ColumnTypeExprContext *columnTypeExpr(); + TableColumnPropertyExprContext *tableColumnPropertyExpr(); + antlr4::tree::TerminalNode *COMMENT(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + CodecExprContext *codecExpr(); + antlr4::tree::TerminalNode *TTL(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableColumnDfntContext* tableColumnDfnt(); + + class TableColumnPropertyExprContext : public antlr4::ParserRuleContext { + public: + TableColumnPropertyExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *DEFAULT(); + antlr4::tree::TerminalNode *MATERIALIZED(); + antlr4::tree::TerminalNode *ALIAS(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableColumnPropertyExprContext* tableColumnPropertyExpr(); + + class TableIndexDfntContext : public antlr4::ParserRuleContext { + public: + TableIndexDfntContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NestedIdentifierContext *nestedIdentifier(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *TYPE(); + ColumnTypeExprContext *columnTypeExpr(); + antlr4::tree::TerminalNode *GRANULARITY(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableIndexDfntContext* tableIndexDfnt(); + + class CodecExprContext : public antlr4::ParserRuleContext { + public: + CodecExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *CODEC(); + antlr4::tree::TerminalNode *LPAREN(); + std::vector codecArgExpr(); + CodecArgExprContext* codecArgExpr(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + CodecExprContext* codecExpr(); + + class CodecArgExprContext : public antlr4::ParserRuleContext { + public: + CodecArgExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + ColumnExprListContext *columnExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + CodecArgExprContext* codecArgExpr(); + + class TtlExprContext : public antlr4::ParserRuleContext { + public: + TtlExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *DELETE(); + antlr4::tree::TerminalNode *TO(); + antlr4::tree::TerminalNode *DISK(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *VOLUME(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TtlExprContext* ttlExpr(); + + class DescribeStmtContext : public antlr4::ParserRuleContext { + public: + DescribeStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TableExprContext *tableExpr(); + antlr4::tree::TerminalNode *DESCRIBE(); + antlr4::tree::TerminalNode *DESC(); + antlr4::tree::TerminalNode *TABLE(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DescribeStmtContext* describeStmt(); + + class DropStmtContext : public antlr4::ParserRuleContext { + public: + DropStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + DropStmtContext() = default; + void copyFrom(DropStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class DropDatabaseStmtContext : public DropStmtContext { + public: + DropDatabaseStmtContext(DropStmtContext *ctx); + + antlr4::tree::TerminalNode *DATABASE(); + DatabaseIdentifierContext *databaseIdentifier(); + antlr4::tree::TerminalNode *DETACH(); + antlr4::tree::TerminalNode *DROP(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + ClusterClauseContext *clusterClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class DropTableStmtContext : public DropStmtContext { + public: + DropTableStmtContext(DropStmtContext *ctx); + + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DETACH(); + antlr4::tree::TerminalNode *DROP(); + antlr4::tree::TerminalNode *DICTIONARY(); + antlr4::tree::TerminalNode *TABLE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + ClusterClauseContext *clusterClause(); + antlr4::tree::TerminalNode *NO(); + antlr4::tree::TerminalNode *DELAY(); + antlr4::tree::TerminalNode *TEMPORARY(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + DropStmtContext* dropStmt(); + + class ExistsStmtContext : public antlr4::ParserRuleContext { + public: + ExistsStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *EXISTS(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DICTIONARY(); + antlr4::tree::TerminalNode *TABLE(); + antlr4::tree::TerminalNode *TEMPORARY(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ExistsStmtContext* existsStmt(); + + class ExplainStmtContext : public antlr4::ParserRuleContext { + public: + ExplainStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *EXPLAIN(); + antlr4::tree::TerminalNode *SYNTAX(); + QueryContext *query(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ExplainStmtContext* explainStmt(); + + class InsertStmtContext : public antlr4::ParserRuleContext { + public: + InsertStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *INSERT(); + antlr4::tree::TerminalNode *INTO(); + DataClauseContext *dataClause(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *FUNCTION(); + TableFunctionExprContext *tableFunctionExpr(); + antlr4::tree::TerminalNode *TABLE(); + ColumnsClauseContext *columnsClause(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + InsertStmtContext* insertStmt(); + + class ColumnsClauseContext : public antlr4::ParserRuleContext { + public: + ColumnsClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LPAREN(); + std::vector nestedIdentifier(); + NestedIdentifierContext* nestedIdentifier(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnsClauseContext* columnsClause(); + + class DataClauseContext : public antlr4::ParserRuleContext { + public: + DataClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + DataClauseContext() = default; + void copyFrom(DataClauseContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class DataClauseValuesContext : public DataClauseContext { + public: + DataClauseValuesContext(DataClauseContext *ctx); + + antlr4::tree::TerminalNode *VALUES(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class DataClauseFormatContext : public DataClauseContext { + public: + DataClauseFormatContext(DataClauseContext *ctx); + + antlr4::tree::TerminalNode *FORMAT(); + IdentifierContext *identifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class DataClauseSelectContext : public DataClauseContext { + public: + DataClauseSelectContext(DataClauseContext *ctx); + + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *EOF(); + antlr4::tree::TerminalNode *SEMICOLON(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + DataClauseContext* dataClause(); + + class KillStmtContext : public antlr4::ParserRuleContext { + public: + KillStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + KillStmtContext() = default; + void copyFrom(KillStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class KillMutationStmtContext : public KillStmtContext { + public: + KillMutationStmtContext(KillStmtContext *ctx); + + antlr4::tree::TerminalNode *KILL(); + antlr4::tree::TerminalNode *MUTATION(); + WhereClauseContext *whereClause(); + ClusterClauseContext *clusterClause(); + antlr4::tree::TerminalNode *SYNC(); + antlr4::tree::TerminalNode *ASYNC(); + antlr4::tree::TerminalNode *TEST(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + KillStmtContext* killStmt(); + + class OptimizeStmtContext : public antlr4::ParserRuleContext { + public: + OptimizeStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *OPTIMIZE(); + antlr4::tree::TerminalNode *TABLE(); + TableIdentifierContext *tableIdentifier(); + ClusterClauseContext *clusterClause(); + PartitionClauseContext *partitionClause(); + antlr4::tree::TerminalNode *FINAL(); + antlr4::tree::TerminalNode *DEDUPLICATE(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + OptimizeStmtContext* optimizeStmt(); + + class RenameStmtContext : public antlr4::ParserRuleContext { + public: + RenameStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *RENAME(); + antlr4::tree::TerminalNode *TABLE(); + std::vector tableIdentifier(); + TableIdentifierContext* tableIdentifier(size_t i); + std::vector TO(); + antlr4::tree::TerminalNode* TO(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + ClusterClauseContext *clusterClause(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + RenameStmtContext* renameStmt(); + + class SelectUnionStmtContext : public antlr4::ParserRuleContext { + public: + SelectUnionStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector selectStmtWithParens(); + SelectStmtWithParensContext* selectStmtWithParens(size_t i); + std::vector UNION(); + antlr4::tree::TerminalNode* UNION(size_t i); + std::vector ALL(); + antlr4::tree::TerminalNode* ALL(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SelectUnionStmtContext* selectUnionStmt(); + + class SelectStmtWithParensContext : public antlr4::ParserRuleContext { + public: + SelectStmtWithParensContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + SelectStmtContext *selectStmt(); + antlr4::tree::TerminalNode *LPAREN(); + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *RPAREN(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SelectStmtWithParensContext* selectStmtWithParens(); + + class SelectStmtContext : public antlr4::ParserRuleContext { + public: + SelectStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SELECT(); + ColumnExprListContext *columnExprList(); + WithClauseContext *withClause(); + antlr4::tree::TerminalNode *DISTINCT(); + TopClauseContext *topClause(); + FromClauseContext *fromClause(); + ArrayJoinClauseContext *arrayJoinClause(); + PrewhereClauseContext *prewhereClause(); + WhereClauseContext *whereClause(); + GroupByClauseContext *groupByClause(); + std::vector WITH(); + antlr4::tree::TerminalNode* WITH(size_t i); + antlr4::tree::TerminalNode *TOTALS(); + HavingClauseContext *havingClause(); + OrderByClauseContext *orderByClause(); + LimitByClauseContext *limitByClause(); + LimitClauseContext *limitClause(); + SettingsClauseContext *settingsClause(); + antlr4::tree::TerminalNode *CUBE(); + antlr4::tree::TerminalNode *ROLLUP(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SelectStmtContext* selectStmt(); + + class WithClauseContext : public antlr4::ParserRuleContext { + public: + WithClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *WITH(); + ColumnExprListContext *columnExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WithClauseContext* withClause(); + + class TopClauseContext : public antlr4::ParserRuleContext { + public: + TopClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *TOP(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + antlr4::tree::TerminalNode *WITH(); + antlr4::tree::TerminalNode *TIES(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TopClauseContext* topClause(); + + class FromClauseContext : public antlr4::ParserRuleContext { + public: + FromClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *FROM(); + JoinExprContext *joinExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + FromClauseContext* fromClause(); + + class ArrayJoinClauseContext : public antlr4::ParserRuleContext { + public: + ArrayJoinClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ARRAY(); + antlr4::tree::TerminalNode *JOIN(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *LEFT(); + antlr4::tree::TerminalNode *INNER(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ArrayJoinClauseContext* arrayJoinClause(); + + class PrewhereClauseContext : public antlr4::ParserRuleContext { + public: + PrewhereClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PREWHERE(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + PrewhereClauseContext* prewhereClause(); + + class WhereClauseContext : public antlr4::ParserRuleContext { + public: + WhereClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *WHERE(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WhereClauseContext* whereClause(); + + class GroupByClauseContext : public antlr4::ParserRuleContext { + public: + GroupByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *GROUP(); + antlr4::tree::TerminalNode *BY(); + antlr4::tree::TerminalNode *LPAREN(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *RPAREN(); + antlr4::tree::TerminalNode *CUBE(); + antlr4::tree::TerminalNode *ROLLUP(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + GroupByClauseContext* groupByClause(); + + class HavingClauseContext : public antlr4::ParserRuleContext { + public: + HavingClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *HAVING(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + HavingClauseContext* havingClause(); + + class OrderByClauseContext : public antlr4::ParserRuleContext { + public: + OrderByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ORDER(); + antlr4::tree::TerminalNode *BY(); + OrderExprListContext *orderExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + OrderByClauseContext* orderByClause(); + + class LimitByClauseContext : public antlr4::ParserRuleContext { + public: + LimitByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LIMIT(); + LimitExprContext *limitExpr(); + antlr4::tree::TerminalNode *BY(); + ColumnExprListContext *columnExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LimitByClauseContext* limitByClause(); + + class LimitClauseContext : public antlr4::ParserRuleContext { + public: + LimitClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LIMIT(); + LimitExprContext *limitExpr(); + antlr4::tree::TerminalNode *WITH(); + antlr4::tree::TerminalNode *TIES(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LimitClauseContext* limitClause(); + + class SettingsClauseContext : public antlr4::ParserRuleContext { + public: + SettingsClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SETTINGS(); + SettingExprListContext *settingExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SettingsClauseContext* settingsClause(); + + class JoinExprContext : public antlr4::ParserRuleContext { + public: + JoinExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + JoinExprContext() = default; + void copyFrom(JoinExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class JoinExprOpContext : public JoinExprContext { + public: + JoinExprOpContext(JoinExprContext *ctx); + + std::vector joinExpr(); + JoinExprContext* joinExpr(size_t i); + antlr4::tree::TerminalNode *JOIN(); + JoinConstraintClauseContext *joinConstraintClause(); + JoinOpContext *joinOp(); + antlr4::tree::TerminalNode *GLOBAL(); + antlr4::tree::TerminalNode *LOCAL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinExprTableContext : public JoinExprContext { + public: + JoinExprTableContext(JoinExprContext *ctx); + + TableExprContext *tableExpr(); + antlr4::tree::TerminalNode *FINAL(); + SampleClauseContext *sampleClause(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinExprParensContext : public JoinExprContext { + public: + JoinExprParensContext(JoinExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + JoinExprContext *joinExpr(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinExprCrossOpContext : public JoinExprContext { + public: + JoinExprCrossOpContext(JoinExprContext *ctx); + + std::vector joinExpr(); + JoinExprContext* joinExpr(size_t i); + JoinOpCrossContext *joinOpCross(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + JoinExprContext* joinExpr(); + JoinExprContext* joinExpr(int precedence); + class JoinOpContext : public antlr4::ParserRuleContext { + public: + JoinOpContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + JoinOpContext() = default; + void copyFrom(JoinOpContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class JoinOpFullContext : public JoinOpContext { + public: + JoinOpFullContext(JoinOpContext *ctx); + + antlr4::tree::TerminalNode *FULL(); + antlr4::tree::TerminalNode *OUTER(); + antlr4::tree::TerminalNode *ALL(); + antlr4::tree::TerminalNode *ANY(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinOpInnerContext : public JoinOpContext { + public: + JoinOpInnerContext(JoinOpContext *ctx); + + antlr4::tree::TerminalNode *INNER(); + antlr4::tree::TerminalNode *ALL(); + antlr4::tree::TerminalNode *ANY(); + antlr4::tree::TerminalNode *ASOF(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinOpLeftRightContext : public JoinOpContext { + public: + JoinOpLeftRightContext(JoinOpContext *ctx); + + antlr4::tree::TerminalNode *LEFT(); + antlr4::tree::TerminalNode *RIGHT(); + antlr4::tree::TerminalNode *OUTER(); + antlr4::tree::TerminalNode *SEMI(); + antlr4::tree::TerminalNode *ALL(); + antlr4::tree::TerminalNode *ANTI(); + antlr4::tree::TerminalNode *ANY(); + antlr4::tree::TerminalNode *ASOF(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + JoinOpContext* joinOp(); + + class JoinOpCrossContext : public antlr4::ParserRuleContext { + public: + JoinOpCrossContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *CROSS(); + antlr4::tree::TerminalNode *JOIN(); + antlr4::tree::TerminalNode *GLOBAL(); + antlr4::tree::TerminalNode *LOCAL(); + antlr4::tree::TerminalNode *COMMA(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + JoinOpCrossContext* joinOpCross(); + + class JoinConstraintClauseContext : public antlr4::ParserRuleContext { + public: + JoinConstraintClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ON(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *USING(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + JoinConstraintClauseContext* joinConstraintClause(); + + class SampleClauseContext : public antlr4::ParserRuleContext { + public: + SampleClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SAMPLE(); + std::vector ratioExpr(); + RatioExprContext* ratioExpr(size_t i); + antlr4::tree::TerminalNode *OFFSET(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SampleClauseContext* sampleClause(); + + class LimitExprContext : public antlr4::ParserRuleContext { + public: + LimitExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *COMMA(); + antlr4::tree::TerminalNode *OFFSET(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LimitExprContext* limitExpr(); + + class OrderExprListContext : public antlr4::ParserRuleContext { + public: + OrderExprListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector orderExpr(); + OrderExprContext* orderExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + OrderExprListContext* orderExprList(); + + class OrderExprContext : public antlr4::ParserRuleContext { + public: + OrderExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *NULLS(); + antlr4::tree::TerminalNode *COLLATE(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *ASCENDING(); + antlr4::tree::TerminalNode *DESCENDING(); + antlr4::tree::TerminalNode *DESC(); + antlr4::tree::TerminalNode *FIRST(); + antlr4::tree::TerminalNode *LAST(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + OrderExprContext* orderExpr(); + + class RatioExprContext : public antlr4::ParserRuleContext { + public: + RatioExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector numberLiteral(); + NumberLiteralContext* numberLiteral(size_t i); + antlr4::tree::TerminalNode *SLASH(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + RatioExprContext* ratioExpr(); + + class SettingExprListContext : public antlr4::ParserRuleContext { + public: + SettingExprListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector settingExpr(); + SettingExprContext* settingExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SettingExprListContext* settingExprList(); + + class SettingExprContext : public antlr4::ParserRuleContext { + public: + SettingExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + LiteralContext *literal(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SettingExprContext* settingExpr(); + + class SetStmtContext : public antlr4::ParserRuleContext { + public: + SetStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SET(); + SettingExprListContext *settingExprList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SetStmtContext* setStmt(); + + class ShowStmtContext : public antlr4::ParserRuleContext { + public: + ShowStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + ShowStmtContext() = default; + void copyFrom(ShowStmtContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class ShowCreateDatabaseStmtContext : public ShowStmtContext { + public: + ShowCreateDatabaseStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *DATABASE(); + DatabaseIdentifierContext *databaseIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ShowDatabasesStmtContext : public ShowStmtContext { + public: + ShowDatabasesStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *DATABASES(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ShowCreateTableStmtContext : public ShowStmtContext { + public: + ShowCreateTableStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *CREATE(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *TEMPORARY(); + antlr4::tree::TerminalNode *TABLE(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ShowTablesStmtContext : public ShowStmtContext { + public: + ShowTablesStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *TABLES(); + antlr4::tree::TerminalNode *TEMPORARY(); + DatabaseIdentifierContext *databaseIdentifier(); + antlr4::tree::TerminalNode *LIKE(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + WhereClauseContext *whereClause(); + LimitClauseContext *limitClause(); + antlr4::tree::TerminalNode *FROM(); + antlr4::tree::TerminalNode *IN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ShowDictionariesStmtContext : public ShowStmtContext { + public: + ShowDictionariesStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *DICTIONARIES(); + antlr4::tree::TerminalNode *FROM(); + DatabaseIdentifierContext *databaseIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ShowCreateDictionaryStmtContext : public ShowStmtContext { + public: + ShowCreateDictionaryStmtContext(ShowStmtContext *ctx); + + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *DICTIONARY(); + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + ShowStmtContext* showStmt(); + + class SystemStmtContext : public antlr4::ParserRuleContext { + public: + SystemStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SYSTEM(); + antlr4::tree::TerminalNode *FLUSH(); + antlr4::tree::TerminalNode *DISTRIBUTED(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *LOGS(); + antlr4::tree::TerminalNode *RELOAD(); + antlr4::tree::TerminalNode *DICTIONARIES(); + antlr4::tree::TerminalNode *DICTIONARY(); + antlr4::tree::TerminalNode *START(); + antlr4::tree::TerminalNode *STOP(); + antlr4::tree::TerminalNode *SENDS(); + antlr4::tree::TerminalNode *FETCHES(); + antlr4::tree::TerminalNode *MERGES(); + antlr4::tree::TerminalNode *TTL(); + antlr4::tree::TerminalNode *REPLICATED(); + antlr4::tree::TerminalNode *SYNC(); + antlr4::tree::TerminalNode *REPLICA(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SystemStmtContext* systemStmt(); + + class TruncateStmtContext : public antlr4::ParserRuleContext { + public: + TruncateStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *TRUNCATE(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *TEMPORARY(); + antlr4::tree::TerminalNode *TABLE(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *EXISTS(); + ClusterClauseContext *clusterClause(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TruncateStmtContext* truncateStmt(); + + class UseStmtContext : public antlr4::ParserRuleContext { + public: + UseStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *USE(); + DatabaseIdentifierContext *databaseIdentifier(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + UseStmtContext* useStmt(); + + class WatchStmtContext : public antlr4::ParserRuleContext { + public: + WatchStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *WATCH(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *EVENTS(); + antlr4::tree::TerminalNode *LIMIT(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WatchStmtContext* watchStmt(); + + class ColumnTypeExprContext : public antlr4::ParserRuleContext { + public: + ColumnTypeExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + ColumnTypeExprContext() = default; + void copyFrom(ColumnTypeExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class ColumnTypeExprNestedContext : public ColumnTypeExprContext { + public: + ColumnTypeExprNestedContext(ColumnTypeExprContext *ctx); + + std::vector identifier(); + IdentifierContext* identifier(size_t i); + antlr4::tree::TerminalNode *LPAREN(); + std::vector columnTypeExpr(); + ColumnTypeExprContext* columnTypeExpr(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnTypeExprParamContext : public ColumnTypeExprContext { + public: + ColumnTypeExprParamContext(ColumnTypeExprContext *ctx); + + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + ColumnExprListContext *columnExprList(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnTypeExprSimpleContext : public ColumnTypeExprContext { + public: + ColumnTypeExprSimpleContext(ColumnTypeExprContext *ctx); + + IdentifierContext *identifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnTypeExprComplexContext : public ColumnTypeExprContext { + public: + ColumnTypeExprComplexContext(ColumnTypeExprContext *ctx); + + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *LPAREN(); + std::vector columnTypeExpr(); + ColumnTypeExprContext* columnTypeExpr(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnTypeExprEnumContext : public ColumnTypeExprContext { + public: + ColumnTypeExprEnumContext(ColumnTypeExprContext *ctx); + + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *LPAREN(); + std::vector enumValue(); + EnumValueContext* enumValue(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + ColumnTypeExprContext* columnTypeExpr(); + + class ColumnExprListContext : public antlr4::ParserRuleContext { + public: + ColumnExprListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector columnsExpr(); + ColumnsExprContext* columnsExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnExprListContext* columnExprList(); + + class ColumnsExprContext : public antlr4::ParserRuleContext { + public: + ColumnsExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + ColumnsExprContext() = default; + void copyFrom(ColumnsExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class ColumnsExprColumnContext : public ColumnsExprContext { + public: + ColumnsExprColumnContext(ColumnsExprContext *ctx); + + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnsExprAsteriskContext : public ColumnsExprContext { + public: + ColumnsExprAsteriskContext(ColumnsExprContext *ctx); + + antlr4::tree::TerminalNode *ASTERISK(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DOT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnsExprSubqueryContext : public ColumnsExprContext { + public: + ColumnsExprSubqueryContext(ColumnsExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + ColumnsExprContext* columnsExpr(); + + class ColumnExprContext : public antlr4::ParserRuleContext { + public: + ColumnExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + ColumnExprContext() = default; + void copyFrom(ColumnExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class ColumnExprTernaryOpContext : public ColumnExprContext { + public: + ColumnExprTernaryOpContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *QUERY(); + antlr4::tree::TerminalNode *COLON(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprAliasContext : public ColumnExprContext { + public: + ColumnExprAliasContext(ColumnExprContext *ctx); + + ColumnExprContext *columnExpr(); + AliasContext *alias(); + antlr4::tree::TerminalNode *AS(); + IdentifierContext *identifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprExtractContext : public ColumnExprContext { + public: + ColumnExprExtractContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *EXTRACT(); + antlr4::tree::TerminalNode *LPAREN(); + IntervalContext *interval(); + antlr4::tree::TerminalNode *FROM(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprNegateContext : public ColumnExprContext { + public: + ColumnExprNegateContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *DASH(); + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprSubqueryContext : public ColumnExprContext { + public: + ColumnExprSubqueryContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprLiteralContext : public ColumnExprContext { + public: + ColumnExprLiteralContext(ColumnExprContext *ctx); + + LiteralContext *literal(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprArrayContext : public ColumnExprContext { + public: + ColumnExprArrayContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *LBRACKET(); + antlr4::tree::TerminalNode *RBRACKET(); + ColumnExprListContext *columnExprList(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprSubstringContext : public ColumnExprContext { + public: + ColumnExprSubstringContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *SUBSTRING(); + antlr4::tree::TerminalNode *LPAREN(); + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *FROM(); + antlr4::tree::TerminalNode *RPAREN(); + antlr4::tree::TerminalNode *FOR(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprCastContext : public ColumnExprContext { + public: + ColumnExprCastContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *CAST(); + antlr4::tree::TerminalNode *LPAREN(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *AS(); + ColumnTypeExprContext *columnTypeExpr(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprOrContext : public ColumnExprContext { + public: + ColumnExprOrContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *OR(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence1Context : public ColumnExprContext { + public: + ColumnExprPrecedence1Context(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *ASTERISK(); + antlr4::tree::TerminalNode *SLASH(); + antlr4::tree::TerminalNode *PERCENT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence2Context : public ColumnExprContext { + public: + ColumnExprPrecedence2Context(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *PLUS(); + antlr4::tree::TerminalNode *DASH(); + antlr4::tree::TerminalNode *CONCAT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence3Context : public ColumnExprContext { + public: + ColumnExprPrecedence3Context(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *EQ_DOUBLE(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + antlr4::tree::TerminalNode *NOT_EQ(); + antlr4::tree::TerminalNode *LE(); + antlr4::tree::TerminalNode *GE(); + antlr4::tree::TerminalNode *LT(); + antlr4::tree::TerminalNode *GT(); + antlr4::tree::TerminalNode *IN(); + antlr4::tree::TerminalNode *LIKE(); + antlr4::tree::TerminalNode *ILIKE(); + antlr4::tree::TerminalNode *GLOBAL(); + antlr4::tree::TerminalNode *NOT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprIntervalContext : public ColumnExprContext { + public: + ColumnExprIntervalContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *INTERVAL(); + ColumnExprContext *columnExpr(); + IntervalContext *interval(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprIsNullContext : public ColumnExprContext { + public: + ColumnExprIsNullContext(ColumnExprContext *ctx); + + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *IS(); + antlr4::tree::TerminalNode *NULL_SQL(); + antlr4::tree::TerminalNode *NOT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprTrimContext : public ColumnExprContext { + public: + ColumnExprTrimContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *TRIM(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *FROM(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *RPAREN(); + antlr4::tree::TerminalNode *BOTH(); + antlr4::tree::TerminalNode *LEADING(); + antlr4::tree::TerminalNode *TRAILING(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprTupleContext : public ColumnExprContext { + public: + ColumnExprTupleContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprArrayAccessContext : public ColumnExprContext { + public: + ColumnExprArrayAccessContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *LBRACKET(); + antlr4::tree::TerminalNode *RBRACKET(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprBetweenContext : public ColumnExprContext { + public: + ColumnExprBetweenContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *BETWEEN(); + antlr4::tree::TerminalNode *AND(); + antlr4::tree::TerminalNode *NOT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprParensContext : public ColumnExprContext { + public: + ColumnExprParensContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprTimestampContext : public ColumnExprContext { + public: + ColumnExprTimestampContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *TIMESTAMP(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprAndContext : public ColumnExprContext { + public: + ColumnExprAndContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *AND(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprTupleAccessContext : public ColumnExprContext { + public: + ColumnExprTupleAccessContext(ColumnExprContext *ctx); + + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *DOT(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprCaseContext : public ColumnExprContext { + public: + ColumnExprCaseContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *CASE(); + antlr4::tree::TerminalNode *END(); + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + std::vector WHEN(); + antlr4::tree::TerminalNode* WHEN(size_t i); + std::vector THEN(); + antlr4::tree::TerminalNode* THEN(size_t i); + antlr4::tree::TerminalNode *ELSE(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprDateContext : public ColumnExprContext { + public: + ColumnExprDateContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *DATE(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprNotContext : public ColumnExprContext { + public: + ColumnExprNotContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *NOT(); + ColumnExprContext *columnExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprIdentifierContext : public ColumnExprContext { + public: + ColumnExprIdentifierContext(ColumnExprContext *ctx); + + ColumnIdentifierContext *columnIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprFunctionContext : public ColumnExprContext { + public: + ColumnExprFunctionContext(ColumnExprContext *ctx); + + IdentifierContext *identifier(); + std::vector LPAREN(); + antlr4::tree::TerminalNode* LPAREN(size_t i); + std::vector RPAREN(); + antlr4::tree::TerminalNode* RPAREN(size_t i); + antlr4::tree::TerminalNode *DISTINCT(); + ColumnArgListContext *columnArgList(); + ColumnExprListContext *columnExprList(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprAsteriskContext : public ColumnExprContext { + public: + ColumnExprAsteriskContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *ASTERISK(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DOT(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + ColumnExprContext* columnExpr(); + ColumnExprContext* columnExpr(int precedence); + class ColumnArgListContext : public antlr4::ParserRuleContext { + public: + ColumnArgListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector columnArgExpr(); + ColumnArgExprContext* columnArgExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnArgListContext* columnArgList(); + + class ColumnArgExprContext : public antlr4::ParserRuleContext { + public: + ColumnArgExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ColumnLambdaExprContext *columnLambdaExpr(); + ColumnExprContext *columnExpr(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnArgExprContext* columnArgExpr(); + + class ColumnLambdaExprContext : public antlr4::ParserRuleContext { + public: + ColumnLambdaExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ARROW(); + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *LPAREN(); + std::vector identifier(); + IdentifierContext* identifier(size_t i); + antlr4::tree::TerminalNode *RPAREN(); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnLambdaExprContext* columnLambdaExpr(); + + class ColumnIdentifierContext : public antlr4::ParserRuleContext { + public: + ColumnIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NestedIdentifierContext *nestedIdentifier(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DOT(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnIdentifierContext* columnIdentifier(); + + class NestedIdentifierContext : public antlr4::ParserRuleContext { + public: + NestedIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector identifier(); + IdentifierContext* identifier(size_t i); + antlr4::tree::TerminalNode *DOT(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + NestedIdentifierContext* nestedIdentifier(); + + class TableExprContext : public antlr4::ParserRuleContext { + public: + TableExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + TableExprContext() = default; + void copyFrom(TableExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class TableExprIdentifierContext : public TableExprContext { + public: + TableExprIdentifierContext(TableExprContext *ctx); + + TableIdentifierContext *tableIdentifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableExprSubqueryContext : public TableExprContext { + public: + TableExprSubqueryContext(TableExprContext *ctx); + + antlr4::tree::TerminalNode *LPAREN(); + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *RPAREN(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableExprAliasContext : public TableExprContext { + public: + TableExprAliasContext(TableExprContext *ctx); + + TableExprContext *tableExpr(); + AliasContext *alias(); + antlr4::tree::TerminalNode *AS(); + IdentifierContext *identifier(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableExprFunctionContext : public TableExprContext { + public: + TableExprFunctionContext(TableExprContext *ctx); + + TableFunctionExprContext *tableFunctionExpr(); + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + TableExprContext* tableExpr(); + TableExprContext* tableExpr(int precedence); + class TableFunctionExprContext : public antlr4::ParserRuleContext { + public: + TableFunctionExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + TableArgListContext *tableArgList(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableFunctionExprContext* tableFunctionExpr(); + + class TableIdentifierContext : public antlr4::ParserRuleContext { + public: + TableIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + DatabaseIdentifierContext *databaseIdentifier(); + antlr4::tree::TerminalNode *DOT(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableIdentifierContext* tableIdentifier(); + + class TableArgListContext : public antlr4::ParserRuleContext { + public: + TableArgListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector tableArgExpr(); + TableArgExprContext* tableArgExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableArgListContext* tableArgList(); + + class TableArgExprContext : public antlr4::ParserRuleContext { + public: + TableArgExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + TableIdentifierContext *tableIdentifier(); + TableFunctionExprContext *tableFunctionExpr(); + LiteralContext *literal(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableArgExprContext* tableArgExpr(); + + class DatabaseIdentifierContext : public antlr4::ParserRuleContext { + public: + DatabaseIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + DatabaseIdentifierContext* databaseIdentifier(); + + class FloatingLiteralContext : public antlr4::ParserRuleContext { + public: + FloatingLiteralContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *FLOATING_LITERAL(); + antlr4::tree::TerminalNode *DOT(); + std::vector DECIMAL_LITERAL(); + antlr4::tree::TerminalNode* DECIMAL_LITERAL(size_t i); + antlr4::tree::TerminalNode *OCTAL_LITERAL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + FloatingLiteralContext* floatingLiteral(); + + class NumberLiteralContext : public antlr4::ParserRuleContext { + public: + NumberLiteralContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + FloatingLiteralContext *floatingLiteral(); + antlr4::tree::TerminalNode *OCTAL_LITERAL(); + antlr4::tree::TerminalNode *DECIMAL_LITERAL(); + antlr4::tree::TerminalNode *HEXADECIMAL_LITERAL(); + antlr4::tree::TerminalNode *INF(); + antlr4::tree::TerminalNode *NAN_SQL(); + antlr4::tree::TerminalNode *PLUS(); + antlr4::tree::TerminalNode *DASH(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + NumberLiteralContext* numberLiteral(); + + class LiteralContext : public antlr4::ParserRuleContext { + public: + LiteralContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + NumberLiteralContext *numberLiteral(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *NULL_SQL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LiteralContext* literal(); + + class IntervalContext : public antlr4::ParserRuleContext { + public: + IntervalContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SECOND(); + antlr4::tree::TerminalNode *MINUTE(); + antlr4::tree::TerminalNode *HOUR(); + antlr4::tree::TerminalNode *DAY(); + antlr4::tree::TerminalNode *WEEK(); + antlr4::tree::TerminalNode *MONTH(); + antlr4::tree::TerminalNode *QUARTER(); + antlr4::tree::TerminalNode *YEAR(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + IntervalContext* interval(); + + class KeywordContext : public antlr4::ParserRuleContext { + public: + KeywordContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *AFTER(); + antlr4::tree::TerminalNode *ALIAS(); + antlr4::tree::TerminalNode *ALL(); + antlr4::tree::TerminalNode *ALTER(); + antlr4::tree::TerminalNode *AND(); + antlr4::tree::TerminalNode *ANTI(); + antlr4::tree::TerminalNode *ANY(); + antlr4::tree::TerminalNode *ARRAY(); + antlr4::tree::TerminalNode *AS(); + antlr4::tree::TerminalNode *ASCENDING(); + antlr4::tree::TerminalNode *ASOF(); + antlr4::tree::TerminalNode *ASYNC(); + antlr4::tree::TerminalNode *ATTACH(); + antlr4::tree::TerminalNode *BETWEEN(); + antlr4::tree::TerminalNode *BOTH(); + antlr4::tree::TerminalNode *BY(); + antlr4::tree::TerminalNode *CASE(); + antlr4::tree::TerminalNode *CAST(); + antlr4::tree::TerminalNode *CHECK(); + antlr4::tree::TerminalNode *CLEAR(); + antlr4::tree::TerminalNode *CLUSTER(); + antlr4::tree::TerminalNode *CODEC(); + antlr4::tree::TerminalNode *COLLATE(); + antlr4::tree::TerminalNode *COLUMN(); + antlr4::tree::TerminalNode *COMMENT(); + antlr4::tree::TerminalNode *CONSTRAINT(); + antlr4::tree::TerminalNode *CREATE(); + antlr4::tree::TerminalNode *CROSS(); + antlr4::tree::TerminalNode *CUBE(); + antlr4::tree::TerminalNode *DATABASE(); + antlr4::tree::TerminalNode *DATABASES(); + antlr4::tree::TerminalNode *DATE(); + antlr4::tree::TerminalNode *DEDUPLICATE(); + antlr4::tree::TerminalNode *DEFAULT(); + antlr4::tree::TerminalNode *DELAY(); + antlr4::tree::TerminalNode *DELETE(); + antlr4::tree::TerminalNode *DESCRIBE(); + antlr4::tree::TerminalNode *DESC(); + antlr4::tree::TerminalNode *DESCENDING(); + antlr4::tree::TerminalNode *DETACH(); + antlr4::tree::TerminalNode *DICTIONARIES(); + antlr4::tree::TerminalNode *DICTIONARY(); + antlr4::tree::TerminalNode *DISK(); + antlr4::tree::TerminalNode *DISTINCT(); + antlr4::tree::TerminalNode *DISTRIBUTED(); + antlr4::tree::TerminalNode *DROP(); + antlr4::tree::TerminalNode *ELSE(); + antlr4::tree::TerminalNode *END(); + antlr4::tree::TerminalNode *ENGINE(); + antlr4::tree::TerminalNode *EVENTS(); + antlr4::tree::TerminalNode *EXISTS(); + antlr4::tree::TerminalNode *EXPLAIN(); + antlr4::tree::TerminalNode *EXPRESSION(); + antlr4::tree::TerminalNode *EXTRACT(); + antlr4::tree::TerminalNode *FETCHES(); + antlr4::tree::TerminalNode *FINAL(); + antlr4::tree::TerminalNode *FIRST(); + antlr4::tree::TerminalNode *FLUSH(); + antlr4::tree::TerminalNode *FOR(); + antlr4::tree::TerminalNode *FORMAT(); + antlr4::tree::TerminalNode *FREEZE(); + antlr4::tree::TerminalNode *FROM(); + antlr4::tree::TerminalNode *FULL(); + antlr4::tree::TerminalNode *FUNCTION(); + antlr4::tree::TerminalNode *GLOBAL(); + antlr4::tree::TerminalNode *GRANULARITY(); + antlr4::tree::TerminalNode *GROUP(); + antlr4::tree::TerminalNode *HAVING(); + antlr4::tree::TerminalNode *HIERARCHICAL(); + antlr4::tree::TerminalNode *ID(); + antlr4::tree::TerminalNode *IF(); + antlr4::tree::TerminalNode *ILIKE(); + antlr4::tree::TerminalNode *IN(); + antlr4::tree::TerminalNode *INDEX(); + antlr4::tree::TerminalNode *INJECTIVE(); + antlr4::tree::TerminalNode *INNER(); + antlr4::tree::TerminalNode *INSERT(); + antlr4::tree::TerminalNode *INTERVAL(); + antlr4::tree::TerminalNode *INTO(); + antlr4::tree::TerminalNode *IS(); + antlr4::tree::TerminalNode *IS_OBJECT_ID(); + antlr4::tree::TerminalNode *JOIN(); + antlr4::tree::TerminalNode *JSON_FALSE(); + antlr4::tree::TerminalNode *JSON_TRUE(); + antlr4::tree::TerminalNode *KEY(); + antlr4::tree::TerminalNode *KILL(); + antlr4::tree::TerminalNode *LAST(); + antlr4::tree::TerminalNode *LAYOUT(); + antlr4::tree::TerminalNode *LEADING(); + antlr4::tree::TerminalNode *LEFT(); + antlr4::tree::TerminalNode *LIFETIME(); + antlr4::tree::TerminalNode *LIKE(); + antlr4::tree::TerminalNode *LIMIT(); + antlr4::tree::TerminalNode *LIVE(); + antlr4::tree::TerminalNode *LOCAL(); + antlr4::tree::TerminalNode *LOGS(); + antlr4::tree::TerminalNode *MATERIALIZED(); + antlr4::tree::TerminalNode *MAX(); + antlr4::tree::TerminalNode *MERGES(); + antlr4::tree::TerminalNode *MIN(); + antlr4::tree::TerminalNode *MODIFY(); + antlr4::tree::TerminalNode *MOVE(); + antlr4::tree::TerminalNode *MUTATION(); + antlr4::tree::TerminalNode *NO(); + antlr4::tree::TerminalNode *NOT(); + antlr4::tree::TerminalNode *NULLS(); + antlr4::tree::TerminalNode *OFFSET(); + antlr4::tree::TerminalNode *ON(); + antlr4::tree::TerminalNode *OPTIMIZE(); + antlr4::tree::TerminalNode *OR(); + antlr4::tree::TerminalNode *ORDER(); + antlr4::tree::TerminalNode *OUTER(); + antlr4::tree::TerminalNode *OUTFILE(); + antlr4::tree::TerminalNode *PARTITION(); + antlr4::tree::TerminalNode *POPULATE(); + antlr4::tree::TerminalNode *PREWHERE(); + antlr4::tree::TerminalNode *PRIMARY(); + antlr4::tree::TerminalNode *RANGE(); + antlr4::tree::TerminalNode *RELOAD(); + antlr4::tree::TerminalNode *REMOVE(); + antlr4::tree::TerminalNode *RENAME(); + antlr4::tree::TerminalNode *REPLACE(); + antlr4::tree::TerminalNode *REPLICA(); + antlr4::tree::TerminalNode *REPLICATED(); + antlr4::tree::TerminalNode *RIGHT(); + antlr4::tree::TerminalNode *ROLLUP(); + antlr4::tree::TerminalNode *SAMPLE(); + antlr4::tree::TerminalNode *SELECT(); + antlr4::tree::TerminalNode *SEMI(); + antlr4::tree::TerminalNode *SENDS(); + antlr4::tree::TerminalNode *SET(); + antlr4::tree::TerminalNode *SETTINGS(); + antlr4::tree::TerminalNode *SHOW(); + antlr4::tree::TerminalNode *SOURCE(); + antlr4::tree::TerminalNode *START(); + antlr4::tree::TerminalNode *STOP(); + antlr4::tree::TerminalNode *SUBSTRING(); + antlr4::tree::TerminalNode *SYNC(); + antlr4::tree::TerminalNode *SYNTAX(); + antlr4::tree::TerminalNode *SYSTEM(); + antlr4::tree::TerminalNode *TABLE(); + antlr4::tree::TerminalNode *TABLES(); + antlr4::tree::TerminalNode *TEMPORARY(); + antlr4::tree::TerminalNode *TEST(); + antlr4::tree::TerminalNode *THEN(); + antlr4::tree::TerminalNode *TIES(); + antlr4::tree::TerminalNode *TIMEOUT(); + antlr4::tree::TerminalNode *TIMESTAMP(); + antlr4::tree::TerminalNode *TOTALS(); + antlr4::tree::TerminalNode *TRAILING(); + antlr4::tree::TerminalNode *TRIM(); + antlr4::tree::TerminalNode *TRUNCATE(); + antlr4::tree::TerminalNode *TO(); + antlr4::tree::TerminalNode *TOP(); + antlr4::tree::TerminalNode *TTL(); + antlr4::tree::TerminalNode *TYPE(); + antlr4::tree::TerminalNode *UNION(); + antlr4::tree::TerminalNode *UPDATE(); + antlr4::tree::TerminalNode *USE(); + antlr4::tree::TerminalNode *USING(); + antlr4::tree::TerminalNode *UUID(); + antlr4::tree::TerminalNode *VALUES(); + antlr4::tree::TerminalNode *VIEW(); + antlr4::tree::TerminalNode *VOLUME(); + antlr4::tree::TerminalNode *WATCH(); + antlr4::tree::TerminalNode *WHEN(); + antlr4::tree::TerminalNode *WHERE(); + antlr4::tree::TerminalNode *WITH(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + KeywordContext* keyword(); + + class KeywordForAliasContext : public antlr4::ParserRuleContext { + public: + KeywordForAliasContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *DATE(); + antlr4::tree::TerminalNode *FIRST(); + antlr4::tree::TerminalNode *ID(); + antlr4::tree::TerminalNode *KEY(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + KeywordForAliasContext* keywordForAlias(); + + class AliasContext : public antlr4::ParserRuleContext { + public: + AliasContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *IDENTIFIER(); + KeywordForAliasContext *keywordForAlias(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + AliasContext* alias(); + + class IdentifierContext : public antlr4::ParserRuleContext { + public: + IdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *IDENTIFIER(); + IntervalContext *interval(); + KeywordContext *keyword(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + IdentifierContext* identifier(); + + class IdentifierOrNullContext : public antlr4::ParserRuleContext { + public: + IdentifierOrNullContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *NULL_SQL(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + IdentifierOrNullContext* identifierOrNull(); + + class EnumValueContext : public antlr4::ParserRuleContext { + public: + EnumValueContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *STRING_LITERAL(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + NumberLiteralContext *numberLiteral(); + + virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + EnumValueContext* enumValue(); + + + virtual bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override; + bool dictionaryAttrDfntSempred(DictionaryAttrDfntContext *_localctx, size_t predicateIndex); + bool dictionaryEngineClauseSempred(DictionaryEngineClauseContext *_localctx, size_t predicateIndex); + bool engineClauseSempred(EngineClauseContext *_localctx, size_t predicateIndex); + bool joinExprSempred(JoinExprContext *_localctx, size_t predicateIndex); + bool columnExprSempred(ColumnExprContext *_localctx, size_t predicateIndex); + bool tableExprSempred(TableExprContext *_localctx, size_t predicateIndex); + +private: + static std::vector _decisionToDFA; + static antlr4::atn::PredictionContextCache _sharedContextCache; + static std::vector _ruleNames; + static std::vector _tokenNames; + + static std::vector _literalNames; + static std::vector _symbolicNames; + static antlr4::dfa::Vocabulary _vocabulary; + static antlr4::atn::ATN _atn; + static std::vector _serializedATN; + + + struct Initializer { + Initializer(); + }; + static Initializer _init; +}; + +} // namespace DB diff --git a/src/Parsers/New/ClickHouseParserVisitor.cpp b/src/Parsers/New/ClickHouseParserVisitor.cpp new file mode 100644 index 00000000000..ad0990faef9 --- /dev/null +++ b/src/Parsers/New/ClickHouseParserVisitor.cpp @@ -0,0 +1,9 @@ + +// Generated from ClickHouseParser.g4 by ANTLR 4.7.2 + + +#include "ClickHouseParserVisitor.h" + + +using namespace DB; + diff --git a/src/Parsers/New/ClickHouseParserVisitor.h b/src/Parsers/New/ClickHouseParserVisitor.h new file mode 100644 index 00000000000..d187fc21a7d --- /dev/null +++ b/src/Parsers/New/ClickHouseParserVisitor.h @@ -0,0 +1,398 @@ + +// Generated from ClickHouseParser.g4 by ANTLR 4.7.2 + +#pragma once + + +#include "antlr4-runtime.h" +#include "ClickHouseParser.h" + + +namespace DB { + +/** + * This class defines an abstract visitor for a parse tree + * produced by ClickHouseParser. + */ +class ClickHouseParserVisitor : public antlr4::tree::AbstractParseTreeVisitor { +public: + + /** + * Visit parse trees produced by ClickHouseParser. + */ + virtual antlrcpp::Any visitQueryStmt(ClickHouseParser::QueryStmtContext *context) = 0; + + virtual antlrcpp::Any visitQuery(ClickHouseParser::QueryContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableStmt(ClickHouseParser::AlterTableStmtContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseAddColumn(ClickHouseParser::AlterTableClauseAddColumnContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseAddIndex(ClickHouseParser::AlterTableClauseAddIndexContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseAttach(ClickHouseParser::AlterTableClauseAttachContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseClear(ClickHouseParser::AlterTableClauseClearContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseComment(ClickHouseParser::AlterTableClauseCommentContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseDelete(ClickHouseParser::AlterTableClauseDeleteContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseDetach(ClickHouseParser::AlterTableClauseDetachContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseDropColumn(ClickHouseParser::AlterTableClauseDropColumnContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseDropIndex(ClickHouseParser::AlterTableClauseDropIndexContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseDropPartition(ClickHouseParser::AlterTableClauseDropPartitionContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseFreezePartition(ClickHouseParser::AlterTableClauseFreezePartitionContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModifyCodec(ClickHouseParser::AlterTableClauseModifyCodecContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModifyComment(ClickHouseParser::AlterTableClauseModifyCommentContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModifyRemove(ClickHouseParser::AlterTableClauseModifyRemoveContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModify(ClickHouseParser::AlterTableClauseModifyContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModifyOrderBy(ClickHouseParser::AlterTableClauseModifyOrderByContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseModifyTTL(ClickHouseParser::AlterTableClauseModifyTTLContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseMovePartition(ClickHouseParser::AlterTableClauseMovePartitionContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseRemoveTTL(ClickHouseParser::AlterTableClauseRemoveTTLContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseRename(ClickHouseParser::AlterTableClauseRenameContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseReplace(ClickHouseParser::AlterTableClauseReplaceContext *context) = 0; + + virtual antlrcpp::Any visitAlterTableClauseUpdate(ClickHouseParser::AlterTableClauseUpdateContext *context) = 0; + + virtual antlrcpp::Any visitAssignmentExprList(ClickHouseParser::AssignmentExprListContext *context) = 0; + + virtual antlrcpp::Any visitAssignmentExpr(ClickHouseParser::AssignmentExprContext *context) = 0; + + virtual antlrcpp::Any visitTableColumnPropertyType(ClickHouseParser::TableColumnPropertyTypeContext *context) = 0; + + virtual antlrcpp::Any visitPartitionClause(ClickHouseParser::PartitionClauseContext *context) = 0; + + virtual antlrcpp::Any visitAttachDictionaryStmt(ClickHouseParser::AttachDictionaryStmtContext *context) = 0; + + virtual antlrcpp::Any visitCheckStmt(ClickHouseParser::CheckStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateDatabaseStmt(ClickHouseParser::CreateDatabaseStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateDictionaryStmt(ClickHouseParser::CreateDictionaryStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateLiveViewStmt(ClickHouseParser::CreateLiveViewStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateMaterializedViewStmt(ClickHouseParser::CreateMaterializedViewStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateTableStmt(ClickHouseParser::CreateTableStmtContext *context) = 0; + + virtual antlrcpp::Any visitCreateViewStmt(ClickHouseParser::CreateViewStmtContext *context) = 0; + + virtual antlrcpp::Any visitDictionarySchemaClause(ClickHouseParser::DictionarySchemaClauseContext *context) = 0; + + virtual antlrcpp::Any visitDictionaryAttrDfnt(ClickHouseParser::DictionaryAttrDfntContext *context) = 0; + + virtual antlrcpp::Any visitDictionaryEngineClause(ClickHouseParser::DictionaryEngineClauseContext *context) = 0; + + virtual antlrcpp::Any visitDictionaryPrimaryKeyClause(ClickHouseParser::DictionaryPrimaryKeyClauseContext *context) = 0; + + virtual antlrcpp::Any visitDictionaryArgExpr(ClickHouseParser::DictionaryArgExprContext *context) = 0; + + virtual antlrcpp::Any visitSourceClause(ClickHouseParser::SourceClauseContext *context) = 0; + + virtual antlrcpp::Any visitLifetimeClause(ClickHouseParser::LifetimeClauseContext *context) = 0; + + virtual antlrcpp::Any visitLayoutClause(ClickHouseParser::LayoutClauseContext *context) = 0; + + virtual antlrcpp::Any visitRangeClause(ClickHouseParser::RangeClauseContext *context) = 0; + + virtual antlrcpp::Any visitDictionarySettingsClause(ClickHouseParser::DictionarySettingsClauseContext *context) = 0; + + virtual antlrcpp::Any visitClusterClause(ClickHouseParser::ClusterClauseContext *context) = 0; + + virtual antlrcpp::Any visitUuidClause(ClickHouseParser::UuidClauseContext *context) = 0; + + virtual antlrcpp::Any visitDestinationClause(ClickHouseParser::DestinationClauseContext *context) = 0; + + virtual antlrcpp::Any visitSubqueryClause(ClickHouseParser::SubqueryClauseContext *context) = 0; + + virtual antlrcpp::Any visitSchemaDescriptionClause(ClickHouseParser::SchemaDescriptionClauseContext *context) = 0; + + virtual antlrcpp::Any visitSchemaAsTableClause(ClickHouseParser::SchemaAsTableClauseContext *context) = 0; + + virtual antlrcpp::Any visitSchemaAsFunctionClause(ClickHouseParser::SchemaAsFunctionClauseContext *context) = 0; + + virtual antlrcpp::Any visitEngineClause(ClickHouseParser::EngineClauseContext *context) = 0; + + virtual antlrcpp::Any visitPartitionByClause(ClickHouseParser::PartitionByClauseContext *context) = 0; + + virtual antlrcpp::Any visitPrimaryKeyClause(ClickHouseParser::PrimaryKeyClauseContext *context) = 0; + + virtual antlrcpp::Any visitSampleByClause(ClickHouseParser::SampleByClauseContext *context) = 0; + + virtual antlrcpp::Any visitTtlClause(ClickHouseParser::TtlClauseContext *context) = 0; + + virtual antlrcpp::Any visitEngineExpr(ClickHouseParser::EngineExprContext *context) = 0; + + virtual antlrcpp::Any visitTableElementExprColumn(ClickHouseParser::TableElementExprColumnContext *context) = 0; + + virtual antlrcpp::Any visitTableElementExprConstraint(ClickHouseParser::TableElementExprConstraintContext *context) = 0; + + virtual antlrcpp::Any visitTableElementExprIndex(ClickHouseParser::TableElementExprIndexContext *context) = 0; + + virtual antlrcpp::Any visitTableColumnDfnt(ClickHouseParser::TableColumnDfntContext *context) = 0; + + virtual antlrcpp::Any visitTableColumnPropertyExpr(ClickHouseParser::TableColumnPropertyExprContext *context) = 0; + + virtual antlrcpp::Any visitTableIndexDfnt(ClickHouseParser::TableIndexDfntContext *context) = 0; + + virtual antlrcpp::Any visitCodecExpr(ClickHouseParser::CodecExprContext *context) = 0; + + virtual antlrcpp::Any visitCodecArgExpr(ClickHouseParser::CodecArgExprContext *context) = 0; + + virtual antlrcpp::Any visitTtlExpr(ClickHouseParser::TtlExprContext *context) = 0; + + virtual antlrcpp::Any visitDescribeStmt(ClickHouseParser::DescribeStmtContext *context) = 0; + + virtual antlrcpp::Any visitDropDatabaseStmt(ClickHouseParser::DropDatabaseStmtContext *context) = 0; + + virtual antlrcpp::Any visitDropTableStmt(ClickHouseParser::DropTableStmtContext *context) = 0; + + virtual antlrcpp::Any visitExistsStmt(ClickHouseParser::ExistsStmtContext *context) = 0; + + virtual antlrcpp::Any visitExplainStmt(ClickHouseParser::ExplainStmtContext *context) = 0; + + virtual antlrcpp::Any visitInsertStmt(ClickHouseParser::InsertStmtContext *context) = 0; + + virtual antlrcpp::Any visitColumnsClause(ClickHouseParser::ColumnsClauseContext *context) = 0; + + virtual antlrcpp::Any visitDataClauseFormat(ClickHouseParser::DataClauseFormatContext *context) = 0; + + virtual antlrcpp::Any visitDataClauseValues(ClickHouseParser::DataClauseValuesContext *context) = 0; + + virtual antlrcpp::Any visitDataClauseSelect(ClickHouseParser::DataClauseSelectContext *context) = 0; + + virtual antlrcpp::Any visitKillMutationStmt(ClickHouseParser::KillMutationStmtContext *context) = 0; + + virtual antlrcpp::Any visitOptimizeStmt(ClickHouseParser::OptimizeStmtContext *context) = 0; + + virtual antlrcpp::Any visitRenameStmt(ClickHouseParser::RenameStmtContext *context) = 0; + + virtual antlrcpp::Any visitSelectUnionStmt(ClickHouseParser::SelectUnionStmtContext *context) = 0; + + virtual antlrcpp::Any visitSelectStmtWithParens(ClickHouseParser::SelectStmtWithParensContext *context) = 0; + + virtual antlrcpp::Any visitSelectStmt(ClickHouseParser::SelectStmtContext *context) = 0; + + virtual antlrcpp::Any visitWithClause(ClickHouseParser::WithClauseContext *context) = 0; + + virtual antlrcpp::Any visitTopClause(ClickHouseParser::TopClauseContext *context) = 0; + + virtual antlrcpp::Any visitFromClause(ClickHouseParser::FromClauseContext *context) = 0; + + virtual antlrcpp::Any visitArrayJoinClause(ClickHouseParser::ArrayJoinClauseContext *context) = 0; + + virtual antlrcpp::Any visitPrewhereClause(ClickHouseParser::PrewhereClauseContext *context) = 0; + + virtual antlrcpp::Any visitWhereClause(ClickHouseParser::WhereClauseContext *context) = 0; + + virtual antlrcpp::Any visitGroupByClause(ClickHouseParser::GroupByClauseContext *context) = 0; + + virtual antlrcpp::Any visitHavingClause(ClickHouseParser::HavingClauseContext *context) = 0; + + virtual antlrcpp::Any visitOrderByClause(ClickHouseParser::OrderByClauseContext *context) = 0; + + virtual antlrcpp::Any visitLimitByClause(ClickHouseParser::LimitByClauseContext *context) = 0; + + virtual antlrcpp::Any visitLimitClause(ClickHouseParser::LimitClauseContext *context) = 0; + + virtual antlrcpp::Any visitSettingsClause(ClickHouseParser::SettingsClauseContext *context) = 0; + + virtual antlrcpp::Any visitJoinExprOp(ClickHouseParser::JoinExprOpContext *context) = 0; + + virtual antlrcpp::Any visitJoinExprTable(ClickHouseParser::JoinExprTableContext *context) = 0; + + virtual antlrcpp::Any visitJoinExprParens(ClickHouseParser::JoinExprParensContext *context) = 0; + + virtual antlrcpp::Any visitJoinExprCrossOp(ClickHouseParser::JoinExprCrossOpContext *context) = 0; + + virtual antlrcpp::Any visitJoinOpInner(ClickHouseParser::JoinOpInnerContext *context) = 0; + + virtual antlrcpp::Any visitJoinOpLeftRight(ClickHouseParser::JoinOpLeftRightContext *context) = 0; + + virtual antlrcpp::Any visitJoinOpFull(ClickHouseParser::JoinOpFullContext *context) = 0; + + virtual antlrcpp::Any visitJoinOpCross(ClickHouseParser::JoinOpCrossContext *context) = 0; + + virtual antlrcpp::Any visitJoinConstraintClause(ClickHouseParser::JoinConstraintClauseContext *context) = 0; + + virtual antlrcpp::Any visitSampleClause(ClickHouseParser::SampleClauseContext *context) = 0; + + virtual antlrcpp::Any visitLimitExpr(ClickHouseParser::LimitExprContext *context) = 0; + + virtual antlrcpp::Any visitOrderExprList(ClickHouseParser::OrderExprListContext *context) = 0; + + virtual antlrcpp::Any visitOrderExpr(ClickHouseParser::OrderExprContext *context) = 0; + + virtual antlrcpp::Any visitRatioExpr(ClickHouseParser::RatioExprContext *context) = 0; + + virtual antlrcpp::Any visitSettingExprList(ClickHouseParser::SettingExprListContext *context) = 0; + + virtual antlrcpp::Any visitSettingExpr(ClickHouseParser::SettingExprContext *context) = 0; + + virtual antlrcpp::Any visitSetStmt(ClickHouseParser::SetStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowCreateDatabaseStmt(ClickHouseParser::ShowCreateDatabaseStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowCreateDictionaryStmt(ClickHouseParser::ShowCreateDictionaryStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowCreateTableStmt(ClickHouseParser::ShowCreateTableStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowDatabasesStmt(ClickHouseParser::ShowDatabasesStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowDictionariesStmt(ClickHouseParser::ShowDictionariesStmtContext *context) = 0; + + virtual antlrcpp::Any visitShowTablesStmt(ClickHouseParser::ShowTablesStmtContext *context) = 0; + + virtual antlrcpp::Any visitSystemStmt(ClickHouseParser::SystemStmtContext *context) = 0; + + virtual antlrcpp::Any visitTruncateStmt(ClickHouseParser::TruncateStmtContext *context) = 0; + + virtual antlrcpp::Any visitUseStmt(ClickHouseParser::UseStmtContext *context) = 0; + + virtual antlrcpp::Any visitWatchStmt(ClickHouseParser::WatchStmtContext *context) = 0; + + virtual antlrcpp::Any visitColumnTypeExprSimple(ClickHouseParser::ColumnTypeExprSimpleContext *context) = 0; + + virtual antlrcpp::Any visitColumnTypeExprNested(ClickHouseParser::ColumnTypeExprNestedContext *context) = 0; + + virtual antlrcpp::Any visitColumnTypeExprEnum(ClickHouseParser::ColumnTypeExprEnumContext *context) = 0; + + virtual antlrcpp::Any visitColumnTypeExprComplex(ClickHouseParser::ColumnTypeExprComplexContext *context) = 0; + + virtual antlrcpp::Any visitColumnTypeExprParam(ClickHouseParser::ColumnTypeExprParamContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprList(ClickHouseParser::ColumnExprListContext *context) = 0; + + virtual antlrcpp::Any visitColumnsExprAsterisk(ClickHouseParser::ColumnsExprAsteriskContext *context) = 0; + + virtual antlrcpp::Any visitColumnsExprSubquery(ClickHouseParser::ColumnsExprSubqueryContext *context) = 0; + + virtual antlrcpp::Any visitColumnsExprColumn(ClickHouseParser::ColumnsExprColumnContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprTernaryOp(ClickHouseParser::ColumnExprTernaryOpContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprAlias(ClickHouseParser::ColumnExprAliasContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprExtract(ClickHouseParser::ColumnExprExtractContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprNegate(ClickHouseParser::ColumnExprNegateContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprSubquery(ClickHouseParser::ColumnExprSubqueryContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprLiteral(ClickHouseParser::ColumnExprLiteralContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprArray(ClickHouseParser::ColumnExprArrayContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprSubstring(ClickHouseParser::ColumnExprSubstringContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprCast(ClickHouseParser::ColumnExprCastContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprOr(ClickHouseParser::ColumnExprOrContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprPrecedence1(ClickHouseParser::ColumnExprPrecedence1Context *context) = 0; + + virtual antlrcpp::Any visitColumnExprPrecedence2(ClickHouseParser::ColumnExprPrecedence2Context *context) = 0; + + virtual antlrcpp::Any visitColumnExprPrecedence3(ClickHouseParser::ColumnExprPrecedence3Context *context) = 0; + + virtual antlrcpp::Any visitColumnExprInterval(ClickHouseParser::ColumnExprIntervalContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprIsNull(ClickHouseParser::ColumnExprIsNullContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprTrim(ClickHouseParser::ColumnExprTrimContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprTuple(ClickHouseParser::ColumnExprTupleContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprArrayAccess(ClickHouseParser::ColumnExprArrayAccessContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprBetween(ClickHouseParser::ColumnExprBetweenContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprParens(ClickHouseParser::ColumnExprParensContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprTimestamp(ClickHouseParser::ColumnExprTimestampContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprAnd(ClickHouseParser::ColumnExprAndContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprTupleAccess(ClickHouseParser::ColumnExprTupleAccessContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprCase(ClickHouseParser::ColumnExprCaseContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprDate(ClickHouseParser::ColumnExprDateContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprNot(ClickHouseParser::ColumnExprNotContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprIdentifier(ClickHouseParser::ColumnExprIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprFunction(ClickHouseParser::ColumnExprFunctionContext *context) = 0; + + virtual antlrcpp::Any visitColumnExprAsterisk(ClickHouseParser::ColumnExprAsteriskContext *context) = 0; + + virtual antlrcpp::Any visitColumnArgList(ClickHouseParser::ColumnArgListContext *context) = 0; + + virtual antlrcpp::Any visitColumnArgExpr(ClickHouseParser::ColumnArgExprContext *context) = 0; + + virtual antlrcpp::Any visitColumnLambdaExpr(ClickHouseParser::ColumnLambdaExprContext *context) = 0; + + virtual antlrcpp::Any visitColumnIdentifier(ClickHouseParser::ColumnIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitNestedIdentifier(ClickHouseParser::NestedIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitTableExprIdentifier(ClickHouseParser::TableExprIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitTableExprSubquery(ClickHouseParser::TableExprSubqueryContext *context) = 0; + + virtual antlrcpp::Any visitTableExprAlias(ClickHouseParser::TableExprAliasContext *context) = 0; + + virtual antlrcpp::Any visitTableExprFunction(ClickHouseParser::TableExprFunctionContext *context) = 0; + + virtual antlrcpp::Any visitTableFunctionExpr(ClickHouseParser::TableFunctionExprContext *context) = 0; + + virtual antlrcpp::Any visitTableIdentifier(ClickHouseParser::TableIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitTableArgList(ClickHouseParser::TableArgListContext *context) = 0; + + virtual antlrcpp::Any visitTableArgExpr(ClickHouseParser::TableArgExprContext *context) = 0; + + virtual antlrcpp::Any visitDatabaseIdentifier(ClickHouseParser::DatabaseIdentifierContext *context) = 0; + + virtual antlrcpp::Any visitFloatingLiteral(ClickHouseParser::FloatingLiteralContext *context) = 0; + + virtual antlrcpp::Any visitNumberLiteral(ClickHouseParser::NumberLiteralContext *context) = 0; + + virtual antlrcpp::Any visitLiteral(ClickHouseParser::LiteralContext *context) = 0; + + virtual antlrcpp::Any visitInterval(ClickHouseParser::IntervalContext *context) = 0; + + virtual antlrcpp::Any visitKeyword(ClickHouseParser::KeywordContext *context) = 0; + + virtual antlrcpp::Any visitKeywordForAlias(ClickHouseParser::KeywordForAliasContext *context) = 0; + + virtual antlrcpp::Any visitAlias(ClickHouseParser::AliasContext *context) = 0; + + virtual antlrcpp::Any visitIdentifier(ClickHouseParser::IdentifierContext *context) = 0; + + virtual antlrcpp::Any visitIdentifierOrNull(ClickHouseParser::IdentifierOrNullContext *context) = 0; + + virtual antlrcpp::Any visitEnumValue(ClickHouseParser::EnumValueContext *context) = 0; + + +}; + +} // namespace DB diff --git a/src/Parsers/New/LexerErrorListener.cpp b/src/Parsers/New/LexerErrorListener.cpp new file mode 100644 index 00000000000..d40d470486e --- /dev/null +++ b/src/Parsers/New/LexerErrorListener.cpp @@ -0,0 +1,25 @@ +#include + +#include + + +using namespace antlr4; + +namespace DB +{ + +namespace ErrorCodes +{ + +extern int SYNTAX_ERROR; + +} + +void LexerErrorListener::syntaxError(Recognizer *, Token *, size_t, size_t, const std::string & message, std::exception_ptr) +{ + std::cerr << "Lexer error: " << message << std::endl; + + throw DB::Exception("Can't recognize input: " + message, ErrorCodes::SYNTAX_ERROR); +} + +} diff --git a/src/Parsers/New/LexerErrorListener.h b/src/Parsers/New/LexerErrorListener.h new file mode 100644 index 00000000000..62445ffb166 --- /dev/null +++ b/src/Parsers/New/LexerErrorListener.h @@ -0,0 +1,21 @@ +#pragma once + +#include + + +namespace DB +{ + +class LexerErrorListener : public antlr4::BaseErrorListener +{ +public: + void syntaxError( + antlr4::Recognizer * recognizer, + antlr4::Token * offending_symbol, + size_t line, + size_t pos, + const std::string & message, + std::exception_ptr e) override; +}; + +} diff --git a/src/Parsers/New/ParseTreeVisitor.cpp b/src/Parsers/New/ParseTreeVisitor.cpp new file mode 100644 index 00000000000..2179e44d78b --- /dev/null +++ b/src/Parsers/New/ParseTreeVisitor.cpp @@ -0,0 +1,149 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Include last, because antlr-runtime undefines EOF macros, which is required in boost multiprecision numbers. +#include + + +namespace DB +{ + +using namespace AST; + +antlrcpp::Any ParseTreeVisitor::visitQueryStmt(ClickHouseParser::QueryStmtContext *ctx) +{ + if (ctx->insertStmt()) return std::static_pointer_cast(visit(ctx->insertStmt()).as>()); + + auto query = visit(ctx->query()).as>(); + + if (ctx->OUTFILE()) query->setOutFile(Literal::createString(ctx->STRING_LITERAL())); + if (ctx->FORMAT()) query->setFormat(visit(ctx->identifierOrNull())); + + return query; +} + +antlrcpp::Any ParseTreeVisitor::visitQuery(ClickHouseParser::QueryContext *ctx) +{ + auto query = visit(ctx->children[0]); + +#define TRY_POINTER_CAST(TYPE) if (query.is>()) return std::static_pointer_cast(query.as>()); + TRY_POINTER_CAST(AlterTableQuery) + TRY_POINTER_CAST(AttachQuery) + TRY_POINTER_CAST(CheckQuery) + TRY_POINTER_CAST(CreateDatabaseQuery) + TRY_POINTER_CAST(CreateDictionaryQuery) + TRY_POINTER_CAST(CreateLiveViewQuery) + TRY_POINTER_CAST(CreateMaterializedViewQuery) + TRY_POINTER_CAST(CreateTableQuery) + TRY_POINTER_CAST(CreateViewQuery) + TRY_POINTER_CAST(DescribeQuery) + TRY_POINTER_CAST(DropQuery) + TRY_POINTER_CAST(ExistsQuery) + TRY_POINTER_CAST(ExplainQuery) + TRY_POINTER_CAST(KillQuery) + TRY_POINTER_CAST(OptimizeQuery) + TRY_POINTER_CAST(RenameQuery) + TRY_POINTER_CAST(SelectUnionQuery) + TRY_POINTER_CAST(SetQuery) + TRY_POINTER_CAST(ShowQuery) + TRY_POINTER_CAST(ShowCreateQuery) + TRY_POINTER_CAST(SystemQuery) + TRY_POINTER_CAST(TruncateQuery) + TRY_POINTER_CAST(UseQuery) + TRY_POINTER_CAST(WatchQuery) +#undef TRY_POINTER_CAST + + throw std::runtime_error("Query is unknown: " + ctx->children[0]->getText()); + + __builtin_unreachable(); +} + +antlrcpp::Any ParseTreeVisitor::visitShowDatabasesStmt(ClickHouseParser::ShowDatabasesStmtContext *) +{ + auto database_name = std::make_shared(nullptr, std::make_shared("name")); + auto expr_list = PtrTo(new ColumnExprList{ColumnExpr::createIdentifier(database_name)}); + auto select_stmt = std::make_shared(false, SelectStmt::ModifierType::NONE, false, expr_list); + + auto system = std::make_shared(std::make_shared("system")); + auto databases = std::make_shared(system, std::make_shared("databases")); + auto system_tables = JoinExpr::createTableExpr(TableExpr::createIdentifier(databases), nullptr, false); + + select_stmt->setFromClause(std::make_shared(system_tables)); + + return PtrTo( + new SelectUnionQuery(std::make_shared>(std::initializer_list>{select_stmt}))); +} + +antlrcpp::Any ParseTreeVisitor::visitShowTablesStmt(ClickHouseParser::ShowTablesStmtContext *ctx) +{ + // TODO: don't forget to convert TEMPORARY into 'is_temporary=1' condition. + + auto table_name = std::make_shared(nullptr, std::make_shared("name")); + auto expr_list = PtrTo(new ColumnExprList{ColumnExpr::createIdentifier(table_name)}); + auto select_stmt = std::make_shared(false, SelectStmt::ModifierType::NONE, false, expr_list); + + auto and_args = PtrTo(new ColumnExprList{ColumnExpr::createLiteral(Literal::createNumber("1"))}); + + if (ctx->databaseIdentifier()) + { + auto database = std::make_shared(nullptr, std::make_shared("database")); + auto args = PtrTo(new ColumnExprList{ + ColumnExpr::createIdentifier(database), + ColumnExpr::createLiteral(Literal::createString(visit(ctx->databaseIdentifier()).as>()->getName())) + }); + and_args->push(ColumnExpr::createFunction(std::make_shared("equals"), nullptr, args)); + } + + if (ctx->LIKE()) + { + auto args = PtrTo(new ColumnExprList{ + ColumnExpr::createIdentifier(table_name), ColumnExpr::createLiteral(Literal::createString(ctx->STRING_LITERAL()))}); + and_args->push(ColumnExpr::createFunction(std::make_shared("like"), nullptr, args)); + } + else if (ctx->whereClause()) + and_args->push(visit(ctx->whereClause()->columnExpr())); + + auto system = std::make_shared(std::make_shared("system")); + auto tables = std::make_shared(system, std::make_shared("tables")); + auto system_tables = JoinExpr::createTableExpr(TableExpr::createIdentifier(tables), nullptr, false); + + select_stmt->setFromClause(std::make_shared(system_tables)); + select_stmt->setWhereClause( + std::make_shared(ColumnExpr::createFunction(std::make_shared("and"), nullptr, and_args))); + select_stmt->setLimitClause(ctx->limitClause() ? visit(ctx->limitClause()).as>() : nullptr); + + return PtrTo( + new SelectUnionQuery(std::make_shared>(std::initializer_list>{select_stmt}))); +} + +} diff --git a/src/Parsers/New/ParseTreeVisitor.h b/src/Parsers/New/ParseTreeVisitor.h new file mode 100644 index 00000000000..4f6d93f0327 --- /dev/null +++ b/src/Parsers/New/ParseTreeVisitor.h @@ -0,0 +1,290 @@ +#pragma once + +#include + + +namespace DB { + +class ParseTreeVisitor : public ClickHouseParserVisitor +{ +public: + virtual ~ParseTreeVisitor() override = default; + + // Top-level statements + antlrcpp::Any visitQueryStmt(ClickHouseParser::QueryStmtContext * ctx) override; + antlrcpp::Any visitQuery(ClickHouseParser::QueryContext * ctx) override; + + // AlterTableQuery + antlrcpp::Any visitAlterTableClauseAddColumn(ClickHouseParser::AlterTableClauseAddColumnContext * ctx) override; + antlrcpp::Any visitAlterTableClauseAddIndex(ClickHouseParser::AlterTableClauseAddIndexContext * ctx) override; + antlrcpp::Any visitAlterTableClauseAttach(ClickHouseParser::AlterTableClauseAttachContext * ctx) override; + antlrcpp::Any visitAlterTableClauseClear(ClickHouseParser::AlterTableClauseClearContext * ctx) override; + antlrcpp::Any visitAlterTableClauseComment(ClickHouseParser::AlterTableClauseCommentContext * ctx) override; + antlrcpp::Any visitAlterTableClauseDelete(ClickHouseParser::AlterTableClauseDeleteContext * ctx) override; + antlrcpp::Any visitAlterTableClauseDetach(ClickHouseParser::AlterTableClauseDetachContext * ctx) override; + antlrcpp::Any visitAlterTableClauseDropColumn(ClickHouseParser::AlterTableClauseDropColumnContext * ctx) override; + antlrcpp::Any visitAlterTableClauseDropIndex(ClickHouseParser::AlterTableClauseDropIndexContext * ctx) override; + antlrcpp::Any visitAlterTableClauseDropPartition(ClickHouseParser::AlterTableClauseDropPartitionContext * ctx) override; + antlrcpp::Any visitAlterTableClauseFreezePartition(ClickHouseParser::AlterTableClauseFreezePartitionContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModify(ClickHouseParser::AlterTableClauseModifyContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModifyCodec(ClickHouseParser::AlterTableClauseModifyCodecContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModifyComment(ClickHouseParser::AlterTableClauseModifyCommentContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModifyOrderBy(ClickHouseParser::AlterTableClauseModifyOrderByContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModifyRemove(ClickHouseParser::AlterTableClauseModifyRemoveContext * ctx) override; + antlrcpp::Any visitAlterTableClauseModifyTTL(ClickHouseParser::AlterTableClauseModifyTTLContext * ctx) override; + antlrcpp::Any visitAlterTableClauseMovePartition(ClickHouseParser::AlterTableClauseMovePartitionContext * ctx) override; + antlrcpp::Any visitAlterTableClauseRemoveTTL(ClickHouseParser::AlterTableClauseRemoveTTLContext * ctx) override; + antlrcpp::Any visitAlterTableClauseRename(ClickHouseParser::AlterTableClauseRenameContext * ctx) override; + antlrcpp::Any visitAlterTableClauseReplace(ClickHouseParser::AlterTableClauseReplaceContext * ctx) override; + antlrcpp::Any visitAlterTableClauseUpdate(ClickHouseParser::AlterTableClauseUpdateContext * ctx) override; + antlrcpp::Any visitAlterTableStmt(ClickHouseParser::AlterTableStmtContext * ctx) override; + antlrcpp::Any visitAssignmentExpr(ClickHouseParser::AssignmentExprContext * ctx) override; + antlrcpp::Any visitAssignmentExprList(ClickHouseParser::AssignmentExprListContext * ctx) override; + antlrcpp::Any visitTableColumnPropertyType(ClickHouseParser::TableColumnPropertyTypeContext * ctx) override; + + // AttachQuery + antlrcpp::Any visitAttachDictionaryStmt(ClickHouseParser::AttachDictionaryStmtContext * ctx) override; + + // CheckQuery + antlrcpp::Any visitCheckStmt(ClickHouseParser::CheckStmtContext * ctx) override; + + // ColumnExpr + antlrcpp::Any visitColumnExprAlias(ClickHouseParser::ColumnExprAliasContext * ctx) override; + antlrcpp::Any visitColumnExprAnd(ClickHouseParser::ColumnExprAndContext * ctx) override; + antlrcpp::Any visitColumnExprArray(ClickHouseParser::ColumnExprArrayContext * ctx) override; + antlrcpp::Any visitColumnExprArrayAccess(ClickHouseParser::ColumnExprArrayAccessContext * ctx) override; + antlrcpp::Any visitColumnExprAsterisk(ClickHouseParser::ColumnExprAsteriskContext * ctx) override; + antlrcpp::Any visitColumnExprBetween(ClickHouseParser::ColumnExprBetweenContext * ctx) override; + antlrcpp::Any visitColumnExprCase(ClickHouseParser::ColumnExprCaseContext * ctx) override; + antlrcpp::Any visitColumnExprCast(ClickHouseParser::ColumnExprCastContext * ctx) override; + antlrcpp::Any visitColumnExprDate(ClickHouseParser::ColumnExprDateContext * ctx) override; + antlrcpp::Any visitColumnExprExtract(ClickHouseParser::ColumnExprExtractContext * ctx) override; + antlrcpp::Any visitColumnExprFunction(ClickHouseParser::ColumnExprFunctionContext * ctx) override; + antlrcpp::Any visitColumnExprIdentifier(ClickHouseParser::ColumnExprIdentifierContext * ctx) override; + antlrcpp::Any visitColumnExprInterval(ClickHouseParser::ColumnExprIntervalContext * ctx) override; + antlrcpp::Any visitColumnExprIsNull(ClickHouseParser::ColumnExprIsNullContext * ctx) override; + antlrcpp::Any visitColumnExprList(ClickHouseParser::ColumnExprListContext * ctx) override; + antlrcpp::Any visitColumnExprLiteral(ClickHouseParser::ColumnExprLiteralContext * ctx) override; + antlrcpp::Any visitColumnExprNegate(ClickHouseParser::ColumnExprNegateContext * ctx) override; + antlrcpp::Any visitColumnExprNot(ClickHouseParser::ColumnExprNotContext * ctx) override; + antlrcpp::Any visitColumnExprOr(ClickHouseParser::ColumnExprOrContext * ctx) override; + antlrcpp::Any visitColumnExprParens(ClickHouseParser::ColumnExprParensContext * ctx) override; + antlrcpp::Any visitColumnExprPrecedence1(ClickHouseParser::ColumnExprPrecedence1Context * ctx) override; + antlrcpp::Any visitColumnExprPrecedence2(ClickHouseParser::ColumnExprPrecedence2Context * ctx) override; + antlrcpp::Any visitColumnExprPrecedence3(ClickHouseParser::ColumnExprPrecedence3Context * ctx) override; + antlrcpp::Any visitColumnExprSubquery(ClickHouseParser::ColumnExprSubqueryContext * ctx) override; + antlrcpp::Any visitColumnExprSubstring(ClickHouseParser::ColumnExprSubstringContext * ctx) override; + antlrcpp::Any visitColumnExprTernaryOp(ClickHouseParser::ColumnExprTernaryOpContext * ctx) override; + antlrcpp::Any visitColumnExprTimestamp(ClickHouseParser::ColumnExprTimestampContext * ctx) override; + antlrcpp::Any visitColumnExprTrim(ClickHouseParser::ColumnExprTrimContext * ctx) override; + antlrcpp::Any visitColumnExprTuple(ClickHouseParser::ColumnExprTupleContext * ctx) override; + antlrcpp::Any visitColumnExprTupleAccess(ClickHouseParser::ColumnExprTupleAccessContext * ctx) override; + + // ColumnTypeExpr + antlrcpp::Any visitColumnTypeExprSimple(ClickHouseParser::ColumnTypeExprSimpleContext * ctx) override; + antlrcpp::Any visitColumnTypeExprParam(ClickHouseParser::ColumnTypeExprParamContext * ctx) override; + antlrcpp::Any visitColumnTypeExprEnum(ClickHouseParser::ColumnTypeExprEnumContext * ctx) override; + antlrcpp::Any visitColumnTypeExprComplex(ClickHouseParser::ColumnTypeExprComplexContext * ctx) override; + antlrcpp::Any visitColumnTypeExprNested(ClickHouseParser::ColumnTypeExprNestedContext * ctx) override; + + // CreateDatabaseQuery + antlrcpp::Any visitCreateDatabaseStmt(ClickHouseParser::CreateDatabaseStmtContext * ctx) override; + + // CreateDictionaryQuery + antlrcpp::Any visitCreateDictionaryStmt(ClickHouseParser::CreateDictionaryStmtContext * ctx) override; + antlrcpp::Any visitDictionaryArgExpr(ClickHouseParser::DictionaryArgExprContext * ctx) override; + antlrcpp::Any visitDictionaryAttrDfnt(ClickHouseParser::DictionaryAttrDfntContext * ctx) override; + antlrcpp::Any visitDictionaryEngineClause(ClickHouseParser::DictionaryEngineClauseContext * ctx) override; + antlrcpp::Any visitDictionaryPrimaryKeyClause(ClickHouseParser::DictionaryPrimaryKeyClauseContext * ctx) override; + antlrcpp::Any visitDictionarySchemaClause(ClickHouseParser::DictionarySchemaClauseContext * ctx) override; + antlrcpp::Any visitDictionarySettingsClause(ClickHouseParser::DictionarySettingsClauseContext * ctx) override; + antlrcpp::Any visitLayoutClause(ClickHouseParser::LayoutClauseContext * ctx) override; + antlrcpp::Any visitLifetimeClause(ClickHouseParser::LifetimeClauseContext * ctx) override; + antlrcpp::Any visitRangeClause(ClickHouseParser::RangeClauseContext * ctx) override; + antlrcpp::Any visitSourceClause(ClickHouseParser::SourceClauseContext * ctx) override; + + // CreateLiveViewQuery + antlrcpp::Any visitCreateLiveViewStmt(ClickHouseParser::CreateLiveViewStmtContext * ctx) override; + + // CreateMaterializedViewQuery + antlrcpp::Any visitCreateMaterializedViewStmt(ClickHouseParser::CreateMaterializedViewStmtContext * ctx) override; + + // CreateTableQuery + antlrcpp::Any visitClusterClause(ClickHouseParser::ClusterClauseContext * ctx) override; + antlrcpp::Any visitCreateTableStmt(ClickHouseParser::CreateTableStmtContext * ctx) override; + antlrcpp::Any visitUuidClause(ClickHouseParser::UuidClauseContext * ctx) override; + + // CreateViewQuery + antlrcpp::Any visitCreateViewStmt(ClickHouseParser::CreateViewStmtContext * ctx) override; + + // DescribeQuery + antlrcpp::Any visitDescribeStmt(ClickHouseParser::DescribeStmtContext * ctx) override; + + // DropQuery + antlrcpp::Any visitDropDatabaseStmt(ClickHouseParser::DropDatabaseStmtContext * ctx) override; + antlrcpp::Any visitDropTableStmt(ClickHouseParser::DropTableStmtContext * ctx) override; + + // EngineExpr + antlrcpp::Any visitEngineClause(ClickHouseParser::EngineClauseContext * ctx) override; + antlrcpp::Any visitEngineExpr(ClickHouseParser::EngineExprContext * ctx) override; + antlrcpp::Any visitPartitionByClause(ClickHouseParser::PartitionByClauseContext * ctx) override; + antlrcpp::Any visitPrimaryKeyClause(ClickHouseParser::PrimaryKeyClauseContext * ctx) override; + antlrcpp::Any visitSampleByClause(ClickHouseParser::SampleByClauseContext * ctx) override; + antlrcpp::Any visitTtlClause(ClickHouseParser::TtlClauseContext * ctx) override; + antlrcpp::Any visitTtlExpr(ClickHouseParser::TtlExprContext * ctx) override; + + // ExistsQuery + antlrcpp::Any visitExistsStmt(ClickHouseParser::ExistsStmtContext * ctx) override; + + // ExplainQuery + antlrcpp::Any visitExplainStmt(ClickHouseParser::ExplainStmtContext * ctx) override; + + // Identifier + antlrcpp::Any visitTableIdentifier(ClickHouseParser::TableIdentifierContext * ctx) override; + + // InsertQuery + antlrcpp::Any visitColumnsClause(ClickHouseParser::ColumnsClauseContext * ctx) override; + antlrcpp::Any visitDataClauseFormat(ClickHouseParser::DataClauseFormatContext * ctx) override; + antlrcpp::Any visitDataClauseSelect(ClickHouseParser::DataClauseSelectContext * ctx) override; + antlrcpp::Any visitDataClauseValues(ClickHouseParser::DataClauseValuesContext * ctx) override; + antlrcpp::Any visitInsertStmt(ClickHouseParser::InsertStmtContext * ctx) override; + + // KillQuery + antlrcpp::Any visitKillMutationStmt(ClickHouseParser::KillMutationStmtContext * ctx) override; + + // OptimizeQuery + antlrcpp::Any visitOptimizeStmt(ClickHouseParser::OptimizeStmtContext * ctx) override; + + // RenameQuery + antlrcpp::Any visitRenameStmt(ClickHouseParser::RenameStmtContext * ctx) override; + + // SelectUnionQuery + antlrcpp::Any visitSelectStmt(ClickHouseParser::SelectStmtContext * ctx) override; + antlrcpp::Any visitSelectStmtWithParens(ClickHouseParser::SelectStmtWithParensContext * ctx) override; + antlrcpp::Any visitSelectUnionStmt(ClickHouseParser::SelectUnionStmtContext * ctx) override; + + // SetQuery + antlrcpp::Any visitSetStmt(ClickHouseParser::SetStmtContext * ctx) override; + + // ShowCreateQuery + antlrcpp::Any visitShowCreateDatabaseStmt(ClickHouseParser::ShowCreateDatabaseStmtContext * ctx) override; + antlrcpp::Any visitShowCreateDictionaryStmt(ClickHouseParser::ShowCreateDictionaryStmtContext * ctx) override; + antlrcpp::Any visitShowCreateTableStmt(ClickHouseParser::ShowCreateTableStmtContext * ctx) override; + + // ShowQuery + antlrcpp::Any visitShowDatabasesStmt(ClickHouseParser::ShowDatabasesStmtContext * ctx) override; + antlrcpp::Any visitShowDictionariesStmt(ClickHouseParser::ShowDictionariesStmtContext * ctx) override; + antlrcpp::Any visitShowTablesStmt(ClickHouseParser::ShowTablesStmtContext * ctx) override; + + // SystemQuery + antlrcpp::Any visitSystemStmt(ClickHouseParser::SystemStmtContext * ctx) override; + + // TableElementExpr + antlrcpp::Any visitCodecArgExpr(ClickHouseParser::CodecArgExprContext * ctx) override; + antlrcpp::Any visitCodecExpr(ClickHouseParser::CodecExprContext * ctx) override; + antlrcpp::Any visitTableColumnDfnt(ClickHouseParser::TableColumnDfntContext * ctx) override; + antlrcpp::Any visitTableColumnPropertyExpr(ClickHouseParser::TableColumnPropertyExprContext * ctx) override; + antlrcpp::Any visitTableElementExprColumn(ClickHouseParser::TableElementExprColumnContext * ctx) override; + antlrcpp::Any visitTableElementExprConstraint(ClickHouseParser::TableElementExprConstraintContext * ctx) override; + antlrcpp::Any visitTableElementExprIndex(ClickHouseParser::TableElementExprIndexContext * ctx) override; + antlrcpp::Any visitTableIndexDfnt(ClickHouseParser::TableIndexDfntContext * ctx) override; + + // TableExpr + antlrcpp::Any visitTableArgExpr(ClickHouseParser::TableArgExprContext * ctx) override; + antlrcpp::Any visitTableArgList(ClickHouseParser::TableArgListContext * ctx) override; + antlrcpp::Any visitTableExprAlias(ClickHouseParser::TableExprAliasContext * ctx) override; + antlrcpp::Any visitTableExprFunction(ClickHouseParser::TableExprFunctionContext * ctx) override; + antlrcpp::Any visitTableExprIdentifier(ClickHouseParser::TableExprIdentifierContext * ctx) override; + antlrcpp::Any visitTableExprSubquery(ClickHouseParser::TableExprSubqueryContext * ctx) override; + antlrcpp::Any visitTableFunctionExpr(ClickHouseParser::TableFunctionExprContext * ctx) override; + + // TruncateQuery + antlrcpp::Any visitTruncateStmt(ClickHouseParser::TruncateStmtContext * ctx) override; + + // UseQuery + antlrcpp::Any visitUseStmt(ClickHouseParser::UseStmtContext * ctx) override; + + // WatchQuery + antlrcpp::Any visitWatchStmt(ClickHouseParser::WatchStmtContext * ctx) override; + + // TODO: sort methods below this comment. + + // CREATE clauses + + antlrcpp::Any visitDestinationClause(ClickHouseParser::DestinationClauseContext *ctx) override; + antlrcpp::Any visitSchemaDescriptionClause(ClickHouseParser::SchemaDescriptionClauseContext *ctx) override; + antlrcpp::Any visitSchemaAsTableClause(ClickHouseParser::SchemaAsTableClauseContext *ctx) override; + antlrcpp::Any visitSchemaAsFunctionClause(ClickHouseParser::SchemaAsFunctionClauseContext *ctx) override; + antlrcpp::Any visitSubqueryClause(ClickHouseParser::SubqueryClauseContext *ctx) override; + + // OPTIMIZE clauses + + antlrcpp::Any visitPartitionClause(ClickHouseParser::PartitionClauseContext *ctx) override; // returns |PtrTo| + + // SELECT clauses + + antlrcpp::Any visitWithClause(ClickHouseParser::WithClauseContext *ctx) override; + antlrcpp::Any visitTopClause(ClickHouseParser::TopClauseContext * ctx) override; + antlrcpp::Any visitFromClause(ClickHouseParser::FromClauseContext *ctx) override; + antlrcpp::Any visitSampleClause(ClickHouseParser::SampleClauseContext *ctx) override; + antlrcpp::Any visitArrayJoinClause(ClickHouseParser::ArrayJoinClauseContext *ctx) override; + antlrcpp::Any visitPrewhereClause(ClickHouseParser::PrewhereClauseContext *ctx) override; + antlrcpp::Any visitWhereClause(ClickHouseParser::WhereClauseContext *ctx) override; + antlrcpp::Any visitGroupByClause(ClickHouseParser::GroupByClauseContext *ctx) override; + antlrcpp::Any visitHavingClause(ClickHouseParser::HavingClauseContext *ctx) override; + antlrcpp::Any visitOrderByClause(ClickHouseParser::OrderByClauseContext *ctx) override; + antlrcpp::Any visitLimitByClause(ClickHouseParser::LimitByClauseContext *ctx) override; + antlrcpp::Any visitLimitClause(ClickHouseParser::LimitClauseContext *ctx) override; + antlrcpp::Any visitSettingsClause(ClickHouseParser::SettingsClauseContext *ctx) override; + + // SELECT expressions + + antlrcpp::Any visitRatioExpr(ClickHouseParser::RatioExprContext *ctx) override; + antlrcpp::Any visitOrderExprList(ClickHouseParser::OrderExprListContext *ctx) override; + antlrcpp::Any visitOrderExpr(ClickHouseParser::OrderExprContext *ctx) override; + antlrcpp::Any visitLimitExpr(ClickHouseParser::LimitExprContext *ctx) override; + antlrcpp::Any visitSettingExprList(ClickHouseParser::SettingExprListContext *ctx) override; + antlrcpp::Any visitSettingExpr(ClickHouseParser::SettingExprContext *ctx) override; + + // Join expressions (alphabetically) + + antlrcpp::Any visitJoinConstraintClause(ClickHouseParser::JoinConstraintClauseContext *ctx) override; + antlrcpp::Any visitJoinExprCrossOp(ClickHouseParser::JoinExprCrossOpContext *ctx) override; + antlrcpp::Any visitJoinExprOp(ClickHouseParser::JoinExprOpContext *ctx) override; + antlrcpp::Any visitJoinExprParens(ClickHouseParser::JoinExprParensContext *ctx) override; + antlrcpp::Any visitJoinExprTable(ClickHouseParser::JoinExprTableContext *ctx) override; + antlrcpp::Any visitJoinOpCross(ClickHouseParser::JoinOpCrossContext *ctx) override; + antlrcpp::Any visitJoinOpFull(ClickHouseParser::JoinOpFullContext *ctx) override; + antlrcpp::Any visitJoinOpInner(ClickHouseParser::JoinOpInnerContext *ctx) override; + antlrcpp::Any visitJoinOpLeftRight(ClickHouseParser::JoinOpLeftRightContext *ctx) override; + + // Column expressions (alphabetically) + + antlrcpp::Any visitColumnArgExpr(ClickHouseParser::ColumnArgExprContext *ctx) override; + antlrcpp::Any visitColumnArgList(ClickHouseParser::ColumnArgListContext *ctx) override; + antlrcpp::Any visitColumnIdentifier(ClickHouseParser::ColumnIdentifierContext *ctx) override; + antlrcpp::Any visitColumnLambdaExpr(ClickHouseParser::ColumnLambdaExprContext *ctx) override; + antlrcpp::Any visitColumnsExprAsterisk(ClickHouseParser::ColumnsExprAsteriskContext *ctx) override; + antlrcpp::Any visitColumnsExprColumn(ClickHouseParser::ColumnsExprColumnContext *ctx) override; + antlrcpp::Any visitColumnsExprSubquery(ClickHouseParser::ColumnsExprSubqueryContext *ctx) override; + antlrcpp::Any visitNestedIdentifier(ClickHouseParser::NestedIdentifierContext *ctx) override; + + // Database expressions + + antlrcpp::Any visitDatabaseIdentifier(ClickHouseParser::DatabaseIdentifierContext *ctx) override; + + // Basic expressions (alphabetically) + + antlrcpp::Any visitAlias(ClickHouseParser::AliasContext * ctx) override; + antlrcpp::Any visitEnumValue(ClickHouseParser::EnumValueContext *ctx) override; + antlrcpp::Any visitFloatingLiteral(ClickHouseParser::FloatingLiteralContext *ctx) override; + antlrcpp::Any visitIdentifier(ClickHouseParser::IdentifierContext *ctx) override; + antlrcpp::Any visitIdentifierOrNull(ClickHouseParser::IdentifierOrNullContext *ctx) override; + antlrcpp::Any visitInterval(ClickHouseParser::IntervalContext * ctx) override; + antlrcpp::Any visitKeyword(ClickHouseParser::KeywordContext *ctx) override; + antlrcpp::Any visitKeywordForAlias(ClickHouseParser::KeywordForAliasContext * ctx) override; + antlrcpp::Any visitLiteral(ClickHouseParser::LiteralContext *ctx) override; + antlrcpp::Any visitNumberLiteral(ClickHouseParser::NumberLiteralContext *ctx) override; +}; + +} diff --git a/src/Parsers/New/ParserErrorListener.cpp b/src/Parsers/New/ParserErrorListener.cpp new file mode 100644 index 00000000000..0f637b1fa12 --- /dev/null +++ b/src/Parsers/New/ParserErrorListener.cpp @@ -0,0 +1,34 @@ +#include + +#include + +#include + +#include + + +using namespace antlr4; + +namespace DB +{ + +namespace ErrorCodes +{ + +extern int SYNTAX_ERROR; + +} + +void ParserErrorListener::syntaxError( + Recognizer * recognizer, Token * token, size_t, size_t, const std::string & message, std::exception_ptr) +{ + auto * parser = dynamic_cast(recognizer); + + std::cerr << "Last element parsed so far:" << std::endl + << parser->getRuleContext()->toStringTree(parser, true) << std::endl + << "Parser error: (pos " << token->getStartIndex() << ") " << message << std::endl; + + throw DB::Exception("Can't parse input: " + message, ErrorCodes::SYNTAX_ERROR); +} + +} diff --git a/src/Parsers/New/ParserErrorListener.h b/src/Parsers/New/ParserErrorListener.h new file mode 100644 index 00000000000..1a02ff01abe --- /dev/null +++ b/src/Parsers/New/ParserErrorListener.h @@ -0,0 +1,21 @@ +#pragma once + +#include + + +namespace DB +{ + +class ParserErrorListener : public antlr4::BaseErrorListener +{ +public: + void syntaxError( + antlr4::Recognizer * recognizer, + antlr4::Token * token, + size_t line, + size_t pos, + const std::string & message, + std::exception_ptr e) override; +}; + +} diff --git a/src/Parsers/New/parseQuery.cpp b/src/Parsers/New/parseQuery.cpp new file mode 100644 index 00000000000..af334717392 --- /dev/null +++ b/src/Parsers/New/parseQuery.cpp @@ -0,0 +1,90 @@ +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + + +namespace DB +{ + +using namespace antlr4; +using namespace AST; + +// For testing only +PtrTo parseQuery(const String & query) +{ + ANTLRInputStream input(query); + ClickHouseLexer lexer(&input); + CommonTokenStream tokens(&lexer); + ClickHouseParser parser(&tokens); + LexerErrorListener lexer_error_listener; + ParserErrorListener parser_error_listener; + + lexer.removeErrorListeners(); + parser.removeErrorListeners(); + lexer.addErrorListener(&lexer_error_listener); + parser.addErrorListener(&parser_error_listener); + + ParseTreeVisitor visitor; + + return visitor.visit(parser.queryStmt()); +} + +ASTPtr parseQuery(const char * begin, const char * end, size_t, size_t) +{ + // TODO: do not ignore |max_parser_depth|. + + size_t size = end - begin; + std::strstreambuf buffer(begin, size); + std::wbuffer_convert> converter(&buffer); + std::wistream stream(&converter); + + UnbufferedCharStream input(stream, size); + ClickHouseLexer lexer(&input); + CommonTokenStream tokens(&lexer); + ClickHouseParser parser(&tokens); + LexerErrorListener lexer_error_listener; + ParserErrorListener parser_error_listener; + + lexer.removeErrorListeners(); + parser.removeErrorListeners(); + lexer.addErrorListener(&lexer_error_listener); + parser.addErrorListener(&parser_error_listener); + + ParseTreeVisitor visitor; + + PtrTo new_ast = visitor.visit(parser.queryStmt()); + auto old_ast = new_ast->convertToOld(); + + if (const auto * insert = new_ast->as()) + { + auto * old_insert = old_ast->as(); + + old_insert->end = end; + if (insert->hasData()) + { + old_insert->data = begin + insert->getDataOffset(); + + // Data starts after the first newline, if there is one, or after all the whitespace characters, otherwise. + auto & data = old_insert->data; + while (data < end && (*data == ' ' || *data == '\t' || *data == '\f')) ++data; + if (data < end && *data == '\r') ++data; + if (data < end && *data == '\n') ++data; + } + + old_insert->data = (old_insert->data != end) ? old_insert->data : nullptr; + } + + return old_ast; +} + +} diff --git a/src/Parsers/New/parseQuery.h b/src/Parsers/New/parseQuery.h new file mode 100644 index 00000000000..ae86dc32eda --- /dev/null +++ b/src/Parsers/New/parseQuery.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + + +namespace DB +{ + +// Compatibility interface + +AST::PtrTo parseQuery(const std::string & query); +ASTPtr parseQuery(const char * begin, const char * end, size_t max_query_size, size_t max_parser_depth); + +} diff --git a/src/Parsers/ParserAlterQuery.cpp b/src/Parsers/ParserAlterQuery.cpp index b3f40eb42eb..f916537f438 100644 --- a/src/Parsers/ParserAlterQuery.cpp +++ b/src/Parsers/ParserAlterQuery.cpp @@ -631,7 +631,7 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected bool ParserAlterCommandList::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) { - auto command_list = std::make_shared(); + auto command_list = std::make_shared(); node = command_list; ParserToken s_comma(TokenType::Comma); @@ -643,7 +643,7 @@ bool ParserAlterCommandList::parseImpl(Pos & pos, ASTPtr & node, Expected & expe if (!p_command.parse(pos, command, expected)) return false; - command_list->add(command); + command_list->children.push_back(command); } while (s_comma.ignore(pos, expected)); diff --git a/src/Parsers/ParserCreateQuery.cpp b/src/Parsers/ParserCreateQuery.cpp index 6416e08d93b..23b4c6f7932 100644 --- a/src/Parsers/ParserCreateQuery.cpp +++ b/src/Parsers/ParserCreateQuery.cpp @@ -49,6 +49,7 @@ bool ParserNestedTable::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) auto func = std::make_shared(); tryGetIdentifierNameInto(name, func->name); + // FIXME(ilezhankin): func->no_empty_args = true; ? func->arguments = columns; func->children.push_back(columns); node = func; diff --git a/src/Parsers/ParserDataType.cpp b/src/Parsers/ParserDataType.cpp index ee746329bff..0148f2f3bb9 100644 --- a/src/Parsers/ParserDataType.cpp +++ b/src/Parsers/ParserDataType.cpp @@ -94,6 +94,7 @@ bool ParserDataType::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) auto function_node = std::make_shared(); function_node->name = type_name; + function_node->no_empty_args = true; if (pos->type != TokenType::OpeningRoundBracket) { diff --git a/src/Parsers/ParserExplainQuery.cpp b/src/Parsers/ParserExplainQuery.cpp index 69281149dc1..fe48addd0cd 100644 --- a/src/Parsers/ParserExplainQuery.cpp +++ b/src/Parsers/ParserExplainQuery.cpp @@ -1,6 +1,8 @@ #include + #include #include +#include #include #include @@ -46,13 +48,15 @@ bool ParserExplainQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected pos = begin; } + ParserCreateTableQuery create_p; ParserSelectWithUnionQuery select_p; ASTPtr query; - if (!select_p.parse(pos, query, expected)) + if (select_p.parse(pos, query, expected) || + create_p.parse(pos, query, expected)) + explain_query->setExplainedQuery(std::move(query)); + else return false; - explain_query->setExplainedQuery(std::move(query)); - node = std::move(explain_query); return true; } diff --git a/src/Parsers/ParserOptimizeQuery.cpp b/src/Parsers/ParserOptimizeQuery.cpp index 56e28876133..da63c89c374 100644 --- a/src/Parsers/ParserOptimizeQuery.cpp +++ b/src/Parsers/ParserOptimizeQuery.cpp @@ -62,7 +62,8 @@ bool ParserOptimizeQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expecte tryGetIdentifierNameInto(table, query->table); query->cluster = cluster_str; - query->partition = partition; + if ((query->partition = partition)) + query->children.push_back(partition); query->final = final; query->deduplicate = deduplicate; diff --git a/src/Parsers/ParserSelectWithUnionQuery.cpp b/src/Parsers/ParserSelectWithUnionQuery.cpp index 9a644d8e937..87e2dab1a47 100644 --- a/src/Parsers/ParserSelectWithUnionQuery.cpp +++ b/src/Parsers/ParserSelectWithUnionQuery.cpp @@ -20,9 +20,9 @@ bool ParserSelectWithUnionQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & if (!parser.parse(pos, list_node, expected)) return false; - /// NOTE: We cann't simply flatten inner union query now, since we may have different union mode in query, + /// NOTE: We can't simply flatten inner union query now, since we may have different union mode in query, /// so flatten may change it's semantics. For example: - /// flatten `SELECT 1 UNION (SELECT 1 UNION ALL SELETC 1)` -> `SELECT 1 UNION SELECT 1 UNION ALL SELECT 1` + /// flatten `SELECT 1 UNION (SELECT 1 UNION ALL SELECT 1)` -> `SELECT 1 UNION SELECT 1 UNION ALL SELECT 1` /// If we got only one child which is ASTSelectWithUnionQuery, just lift it up auto & expr_list = list_node->as(); diff --git a/src/Parsers/ParserSystemQuery.cpp b/src/Parsers/ParserSystemQuery.cpp index 020b7993c2d..b6a90b348a0 100644 --- a/src/Parsers/ParserSystemQuery.cpp +++ b/src/Parsers/ParserSystemQuery.cpp @@ -120,7 +120,7 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & if (!parseDatabaseAndTableName(pos, expected, res->database, res->table)) { /// FLUSH DISTRIBUTED requires table - /// START/STOP DISTRIBUTED SENDS does not requires table + /// START/STOP DISTRIBUTED SENDS does not require table if (res->type == Type::FLUSH_DISTRIBUTED) return false; } diff --git a/src/Parsers/parseQuery.cpp b/src/Parsers/parseQuery.cpp index 5ecdd091e11..2dc1c4c8c71 100644 --- a/src/Parsers/parseQuery.cpp +++ b/src/Parsers/parseQuery.cpp @@ -336,8 +336,7 @@ ASTPtr parseQuery( size_t max_query_size, size_t max_parser_depth) { - const char * pos = begin; - return parseQueryAndMovePosition(parser, pos, end, query_description, false, max_query_size, max_parser_depth); + return parseQueryAndMovePosition(parser, begin, end, query_description, false, max_query_size, max_parser_depth); } diff --git a/src/Parsers/ya.make.in b/src/Parsers/ya.make.in index 01edf8dca82..0dbd6b5b593 100644 --- a/src/Parsers/ya.make.in +++ b/src/Parsers/ya.make.in @@ -8,7 +8,7 @@ PEERDIR( SRCS( - + ) END() diff --git a/src/Processors/Formats/Impl/ConstantExpressionTemplate.cpp b/src/Processors/Formats/Impl/ConstantExpressionTemplate.cpp index 9514ca69e54..68854e53a02 100644 --- a/src/Processors/Formats/Impl/ConstantExpressionTemplate.cpp +++ b/src/Processors/Formats/Impl/ConstantExpressionTemplate.cpp @@ -599,7 +599,7 @@ void ConstantExpressionTemplate::TemplateStructure::addNodesToCastResult(const I expr = makeASTFunction("assumeNotNull", std::move(expr)); } - expr = makeASTFunction("CAST", std::move(expr), std::make_shared(result_column_type.getName())); + expr = makeASTFunction("cast", std::move(expr), std::make_shared(result_column_type.getName())); if (null_as_default) { diff --git a/src/Storages/LiveView/TemporaryLiveViewCleaner.cpp b/src/Storages/LiveView/TemporaryLiveViewCleaner.cpp index 1159a93d2ef..052b22fd666 100644 --- a/src/Storages/LiveView/TemporaryLiveViewCleaner.cpp +++ b/src/Storages/LiveView/TemporaryLiveViewCleaner.cpp @@ -149,7 +149,6 @@ void TemporaryLiveViewCleaner::backgroundThreadFunc() void TemporaryLiveViewCleaner::stopBackgroundThread() { - std::lock_guard lock{mutex}; if (background_thread.joinable()) { background_thread_should_exit = true; diff --git a/src/Storages/MergeTree/KeyCondition.cpp b/src/Storages/MergeTree/KeyCondition.cpp index 49ed7340a04..5903dc89e9b 100644 --- a/src/Storages/MergeTree/KeyCondition.cpp +++ b/src/Storages/MergeTree/KeyCondition.cpp @@ -946,6 +946,9 @@ bool KeyCondition::isKeyPossiblyWrappedByMonotonicFunctionsImpl( if (const auto * func = node->as()) { + if (!func->arguments) + return false; + const auto & args = func->arguments->children; if (args.size() > 2 || args.empty()) return false; diff --git a/src/Storages/MutationCommands.cpp b/src/Storages/MutationCommands.cpp index f832e674444..2aa90a039bc 100644 --- a/src/Storages/MutationCommands.cpp +++ b/src/Storages/MutationCommands.cpp @@ -120,11 +120,11 @@ std::optional MutationCommand::parse(ASTAlterCommand * command, } -std::shared_ptr MutationCommands::ast() const +std::shared_ptr MutationCommands::ast() const { - auto res = std::make_shared(); + auto res = std::make_shared(); for (const MutationCommand & command : *this) - res->add(command.ast->clone()); + res->children.push_back(command.ast->clone()); return res; } @@ -144,8 +144,9 @@ void MutationCommands::readText(ReadBuffer & in) ParserAlterCommandList p_alter_commands; auto commands_ast = parseQuery( p_alter_commands, commands_str.data(), commands_str.data() + commands_str.length(), "mutation commands list", 0, DBMS_DEFAULT_MAX_PARSER_DEPTH); - for (ASTAlterCommand * command_ast : commands_ast->as().commands) + for (const auto & child : commands_ast->children) { + auto * command_ast = child->as(); auto command = MutationCommand::parse(command_ast, true); if (!command) throw Exception("Unknown mutation command type: " + DB::toString(command_ast->type), ErrorCodes::UNKNOWN_MUTATION_COMMAND); diff --git a/src/Storages/MutationCommands.h b/src/Storages/MutationCommands.h index 0f031eb56e6..ecf819eed9b 100644 --- a/src/Storages/MutationCommands.h +++ b/src/Storages/MutationCommands.h @@ -67,7 +67,7 @@ struct MutationCommand class MutationCommands : public std::vector { public: - std::shared_ptr ast() const; + std::shared_ptr ast() const; void writeText(WriteBuffer & out) const; void readText(ReadBuffer & in); diff --git a/src/Storages/extractKeyExpressionList.cpp b/src/Storages/extractKeyExpressionList.cpp index 9dd44fe3902..cd03d0d5123 100644 --- a/src/Storages/extractKeyExpressionList.cpp +++ b/src/Storages/extractKeyExpressionList.cpp @@ -13,8 +13,11 @@ namespace DB if (expr_func && expr_func->name == "tuple") { - /// Primary key is specified in tuple, extract its arguments. - return expr_func->arguments->clone(); + if (expr_func->arguments) + /// Primary key is specified in tuple, extract its arguments. + return expr_func->arguments->clone(); + else + return std::make_shared(); } else { diff --git a/tests/queries/0_stateless/00048_a_stored_aggregates_merge.sql b/tests/queries/0_stateless/00048_a_stored_aggregates_merge.sql index 79617692ebd..0138a75c19a 100644 --- a/tests/queries/0_stateless/00048_a_stored_aggregates_merge.sql +++ b/tests/queries/0_stateless/00048_a_stored_aggregates_merge.sql @@ -2,18 +2,18 @@ DROP TABLE IF EXISTS stored_aggregates; CREATE TABLE stored_aggregates ( - d Date, - Uniq AggregateFunction(uniq, UInt64) + d Date, + Uniq AggregateFunction(uniq, UInt64) ) ENGINE = AggregatingMergeTree(d, d, 8192); INSERT INTO stored_aggregates SELECT - toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d, - uniqState(intDiv(number, 10)) AS Uniq + toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d, + uniqState(intDiv(number, 10)) AS Uniq FROM ( - SELECT * FROM system.numbers LIMIT 1000 + SELECT * FROM system.numbers LIMIT 1000 ) GROUP BY d; @@ -23,11 +23,11 @@ SELECT d, uniqMerge(Uniq) FROM stored_aggregates GROUP BY d ORDER BY d; INSERT INTO stored_aggregates SELECT - toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d, - uniqState(intDiv(number + 50, 10)) AS Uniq + toDate(toUInt16(toDate('2014-06-01')) + intDiv(number, 100)) AS d, + uniqState(intDiv(number + 50, 10)) AS Uniq FROM ( - SELECT * FROM system.numbers LIMIT 500, 1000 + SELECT * FROM system.numbers LIMIT 500, 1000 ) GROUP BY d; diff --git a/tests/queries/0_stateless/00063_check_query.sql b/tests/queries/0_stateless/00063_check_query.sql index 2b806cb3bf2..e7362074a05 100644 --- a/tests/queries/0_stateless/00063_check_query.sql +++ b/tests/queries/0_stateless/00063_check_query.sql @@ -4,7 +4,7 @@ DROP TABLE IF EXISTS check_query_tiny_log; CREATE TABLE check_query_tiny_log (N UInt32, S String) Engine = TinyLog; -INSERT INTO check_query_tiny_log VALUES (1, 'A'), (2, 'B'), (3, 'C') +INSERT INTO check_query_tiny_log VALUES (1, 'A'), (2, 'B'), (3, 'C'); CHECK TABLE check_query_tiny_log; @@ -13,7 +13,7 @@ DROP TABLE IF EXISTS check_query_log; CREATE TABLE check_query_log (N UInt32,S String) Engine = Log; -INSERT INTO check_query_log VALUES (1, 'A'), (2, 'B'), (3, 'C') +INSERT INTO check_query_log VALUES (1, 'A'), (2, 'B'), (3, 'C'); CHECK TABLE check_query_log; diff --git a/tests/queries/0_stateless/00097_long_storage_buffer_race_condition.sh b/tests/queries/0_stateless/00097_long_storage_buffer_race_condition.sh index 57adcfaf061..26502247055 100755 --- a/tests/queries/0_stateless/00097_long_storage_buffer_race_condition.sh +++ b/tests/queries/0_stateless/00097_long_storage_buffer_race_condition.sh @@ -3,4 +3,4 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) [ "$NO_SHELL_CONFIG" ] || . "$CURDIR"/../shell_config.sh -seq 1 1000 | sed -r 's/.+/CREATE TABLE IF NOT EXISTS buf_00097 (a UInt8) ENGINE = Buffer(currentDatabase(), b, 1, 1, 1, 1, 1, 1, 1); DROP TABLE buf_00097;/' | $CLICKHOUSE_CLIENT -n +seq 1 1000 | sed -r 's/.+/CREATE TABLE IF NOT EXISTS buf_00097 (a UInt8) ENGINE = Buffer('$CLICKHOUSE_DATABASE', b, 1, 1, 1, 1, 1, 1, 1); DROP TABLE buf_00097;/' | $CLICKHOUSE_CLIENT -n diff --git a/tests/queries/0_stateless/00416_pocopatch_progress_in_http_headers.sh b/tests/queries/0_stateless/00416_pocopatch_progress_in_http_headers.sh index 941cdad4c5c..31f5e0f0f43 100755 --- a/tests/queries/0_stateless/00416_pocopatch_progress_in_http_headers.sh +++ b/tests/queries/0_stateless/00416_pocopatch_progress_in_http_headers.sh @@ -29,5 +29,4 @@ ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}" -H 'Accept-Encoding: gzip' -d 'CREAT ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}&max_block_size=1&http_headers_progress_interval_ms=0&send_progress_in_http_headers=1" -d 'INSERT INTO insert_number_query (record) SELECT number FROM system.numbers LIMIT 10' 2>&1 | grep -E 'Content-Encoding|X-ClickHouse-Summary|^[0-9]' ${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}" -H 'Accept-Encoding: gzip' -d 'DROP TABLE insert_number_query' > /dev/null 2>&1 -${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}" -H 'Accept-Encoding: gzip' -d 'DROP TABLE insert_number_query2' > /dev/null 2>&1 - +${CLICKHOUSE_CURL} -vsS "${CLICKHOUSE_URL}" -H 'Accept-Encoding: gzip' -d 'DROP TABLE insert_number_query_2' > /dev/null 2>&1 diff --git a/tests/queries/0_stateless/00443_optimize_final_vertical_merge.sh b/tests/queries/0_stateless/00443_optimize_final_vertical_merge.sh index 1ea7762b813..3cea3a65cdf 100755 --- a/tests/queries/0_stateless/00443_optimize_final_vertical_merge.sh +++ b/tests/queries/0_stateless/00443_optimize_final_vertical_merge.sh @@ -5,13 +5,12 @@ set -e CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CURDIR"/../shell_config.sh -db="test" table="optimize_me_finally" -name="$db.$table" +name="$CLICKHOUSE_DATABASE.$table" res_rows=1500000 # >= vertical_merge_algorithm_min_rows_to_activate function get_num_parts { - $CLICKHOUSE_CLIENT -q "SELECT count() FROM system.parts WHERE active AND database='$db' AND table='$table'" + $CLICKHOUSE_CLIENT -q "SELECT count() FROM system.parts WHERE active AND database='$CLICKHOUSE_DATABASE' AND table='$table'" } $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS $name" diff --git a/tests/queries/0_stateless/00462_json_true_false_literals.sql b/tests/queries/0_stateless/00462_json_true_false_literals.sql index 37cfe8f4cda..740683ad3ce 100644 --- a/tests/queries/0_stateless/00462_json_true_false_literals.sql +++ b/tests/queries/0_stateless/00462_json_true_false_literals.sql @@ -1,6 +1,6 @@ DROP TABLE IF EXISTS json; CREATE TABLE json (x UInt8, title String) ENGINE = Memory; -INSERT INTO json FORMAT JSONEachRow {"x": true, "title": "true"}, {"x": false, "title": "false"}, {"x": 0, "title": "0"}, {"x": 1, "title": "1"} +INSERT INTO json FORMAT JSONEachRow {"x": true, "title": "true"}, {"x": false, "title": "false"}, {"x": 0, "title": "0"}, {"x": 1, "title": "1"}; SELECT * FROM json ORDER BY title; DROP TABLE IF EXISTS json; diff --git a/tests/queries/0_stateless/00463_long_sessions_in_http_interface.sh b/tests/queries/0_stateless/00463_long_sessions_in_http_interface.sh index bf5765c22c1..c49924741df 100755 --- a/tests/queries/0_stateless/00463_long_sessions_in_http_interface.sh +++ b/tests/queries/0_stateless/00463_long_sessions_in_http_interface.sh @@ -34,7 +34,7 @@ check() { address=${CLICKHOUSE_HOST} port=${CLICKHOUSE_PORT_HTTP} url="${CLICKHOUSE_PORT_HTTP_PROTO}://$address:$port/" -session="?session_id=test_$$" +session="?session_id=test_$$" # use PID for session ID select="SELECT * FROM system.settings WHERE name = 'max_rows_to_read'" select_from_temporary_table="SELECT * FROM temp ORDER BY x" select_from_non_existent_table="SELECT * FROM no_such_table ORDER BY x" diff --git a/tests/queries/0_stateless/00469_comparison_of_strings_containing_null_char.sql b/tests/queries/0_stateless/00469_comparison_of_strings_containing_null_char.sql index abc4e143458..d37335026ed 100644 --- a/tests/queries/0_stateless/00469_comparison_of_strings_containing_null_char.sql +++ b/tests/queries/0_stateless/00469_comparison_of_strings_containing_null_char.sql @@ -7,8 +7,7 @@ SELECT 'a\0\0\0\0' < 'a\0\0\0', 'a\0\0\0\0' > 'a\0\0\0'; DROP TABLE IF EXISTS strings_00469; CREATE TABLE strings_00469(x String, y String) ENGINE = TinyLog; -INSERT INTO strings_00469 VALUES - ('abcde\0', 'abcde'), ('aa\0a', 'aa\0b'), ('aa', 'aa\0'), ('a\0\0\0\0', 'a\0\0\0'), ('a\0\0', 'a\0'), ('a', 'a'); +INSERT INTO strings_00469 VALUES ('abcde\0', 'abcde'), ('aa\0a', 'aa\0b'), ('aa', 'aa\0'), ('a\0\0\0\0', 'a\0\0\0'), ('a\0\0', 'a\0'), ('a', 'a'); SELECT '**** vector-vector comparisons ****'; diff --git a/tests/queries/0_stateless/00489_pk_subexpression.sql b/tests/queries/0_stateless/00489_pk_subexpression.sql index 59f310a7605..41499f0bd1b 100644 --- a/tests/queries/0_stateless/00489_pk_subexpression.sql +++ b/tests/queries/0_stateless/00489_pk_subexpression.sql @@ -20,10 +20,10 @@ SELECT toUInt32(x), y, z FROM pk WHERE x = toDateTime(1); -- Index works on interval 00:01:00 - 00:01:59 SET max_rows_to_read = 4; -SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(119) AND y = 11; +SELECT toUInt32(x), y, z FROM pk WHERE (x BETWEEN toDateTime(60) AND toDateTime(119)) AND y = 11; -- Cannot read less rows as PK is coarser on interval 00:01:00 - 00:02:00 SET max_rows_to_read = 5; -SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(120) AND y = 11; +SELECT toUInt32(x), y, z FROM pk WHERE (x BETWEEN toDateTime(60) AND toDateTime(120)) AND y = 11; DROP TABLE pk; diff --git a/tests/queries/0_stateless/00597_push_down_predicate.reference b/tests/queries/0_stateless/00597_push_down_predicate.reference index 83f783138a0..e239b1c27fd 100644 --- a/tests/queries/0_stateless/00597_push_down_predicate.reference +++ b/tests/queries/0_stateless/00597_push_down_predicate.reference @@ -114,7 +114,7 @@ FROM ( SELECT 1 AS id, - CAST(1, \'UInt8\') AS subquery + cast(1, \'UInt8\') AS subquery ) 1 1 SELECT diff --git a/tests/queries/0_stateless/00612_pk_in_tuple_perf.sh b/tests/queries/0_stateless/00612_pk_in_tuple_perf.sh index 62bda850886..59617c81db9 100755 --- a/tests/queries/0_stateless/00612_pk_in_tuple_perf.sh +++ b/tests/queries/0_stateless/00612_pk_in_tuple_perf.sh @@ -43,3 +43,6 @@ query="SELECT count() FROM pk_in_tuple_perf_non_const WHERE (u, d) IN ((0, today $CLICKHOUSE_CLIENT --query "$query" $CLICKHOUSE_CLIENT --query "$query FORMAT JSON" | grep "rows_read" + +$CLICKHOUSE_CLIENT --query "DROP TABLE pk_in_tuple_perf" +$CLICKHOUSE_CLIENT --query "DROP TABLE pk_in_tuple_perf_non_const" diff --git a/tests/queries/0_stateless/00626_replace_partition_from_table_zookeeper.sh b/tests/queries/0_stateless/00626_replace_partition_from_table_zookeeper.sh index 8a900f9aeea..0c56a02b894 100755 --- a/tests/queries/0_stateless/00626_replace_partition_from_table_zookeeper.sh +++ b/tests/queries/0_stateless/00626_replace_partition_from_table_zookeeper.sh @@ -74,14 +74,14 @@ query_with_retry "ALTER TABLE dst_r1 DROP PARTITION 1;" $CLICKHOUSE_CLIENT --query="INSERT INTO dst_r1 VALUES (1, '1', 2), (1, '2', 2);" $CLICKHOUSE_CLIENT --query="CREATE table test_block_numbers (m UInt64) ENGINE MergeTree() ORDER BY tuple();" -$CLICKHOUSE_CLIENT --query="INSERT INTO test_block_numbers SELECT max(max_block_number) AS m FROM system.parts WHERE database=currentDatabase() AND table='dst_r1' AND active AND name LIKE '1_%';" +$CLICKHOUSE_CLIENT --query="INSERT INTO test_block_numbers SELECT max(max_block_number) AS m FROM system.parts WHERE database='$CLICKHOUSE_DATABASE' AND table='dst_r1' AND active AND name LIKE '1_%';" query_with_retry "ALTER TABLE dst_r1 REPLACE PARTITION 1 FROM dst_r1;" $CLICKHOUSE_CLIENT --query="SYSTEM SYNC REPLICA dst_r2;" $CLICKHOUSE_CLIENT --query="SELECT count(), sum(d) FROM dst_r1;" $CLICKHOUSE_CLIENT --query="SELECT count(), sum(d) FROM dst_r2;" -$CLICKHOUSE_CLIENT --query="INSERT INTO test_block_numbers SELECT max(max_block_number) AS m FROM system.parts WHERE database=currentDatabase() AND table='dst_r1' AND active AND name LIKE '1_%';" +$CLICKHOUSE_CLIENT --query="INSERT INTO test_block_numbers SELECT max(max_block_number) AS m FROM system.parts WHERE database='$CLICKHOUSE_DATABASE' AND table='dst_r1' AND active AND name LIKE '1_%';" $CLICKHOUSE_CLIENT --query="SELECT (max(m) - min(m) > 1) AS new_block_is_generated FROM test_block_numbers;" $CLICKHOUSE_CLIENT --query="DROP TABLE test_block_numbers;" diff --git a/tests/queries/0_stateless/00642_cast.reference b/tests/queries/0_stateless/00642_cast.reference index 7f5333f590e..3d5572932fb 100644 --- a/tests/queries/0_stateless/00642_cast.reference +++ b/tests/queries/0_stateless/00642_cast.reference @@ -10,11 +10,11 @@ hello CREATE TABLE default.cast ( `x` UInt8, - `e` Enum8('hello' = 1, 'world' = 2) DEFAULT CAST(x, 'Enum8(\'hello\' = 1, \'world\' = 2)') + `e` Enum8('hello' = 1, 'world' = 2) DEFAULT cast(x, 'Enum8(\'hello\' = 1, \'world\' = 2)') ) ENGINE = MergeTree ORDER BY e SETTINGS index_granularity = 8192 x UInt8 -e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT CAST(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\') +e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT cast(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\') 1 hello diff --git a/tests/queries/0_stateless/00643_cast_zookeeper.reference b/tests/queries/0_stateless/00643_cast_zookeeper.reference index 9123463de1a..658233be742 100644 --- a/tests/queries/0_stateless/00643_cast_zookeeper.reference +++ b/tests/queries/0_stateless/00643_cast_zookeeper.reference @@ -1,12 +1,12 @@ CREATE TABLE default.cast1 ( `x` UInt8, - `e` Enum8('hello' = 1, 'world' = 2) DEFAULT CAST(x, 'Enum8(\'hello\' = 1, \'world\' = 2)') + `e` Enum8('hello' = 1, 'world' = 2) DEFAULT cast(x, 'Enum8(\'hello\' = 1, \'world\' = 2)') ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_00643/cast', 'r1') ORDER BY e SETTINGS index_granularity = 8192 x UInt8 -e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT CAST(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\') +e Enum8(\'hello\' = 1, \'world\' = 2) DEFAULT cast(x, \'Enum8(\\\'hello\\\' = 1, \\\'world\\\' = 2)\') 1 hello 1 hello diff --git a/tests/queries/0_stateless/00674_join_on_syntax.sql b/tests/queries/0_stateless/00674_join_on_syntax.sql index f455f5e9a1b..cdca4e27a71 100644 --- a/tests/queries/0_stateless/00674_join_on_syntax.sql +++ b/tests/queries/0_stateless/00674_join_on_syntax.sql @@ -46,36 +46,36 @@ select a2, b2 + 1 from tab1 any left join tab2 on b1 + 1 = a2 + 1 and a1 + 4 = b select 'join on aliases'; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on first.b1 = second.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on second.a2 = first.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on first.b1 = second_.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on second_.a2 = first.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab1.b1 = tab2.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab2.a2 = tab1.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab1.b1 = tab2.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab2.a2 = tab1.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab1.b1 = tab2.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab2.a2 = tab1.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab1.b1 = tab2.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab2.a2 = tab1.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on first.b1 = tab2.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab2.a2 = first.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on first.b1 = tab2.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab2.a2 = first.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on first.b1 = tab2.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab2.a2 = first.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on first.b1 = tab2.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab2.a2 = first.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab1.b1 = second.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on second.a2 = tab1.b1; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on tab1.b1 = second.a2; -select a1, a2, b1, b2 from tab1 first any left join tab2 second on second.a2 = tab1.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab1.b1 = second_.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on second_.a2 = tab1.b1; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on tab1.b1 = second_.a2; +select a1, a2, b1, b2 from tab1 first any left join tab2 second_ on second_.a2 = tab1.b1; -select a1, a2, first.b1, second.b2 from tab1 first any left join tab2 second on b1 = a2; -select a1, a2, tab1.b1, tab2.b2 from tab1 first any left join tab2 second on b1 = a2; -select a1, a2, tab1.b1, tab2.b2 from tab1 first any left join tab2 second on b1 = a2; +select a1, a2, first.b1, second_.b2 from tab1 first any left join tab2 second_ on b1 = a2; +select a1, a2, tab1.b1, tab2.b2 from tab1 first any left join tab2 second_ on b1 = a2; +select a1, a2, tab1.b1, tab2.b2 from tab1 first any left join tab2 second_ on b1 = a2; select 'join on complex expression'; select a2, b2 from tab2 any left join tab3 on a2 + b2 = a3 + b3; select a2, b2 from tab2 any left join tab3 on a3 + tab3.b3 = a2 + b2; -select a2, b2 from tab2 second any left join tab3 on a3 + b3 = a2 + second.b2; -select a2, b2 from tab2 second any left join tab3 third on third.a3 + tab3.b3 = tab2.a2 + second.b2; -select a2, b2 from tab2 second any left join tab3 third on third.a3 + tab3.b3 = tab2.a2 + second.b2; +select a2, b2 from tab2 second_ any left join tab3 on a3 + b3 = a2 + second_.b2; +select a2, b2 from tab2 second_ any left join tab3 third on third.a3 + tab3.b3 = tab2.a2 + second_.b2; +select a2, b2 from tab2 second_ any left join tab3 third on third.a3 + tab3.b3 = tab2.a2 + second_.b2; select 'duplicate column names'; select a1, tab1_copy.a1 from tab1 any left join tab1_copy on tab1.b1 + 3 = tab1_copy.b1 + 2 FORMAT JSONEachRow; @@ -102,10 +102,10 @@ select a1, b1, a2, b2 from tab1 any left join (select *, a2 + 1 as z from tab2) select a1, b1, a2, b2 from tab1 any left join (select *, a2 + 1 as z from tab2) on b1 + 2 = z + 1 format TSV; select 'subquery alias'; -select a1, a2, b1, b2 from tab1 first any left join (select * from tab2) second on first.b1 = second.a2; -select a1, a2, b1, b2 from tab1 first any left join (select *, a2 as z from tab2) second on first.b1 = second.z; -select a1, a2, b1, b2 from tab1 first any left join (select *, a2 + 1 as z from tab2) second on first.b1 + 1 = second.z; -select tab1.a1, a2, tab1.b1, second.b2 from tab1 first any left join (select * from tab2) second on first.b1 = second.a2; +select a1, a2, b1, b2 from tab1 first any left join (select * from tab2) second_ on first.b1 = second_.a2; +select a1, a2, b1, b2 from tab1 first any left join (select *, a2 as z from tab2) second_ on first.b1 = second_.z; +select a1, a2, b1, b2 from tab1 first any left join (select *, a2 + 1 as z from tab2) second_ on first.b1 + 1 = second_.z; +select tab1.a1, a2, tab1.b1, second_.b2 from tab1 first any left join (select * from tab2) second_ on first.b1 = second_.a2; select a1, s.a1 from tab1 any left join (select * from tab1_copy) s on tab1.b1 + 3 = s.b1 + 2 FORMAT JSONEachRow; drop table tab1; diff --git a/tests/queries/0_stateless/00725_comment_columns.reference b/tests/queries/0_stateless/00725_comment_columns.reference index 7543f5854d7..0e1eba00902 100644 --- a/tests/queries/0_stateless/00725_comment_columns.reference +++ b/tests/queries/0_stateless/00725_comment_columns.reference @@ -20,7 +20,7 @@ CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 DEF │ check_query_comment_column │ fifth_column │ comment 5_2 │ └────────────────────────────┴───────────────┴─────────────┘ CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 DEFAULT 1 COMMENT \'comment 1_2\',\n `second_column` UInt8 MATERIALIZED first_column COMMENT \'comment 2_2\',\n `third_column` UInt8 ALIAS second_column COMMENT \'comment 3_2\',\n `fourth_column` UInt8 COMMENT \'comment 4_2\',\n `fifth_column` UInt8 COMMENT \'comment 5_2\'\n)\nENGINE = TinyLog -CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1\',\n `second_column` UInt8 COMMENT \'comment 2\',\n `third_column` UInt8 COMMENT \'comment 3\'\n)\nENGINE = MergeTree()\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 +CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1\',\n `second_column` UInt8 COMMENT \'comment 2\',\n `third_column` UInt8 COMMENT \'comment 3\'\n)\nENGINE = MergeTree\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 first_column UInt8 comment 1 second_column UInt8 comment 2 third_column UInt8 comment 3 @@ -29,8 +29,8 @@ third_column UInt8 comment 3 │ check_query_comment_column │ second_column │ comment 2 │ │ check_query_comment_column │ third_column │ comment 3 │ └────────────────────────────┴───────────────┴───────────┘ -CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1_2\',\n `second_column` UInt8 COMMENT \'comment 2_2\',\n `third_column` UInt8 COMMENT \'comment 3_2\'\n)\nENGINE = MergeTree()\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 -CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1_3\',\n `second_column` UInt8 COMMENT \'comment 2_3\',\n `third_column` UInt8 COMMENT \'comment 3_3\'\n)\nENGINE = MergeTree()\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 +CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1_2\',\n `second_column` UInt8 COMMENT \'comment 2_2\',\n `third_column` UInt8 COMMENT \'comment 3_2\'\n)\nENGINE = MergeTree\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 +CREATE TABLE default.check_query_comment_column\n(\n `first_column` UInt8 COMMENT \'comment 1_3\',\n `second_column` UInt8 COMMENT \'comment 2_3\',\n `third_column` UInt8 COMMENT \'comment 3_3\'\n)\nENGINE = MergeTree\nPARTITION BY second_column\nORDER BY first_column\nSAMPLE BY first_column\nSETTINGS index_granularity = 8192 ┌─table──────────────────────┬─name──────────┬─comment─────┐ │ check_query_comment_column │ first_column │ comment 1_3 │ │ check_query_comment_column │ second_column │ comment 2_3 │ diff --git a/tests/queries/0_stateless/00730_unicode_terminal_format.sql b/tests/queries/0_stateless/00730_unicode_terminal_format.sql index f01c5defdfb..b7a8084c406 100644 --- a/tests/queries/0_stateless/00730_unicode_terminal_format.sql +++ b/tests/queries/0_stateless/00730_unicode_terminal_format.sql @@ -1,18 +1,18 @@ DROP TABLE IF EXISTS unicode; CREATE TABLE unicode(c1 String, c2 String) ENGINE = Memory; -INSERT INTO unicode VALUES ('Здравствуйте', 'Этот код можно отредактировать и запустить!'), -INSERT INTO unicode VALUES ('你好', '这段代码是可以编辑并且能够运行的!'), -INSERT INTO unicode VALUES ('Hola', '¡Este código es editable y ejecutable!'), -INSERT INTO unicode VALUES ('Bonjour', 'Ce code est modifiable et exécutable !'), -INSERT INTO unicode VALUES ('Ciao', 'Questo codice è modificabile ed eseguibile!'), -INSERT INTO unicode VALUES ('こんにちは', 'このコードは編集して実行出来ます!'), -INSERT INTO unicode VALUES ('안녕하세요', '여기에서 코드를 수정하고 실행할 수 있습니다!'), -INSERT INTO unicode VALUES ('Cześć', 'Ten kod można edytować oraz uruchomić!'), -INSERT INTO unicode VALUES ('Olá', 'Este código é editável e executável!'), -INSERT INTO unicode VALUES ('Chào bạn', 'Bạn có thể edit và run code trực tiếp!'), -INSERT INTO unicode VALUES ('Hallo', 'Dieser Code kann bearbeitet und ausgeführt werden!'), -INSERT INTO unicode VALUES ('Hej', 'Den här koden kan redigeras och köras!'), +INSERT INTO unicode VALUES ('Здравствуйте', 'Этот код можно отредактировать и запустить!'); +INSERT INTO unicode VALUES ('你好', '这段代码是可以编辑并且能够运行的!'); +INSERT INTO unicode VALUES ('Hola', '¡Este código es editable y ejecutable!'); +INSERT INTO unicode VALUES ('Bonjour', 'Ce code est modifiable et exécutable !'); +INSERT INTO unicode VALUES ('Ciao', 'Questo codice è modificabile ed eseguibile!'); +INSERT INTO unicode VALUES ('こんにちは', 'このコードは編集して実行出来ます!'); +INSERT INTO unicode VALUES ('안녕하세요', '여기에서 코드를 수정하고 실행할 수 있습니다!'); +INSERT INTO unicode VALUES ('Cześć', 'Ten kod można edytować oraz uruchomić!'); +INSERT INTO unicode VALUES ('Olá', 'Este código é editável e executável!'); +INSERT INTO unicode VALUES ('Chào bạn', 'Bạn có thể edit và run code trực tiếp!'); +INSERT INTO unicode VALUES ('Hallo', 'Dieser Code kann bearbeitet und ausgeführt werden!'); +INSERT INTO unicode VALUES ('Hej', 'Den här koden kan redigeras och köras!'); INSERT INTO unicode VALUES ('Ahoj', 'Tento kód můžete upravit a spustit'); INSERT INTO unicode VALUES ('Tabs \t Tabs', 'Non-first \t Tabs'); INSERT INTO unicode VALUES ('Control characters \x1f\x1f\x1f\x1f with zero width', 'Invalid UTF-8 which eats pending characters \xf0, or invalid by itself \x80 with zero width'); diff --git a/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards.sh b/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards.sh index aeacd21a0bc..d3aa04c9095 100755 --- a/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards.sh +++ b/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards.sh @@ -103,3 +103,6 @@ ${CLICKHOUSE_CLIENT} -n --query=" SET optimize_skip_unused_shards = 1; SELECT count(*) FROM distributed WHERE a = 0 AND b = 0 OR c = 0; " 2>&1 \ | grep -F -q "All connection tries failed" && echo 'OK' || echo 'FAIL' + +$CLICKHOUSE_CLIENT -q "DROP TABLE distributed" +$CLICKHOUSE_CLIENT -q "DROP TABLE mergetree_00754" diff --git a/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards_with_prewhere.sh b/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards_with_prewhere.sh index 0793adb53a7..5cdc150dace 100755 --- a/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards_with_prewhere.sh +++ b/tests/queries/0_stateless/00754_distributed_optimize_skip_select_on_unused_shards_with_prewhere.sh @@ -98,3 +98,6 @@ ${CLICKHOUSE_CLIENT} -n --query=" SET optimize_skip_unused_shards = 1; SELECT count(*) FROM distributed_00754 PREWHERE a = 0 AND b = 0 OR c LIKE '%l%'; " 2>&1 \ | grep -F -q "All connection tries failed" && echo 'OK' || echo 'FAIL' + +$CLICKHOUSE_CLIENT -q "DROP TABLE distributed_00754" +$CLICKHOUSE_CLIENT -q "DROP TABLE mergetree_00754" diff --git a/tests/queries/0_stateless/00804_test_custom_compression_codecs.reference b/tests/queries/0_stateless/00804_test_custom_compression_codecs.reference index a0c13b9ca47..6470739db21 100644 --- a/tests/queries/0_stateless/00804_test_custom_compression_codecs.reference +++ b/tests/queries/0_stateless/00804_test_custom_compression_codecs.reference @@ -9,10 +9,10 @@ 10003 274972506.6 9175437371954010821 -CREATE TABLE default.compression_codec_multiple_more_types\n(\n `id` Decimal(38, 13) CODEC(ZSTD(1), LZ4, ZSTD(1), ZSTD(1), Delta(2), Delta(4), Delta(1), LZ4HC(0)),\n `data` FixedString(12) CODEC(ZSTD(1), ZSTD(1), NONE, NONE, NONE, LZ4HC(0)),\n `ddd.age` Array(UInt8) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8)),\n `ddd.Name` Array(String) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8))\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.compression_codec_multiple_more_types\n(\n `id` Decimal(38, 13) CODEC(ZSTD(1), LZ4, ZSTD(1), ZSTD(1), Delta(2), Delta(4), Delta(1), LZ4HC(0)),\n `data` FixedString(12) CODEC(ZSTD(1), ZSTD(1), NONE, NONE, NONE, LZ4HC(0)),\n `ddd.age` Array(UInt8) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8)),\n `ddd.Name` Array(String) CODEC(LZ4, LZ4HC(0), NONE, NONE, NONE, ZSTD(1), Delta(8))\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 1.5555555555555 hello world! [77] ['John'] 7.1000000000000 xxxxxxxxxxxx [127] ['Henry'] ! 222 !ZSTD -CREATE TABLE default.test_default_delta\n(\n `id` UInt64 CODEC(Delta(8)),\n `data` String CODEC(Delta(1)),\n `somedate` Date CODEC(Delta(2)),\n `somenum` Float64 CODEC(Delta(8)),\n `somestr` FixedString(3) CODEC(Delta(1)),\n `othernum` Int64 CODEC(Delta(8)),\n `yetothernum` Float32 CODEC(Delta(4)),\n `ddd.age` Array(UInt8) CODEC(Delta(1)),\n `ddd.Name` Array(String) CODEC(Delta(1)),\n `ddd.OName` Array(String) CODEC(Delta(1)),\n `ddd.BName` Array(String) CODEC(Delta(1))\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.test_default_delta\n(\n `id` UInt64 CODEC(Delta(8)),\n `data` String CODEC(Delta(1)),\n `somedate` Date CODEC(Delta(2)),\n `somenum` Float64 CODEC(Delta(8)),\n `somestr` FixedString(3) CODEC(Delta(1)),\n `othernum` Int64 CODEC(Delta(8)),\n `yetothernum` Float32 CODEC(Delta(4)),\n `ddd.age` Array(UInt8) CODEC(Delta(1)),\n `ddd.Name` Array(String) CODEC(Delta(1)),\n `ddd.OName` Array(String) CODEC(Delta(1)),\n `ddd.BName` Array(String) CODEC(Delta(1))\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.reference b/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.reference index 113e413bfac..8145ca99829 100644 --- a/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.reference +++ b/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.reference @@ -1,9 +1,9 @@ -CREATE TABLE default.compression_codec_log\n(\n `id` UInt64 CODEC(LZ4),\n `data` String CODEC(ZSTD(1)),\n `ddd` Date CODEC(NONE),\n `somenum` Float64 CODEC(ZSTD(2)),\n `somestr` FixedString(3) CODEC(LZ4HC(7)),\n `othernum` Int64 CODEC(Delta(8))\n)\nENGINE = Log() +CREATE TABLE default.compression_codec_log\n(\n `id` UInt64 CODEC(LZ4),\n `data` String CODEC(ZSTD(1)),\n `ddd` Date CODEC(NONE),\n `somenum` Float64 CODEC(ZSTD(2)),\n `somestr` FixedString(3) CODEC(LZ4HC(7)),\n `othernum` Int64 CODEC(Delta(8))\n)\nENGINE = Log 1 hello 2018-12-14 1.1 aaa 5 2 world 2018-12-15 2.2 bbb 6 3 ! 2018-12-16 3.3 ccc 7 2 -CREATE TABLE default.compression_codec_multiple_log\n(\n `id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)),\n `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)),\n `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)),\n `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))\n)\nENGINE = Log() +CREATE TABLE default.compression_codec_multiple_log\n(\n `id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)),\n `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)),\n `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)),\n `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))\n)\nENGINE = Log 1 world 2018-10-05 1.1 2 hello 2018-10-01 2.2 3 buy 2018-10-11 3.3 @@ -11,12 +11,12 @@ CREATE TABLE default.compression_codec_multiple_log\n(\n `id` UInt64 CODEC(LZ 10003 274972506.6 9175437371954010821 -CREATE TABLE default.compression_codec_tiny_log\n(\n `id` UInt64 CODEC(LZ4),\n `data` String CODEC(ZSTD(1)),\n `ddd` Date CODEC(NONE),\n `somenum` Float64 CODEC(ZSTD(2)),\n `somestr` FixedString(3) CODEC(LZ4HC(7)),\n `othernum` Int64 CODEC(Delta(8))\n)\nENGINE = TinyLog() +CREATE TABLE default.compression_codec_tiny_log\n(\n `id` UInt64 CODEC(LZ4),\n `data` String CODEC(ZSTD(1)),\n `ddd` Date CODEC(NONE),\n `somenum` Float64 CODEC(ZSTD(2)),\n `somestr` FixedString(3) CODEC(LZ4HC(7)),\n `othernum` Int64 CODEC(Delta(8))\n)\nENGINE = TinyLog 1 hello 2018-12-14 1.1 aaa 5 2 world 2018-12-15 2.2 bbb 6 3 ! 2018-12-16 3.3 ccc 7 2 -CREATE TABLE default.compression_codec_multiple_tiny_log\n(\n `id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)),\n `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)),\n `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)),\n `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))\n)\nENGINE = TinyLog() +CREATE TABLE default.compression_codec_multiple_tiny_log\n(\n `id` UInt64 CODEC(LZ4, ZSTD(1), NONE, LZ4HC(0), Delta(4)),\n `data` String CODEC(ZSTD(2), NONE, Delta(2), LZ4HC(0), LZ4, LZ4, Delta(8)),\n `ddd` Date CODEC(NONE, NONE, NONE, Delta(1), LZ4, ZSTD(1), LZ4HC(0), LZ4HC(0)),\n `somenum` Float64 CODEC(Delta(4), LZ4, LZ4, ZSTD(2), LZ4HC(5), ZSTD(3), ZSTD(1))\n)\nENGINE = TinyLog 1 world 2018-10-05 1.1 2 hello 2018-10-01 2.2 3 buy 2018-10-11 3.3 diff --git a/tests/queries/0_stateless/00816_long_concurrent_alter_column.sh b/tests/queries/0_stateless/00816_long_concurrent_alter_column.sh index 8fdd6654bae..7f4df58d764 100755 --- a/tests/queries/0_stateless/00816_long_concurrent_alter_column.sh +++ b/tests/queries/0_stateless/00816_long_concurrent_alter_column.sh @@ -59,7 +59,7 @@ wait echo "DROP TABLE concurrent_alter_column NO DELAY" | ${CLICKHOUSE_CLIENT} # NO DELAY has effect only for Atomic database -db_engine=`$CLICKHOUSE_CLIENT -q "SELECT engine FROM system.databases WHERE name=currentDatabase()"` +db_engine=`$CLICKHOUSE_CLIENT -q "SELECT engine FROM system.databases WHERE name='$CLICKHOUSE_DATABASE'"` if [[ $db_engine == "Atomic" ]]; then # DROP is non-blocking, so wait for alters while true; do diff --git a/tests/queries/0_stateless/00818_alias_bug_4110.sql b/tests/queries/0_stateless/00818_alias_bug_4110.sql index 60c2470e80e..7b2fd5d3864 100644 --- a/tests/queries/0_stateless/00818_alias_bug_4110.sql +++ b/tests/queries/0_stateless/00818_alias_bug_4110.sql @@ -20,6 +20,6 @@ SELECT sum(value) as value FROM (SELECT 1 as value) as data WHERE data.value > 0 DROP TABLE IF EXISTS test_00818; CREATE TABLE test_00818 (field String, not_field String) ENGINE = Memory; -INSERT INTO test_00818 (field, not_field) VALUES ('123', '456') +INSERT INTO test_00818 (field, not_field) VALUES ('123', '456'); SELECT test_00818.field AS other_field, test_00818.not_field AS field FROM test_00818; DROP TABLE test_00818; diff --git a/tests/queries/0_stateless/00834_kill_mutation.reference b/tests/queries/0_stateless/00834_kill_mutation.reference index aa0bbdcdfee..1685343c2b1 100644 --- a/tests/queries/0_stateless/00834_kill_mutation.reference +++ b/tests/queries/0_stateless/00834_kill_mutation.reference @@ -1,8 +1,8 @@ *** Create and kill a single invalid mutation *** 1 -waiting test kill_mutation mutation_3.txt DELETE WHERE toUInt32(s) = 1 +waiting default kill_mutation mutation_3.txt DELETE WHERE toUInt32(s) = 1 *** Create and kill invalid mutation that blocks another mutation *** happened during execution of mutations 'mutation_4.txt, mutation_5.txt' 1 -waiting test kill_mutation mutation_4.txt DELETE WHERE toUInt32(s) = 1 +waiting default kill_mutation mutation_4.txt DELETE WHERE toUInt32(s) = 1 2001-01-01 2 b diff --git a/tests/queries/0_stateless/00834_kill_mutation.sh b/tests/queries/0_stateless/00834_kill_mutation.sh index d37ab4b3feb..886433e7ba8 100755 --- a/tests/queries/0_stateless/00834_kill_mutation.sh +++ b/tests/queries/0_stateless/00834_kill_mutation.sh @@ -5,40 +5,40 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CURDIR"/mergetree_mutations.lib -${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS test.kill_mutation" +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS kill_mutation" -${CLICKHOUSE_CLIENT} --query="CREATE TABLE test.kill_mutation(d Date, x UInt32, s String) ENGINE MergeTree ORDER BY x PARTITION BY d" +${CLICKHOUSE_CLIENT} --query="CREATE TABLE kill_mutation(d Date, x UInt32, s String) ENGINE MergeTree ORDER BY x PARTITION BY d" -${CLICKHOUSE_CLIENT} --query="INSERT INTO test.kill_mutation VALUES ('2000-01-01', 1, 'a')" -${CLICKHOUSE_CLIENT} --query="INSERT INTO test.kill_mutation VALUES ('2001-01-01', 2, 'b')" +${CLICKHOUSE_CLIENT} --query="INSERT INTO kill_mutation VALUES ('2000-01-01', 1, 'a')" +${CLICKHOUSE_CLIENT} --query="INSERT INTO kill_mutation VALUES ('2001-01-01', 2, 'b')" ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill a single invalid mutation ***'" -${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1 SETTINGS mutations_sync = 1" 2>/dev/null +${CLICKHOUSE_CLIENT} --query="ALTER TABLE kill_mutation DELETE WHERE toUInt32(s) = 1 SETTINGS mutations_sync = 1" 2>/dev/null -${CLICKHOUSE_CLIENT} --query="SELECT count() FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation' and is_done = 0" +${CLICKHOUSE_CLIENT} --query="SELECT count() FROM system.mutations WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'kill_mutation' and is_done = 0" -${CLICKHOUSE_CLIENT} --query="KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation'" +${CLICKHOUSE_CLIENT} --query="KILL MUTATION WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'kill_mutation'" -${CLICKHOUSE_CLIENT} --query="SELECT mutation_id FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation'" +${CLICKHOUSE_CLIENT} --query="SELECT mutation_id FROM system.mutations WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'kill_mutation'" ${CLICKHOUSE_CLIENT} --query="SELECT '*** Create and kill invalid mutation that blocks another mutation ***'" -${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation DELETE WHERE toUInt32(s) = 1" -${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation DELETE WHERE x = 1 SETTINGS mutations_sync = 1" 2>&1 | grep -o "happened during execution of mutations 'mutation_4.txt, mutation_5.txt'" | head -n 1 +${CLICKHOUSE_CLIENT} --query="ALTER TABLE kill_mutation DELETE WHERE toUInt32(s) = 1" +${CLICKHOUSE_CLIENT} --query="ALTER TABLE kill_mutation DELETE WHERE x = 1 SETTINGS mutations_sync = 1" 2>&1 | grep -o "happened during execution of mutations 'mutation_4.txt, mutation_5.txt'" | head -n 1 # but exception doesn't stop mutations, and we will still see them in system.mutations -${CLICKHOUSE_CLIENT} --query="SELECT count() FROM system.mutations WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'" # 1 +${CLICKHOUSE_CLIENT} --query="SELECT count() FROM system.mutations WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'" # 1 # waiting test kill_mutation mutation_4.txt DELETE WHERE toUInt32(s) = 1 -${CLICKHOUSE_CLIENT} --query="KILL MUTATION WHERE database = 'test' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'" +${CLICKHOUSE_CLIENT} --query="KILL MUTATION WHERE database = '$CLICKHOUSE_DATABASE' AND table = 'kill_mutation' AND mutation_id = 'mutation_4.txt'" # just to wait previous mutation to finish (and don't poll system.mutations), doesn't affect data -${CLICKHOUSE_CLIENT} --query="ALTER TABLE test.kill_mutation DELETE WHERE x = 1 SETTINGS mutations_sync = 1" +${CLICKHOUSE_CLIENT} --query="ALTER TABLE kill_mutation DELETE WHERE x = 1 SETTINGS mutations_sync = 1" -${CLICKHOUSE_CLIENT} --query="SELECT * FROM test.kill_mutation" # 2001-01-01 2 b +${CLICKHOUSE_CLIENT} --query="SELECT * FROM kill_mutation" # 2001-01-01 2 b # must always be empty -${CLICKHOUSE_CLIENT} --query="SELECT * FROM system.mutations WHERE table = 'kill_mutation' AND database = 'test' AND is_done = 0" +${CLICKHOUSE_CLIENT} --query="SELECT * FROM system.mutations WHERE table = 'kill_mutation' AND database = '$CLICKHOUSE_DATABASE' AND is_done = 0" -${CLICKHOUSE_CLIENT} --query="DROP TABLE test.kill_mutation" +${CLICKHOUSE_CLIENT} --query="DROP TABLE kill_mutation" diff --git a/tests/queries/0_stateless/00836_indices_alter.reference b/tests/queries/0_stateless/00836_indices_alter.reference index 7fd63a45d31..b514e72b1a6 100644 --- a/tests/queries/0_stateless/00836_indices_alter.reference +++ b/tests/queries/0_stateless/00836_indices_alter.reference @@ -1,4 +1,4 @@ -CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx1 u64 * i32 TYPE minmax GRANULARITY 10,\n INDEX idx3 u64 - i32 TYPE minmax GRANULARITY 10,\n INDEX idx2 u64 + i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx1 u64 * i32 TYPE minmax GRANULARITY 10,\n INDEX idx3 u64 - i32 TYPE minmax GRANULARITY 10,\n INDEX idx2 u64 + i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 1 2 1 2 1 2 @@ -6,15 +6,15 @@ CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n IND 1 2 1 2 1 2 -CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx3 u64 - i32 TYPE minmax GRANULARITY 10,\n INDEX idx2 u64 + i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx3 u64 - i32 TYPE minmax GRANULARITY 10,\n INDEX idx2 u64 + i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 1 2 1 2 1 2 1 2 1 2 1 2 -CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 -CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx1 u64 * i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n INDEX idx1 u64 * i32 TYPE minmax GRANULARITY 10\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 1 2 1 2 1 2 @@ -23,6 +23,6 @@ CREATE TABLE default.minmax_idx\n(\n `u64` UInt64,\n `i32` Int32,\n IND 1 2 1 2 1 2 -CREATE TABLE default.minmax_idx2\n(\n `u64` UInt64,\n `i32` Int32\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE default.minmax_idx2\n(\n `u64` UInt64,\n `i32` Int32\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 1 2 1 2 diff --git a/tests/queries/0_stateless/00848_join_use_nulls_segfault.sql b/tests/queries/0_stateless/00848_join_use_nulls_segfault.sql index 1a0949d9d27..57eca0eb9e0 100644 --- a/tests/queries/0_stateless/00848_join_use_nulls_segfault.sql +++ b/tests/queries/0_stateless/00848_join_use_nulls_segfault.sql @@ -18,7 +18,7 @@ SELECT *, toTypeName(t2.id), toTypeName(t3.id) FROM t2_00848 t2 ANY FULL JOIN t3 SELECT *, toTypeName(t1.id), toTypeName(t3.id) FROM t1_00848 t1 LEFT JOIN t3_00848 t3 ON t1.id = t3.id ORDER BY t1.id, t3.id; SELECT *, toTypeName(t1.id), toTypeName(t3.id) FROM t1_00848 t1 FULL JOIN t3_00848 t3 ON t1.id = t3.id ORDER BY t1.id, t3.id; -SELECT *, toTypeName(t2.id), toTypeName(t3.id) FROM t2_00848 t2 FULL JOIN t3_00848 t3 ON t2.id = t3.id ORDER BY t2.id, t3.id;; +SELECT *, toTypeName(t2.id), toTypeName(t3.id) FROM t2_00848 t2 FULL JOIN t3_00848 t3 ON t2.id = t3.id ORDER BY t2.id, t3.id; SELECT t3.id = 'l', t3.not_id = 'l' FROM t1_00848 t1 ANY LEFT JOIN t3_00848 t3 ON t1.id = t3.id ORDER BY t1.id, t3.id; SELECT t3.id = 'l', t3.not_id = 'l' FROM t1_00848 t1 LEFT JOIN t3_00848 t3 ON t1.id = t3.id ORDER BY t1.id, t3.id; diff --git a/tests/queries/0_stateless/00900_parquet_decimal.sh b/tests/queries/0_stateless/00900_parquet_decimal.sh index e93a74bd226..e6174a1f3a9 100755 --- a/tests/queries/0_stateless/00900_parquet_decimal.sh +++ b/tests/queries/0_stateless/00900_parquet_decimal.sh @@ -107,5 +107,5 @@ ${CLICKHOUSE_CLIENT} --query="SELECT * FROM decimal2 ORDER BY a, b, c, d;" > "${ echo diff3: diff "${CLICKHOUSE_TMP}"/parquet_decimal3_1.dump "${CLICKHOUSE_TMP}"/parquet_decimal3_2.dump -#${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS decimal;" -#${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS decimal2;" +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS decimal;" +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS decimal2;" diff --git a/tests/queries/0_stateless/00902_entropy.sql b/tests/queries/0_stateless/00902_entropy.sql index 8fc96cc425b..6e1364d5e93 100644 --- a/tests/queries/0_stateless/00902_entropy.sql +++ b/tests/queries/0_stateless/00902_entropy.sql @@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS defaults ( vals UInt64 ) ENGINE = Memory; -insert into defaults values (0), (0), (1), (0), (0), (0), (1), (2), (3), (5), (3), (1), (1), (4), (5), (2) +insert into defaults values (0), (0), (1), (0), (0), (0), (1), (2), (3), (5), (3), (1), (1), (4), (5), (2); select val < 2.4 and val > 2.3393 from (select entropy(vals) as val from defaults); @@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS defaults ( vals UInt32 ) ENGINE = Memory; -insert into defaults values (0), (0), (1), (0), (0), (0), (1), (2), (3), (5), (3), (1), (1), (4), (5), (2) +insert into defaults values (0), (0), (1), (0), (0), (0), (1), (2), (3), (5), (3), (1), (1), (4), (5), (2); select val < 2.4 and val > 2.3393 from (select entropy(vals) as val from defaults); @@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS defaults ( vals Int32 ) ENGINE = Memory; -insert into defaults values (0), (0), (-1), (0), (0), (0), (-1), (2), (3), (5), (3), (-1), (-1), (4), (5), (2) +insert into defaults values (0), (0), (-1), (0), (0), (0), (-1), (2), (3), (5), (3), (-1), (-1), (4), (5), (2); select val < 2.4 and val > 2.3393 from (select entropy(vals) as val from defaults); diff --git a/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql b/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql index fe434845c29..3f151abc8fc 100644 --- a/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql +++ b/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql @@ -21,11 +21,11 @@ SELECT toUInt32(x), y, z FROM pk WHERE x = toDateTime(1); -- Index works on interval 00:01:00 - 00:01:59 SET max_rows_to_read = 4; -SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(119) AND y = 11; +SELECT toUInt32(x), y, z FROM pk WHERE (x BETWEEN toDateTime(60) AND toDateTime(119)) AND y = 11; -- Cannot read less rows as PK is coarser on interval 00:01:00 - 00:02:00 SET max_rows_to_read = 5; -SELECT toUInt32(x), y, z FROM pk WHERE x BETWEEN toDateTime(60) AND toDateTime(120) AND y = 11; +SELECT toUInt32(x), y, z FROM pk WHERE (x BETWEEN toDateTime(60) AND toDateTime(120)) AND y = 11; DROP TABLE pk; diff --git a/tests/queries/0_stateless/00937_test_use_header_tsv.sh b/tests/queries/0_stateless/00937_test_use_header_tsv.sh index 38930cfae8b..a272e70d32b 100755 --- a/tests/queries/0_stateless/00937_test_use_header_tsv.sh +++ b/tests/queries/0_stateless/00937_test_use_header_tsv.sh @@ -4,10 +4,10 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CURDIR"/../shell_config.sh -$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.tsv" -$CLICKHOUSE_CLIENT --query="CREATE TABLE test.tsv (d Date, u UInt8, str String) ENGINE = TinyLog" +$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS tsv" +$CLICKHOUSE_CLIENT --query="CREATE TABLE tsv (d Date, u UInt8, str String) ENGINE = TinyLog" -INSERT_QUERY='$CLICKHOUSE_CLIENT --query="INSERT INTO test.tsv FORMAT TSVWithNames"' +INSERT_QUERY='$CLICKHOUSE_CLIENT --query="INSERT INTO tsv FORMAT TSVWithNames"' USE_HEADER='--input_format_with_names_use_header=1' SKIP_UNKNOWN='--input_format_skip_unknown_fields=1' @@ -33,5 +33,5 @@ echo -ne 'str\tu\nLine16\t1\nLine17\t2\n' | eval "$INSERT_QUERY echo -ne 'd\tstr\n2019-04-18\tLine18\n2019-04-18\tLine19\n'| eval "$INSERT_QUERY" $USE_HEADER echo -ne 'unknown\n\n\n' | eval "$INSERT_QUERY" $USE_HEADER $SKIP_UNKNOWN -$CLICKHOUSE_CLIENT --query="SELECT * FROM test.tsv" -$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.tsv" +$CLICKHOUSE_CLIENT --query="SELECT * FROM tsv" +$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS tsv" diff --git a/tests/queries/0_stateless/00944_create_bloom_filter_index_with_merge_tree.sh b/tests/queries/0_stateless/00944_create_bloom_filter_index_with_merge_tree.sh index 9ff56c9adfc..9cdc3da4bac 100755 --- a/tests/queries/0_stateless/00944_create_bloom_filter_index_with_merge_tree.sh +++ b/tests/queries/0_stateless/00944_create_bloom_filter_index_with_merge_tree.sh @@ -7,6 +7,8 @@ set -e for sequence in 1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000; do \ rate=$(echo "1 $sequence" | awk '{printf("%0.9f\n",$1/$2)}') -$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.bloom_filter_idx"; -$CLICKHOUSE_CLIENT --query="CREATE TABLE test.bloom_filter_idx ( u64 UInt64, i32 Int32, f64 Float64, d Decimal(10, 2), s String, e Enum8('a' = 1, 'b' = 2, 'c' = 3), dt Date, INDEX bloom_filter_a i32 TYPE bloom_filter($rate) GRANULARITY 1 ) ENGINE = MergeTree() ORDER BY u64 SETTINGS index_granularity = 8192" +$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS bloom_filter_idx"; +$CLICKHOUSE_CLIENT --query="CREATE TABLE bloom_filter_idx ( u64 UInt64, i32 Int32, f64 Float64, d Decimal(10, 2), s String, e Enum8('a' = 1, 'b' = 2, 'c' = 3), dt Date, INDEX bloom_filter_a i32 TYPE bloom_filter($rate) GRANULARITY 1 ) ENGINE = MergeTree() ORDER BY u64 SETTINGS index_granularity = 8192" done + +$CLICKHOUSE_CLIENT --query="DROP TABLE bloom_filter_idx"; diff --git a/tests/queries/0_stateless/00952_basic_constraints.sh b/tests/queries/0_stateless/00952_basic_constraints.sh index 146e4b61819..d8d44a9e77d 100755 --- a/tests/queries/0_stateless/00952_basic_constraints.sh +++ b/tests/queries/0_stateless/00952_basic_constraints.sh @@ -5,7 +5,6 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) EXCEPTION_TEXT=violated EXCEPTION_SUCCESS_TEXT=ok -$CLICKHOUSE_CLIENT --query="CREATE DATABASE IF NOT EXISTS test;" $CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test_constraints;" $CLICKHOUSE_CLIENT --query="CREATE TABLE test_constraints @@ -52,4 +51,4 @@ $CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;" $CLICKHOUSE_CLIENT --query="INSERT INTO test_constraints VALUES (7, 18), (0, 11);" $CLICKHOUSE_CLIENT --query="SELECT * FROM test_constraints;" -$CLICKHOUSE_CLIENT --query="DROP TABLE test_constraints;" \ No newline at end of file +$CLICKHOUSE_CLIENT --query="DROP TABLE test_constraints;" diff --git a/tests/queries/0_stateless/00953_zookeeper_suetin_deduplication_bug.sh b/tests/queries/0_stateless/00953_zookeeper_suetin_deduplication_bug.sh index 10023ec7d0d..3caba663df6 100755 --- a/tests/queries/0_stateless/00953_zookeeper_suetin_deduplication_bug.sh +++ b/tests/queries/0_stateless/00953_zookeeper_suetin_deduplication_bug.sh @@ -61,3 +61,5 @@ done $CLICKHOUSE_CLIENT --query="INSERT INTO elog VALUES (toDate('2018-10-01'), 2, 'hello')" $CLICKHOUSE_CLIENT --query="SELECT count(*) from elog" # still 5 rows + +$CLICKHOUSE_CLIENT -q "DROP TABLE elog" diff --git a/tests/queries/0_stateless/00955_test_final_mark_use.sh b/tests/queries/0_stateless/00955_test_final_mark_use.sh index 81a1d543fb5..d14c9e49814 100755 --- a/tests/queries/0_stateless/00955_test_final_mark_use.sh +++ b/tests/queries/0_stateless/00955_test_final_mark_use.sh @@ -16,7 +16,7 @@ PARTITION BY toYYYYMM(d) ORDER BY (x, z) SETTINGS index_granularity_bytes=10000, $CLICKHOUSE_CLIENT --query="INSERT INTO mt_with_pk (d, x, y, z, n.Age, n.Name) VALUES (toDate('2018-10-01'), toDateTime('2018-10-01 12:57:57'), [1, 1, 1], 11, [77], ['Joe']), (toDate('2018-10-01'), toDateTime('2018-10-01 16:57:57'), [2, 2, 2], 12, [88], ['Mark']), (toDate('2018-10-01'), toDateTime('2018-10-01 19:57:57'), [3, 3, 3], 13, [99], ['Robert']);" -$CLICKHOUSE_CLIENT --query="SELECT sum(marks) FROM system.parts WHERE table = 'mt_with_pk' AND database = currentDatabase() AND active=1;" +$CLICKHOUSE_CLIENT --query="SELECT sum(marks) FROM system.parts WHERE table = 'mt_with_pk' AND database = '$CLICKHOUSE_DATABASE' AND active=1;" $CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM mt_with_pk WHERE x > toDateTime('2018-10-01 23:57:57') FORMAT JSON;" | grep "rows_read" @@ -24,6 +24,8 @@ $CLICKHOUSE_CLIENT --query="INSERT INTO mt_with_pk (d, x, y, z, n.Age, n.Name) V $CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE mt_with_pk FINAL" -$CLICKHOUSE_CLIENT --query="SELECT sum(marks) FROM system.parts WHERE table = 'mt_with_pk' AND database = currentDatabase() AND active=1;" +$CLICKHOUSE_CLIENT --query="SELECT sum(marks) FROM system.parts WHERE table = 'mt_with_pk' AND database = '$CLICKHOUSE_DATABASE' AND active=1;" $CLICKHOUSE_CLIENT --query="SELECT COUNT(*) FROM mt_with_pk WHERE x > toDateTime('2018-10-01 23:57:57') FORMAT JSON;" | grep "rows_read" + +$CLICKHOUSE_CLIENT -q "DROP TABLE mt_with_pk" diff --git a/tests/queries/0_stateless/00980_merge_alter_settings.reference b/tests/queries/0_stateless/00980_merge_alter_settings.reference index 7f8aa23b722..20146ed9d1e 100644 --- a/tests/queries/0_stateless/00980_merge_alter_settings.reference +++ b/tests/queries/0_stateless/00980_merge_alter_settings.reference @@ -1,6 +1,6 @@ -CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = 4096 -CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 1, parts_to_delay_insert = 1 -CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100 +CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 4096 +CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 1, parts_to_delay_insert = 1 +CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100 2 -CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100, check_delay_period = 30 -CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String,\n `Data2` UInt64\n)\nENGINE = MergeTree()\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100, check_delay_period = 15 +CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100, check_delay_period = 30 +CREATE TABLE default.table_for_alter\n(\n `id` UInt64,\n `Data` String,\n `Data2` UInt64\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 4096, parts_to_throw_insert = 100, parts_to_delay_insert = 100, check_delay_period = 15 diff --git a/tests/queries/0_stateless/01001_rename_merge_race_condition.sh b/tests/queries/0_stateless/01001_rename_merge_race_condition.sh index e7ce2209e29..8b2cb026187 100755 --- a/tests/queries/0_stateless/01001_rename_merge_race_condition.sh +++ b/tests/queries/0_stateless/01001_rename_merge_race_condition.sh @@ -12,7 +12,7 @@ $CLICKHOUSE_CLIENT --query "CREATE TABLE test1 (x UInt64) ENGINE = Memory"; function thread1() { - while true; do + while true; do seq 1 1000 | sed -r -e 's/.+/RENAME TABLE test1 TO test2; RENAME TABLE test2 TO test1;/' | $CLICKHOUSE_CLIENT -n done } @@ -20,7 +20,7 @@ function thread1() function thread2() { while true; do - $CLICKHOUSE_CLIENT --query "SELECT * FROM merge(currentDatabase(), '^test[12]$')" + $CLICKHOUSE_CLIENT --query "SELECT * FROM merge('$CLICKHOUSE_DATABASE', '^test[12]$')" done } diff --git a/tests/queries/0_stateless/01005_rwr_shard_deadlock.sh b/tests/queries/0_stateless/01005_rwr_shard_deadlock.sh index 2ad963e3443..4a6a6e7eb1c 100755 --- a/tests/queries/0_stateless/01005_rwr_shard_deadlock.sh +++ b/tests/queries/0_stateless/01005_rwr_shard_deadlock.sh @@ -10,7 +10,7 @@ $CLICKHOUSE_CLIENT --query "CREATE TABLE test1 (x UInt8) ENGINE = MergeTree ORDE function thread1() { - while true; do + while true; do $CLICKHOUSE_CLIENT --query "ALTER TABLE test1 MODIFY COLUMN x Nullable(UInt8)" $CLICKHOUSE_CLIENT --query "ALTER TABLE test1 MODIFY COLUMN x UInt8" done @@ -19,7 +19,7 @@ function thread1() function thread2() { while true; do - $CLICKHOUSE_CLIENT --query "SELECT x FROM test1 WHERE x IN (SELECT x FROM remote('127.0.0.2', currentDatabase(), test1))" --format Null + $CLICKHOUSE_CLIENT --query "SELECT x FROM test1 WHERE x IN (SELECT x FROM remote('127.0.0.2', '$CLICKHOUSE_DATABASE', test1))" --format Null done } diff --git a/tests/queries/0_stateless/01010_low_cardinality_and_native_http.sh b/tests/queries/0_stateless/01010_low_cardinality_and_native_http.sh index 19b30d9b19f..3a933e1fb21 100755 --- a/tests/queries/0_stateless/01010_low_cardinality_and_native_http.sh +++ b/tests/queries/0_stateless/01010_low_cardinality_and_native_http.sh @@ -19,3 +19,6 @@ ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&query=select+x+from+tab_str_lc+format+ $CLICKHOUSE_CLIENT --query="select '----'"; $CLICKHOUSE_CLIENT --query="select x from tab_str"; + +$CLICKHOUSE_CLIENT -q "DROP TABLE tab_str" +$CLICKHOUSE_CLIENT -q "DROP TABLE tab_str_lc" diff --git a/tests/queries/0_stateless/01014_lazy_database_concurrent_recreate_reattach_and_show_tables.sh b/tests/queries/0_stateless/01014_lazy_database_concurrent_recreate_reattach_and_show_tables.sh index 23cad8c30ad..ef001b0988a 100755 --- a/tests/queries/0_stateless/01014_lazy_database_concurrent_recreate_reattach_and_show_tables.sh +++ b/tests/queries/0_stateless/01014_lazy_database_concurrent_recreate_reattach_and_show_tables.sh @@ -107,3 +107,5 @@ ${CLICKHOUSE_CLIENT} -n -q " # DROP DATABASE $CURR_DATABASE; -- This fails for some reason echo "Test OK" + +# TODO: it doesn't work! $CLICKHOUSE_CLIENT -q "DROP DATABASE $CURR_DATABASE" diff --git a/tests/queries/0_stateless/01018_ddl_dictionaries_create.sql b/tests/queries/0_stateless/01018_ddl_dictionaries_create.sql index 1a3733fd5cb..f7d34071eb0 100644 --- a/tests/queries/0_stateless/01018_ddl_dictionaries_create.sql +++ b/tests/queries/0_stateless/01018_ddl_dictionaries_create.sql @@ -87,7 +87,7 @@ CREATE DICTIONARY memory_db.dict2 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); -- {serverError 48} @@ -112,7 +112,7 @@ CREATE DICTIONARY lazy_db.dict3 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column, second_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) LIFETIME(MIN 1 MAX 10) LAYOUT(COMPLEX_KEY_HASHED()); -- {serverError 48} @@ -131,7 +131,7 @@ CREATE DICTIONARY db_01018.dict4 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); @@ -150,7 +150,7 @@ CREATE DICTIONARY db_01018.dict4 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01018_ddl_dictionaries_select.sql b/tests/queries/0_stateless/01018_ddl_dictionaries_select.sql index 4bb506579cc..229d5d55774 100644 --- a/tests/queries/0_stateless/01018_ddl_dictionaries_select.sql +++ b/tests/queries/0_stateless/01018_ddl_dictionaries_select.sql @@ -26,7 +26,7 @@ CREATE DICTIONARY database_for_dict.dict1 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); @@ -80,7 +80,7 @@ CREATE DICTIONARY database_for_dict.dict1 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column, third_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(COMPLEX_KEY_CACHE(SIZE_IN_CELLS 1)); @@ -102,7 +102,7 @@ CREATE DICTIONARY database_for_dict.dict2 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(HASHED()); @@ -120,7 +120,7 @@ CREATE DICTIONARY database_for_dict.dict3 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) LIFETIME(0) LAYOUT(HASHED()); diff --git a/tests/queries/0_stateless/01018_ddl_dictionaries_special.sql b/tests/queries/0_stateless/01018_ddl_dictionaries_special.sql index ace3d107cb0..db3b7f29492 100644 --- a/tests/queries/0_stateless/01018_ddl_dictionaries_special.sql +++ b/tests/queries/0_stateless/01018_ddl_dictionaries_special.sql @@ -28,7 +28,7 @@ CREATE DICTIONARY database_for_dict.dict1 Tax Float64 ) PRIMARY KEY CountryID -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'date_table' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'date_table' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 1000) LAYOUT(RANGE_HASHED()) RANGE(MIN StartDate MAX EndDate); @@ -62,7 +62,7 @@ CREATE DICTIONARY database_for_dict.dict2 Tax Float64 ) PRIMARY KEY CountryID -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'datetime_table' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'datetime_table' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 1000) LAYOUT(RANGE_HASHED()) RANGE(MIN StartDate MAX EndDate); @@ -93,7 +93,7 @@ CREATE DICTIONARY database_for_dict.dictionary_with_hierarchy RegionName String ) PRIMARY KEY RegionID -SOURCE(CLICKHOUSE(host 'localhost' port 9000 user 'default' db 'database_for_dict' table 'table_with_hierarchy')) +SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db 'database_for_dict' table 'table_with_hierarchy')) LAYOUT(HASHED()) LIFETIME(MIN 1 MAX 1000); diff --git a/tests/queries/0_stateless/01018_dictionaries_from_dictionaries.sql b/tests/queries/0_stateless/01018_dictionaries_from_dictionaries.sql index 86180643f88..fb34beaca2a 100644 --- a/tests/queries/0_stateless/01018_dictionaries_from_dictionaries.sql +++ b/tests/queries/0_stateless/01018_dictionaries_from_dictionaries.sql @@ -26,7 +26,7 @@ CREATE DICTIONARY database_for_dict.dict1 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); @@ -40,7 +40,7 @@ CREATE DICTIONARY database_for_dict.dict2 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict1' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict1' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(HASHED()); @@ -61,7 +61,7 @@ CREATE DICTIONARY database_for_dict.dict3 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict2' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict2' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(HASHED()); @@ -84,7 +84,7 @@ CREATE DICTIONARY database_for_dict.dict4 fourth_column Float64 DEFAULT 42.0 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'non_existing_table' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'non_existing_table' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(HASHED()); diff --git a/tests/queries/0_stateless/01019_alter_materialized_view_atomic.sh b/tests/queries/0_stateless/01019_alter_materialized_view_atomic.sh index cf73815f288..46f1e82f54c 100755 --- a/tests/queries/0_stateless/01019_alter_materialized_view_atomic.sh +++ b/tests/queries/0_stateless/01019_alter_materialized_view_atomic.sh @@ -51,3 +51,6 @@ done $CLICKHOUSE_CLIENT -q "SELECT count() FROM mv;" wait + +$CLICKHOUSE_CLIENT -q "DROP VIEW mv" +$CLICKHOUSE_CLIENT -q "DROP TABLE src" diff --git a/tests/queries/0_stateless/01019_alter_materialized_view_consistent.sh b/tests/queries/0_stateless/01019_alter_materialized_view_consistent.sh index 64d052723e1..406cb46b5fd 100755 --- a/tests/queries/0_stateless/01019_alter_materialized_view_consistent.sh +++ b/tests/queries/0_stateless/01019_alter_materialized_view_consistent.sh @@ -76,3 +76,7 @@ wait $CLICKHOUSE_CLIENT -q "SELECT countIf(case = 1) > 0 AND countIf(case = 2) > 0 FROM mv LIMIT 1;" $CLICKHOUSE_CLIENT -q "SELECT 'inconsistencies', count() FROM mv WHERE test == 0;" + +$CLICKHOUSE_CLIENT -q "DROP VIEW mv" +$CLICKHOUSE_CLIENT -q "DROP TABLE src_a" +$CLICKHOUSE_CLIENT -q "DROP TABLE src_b" diff --git a/tests/queries/0_stateless/01023_materialized_view_query_context.sql b/tests/queries/0_stateless/01023_materialized_view_query_context.sql index d68d6df6ea3..7ec8d8fd506 100644 --- a/tests/queries/0_stateless/01023_materialized_view_query_context.sql +++ b/tests/queries/0_stateless/01023_materialized_view_query_context.sql @@ -12,7 +12,7 @@ CREATE DICTIONARY dict_in_01023.dict val UInt64 DEFAULT 1 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'input' PASSWORD '' DB 'dict_in_01023')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'input' PASSWORD '' DB 'dict_in_01023')) LIFETIME(MIN 0 MAX 0) LAYOUT(HASHED()); @@ -27,3 +27,13 @@ CREATE MATERIALIZED VIEW mv TO output AS SELECT key, dictGetUInt64('dict_in_0102 INSERT INTO input VALUES (1); SELECT count() FROM output; + +DROP TABLE mv; +DROP TABLE output; +DROP TABLE dist_out; +DROP TABLE buffer_; +DROP TABLE null_; +DROP TABLE input; +DROP DICTIONARY dict_in_01023.dict; +DROP TABLE dict_in_01023.input; +DROP DATABASE dict_in_01023; diff --git a/tests/queries/0_stateless/01033_dictionaries_lifetime.sql b/tests/queries/0_stateless/01033_dictionaries_lifetime.sql index 0a8288c2df0..40482cd9f7b 100644 --- a/tests/queries/0_stateless/01033_dictionaries_lifetime.sql +++ b/tests/queries/0_stateless/01033_dictionaries_lifetime.sql @@ -30,7 +30,7 @@ CREATE DICTIONARY ordinary_db.dict1 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database.sql b/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database.sql index 8fbe68e70e0..bd01ea704b1 100644 --- a/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database.sql +++ b/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database.sql @@ -8,7 +8,7 @@ CREATE DICTIONARY dict_db_01036.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01036')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01036')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); @@ -26,3 +26,8 @@ SELECT 'CREATE DATABASE'; DROP DATABASE IF EXISTS empty_db_01036; CREATE DATABASE empty_db_01036; SELECT query_count FROM system.dictionaries WHERE database = 'dict_db_01036' AND name = 'dict'; + +DROP DICTIONARY dict_db_01036.dict; +DROP TABLE dict_db_01036.dict_data; +DROP DATABASE dict_db_01036; +DROP DATABASE empty_db_01036; diff --git a/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database_2.sql b/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database_2.sql index 7f407daff14..fa0502ac328 100644 --- a/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database_2.sql +++ b/tests/queries/0_stateless/01036_no_superfluous_dict_reload_on_create_database_2.sql @@ -8,7 +8,7 @@ CREATE DICTIONARY `foo 1234`.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'foo 1234')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'foo 1234')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); @@ -26,3 +26,8 @@ SELECT 'CREATE DATABASE'; DROP DATABASE IF EXISTS `foo 123`; CREATE DATABASE `foo 123`; SELECT query_count FROM system.dictionaries WHERE database = 'foo 1234' AND name = 'dict'; + +DROP DICTIONARY `foo 1234`.dict; +DROP TABLE `foo 1234`.dict_data; +DROP DATABASE `foo 1234`; +DROP DATABASE `foo 123`; diff --git a/tests/queries/0_stateless/01040_dictionary_invalidate_query_switchover_long.sh b/tests/queries/0_stateless/01040_dictionary_invalidate_query_switchover_long.sh index f9b4573bfb4..3dd3c0ee363 100755 --- a/tests/queries/0_stateless/01040_dictionary_invalidate_query_switchover_long.sh +++ b/tests/queries/0_stateless/01040_dictionary_invalidate_query_switchover_long.sh @@ -24,7 +24,7 @@ CREATE DICTIONARY dictdb.invalidate two UInt8 EXPRESSION dummy ) PRIMARY KEY dummy -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_invalidate' DB 'dictdb' INVALIDATE_QUERY 'select max(last_time) from dictdb.dict_invalidate')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_invalidate' DB 'dictdb' INVALIDATE_QUERY 'select max(last_time) from dictdb.dict_invalidate')) LIFETIME(MIN 0 MAX 1) LAYOUT(FLAT())" diff --git a/tests/queries/0_stateless/01041_create_dictionary_if_not_exists.sql b/tests/queries/0_stateless/01041_create_dictionary_if_not_exists.sql index 5ec76e6ae91..3d6586063e9 100644 --- a/tests/queries/0_stateless/01041_create_dictionary_if_not_exists.sql +++ b/tests/queries/0_stateless/01041_create_dictionary_if_not_exists.sql @@ -20,7 +20,7 @@ CREATE DICTIONARY IF NOT EXISTS dictdb.dict_exists value Float64 DEFAULT 77.77 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'dictdb')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'dictdb')) LIFETIME(1) LAYOUT(FLAT()); @@ -33,7 +33,7 @@ CREATE DICTIONARY IF NOT EXISTS dictdb.dict_exists value Float64 DEFAULT 77.77 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'dictdb')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'dictdb')) LIFETIME(1) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01042_system_reload_dictionary_reloads_completely.sh b/tests/queries/0_stateless/01042_system_reload_dictionary_reloads_completely.sh index 46031a3d508..0d1ebad45e0 100755 --- a/tests/queries/0_stateless/01042_system_reload_dictionary_reloads_completely.sh +++ b/tests/queries/0_stateless/01042_system_reload_dictionary_reloads_completely.sh @@ -19,7 +19,7 @@ CREATE DICTIONARY dictdb.dict insert_time DateTime ) PRIMARY KEY x -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table' DB 'dictdb' UPDATE_FIELD 'insert_time')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table' DB 'dictdb' UPDATE_FIELD 'insert_time')) LAYOUT(FLAT()) LIFETIME(1); EOF diff --git a/tests/queries/0_stateless/01043_dictionary_attribute_properties_values.sql b/tests/queries/0_stateless/01043_dictionary_attribute_properties_values.sql index adeb5630529..5e448862603 100644 --- a/tests/queries/0_stateless/01043_dictionary_attribute_properties_values.sql +++ b/tests/queries/0_stateless/01043_dictionary_attribute_properties_values.sql @@ -13,7 +13,7 @@ CREATE DICTIONARY dictdb.dict ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dicttbl' DB 'dictdb')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dicttbl' DB 'dictdb')) LAYOUT(FLAT()) LIFETIME(1); diff --git a/tests/queries/0_stateless/01045_order_by_pk_special_storages.sh b/tests/queries/0_stateless/01045_order_by_pk_special_storages.sh index a26f2ce7807..1853d5753e4 100755 --- a/tests/queries/0_stateless/01045_order_by_pk_special_storages.sh +++ b/tests/queries/0_stateless/01045_order_by_pk_special_storages.sh @@ -14,7 +14,7 @@ $CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS mv" $CLICKHOUSE_CLIENT -q "CREATE TABLE s1 (a UInt32, s String) ENGINE = MergeTree ORDER BY a PARTITION BY a % 3 SETTINGS min_bytes_for_wide_part = 0" $CLICKHOUSE_CLIENT -q "CREATE TABLE s2 (a UInt32, s String) ENGINE = MergeTree ORDER BY a PARTITION BY a % 3 SETTINGS min_bytes_for_wide_part = 0" -$CLICKHOUSE_CLIENT -q "CREATE TABLE m (a UInt32, s String) engine = Merge(currentDatabase(), 's[1,2]')" +$CLICKHOUSE_CLIENT -q "CREATE TABLE m (a UInt32, s String) engine = Merge('$CLICKHOUSE_DATABASE', 's[1,2]')" $CLICKHOUSE_CLIENT -q "INSERT INTO s1 select (number % 20) * 2 as n, toString(number * number) from numbers(100000)" $CLICKHOUSE_CLIENT -q "INSERT INTO s2 select (number % 20) * 2 + 1 as n, toString(number * number * number) from numbers(100000)" @@ -33,7 +33,7 @@ else fi $CLICKHOUSE_CLIENT -q "SELECT '---StorageBuffer---'" -$CLICKHOUSE_CLIENT -q "CREATE TABLE buf (a UInt32, s String) engine = Buffer(currentDatabase(), s2, 16, 10, 100, 10000, 1000000, 10000000, 100000000)" +$CLICKHOUSE_CLIENT -q "CREATE TABLE buf (a UInt32, s String) engine = Buffer('$CLICKHOUSE_DATABASE', s2, 16, 10, 100, 10000, 1000000, 10000000, 100000000)" $CLICKHOUSE_CLIENT -q "SELECT a, s FROM buf ORDER BY a, s LIMIT 10" rows_read=$($CLICKHOUSE_CLIENT -q "SELECT a FROM buf ORDER BY a LIMIT 10 FORMAT JSON" --max_threads=1 --max_block_size=20 | grep "rows_read" | sed 's/[^0-9]*//g') diff --git a/tests/queries/0_stateless/01053_ssd_dictionary.sql b/tests/queries/0_stateless/01053_ssd_dictionary.sql index fb4acdeadb4..cd4ce95802f 100644 --- a/tests/queries/0_stateless/01053_ssd_dictionary.sql +++ b/tests/queries/0_stateless/01053_ssd_dictionary.sql @@ -33,7 +33,7 @@ CREATE DICTIONARY database_for_dict.ssd_dict c String DEFAULT 'none' ) PRIMARY KEY id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1000 MAX 2000) LAYOUT(SSD_CACHE(FILE_SIZE 8192 PATH '/var/lib/clickhouse/clickhouse_dicts/0d')); @@ -74,7 +74,7 @@ CREATE DICTIONARY database_for_dict.ssd_dict c String DEFAULT 'none' ) PRIMARY KEY id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1000 MAX 2000) LAYOUT(SSD_CACHE(FILE_SIZE 8192 PATH '/var/lib/clickhouse/clickhouse_dicts/1d' BLOCK_SIZE 512 WRITE_BUFFER_SIZE 4096 MAX_STORED_KEYS 1000000)); @@ -140,7 +140,7 @@ CREATE DICTIONARY database_for_dict.ssd_dict b Int32 DEFAULT -1 ) PRIMARY KEY id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1000 MAX 2000) LAYOUT(SSD_CACHE(FILE_SIZE 8192 PATH '/var/lib/clickhouse/clickhouse_dicts/2d' BLOCK_SIZE 512 WRITE_BUFFER_SIZE 1024 MAX_STORED_KEYS 10)); diff --git a/tests/queries/0_stateless/01054_cache_dictionary_bunch_update.sh b/tests/queries/0_stateless/01054_cache_dictionary_bunch_update.sh index a6dd259f9d1..68b76fde32e 100755 --- a/tests/queries/0_stateless/01054_cache_dictionary_bunch_update.sh +++ b/tests/queries/0_stateless/01054_cache_dictionary_bunch_update.sh @@ -72,3 +72,4 @@ wait echo OK $CLICKHOUSE_CLIENT --query "DROP TABLE if exists test_01054.ints" +$CLICKHOUSE_CLIENT -q "DROP DATABASE test_01054" diff --git a/tests/queries/0_stateless/01055_compact_parts_granularity.sh b/tests/queries/0_stateless/01055_compact_parts_granularity.sh index 067f0d2a87e..750b7e431c7 100755 --- a/tests/queries/0_stateless/01055_compact_parts_granularity.sh +++ b/tests/queries/0_stateless/01055_compact_parts_granularity.sh @@ -16,7 +16,7 @@ $CLICKHOUSE_CLIENT -q "SYSTEM STOP MERGES mt_compact" $CLICKHOUSE_CLIENT --max_block_size=1 --min_insert_block_size_rows=1 -q \ "INSERT INTO mt_compact SELECT number, 'aaa' FROM numbers(100);" -$CLICKHOUSE_CLIENT -q "SELECT count() FROM system.parts WHERE table = 'mt_compact' AND database = currentDatabase() AND active" +$CLICKHOUSE_CLIENT -q "SELECT count() FROM system.parts WHERE table = 'mt_compact' AND database = '$CLICKHOUSE_DATABASE' AND active" $CLICKHOUSE_CLIENT -q "SYSTEM START MERGES mt_compact" # Retry because already started concurrent merges may interrupt optimize @@ -28,5 +28,5 @@ for _ in {0..10}; do sleep 0.1 done -$CLICKHOUSE_CLIENT -q "SELECT count(), sum(marks) FROM system.parts WHERE table = 'mt_compact' AND database = currentDatabase() AND active" +$CLICKHOUSE_CLIENT -q "SELECT count(), sum(marks) FROM system.parts WHERE table = 'mt_compact' AND database = '$CLICKHOUSE_DATABASE' AND active" $CLICKHOUSE_CLIENT -q "DROP TABLE mt_compact" diff --git a/tests/queries/0_stateless/01056_create_table_as.sql b/tests/queries/0_stateless/01056_create_table_as.sql index 32a39646170..bf2a143fa5a 100644 --- a/tests/queries/0_stateless/01056_create_table_as.sql +++ b/tests/queries/0_stateless/01056_create_table_as.sql @@ -37,7 +37,7 @@ CREATE DICTIONARY dict ) PRIMARY KEY key SOURCE(CLICKHOUSE( - HOST '127.0.0.1' PORT 9000 + HOST '127.0.0.1' PORT tcpPort() TABLE 'dict_data' DB 'test_01056_dict_data' USER 'default' PASSWORD '')) LIFETIME(MIN 0 MAX 0) LAYOUT(SPARSE_HASHED()); diff --git a/tests/queries/0_stateless/01080_check_for_error_incorrect_size_of_nested_column.sql b/tests/queries/0_stateless/01080_check_for_error_incorrect_size_of_nested_column.sql index 74f2c37567b..6c80a391c30 100644 --- a/tests/queries/0_stateless/01080_check_for_error_incorrect_size_of_nested_column.sql +++ b/tests/queries/0_stateless/01080_check_for_error_incorrect_size_of_nested_column.sql @@ -1,11 +1,13 @@ +-- TODO: can't just default prefix, it breaks the test! + drop table if exists default.test_table_01080; CREATE TABLE default.test_table_01080 (dim_key Int64, dim_id String) ENGINE = MergeTree Order by (dim_key); insert into default.test_table_01080 values(1,'test1'); drop DICTIONARY if exists default.test_dict_01080; -CREATE DICTIONARY default.test_dict_01080 ( dim_key Int64, dim_id String ) -PRIMARY KEY dim_key +CREATE DICTIONARY default.test_dict_01080 ( dim_key Int64, dim_id String ) +PRIMARY KEY dim_key source(clickhouse(host 'localhost' port '9000' user 'default' password '' db 'default' table 'test_table_01080')) LIFETIME(MIN 0 MAX 0) LAYOUT(complex_key_hashed()); diff --git a/tests/queries/0_stateless/01108_restart_replicas_rename_deadlock_zookeeper.sh b/tests/queries/0_stateless/01108_restart_replicas_rename_deadlock_zookeeper.sh index bc7588f07f8..39240ea9f8d 100755 --- a/tests/queries/0_stateless/01108_restart_replicas_rename_deadlock_zookeeper.sh +++ b/tests/queries/0_stateless/01108_restart_replicas_rename_deadlock_zookeeper.sh @@ -71,8 +71,8 @@ while [[ $($CLICKHOUSE_CLIENT -q "SELECT count() FROM system.processes WHERE que sleep 1 done; -$CLICKHOUSE_CLIENT -q "SELECT replaceOne(name, '_tmp', '') FROM system.tables WHERE database = currentDatabase() AND match(name, '^replica_01108_')" -$CLICKHOUSE_CLIENT -q "SELECT sum(n), count(n) FROM merge(currentDatabase(), '^replica_01108_') GROUP BY position(_table, 'tmp')" +$CLICKHOUSE_CLIENT -q "SELECT replaceOne(name, '_tmp', '') FROM system.tables WHERE database = '$CLICKHOUSE_DATABASE' AND match(name, '^replica_01108_')" +$CLICKHOUSE_CLIENT -q "SELECT sum(n), count(n) FROM merge('$CLICKHOUSE_DATABASE', '^replica_01108_') GROUP BY position(_table, 'tmp')" for i in $(seq 4); do diff --git a/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.reference b/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.reference index 69018bef2ef..0a935516722 100644 --- a/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.reference +++ b/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.reference @@ -1,3 +1,3 @@ World -CREATE DICTIONARY db_for_dict.dict_with_hashed_layout\n(\n `key1` UInt64,\n `value` String\n)\nPRIMARY KEY key1\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'table_for_dict\' DB \'db_for_dict\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(HASHED) +CREATE DICTIONARY db_for_dict.dict_with_hashed_layout\n(\n `key1` UInt64,\n `value` String\n)\nPRIMARY KEY key1\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'table_for_dict\' DB \'db_for_dict\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(HASHED) Hello diff --git a/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.sql b/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.sql index 718e7f295b3..e39afcba742 100644 --- a/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.sql +++ b/tests/queries/0_stateless/01110_dictionary_layout_without_arguments.sql @@ -17,7 +17,7 @@ CREATE DICTIONARY db_for_dict.dict_with_hashed_layout ) PRIMARY KEY key1 LAYOUT(HASHED) -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'db_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'db_for_dict')) LIFETIME(MIN 1 MAX 10); SELECT dictGet('db_for_dict.dict_with_hashed_layout', 'value', toUInt64(2)); diff --git a/tests/queries/0_stateless/01113_local_dictionary_type_conversion.sql b/tests/queries/0_stateless/01113_local_dictionary_type_conversion.sql index df1f405e286..3b6d9310042 100644 --- a/tests/queries/0_stateless/01113_local_dictionary_type_conversion.sql +++ b/tests/queries/0_stateless/01113_local_dictionary_type_conversion.sql @@ -18,7 +18,7 @@ CREATE DICTIONARY database_for_dict.dict_with_conversion SomeID Int32 DEFAULT 0 ) PRIMARY KEY CompanyID -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 20) LAYOUT(COMPLEX_KEY_HASHED()); diff --git a/tests/queries/0_stateless/01114_database_atomic.reference b/tests/queries/0_stateless/01114_database_atomic.reference index a79784230a6..05260106ab9 100644 --- a/tests/queries/0_stateless/01114_database_atomic.reference +++ b/tests/queries/0_stateless/01114_database_atomic.reference @@ -6,11 +6,11 @@ test_01114_2 Atomic store 00001114-1000-4000-8000-000000000002 1 test_01114_3 Ordinary test_01114_3 test_01114_3 1 20 100 -CREATE TABLE test_01114_2.mt UUID \'00001114-0000-4000-8000-000000000002\'\n(\n `n` UInt64\n)\nENGINE = MergeTree()\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -mt 00001114-0000-4000-8000-000000000002 CREATE TABLE test_01114_2.mt (`n` UInt64) ENGINE = MergeTree() PARTITION BY n % 5 ORDER BY tuple() SETTINGS index_granularity = 8192 +CREATE TABLE test_01114_2.mt UUID \'00001114-0000-4000-8000-000000000002\'\n(\n `n` UInt64\n)\nENGINE = MergeTree\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +mt 00001114-0000-4000-8000-000000000002 CREATE TABLE test_01114_2.mt (`n` UInt64) ENGINE = MergeTree PARTITION BY n % 5 ORDER BY tuple() SETTINGS index_granularity = 8192 20 -CREATE TABLE test_01114_1.mt UUID \'00001114-0000-4000-8000-000000000001\'\n(\n `n` UInt64\n)\nENGINE = MergeTree()\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -CREATE TABLE test_01114_2.mt UUID \'00001114-0000-4000-8000-000000000002\'\n(\n `n` UInt64\n)\nENGINE = MergeTree()\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE test_01114_1.mt UUID \'00001114-0000-4000-8000-000000000001\'\n(\n `n` UInt64\n)\nENGINE = MergeTree\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE test_01114_2.mt UUID \'00001114-0000-4000-8000-000000000002\'\n(\n `n` UInt64\n)\nENGINE = MergeTree\nPARTITION BY n % 5\nORDER BY tuple()\nSETTINGS index_granularity = 8192 5 dropped 20 190 diff --git a/tests/queries/0_stateless/01115_join_with_dictionary.sql b/tests/queries/0_stateless/01115_join_with_dictionary.sql index 807b53c39c0..70aecf1c478 100644 --- a/tests/queries/0_stateless/01115_join_with_dictionary.sql +++ b/tests/queries/0_stateless/01115_join_with_dictionary.sql @@ -14,19 +14,19 @@ INSERT INTO t1 SELECT number, number, toString(number), number from numbers(4); CREATE DICTIONARY dict_flat (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 't1' PASSWORD '' DB 'db_01115')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' PASSWORD '' DB 'db_01115')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); CREATE DICTIONARY db_01115.dict_hashed (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 't1' DB 'db_01115')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' DB 'db_01115')) LIFETIME(MIN 1 MAX 10) LAYOUT(HASHED()); CREATE DICTIONARY dict_complex_cache (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0) PRIMARY KEY key, b -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 't1' DB 'db_01115')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' DB 'db_01115')) LIFETIME(MIN 1 MAX 10) LAYOUT(COMPLEX_KEY_CACHE(SIZE_IN_CELLS 1)); diff --git a/tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql b/tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql index 3f87235bdf4..6ad76ee5a7e 100644 --- a/tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql +++ b/tests/queries/0_stateless/01125_dict_ddl_cannot_add_column.sql @@ -22,7 +22,7 @@ CREATE DICTIONARY somedict end Date ) PRIMARY KEY id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'date_table' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'date_table' DB 'database_for_dict')) LAYOUT(RANGE_HASHED()) RANGE (MIN start MAX end) LIFETIME(MIN 300 MAX 360); diff --git a/tests/queries/0_stateless/01129_dict_get_join_lose_constness.sql b/tests/queries/0_stateless/01129_dict_get_join_lose_constness.sql index b9c233c9382..09659145977 100644 --- a/tests/queries/0_stateless/01129_dict_get_join_lose_constness.sql +++ b/tests/queries/0_stateless/01129_dict_get_join_lose_constness.sql @@ -7,7 +7,7 @@ CREATE DICTIONARY IF NOT EXISTS system.dict1 loading_start_time DateTime ) PRIMARY KEY bytes_allocated -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' PASSWORD '' TABLE 'dictionaries' DB 'system')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' PASSWORD '' TABLE 'dictionaries' DB 'system')) LIFETIME(0) LAYOUT(hashed()); diff --git a/tests/queries/0_stateless/01190_full_attach_syntax.reference b/tests/queries/0_stateless/01190_full_attach_syntax.reference index 4e6eabcd6f0..9d74a8cb3ce 100644 --- a/tests/queries/0_stateless/01190_full_attach_syntax.reference +++ b/tests/queries/0_stateless/01190_full_attach_syntax.reference @@ -1,7 +1,7 @@ -CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'table_for_dict\' PASSWORD \'\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT()) -CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'table_for_dict\' PASSWORD \'\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT()) +CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'table_for_dict\' PASSWORD \'\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT()) +CREATE DICTIONARY test_01190.dict\n(\n `key` UInt64 DEFAULT 0,\n `col` UInt8 DEFAULT 1\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'table_for_dict\' PASSWORD \'\' DB \'test_01190\'))\nLIFETIME(MIN 1 MAX 10)\nLAYOUT(FLAT()) +CREATE TABLE test_01190.log\n(\n `s` String\n)\nENGINE = Log CREATE TABLE test_01190.log\n(\n `s` String\n)\nENGINE = Log -CREATE TABLE test_01190.log\n(\n `s` String\n)\nENGINE = Log() test CREATE TABLE test_01190.mt\n(\n `key` Array(UInt8),\n `s` String,\n `n` UInt64,\n `d` Date MATERIALIZED \'2000-01-01\'\n)\nENGINE = MergeTree(d, (key, s, n), 1) [1,2] Hello 2 diff --git a/tests/queries/0_stateless/01190_full_attach_syntax.sql b/tests/queries/0_stateless/01190_full_attach_syntax.sql index 78f0f53d101..62e77f9870e 100644 --- a/tests/queries/0_stateless/01190_full_attach_syntax.sql +++ b/tests/queries/0_stateless/01190_full_attach_syntax.sql @@ -4,14 +4,14 @@ USE test_01190; CREATE TABLE test_01190.table_for_dict (key UInt64, col UInt8) ENGINE = Memory; -CREATE DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 1) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); +CREATE DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 1) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()); SHOW CREATE DICTIONARY test_01190.dict; DETACH DICTIONARY test_01190.dict; ATTACH TABLE test_01190.dict; -- { serverError 80 } -- Full ATTACH syntax is not allowed for dictionaries -ATTACH DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 42) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 100) LAYOUT(FLAT()); -- { clientError 62 } +ATTACH DICTIONARY test_01190.dict (key UInt64 DEFAULT 0, col UInt8 DEFAULT 42) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'test_01190')) LIFETIME(MIN 1 MAX 100) LAYOUT(FLAT()); -- { clientError 62 } ATTACH DICTIONARY test_01190.dict; SHOW CREATE DICTIONARY test_01190.dict; diff --git a/tests/queries/0_stateless/01191_rename_dictionary.sql b/tests/queries/0_stateless/01191_rename_dictionary.sql index 1a2440ee28b..3656d49f6e6 100644 --- a/tests/queries/0_stateless/01191_rename_dictionary.sql +++ b/tests/queries/0_stateless/01191_rename_dictionary.sql @@ -6,7 +6,7 @@ CREATE TABLE test_01191._ (n UInt64, s String) ENGINE = Memory(); CREATE DICTIONARY test_01191.dict (n UInt64, s String) PRIMARY KEY n LAYOUT(DIRECT()) -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE '_' DB 'test_01191')); +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE '_' DB 'test_01191')); INSERT INTO test_01191._ VALUES (42, 'test'); diff --git a/tests/queries/0_stateless/01192_rename_database_zookeeper.reference b/tests/queries/0_stateless/01192_rename_database_zookeeper.reference index 13f2a780e0b..5b430f0a5b1 100644 --- a/tests/queries/0_stateless/01192_rename_database_zookeeper.reference +++ b/tests/queries/0_stateless/01192_rename_database_zookeeper.reference @@ -14,7 +14,7 @@ renamed 10 45 10 45 ok -CREATE DICTIONARY test_01192_atomic.dict UUID \'00001192-0000-4000-8000-000000000002\'\n(\n `n` UInt64,\n `_part` String DEFAULT \'no\'\n)\nPRIMARY KEY n\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'mt\' DB \'test_01192\'))\nLAYOUT(DIRECT()) +CREATE DICTIONARY test_01192_atomic.dict UUID \'00001192-0000-4000-8000-000000000002\'\n(\n `n` UInt64,\n `_part` String DEFAULT \'no\'\n)\nPRIMARY KEY n\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'mt\' DB \'test_01192\'))\nLAYOUT(DIRECT()) test_01192_atomic dict NOT_LOADED 00001192-0000-4000-8000-000000000002 no ok diff --git a/tests/queries/0_stateless/01192_rename_database_zookeeper.sh b/tests/queries/0_stateless/01192_rename_database_zookeeper.sh index c97ec14335c..bb84cab8977 100755 --- a/tests/queries/0_stateless/01192_rename_database_zookeeper.sh +++ b/tests/queries/0_stateless/01192_rename_database_zookeeper.sh @@ -52,7 +52,7 @@ $CLICKHOUSE_CLIENT -q "SELECT count(n), sum(n) FROM test_01192_atomic.mv" 2>&1| # 7. create dictionary and check it $CLICKHOUSE_CLIENT -q "CREATE TABLE test_01192.mt (n UInt64, _part String) ENGINE=Memory" # mock -$CLICKHOUSE_CLIENT -q "CREATE DICTIONARY test_01192_atomic.dict UUID '00001192-0000-4000-8000-000000000002' (n UInt64, _part String DEFAULT 'no') PRIMARY KEY n LAYOUT(DIRECT()) SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'mt' DB 'test_01192'))" +$CLICKHOUSE_CLIENT -q "CREATE DICTIONARY test_01192_atomic.dict UUID '00001192-0000-4000-8000-000000000002' (n UInt64, _part String DEFAULT 'no') PRIMARY KEY n LAYOUT(DIRECT()) SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'mt' DB 'test_01192'))" $CLICKHOUSE_CLIENT --show_table_uuid_in_table_create_query_if_not_nil=1 -q "SHOW CREATE DICTIONARY test_01192_atomic.dict" $CLICKHOUSE_CLIENT -q "SELECT database, name, status, origin FROM system.dictionaries WHERE uuid='00001192-0000-4000-8000-000000000002'" $CLICKHOUSE_CLIENT -q "SELECT dictGet('test_01192_atomic.dict', '_part', toUInt64(1))" diff --git a/tests/queries/0_stateless/01213_alter_rename_nested.reference b/tests/queries/0_stateless/01213_alter_rename_nested.reference index 403e87256fe..8277f00498b 100644 --- a/tests/queries/0_stateless/01213_alter_rename_nested.reference +++ b/tests/queries/0_stateless/01213_alter_rename_nested.reference @@ -1,10 +1,10 @@ [8,9,10] ['a','b','c'] -CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.x` Array(UInt32),\n `n.y` Array(String),\n `value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 -CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.x` Array(UInt32),\n `n.y` Array(String),\n `value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 7 [8,9,10] 7 ['a','b','c'] [['7']] -CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `renamed_value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `renamed_value1` Array(Array(LowCardinality(String)))\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 date key n.renamed_x n.renamed_y renamed_value1 2019-10-01 7 [8,9,10] ['a','b','c'] [['7']] diff --git a/tests/queries/0_stateless/01213_alter_rename_with_default_zookeeper.reference b/tests/queries/0_stateless/01213_alter_rename_with_default_zookeeper.reference index 8b5199a44d1..da3dad5cb16 100644 --- a/tests/queries/0_stateless/01213_alter_rename_with_default_zookeeper.reference +++ b/tests/queries/0_stateless/01213_alter_rename_with_default_zookeeper.reference @@ -1,9 +1,9 @@ date key value1 value2 2019-10-02 1 1 Hello 1 -CREATE TABLE default.table_rename_with_default\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String DEFAULT concat(\'Hello \', value1),\n `value3` String ALIAS concat(\'Word \', value1)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_rename_with_default\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String DEFAULT concat(\'Hello \', value1),\n `value3` String ALIAS concat(\'Word \', value1)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 date key renamed_value1 value2 2019-10-02 1 1 Hello 1 -CREATE TABLE default.table_rename_with_default\n(\n `date` Date,\n `key` UInt64,\n `renamed_value1` String,\n `value2` String DEFAULT concat(\'Hello \', renamed_value1),\n `value3` String ALIAS concat(\'Word \', renamed_value1)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_rename_with_default\n(\n `date` Date,\n `key` UInt64,\n `renamed_value1` String,\n `value2` String DEFAULT concat(\'Hello \', renamed_value1),\n `value3` String ALIAS concat(\'Word \', renamed_value1)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 Hello 1 Word 1 date1 date2 value1 value2 diff --git a/tests/queries/0_stateless/01213_alter_table_rename_nested.reference b/tests/queries/0_stateless/01213_alter_table_rename_nested.reference index 1b89cf8f461..d06fb9dc00f 100644 --- a/tests/queries/0_stateless/01213_alter_table_rename_nested.reference +++ b/tests/queries/0_stateless/01213_alter_table_rename_nested.reference @@ -1,6 +1,6 @@ [8,9,10] ['a','b','c'] -CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.x` Array(UInt32),\n `n.y` Array(String),\n `value1` String\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 -CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `value1` String\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.x` Array(UInt32),\n `n.y` Array(String),\n `value1` String\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename_nested\n(\n `date` Date,\n `key` UInt64,\n `n.renamed_x` Array(UInt32),\n `n.renamed_y` Array(String),\n `value1` String\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 7 [8,9,10] 7 ['a','b','c'] diff --git a/tests/queries/0_stateless/01224_no_superfluous_dict_reload.reference b/tests/queries/0_stateless/01224_no_superfluous_dict_reload.reference index d80501b3f4d..5a05edcad58 100644 --- a/tests/queries/0_stateless/01224_no_superfluous_dict_reload.reference +++ b/tests/queries/0_stateless/01224_no_superfluous_dict_reload.reference @@ -6,7 +6,7 @@ CREATE DICTIONARY dict_db_01224.dict `val` UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01224')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01224')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()) NOT_LOADED @@ -17,7 +17,7 @@ CREATE TABLE dict_db_01224_dictionary.`dict_db_01224.dict` ) ENGINE = Dictionary(`dict_db_01224.dict`) NOT_LOADED -Dictionary 1 CREATE DICTIONARY dict_db_01224.dict (`key` UInt64 DEFAULT 0, `val` UInt64 DEFAULT 10) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'dict_data\' PASSWORD \'\' DB \'dict_db_01224\')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()) +Dictionary 1 CREATE DICTIONARY dict_db_01224.dict (`key` UInt64 DEFAULT 0, `val` UInt64 DEFAULT 10) PRIMARY KEY key SOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'dict_data\' PASSWORD \'\' DB \'dict_db_01224\')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()) NOT_LOADED key UInt64 val UInt64 diff --git a/tests/queries/0_stateless/01224_no_superfluous_dict_reload.sql b/tests/queries/0_stateless/01224_no_superfluous_dict_reload.sql index da4928a26fb..f15ea4a75f4 100644 --- a/tests/queries/0_stateless/01224_no_superfluous_dict_reload.sql +++ b/tests/queries/0_stateless/01224_no_superfluous_dict_reload.sql @@ -10,7 +10,7 @@ CREATE DICTIONARY dict_db_01224.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01224')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01224')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01225_drop_dictionary_as_table.sql b/tests/queries/0_stateless/01225_drop_dictionary_as_table.sql index 866f2dff56b..451f2adbede 100644 --- a/tests/queries/0_stateless/01225_drop_dictionary_as_table.sql +++ b/tests/queries/0_stateless/01225_drop_dictionary_as_table.sql @@ -8,7 +8,7 @@ CREATE DICTIONARY dict_db_01225.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01225')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01225')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01225_show_create_table_from_dictionary.sql b/tests/queries/0_stateless/01225_show_create_table_from_dictionary.sql index 24d10537dbb..a49f113ebde 100644 --- a/tests/queries/0_stateless/01225_show_create_table_from_dictionary.sql +++ b/tests/queries/0_stateless/01225_show_create_table_from_dictionary.sql @@ -10,7 +10,7 @@ CREATE DICTIONARY dict_db_01225.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01225')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01225')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01249_bad_arguments_for_bloom_filter.reference b/tests/queries/0_stateless/01249_bad_arguments_for_bloom_filter.reference index fb993e8d572..945ade08b3e 100644 --- a/tests/queries/0_stateless/01249_bad_arguments_for_bloom_filter.reference +++ b/tests/queries/0_stateless/01249_bad_arguments_for_bloom_filter.reference @@ -1,3 +1,3 @@ -CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(0., 1.) GRANULARITY 1\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 -CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(-0.1) GRANULARITY 1\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 -CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(1.01) GRANULARITY 1\n)\nENGINE = MergeTree()\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(0., 1.) GRANULARITY 1\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(-0.1) GRANULARITY 1\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 +CREATE TABLE test_01249.bloom_filter_idx_good\n(\n `u64` UInt64,\n `i32` Int32,\n `f64` Float64,\n `d` Decimal(10, 2),\n `s` String,\n `e` Enum8(\'a\' = 1, \'b\' = 2, \'c\' = 3),\n `dt` Date,\n INDEX bloom_filter_a i32 TYPE bloom_filter(1.01) GRANULARITY 1\n)\nENGINE = MergeTree\nORDER BY u64\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01251_dict_is_in_infinite_loop.sql b/tests/queries/0_stateless/01251_dict_is_in_infinite_loop.sql index 8e7e76697b5..958165805e1 100644 --- a/tests/queries/0_stateless/01251_dict_is_in_infinite_loop.sql +++ b/tests/queries/0_stateless/01251_dict_is_in_infinite_loop.sql @@ -12,7 +12,7 @@ CREATE DICTIONARY database_for_dict.dictionary_with_hierarchy id UInt64, parent_id UInt64 HIERARCHICAL, value String ) PRIMARY KEY id -SOURCE(CLICKHOUSE(host 'localhost' port 9000 user 'default' db 'database_for_dict' table 'dict_source')) +SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db 'database_for_dict' table 'dict_source')) LAYOUT(HASHED()) LIFETIME(MIN 1 MAX 1); @@ -41,7 +41,7 @@ CREATE DICTIONARY database_for_dict.dictionary_with_hierarchy id UInt64, parent_id UInt64 HIERARCHICAL, value String ) PRIMARY KEY id -SOURCE(CLICKHOUSE(host 'localhost' port 9000 user 'default' db 'database_for_dict' table 'dict_source')) +SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db 'database_for_dict' table 'dict_source')) LAYOUT(FLAT()) LIFETIME(MIN 1 MAX 1); @@ -70,7 +70,7 @@ CREATE DICTIONARY database_for_dict.dictionary_with_hierarchy id UInt64, parent_id UInt64 HIERARCHICAL, value String ) PRIMARY KEY id -SOURCE(CLICKHOUSE(host 'localhost' port 9000 user 'default' db 'database_for_dict' table 'dict_source')) +SOURCE(CLICKHOUSE(host 'localhost' port tcpPort() user 'default' db 'database_for_dict' table 'dict_source')) LAYOUT(CACHE(SIZE_IN_CELLS 10)) LIFETIME(MIN 1 MAX 1); diff --git a/tests/queries/0_stateless/01254_dict_create_without_db.sql b/tests/queries/0_stateless/01254_dict_create_without_db.sql index e7c7702bb21..0c7f3126d98 100644 --- a/tests/queries/0_stateless/01254_dict_create_without_db.sql +++ b/tests/queries/0_stateless/01254_dict_create_without_db.sql @@ -9,7 +9,7 @@ CREATE DICTIONARY dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01254')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01254')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01254_dict_load_after_detach_attach.sql b/tests/queries/0_stateless/01254_dict_load_after_detach_attach.sql index 5a5f694d28f..8fd56f40afe 100644 --- a/tests/queries/0_stateless/01254_dict_load_after_detach_attach.sql +++ b/tests/queries/0_stateless/01254_dict_load_after_detach_attach.sql @@ -8,7 +8,7 @@ CREATE DICTIONARY dict_db_01254.dict val UInt64 DEFAULT 10 ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01254')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dict_data' PASSWORD '' DB 'dict_db_01254')) LIFETIME(MIN 0 MAX 0) LAYOUT(FLAT()); diff --git a/tests/queries/0_stateless/01257_dictionary_mismatch_types.sql b/tests/queries/0_stateless/01257_dictionary_mismatch_types.sql index 7116f044391..35782f1cd02 100644 --- a/tests/queries/0_stateless/01257_dictionary_mismatch_types.sql +++ b/tests/queries/0_stateless/01257_dictionary_mismatch_types.sql @@ -56,7 +56,7 @@ CREATE DICTIONARY test_dict_db.table1_dict col20 String ) PRIMARY KEY col1,col2,col3,col4,col5 -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 DB test_dict_db TABLE table1 USER 'default')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() DB test_dict_db TABLE table1 USER 'default')) LIFETIME(MIN 0 MAX 0) LAYOUT(COMPLEX_KEY_HASHED()); SELECT diff --git a/tests/queries/0_stateless/01259_dictionary_custom_settings_ddl.sql b/tests/queries/0_stateless/01259_dictionary_custom_settings_ddl.sql index 9c2174c8469..3c8b4e03507 100644 --- a/tests/queries/0_stateless/01259_dictionary_custom_settings_ddl.sql +++ b/tests/queries/0_stateless/01259_dictionary_custom_settings_ddl.sql @@ -28,7 +28,7 @@ CREATE DICTIONARY ordinary_db.dict1 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1 MAX 10) LAYOUT(FLAT()) SETTINGS(max_result_bytes=1); diff --git a/tests/queries/0_stateless/01268_dictionary_direct_layout.sql b/tests/queries/0_stateless/01268_dictionary_direct_layout.sql index 48642c91102..f4f3cbec705 100644 --- a/tests/queries/0_stateless/01268_dictionary_direct_layout.sql +++ b/tests/queries/0_stateless/01268_dictionary_direct_layout.sql @@ -62,7 +62,7 @@ CREATE DICTIONARY db_01268.dict1 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB 'database_for_dict_01268')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB 'database_for_dict_01268')) LAYOUT(DIRECT()) SETTINGS(max_result_bytes=1); CREATE DICTIONARY db_01268.dict2 @@ -72,7 +72,7 @@ CREATE DICTIONARY db_01268.dict2 region_name String DEFAULT '' ) PRIMARY KEY region_id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict2' PASSWORD '' DB 'database_for_dict_01268')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict2' PASSWORD '' DB 'database_for_dict_01268')) LAYOUT(DIRECT()); CREATE DICTIONARY db_01268.dict3 @@ -82,7 +82,7 @@ CREATE DICTIONARY db_01268.dict3 region_name String DEFAULT '' ) PRIMARY KEY region_id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict3' PASSWORD '' DB 'database_for_dict_01268')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict3' PASSWORD '' DB 'database_for_dict_01268')) LAYOUT(DIRECT()); SELECT 'INITIALIZING DICTIONARY'; diff --git a/tests/queries/0_stateless/01269_create_with_null.reference b/tests/queries/0_stateless/01269_create_with_null.reference index e4945eed114..86be41bc06a 100644 --- a/tests/queries/0_stateless/01269_create_with_null.reference +++ b/tests/queries/0_stateless/01269_create_with_null.reference @@ -1,4 +1,4 @@ Nullable(Int32) Int32 Nullable(Int32) Int32 -CREATE TABLE default.data_null\n(\n `a` Nullable(Int32),\n `b` Int32,\n `c` Nullable(Int32),\n `d` Int32\n)\nENGINE = Memory() +CREATE TABLE default.data_null\n(\n `a` Nullable(Int32),\n `b` Int32,\n `c` Nullable(Int32),\n `d` Int32\n)\nENGINE = Memory Nullable(Int32) Int32 Nullable(Int32) Nullable(Int32) -CREATE TABLE default.set_null\n(\n `a` Nullable(Int32),\n `b` Int32,\n `c` Nullable(Int32),\n `d` Nullable(Int32)\n)\nENGINE = Memory() +CREATE TABLE default.set_null\n(\n `a` Nullable(Int32),\n `b` Int32,\n `c` Nullable(Int32),\n `d` Nullable(Int32)\n)\nENGINE = Memory diff --git a/tests/queries/0_stateless/01273_arrow_load.sh b/tests/queries/0_stateless/01273_arrow_load.sh index 5fc5923a0ef..7f4b88ec8e2 100755 --- a/tests/queries/0_stateless/01273_arrow_load.sh +++ b/tests/queries/0_stateless/01273_arrow_load.sh @@ -14,3 +14,4 @@ ${CLICKHOUSE_CLIENT} --query="CREATE TABLE arrow_load (bool UInt8, int8 Int8, in cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into arrow_load format Arrow" ${CLICKHOUSE_CLIENT} --query="select * from arrow_load" +$CLICKHOUSE_CLIENT -q "DROP TABLE arrow_load" diff --git a/tests/queries/0_stateless/01275_alter_rename_column_default_expr.reference b/tests/queries/0_stateless/01275_alter_rename_column_default_expr.reference index e1ea5a778da..93c8b2530e0 100644 --- a/tests/queries/0_stateless/01275_alter_rename_column_default_expr.reference +++ b/tests/queries/0_stateless/01275_alter_rename_column_default_expr.reference @@ -7,7 +7,7 @@ 2019-10-01 6 6 7 6 + 7 2019-10-02 7 7 8 7 + 8 2019-10-03 8 8 9 8 + 9 -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String DEFAULT concat(value4, \' + \', value5)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String DEFAULT concat(value4, \' + \', value5)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 0 + 1 2019-10-02 1 1 2 1 + 2 2019-10-03 2 2 3 2 + 3 @@ -36,7 +36,7 @@ CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n 2019-10-03 17 17 18 17 + 18 2019-10-01 18 18 19 18 + 19 2019-10-02 19 19 20 19 + 20 -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String DEFAULT concat(value1, \' + \', value2)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String DEFAULT concat(value1, \' + \', value2)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 0 + 1 2019-10-02 1 1 2 1 + 2 2019-10-03 2 2 3 2 + 3 diff --git a/tests/queries/0_stateless/01276_alter_rename_column_materialized_expr.reference b/tests/queries/0_stateless/01276_alter_rename_column_materialized_expr.reference index c430b6a28af..833e4d31e34 100644 --- a/tests/queries/0_stateless/01276_alter_rename_column_materialized_expr.reference +++ b/tests/queries/0_stateless/01276_alter_rename_column_materialized_expr.reference @@ -7,7 +7,7 @@ 2019-10-01 6 6 7 2019-10-02 7 7 8 2019-10-03 8 8 9 -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String MATERIALIZED concat(value4, \' + \', value5)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String MATERIALIZED concat(value4, \' + \', value5)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 2019-10-02 1 1 2 2019-10-03 2 2 3 @@ -38,7 +38,7 @@ CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n 2019-10-01 18 18 19 2019-10-02 19 19 20 -- rename columns back -- -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String MATERIALIZED concat(value1, \' + \', value2)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String MATERIALIZED concat(value1, \' + \', value2)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 2019-10-02 1 1 2 2019-10-03 2 2 3 diff --git a/tests/queries/0_stateless/01277_alter_rename_column_constraint.reference b/tests/queries/0_stateless/01277_alter_rename_column_constraint.reference index 4316c7fa1b9..c122d420f82 100644 --- a/tests/queries/0_stateless/01277_alter_rename_column_constraint.reference +++ b/tests/queries/0_stateless/01277_alter_rename_column_constraint.reference @@ -7,7 +7,7 @@ 2019-10-01 6 6 7 8 2019-10-02 7 7 8 9 2019-10-03 8 8 9 10 -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String,\n CONSTRAINT cs_value1 CHECK toInt64(value4) < toInt64(value5),\n CONSTRAINT cs_value2 CHECK toInt64(value5) < toInt64(value3)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value4` String,\n `value5` String,\n `value3` String,\n CONSTRAINT cs_value1 CHECK toInt64(value4) < toInt64(value5),\n CONSTRAINT cs_value2 CHECK toInt64(value5) < toInt64(value3)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 2 2019-10-02 1 1 2 3 2019-10-03 2 2 3 4 @@ -38,7 +38,7 @@ CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n 2019-10-01 18 18 19 20 2019-10-02 19 19 20 21 -- rename columns back -- -CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String,\n CONSTRAINT cs_value1 CHECK toInt64(value1) < toInt64(value2),\n CONSTRAINT cs_value2 CHECK toInt64(value2) < toInt64(value3)\n)\nENGINE = MergeTree()\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_for_rename\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` String,\n `value3` String,\n CONSTRAINT cs_value1 CHECK toInt64(value1) < toInt64(value2),\n CONSTRAINT cs_value2 CHECK toInt64(value2) < toInt64(value3)\n)\nENGINE = MergeTree\nPARTITION BY date\nORDER BY key\nSETTINGS index_granularity = 8192 2019-10-01 0 0 1 2 2019-10-02 1 1 2 3 2019-10-03 2 2 3 4 diff --git a/tests/queries/0_stateless/01278_min_insert_block_size_rows_for_materialized_views.sh b/tests/queries/0_stateless/01278_min_insert_block_size_rows_for_materialized_views.sh index 2dc3d695937..f933283cddf 100755 --- a/tests/queries/0_stateless/01278_min_insert_block_size_rows_for_materialized_views.sh +++ b/tests/queries/0_stateless/01278_min_insert_block_size_rows_for_materialized_views.sh @@ -53,10 +53,10 @@ EOL echo "create table null_01278 as data_01278 Engine=Null();" | execute for i in $(seq 1 $TEST_01278_PARTS); do - echo "create table part_01278_$i as data_01278 Engine=Buffer(currentDatabase(), null_01278, 1, 86400, 86400, 1e5, 1e6, 10e6, 100e6);" + echo "create table part_01278_$i as data_01278 Engine=Buffer('$CLICKHOUSE_DATABASE', null_01278, 1, 86400, 86400, 1e5, 1e6, 10e6, 100e6);" echo "create materialized view mv_01278_$i to part_01278_$i as select * from data_01278 where key%$TEST_01278_PARTS+1 != $i;" done | execute -echo "create table out_01278 as data_01278 Engine=Merge(currentDatabase(), 'part_01278_');" | execute +echo "create table out_01278 as data_01278 Engine=Merge('$CLICKHOUSE_DATABASE', 'part_01278_');" | execute # # INSERT diff --git a/tests/queries/0_stateless/01279_empty_external_table.sh b/tests/queries/0_stateless/01279_empty_external_table.sh index a091a730610..16a6b5293a9 100755 --- a/tests/queries/0_stateless/01279_empty_external_table.sh +++ b/tests/queries/0_stateless/01279_empty_external_table.sh @@ -6,8 +6,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) set -e touch "${CLICKHOUSE_TMP}"/empty.tsv -clickhouse-client --query="SELECT count() FROM data" --external --file="${CLICKHOUSE_TMP}"/empty.tsv --name=data --types=UInt32 +$CLICKHOUSE_CLIENT --query="SELECT count() FROM data" --external --file="${CLICKHOUSE_TMP}"/empty.tsv --name=data --types=UInt32 rm "${CLICKHOUSE_TMP}"/empty.tsv -echo -n | clickhouse-client --query="SELECT count() FROM data" --external --file=- --name=data --types=UInt32 -echo | clickhouse-client --query="SELECT count() FROM data" --external --file=- --name=data --types=String +echo -n | $CLICKHOUSE_CLIENT --query="SELECT count() FROM data" --external --file=- --name=data --types=UInt32 +echo | $CLICKHOUSE_CLIENT --query="SELECT count() FROM data" --external --file=- --name=data --types=String diff --git a/tests/queries/0_stateless/01280_ssd_complex_key_dictionary.sql b/tests/queries/0_stateless/01280_ssd_complex_key_dictionary.sql index 7f2da983525..fbfd6900555 100644 --- a/tests/queries/0_stateless/01280_ssd_complex_key_dictionary.sql +++ b/tests/queries/0_stateless/01280_ssd_complex_key_dictionary.sql @@ -35,7 +35,7 @@ CREATE DICTIONARY database_for_dict.ssd_dict c String DEFAULT 'none' ) PRIMARY KEY k1, k2 -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1000 MAX 2000) LAYOUT(COMPLEX_KEY_SSD_CACHE(FILE_SIZE 8192 PATH '/var/lib/clickhouse/clickhouse_dicts/0d')); @@ -94,7 +94,7 @@ CREATE DICTIONARY database_for_dict.ssd_dict c String DEFAULT 'none' ) PRIMARY KEY k1, k2 -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict')) LIFETIME(MIN 1000 MAX 2000) LAYOUT(COMPLEX_KEY_SSD_CACHE(FILE_SIZE 8192 PATH '/var/lib/clickhouse/clickhouse_dicts/1d' BLOCK_SIZE 512 WRITE_BUFFER_SIZE 4096 MAX_STORED_KEYS 1000000)); diff --git a/tests/queries/0_stateless/01280_ttl_where_group_by.sh b/tests/queries/0_stateless/01280_ttl_where_group_by.sh index 9b05606f928..1d0d627e5bb 100755 --- a/tests/queries/0_stateless/01280_ttl_where_group_by.sh +++ b/tests/queries/0_stateless/01280_ttl_where_group_by.sh @@ -101,3 +101,10 @@ insert into ttl_01280_6 values (1, 5, 3, 5, now())" sleep 2 optimize "ttl_01280_6" $CLICKHOUSE_CLIENT --query "select a, b, x, y from ttl_01280_6 ORDER BY a, b, x, y" + +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_1" +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_2" +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_3" +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_4" +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_5" +$CLICKHOUSE_CLIENT -q "DROP TABLE ttl_01280_6" diff --git a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh index 218112bbf46..d43a9361d71 100755 --- a/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh +++ b/tests/queries/0_stateless/01294_lazy_database_concurrent_recreate_reattach_and_show_tables.sh @@ -107,3 +107,5 @@ ${CLICKHOUSE_CLIENT} -n -q " $CLICKHOUSE_CLIENT -q "SYSTEM START TTL MERGES"; echo "Test OK" + +# TODO: doesn't work! $CLICKHOUSE_CLIENT -q "DROP DATABASE $CURR_DATABASE" diff --git a/tests/queries/0_stateless/01305_replica_create_drop_zookeeper.sh b/tests/queries/0_stateless/01305_replica_create_drop_zookeeper.sh index 1313830d589..e3e702b7b1f 100755 --- a/tests/queries/0_stateless/01305_replica_create_drop_zookeeper.sh +++ b/tests/queries/0_stateless/01305_replica_create_drop_zookeeper.sh @@ -7,7 +7,7 @@ set -e function thread() { - db_engine=`$CLICKHOUSE_CLIENT -q "SELECT engine FROM system.databases WHERE name=currentDatabase()"` + db_engine=`$CLICKHOUSE_CLIENT -q "SELECT engine FROM system.databases WHERE name='$CLICKHOUSE_DATABASE'"` if [[ $db_engine == "Atomic" ]]; then # Ignore "Replica already exists" exception while true; do diff --git a/tests/queries/0_stateless/01318_alter_add_column_exists.reference b/tests/queries/0_stateless/01318_alter_add_column_exists.reference index e357550ca1c..529c80dc109 100644 --- a/tests/queries/0_stateless/01318_alter_add_column_exists.reference +++ b/tests/queries/0_stateless/01318_alter_add_column_exists.reference @@ -1,4 +1,4 @@ -CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 -CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 -CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 -CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String,\n `value2` UInt64\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.add_table\n(\n `key` UInt64,\n `value1` String,\n `value2` UInt64\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01318_alter_add_constraint_format.reference b/tests/queries/0_stateless/01318_alter_add_constraint_format.reference index 4283da7b3af..9f58d161539 100644 --- a/tests/queries/0_stateless/01318_alter_add_constraint_format.reference +++ b/tests/queries/0_stateless/01318_alter_add_constraint_format.reference @@ -1 +1 @@ -ALTER TABLE replicated_constraints1 ADD CONSTRAINT IF NOT EXISTS b_constraint CHECK b > 10 +ALTER TABLE replicated_constraints1 ADD CONSTRAINT IF NOT EXISTS b_constraint CHECK b > 10 diff --git a/tests/queries/0_stateless/01338_long_select_and_alter.reference b/tests/queries/0_stateless/01338_long_select_and_alter.reference index de0f4f0a920..c2678e7052e 100644 --- a/tests/queries/0_stateless/01338_long_select_and_alter.reference +++ b/tests/queries/0_stateless/01338_long_select_and_alter.reference @@ -1,3 +1,3 @@ 10 5 -CREATE TABLE default.alter_mt\n(\n `key` UInt64,\n `value` UInt64\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.alter_mt\n(\n `key` UInt64,\n `value` UInt64\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01376_GROUP_BY_injective_elimination_dictGet.sql b/tests/queries/0_stateless/01376_GROUP_BY_injective_elimination_dictGet.sql index 5982864bd97..56f81eb36ec 100644 --- a/tests/queries/0_stateless/01376_GROUP_BY_injective_elimination_dictGet.sql +++ b/tests/queries/0_stateless/01376_GROUP_BY_injective_elimination_dictGet.sql @@ -24,8 +24,12 @@ CREATE DICTIONARY IF NOT EXISTS dictdb_01376.dict_exists value Float64 DEFAULT 77.77 ) PRIMARY KEY key_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict' DB 'dictdb_01376')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' DB 'dictdb_01376')) LIFETIME(1) LAYOUT(FLAT()); SELECT dictGet('dictdb_01376.dict_exists', 'value', toUInt64(1)) as val FROM numbers(2) GROUP BY val; + +DROP DICTIONARY dictdb_01376.dict_exists; +DROP TABLE dictdb_01376.table_for_dict; +DROP DATABASE dictdb_01376; diff --git a/tests/queries/0_stateless/01391_join_on_dict_crash.sql b/tests/queries/0_stateless/01391_join_on_dict_crash.sql index 238a966727f..0f26359796d 100644 --- a/tests/queries/0_stateless/01391_join_on_dict_crash.sql +++ b/tests/queries/0_stateless/01391_join_on_dict_crash.sql @@ -14,7 +14,7 @@ INSERT INTO d_src VALUES (0, 0, 'n'); CREATE DICTIONARY d (id UInt32, country_id UInt8, name String) PRIMARY KEY id -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' DB 'db_01391' table 'd_src')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' DB 'db_01391' table 'd_src')) LIFETIME(MIN 1 MAX 1) LAYOUT(HASHED()); diff --git a/tests/queries/0_stateless/01396_inactive_replica_cleanup_nodes_zookeeper.sh b/tests/queries/0_stateless/01396_inactive_replica_cleanup_nodes_zookeeper.sh index 798b3dd4a57..4d68a8a722e 100755 --- a/tests/queries/0_stateless/01396_inactive_replica_cleanup_nodes_zookeeper.sh +++ b/tests/queries/0_stateless/01396_inactive_replica_cleanup_nodes_zookeeper.sh @@ -23,7 +23,7 @@ $CLICKHOUSE_CLIENT --max_block_size 1 --min_insert_block_size_rows 1 --min_inser for _ in {1..60}; do $CLICKHOUSE_CLIENT --query "SYSTEM FLUSH LOGS" - [[ $($CLICKHOUSE_CLIENT --query "SELECT sum(toUInt32(extract(message, 'Removed (\d+) old log entries'))) FROM system.text_log WHERE event_date >= yesterday() AND logger_name LIKE '%' || currentDatabase() || '%r1%(ReplicatedMergeTreeCleanupThread)%' AND message LIKE '%Removed % old log entries%'") -gt $((SCALE - 100)) ]] && break; + [[ $($CLICKHOUSE_CLIENT --query "SELECT sum(toUInt32(extract(message, 'Removed (\d+) old log entries'))) FROM system.text_log WHERE event_date >= yesterday() AND logger_name LIKE '%' || '$CLICKHOUSE_DATABASE' || '%r1%(ReplicatedMergeTreeCleanupThread)%' AND message LIKE '%Removed % old log entries%'") -gt $((SCALE - 100)) ]] && break; sleep 1 done diff --git a/tests/queries/0_stateless/01413_allow_non_metadata_alters.reference b/tests/queries/0_stateless/01413_allow_non_metadata_alters.reference index bd7e2daeb05..7b0f281776a 100644 --- a/tests/queries/0_stateless/01413_allow_non_metadata_alters.reference +++ b/tests/queries/0_stateless/01413_allow_non_metadata_alters.reference @@ -1,2 +1,2 @@ -CREATE TABLE default.non_metadata_alters\n(\n `key` UInt64,\n `value1` String,\n `value2` Enum8(\'Hello\' = 1, \'World\' = 2),\n `value3` UInt16 TTL value5 + toIntervalDay(5),\n `value4` DateTime,\n `value5` Date\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -CREATE TABLE default.non_metadata_alters\n(\n `key` UInt64,\n `value1` String DEFAULT \'X\',\n `value2` Enum8(\'Hello\' = 1, \'World\' = 2, \'!\' = 3),\n `value3` Date TTL value5 + toIntervalDay(5),\n `value4` UInt32,\n `value5` Date,\n `value6` Decimal(3, 3)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.non_metadata_alters\n(\n `key` UInt64,\n `value1` String,\n `value2` Enum8(\'Hello\' = 1, \'World\' = 2),\n `value3` UInt16 TTL value5 + toIntervalDay(5),\n `value4` DateTime,\n `value5` Date\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.non_metadata_alters\n(\n `key` UInt64,\n `value1` String DEFAULT \'X\',\n `value2` Enum8(\'Hello\' = 1, \'World\' = 2, \'!\' = 3),\n `value3` Date TTL value5 + toIntervalDay(5),\n `value4` UInt32,\n `value5` Date,\n `value6` Decimal(3, 3)\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01415_sticking_mutations.reference b/tests/queries/0_stateless/01415_sticking_mutations.reference index 5d2e2b67958..9c21d5581a7 100644 --- a/tests/queries/0_stateless/01415_sticking_mutations.reference +++ b/tests/queries/0_stateless/01415_sticking_mutations.reference @@ -1,14 +1,14 @@ 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `renamed_value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `renamed_value1` String,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 1 -CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree()\nORDER BY key\nTTL date + toIntervalDay(1)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.sticking_mutations\n(\n `date` Date,\n `key` UInt64,\n `value1` UInt64,\n `value2` UInt8\n)\nENGINE = MergeTree\nORDER BY key\nTTL date + toIntervalDay(1)\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01429_empty_arrow_and_parquet.sh b/tests/queries/0_stateless/01429_empty_arrow_and_parquet.sh index 893cadfe17c..223a5d246ae 100755 --- a/tests/queries/0_stateless/01429_empty_arrow_and_parquet.sh +++ b/tests/queries/0_stateless/01429_empty_arrow_and_parquet.sh @@ -21,3 +21,5 @@ ${CLICKHOUSE_CLIENT} --query="SELECT count() FROM test_empty_data" ${CLICKHOUSE_CLIENT} --query="SELECT count() FROM test_empty_data" (echo "INSERT INTO test_empty_data FORMAT Parquet" && ${CLICKHOUSE_CLIENT} --query="SELECT 1 AS x LIMIT 0 FORMAT Parquet") | ${CLICKHOUSE_CLIENT} ${CLICKHOUSE_CLIENT} --query="SELECT count() FROM test_empty_data" + +${CLICKHOUSE_CLIENT} -q "DROP TABLE test_empty_data" diff --git a/tests/queries/0_stateless/01442_merge_detach_attach.sh b/tests/queries/0_stateless/01442_merge_detach_attach.sh index 4577d805da5..a0ed8e42357 100755 --- a/tests/queries/0_stateless/01442_merge_detach_attach.sh +++ b/tests/queries/0_stateless/01442_merge_detach_attach.sh @@ -19,3 +19,5 @@ for _ in {1..100}; do done wait + +$CLICKHOUSE_CLIENT -q "DROP TABLE t" diff --git a/tests/queries/0_stateless/01443_merge_truncate.sh b/tests/queries/0_stateless/01443_merge_truncate.sh index 5a0d1188ab6..23c5a8f6c77 100755 --- a/tests/queries/0_stateless/01443_merge_truncate.sh +++ b/tests/queries/0_stateless/01443_merge_truncate.sh @@ -19,3 +19,5 @@ for _ in {1..100}; do done wait + +$CLICKHOUSE_CLIENT -q "DROP TABLE t" diff --git a/tests/queries/0_stateless/01454_storagememory_data_race_challenge.sh b/tests/queries/0_stateless/01454_storagememory_data_race_challenge.sh index c3633f5736c..8fce5c9065b 100755 --- a/tests/queries/0_stateless/01454_storagememory_data_race_challenge.sh +++ b/tests/queries/0_stateless/01454_storagememory_data_race_challenge.sh @@ -37,3 +37,5 @@ export -f g; timeout 30 bash -c f > /dev/null & timeout 30 bash -c g > /dev/null & wait + +$CLICKHOUSE_CLIENT -q "DROP TABLE mem" diff --git a/tests/queries/0_stateless/01455_default_compression.reference b/tests/queries/0_stateless/01455_default_compression.reference index 711ef2d48d2..792cd3272d0 100644 --- a/tests/queries/0_stateless/01455_default_compression.reference +++ b/tests/queries/0_stateless/01455_default_compression.reference @@ -5,4 +5,4 @@ key UInt64 value1 String Default value2 UInt64 Delta(8), Default value3 String Default -CREATE TABLE default.compress_table\n(\n `key` UInt64,\n `value1` String CODEC(Default),\n `value2` UInt64 CODEC(Delta(8), Default),\n `value3` String CODEC(Default)\n)\nENGINE = MergeTree()\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.compress_table\n(\n `key` UInt64,\n `value1` String CODEC(Default),\n `value2` UInt64 CODEC(Delta(8), Default),\n `value3` String CODEC(Default)\n)\nENGINE = MergeTree\nORDER BY key\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01461_alter_table_function.reference b/tests/queries/0_stateless/01461_alter_table_function.reference index b552dd81b77..bf4369056ec 100644 --- a/tests/queries/0_stateless/01461_alter_table_function.reference +++ b/tests/queries/0_stateless/01461_alter_table_function.reference @@ -2,5 +2,5 @@ CREATE TABLE default.table_from_remote\n(\n `number` UInt64\n) AS remote(\'lo CREATE TABLE default.table_from_remote\n(\n `number` UInt64,\n `col` UInt8\n) AS remote(\'localhost\', \'system\', \'numbers\') CREATE TABLE default.table_from_numbers\n(\n `number` UInt64\n) AS numbers(1000) CREATE TABLE default.table_from_numbers\n(\n `number` UInt64\n) AS numbers(1000) -CREATE TABLE default.table_from_select\n(\n `number` UInt64\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -CREATE TABLE default.table_from_select\n(\n `number` UInt64,\n `col` UInt8\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_from_select\n(\n `number` UInt64\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.table_from_select\n(\n `number` UInt64,\n `col` UInt8\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01465_ttl_recompression.reference b/tests/queries/0_stateless/01465_ttl_recompression.reference index 1c576c04e45..108df565669 100644 --- a/tests/queries/0_stateless/01465_ttl_recompression.reference +++ b/tests/queries/0_stateless/01465_ttl_recompression.reference @@ -1,4 +1,4 @@ -CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree()\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalMonth(1) RECOMPRESS CODEC(ZSTD(17)), dt + toIntervalYear(1) RECOMPRESS CODEC(LZ4HC(10))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 +CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalMonth(1) RECOMPRESS CODEC(ZSTD(17)), dt + toIntervalYear(1) RECOMPRESS CODEC(LZ4HC(10))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 3000 1_1_1 LZ4 2_2_2 LZ4 @@ -6,7 +6,7 @@ CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt6 1_1_1 LZ4 2_2_2 ZSTD(17) 3_3_3 LZ4HC(10) -CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree()\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalDay(1) RECOMPRESS CODEC(ZSTD(12))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 +CREATE TABLE default.recompression_table\n(\n `dt` DateTime,\n `key` UInt64,\n `value` String\n)\nENGINE = MergeTree\nPARTITION BY key\nORDER BY tuple()\nTTL dt + toIntervalDay(1) RECOMPRESS CODEC(ZSTD(12))\nSETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, index_granularity = 8192 1_1_1 LZ4 2_2_2 ZSTD(17) 3_3_3 LZ4HC(10) diff --git a/tests/queries/0_stateless/01493_alter_remove_no_property_zookeeper.reference b/tests/queries/0_stateless/01493_alter_remove_no_property_zookeeper.reference index e7e7c2e6ad1..82f6fbd6615 100644 --- a/tests/queries/0_stateless/01493_alter_remove_no_property_zookeeper.reference +++ b/tests/queries/0_stateless/01493_alter_remove_no_property_zookeeper.reference @@ -1,4 +1,4 @@ -CREATE TABLE default.no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -CREATE TABLE default.no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 CREATE TABLE default.r_no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = ReplicatedMergeTree(\'/clickhouse/test/01493_r_no_prop_table\', \'1\')\nORDER BY tuple()\nSETTINGS index_granularity = 8192 CREATE TABLE default.r_no_prop_table\n(\n `some_column` UInt64\n)\nENGINE = ReplicatedMergeTree(\'/clickhouse/test/01493_r_no_prop_table\', \'1\')\nORDER BY tuple()\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01493_alter_remove_properties.reference b/tests/queries/0_stateless/01493_alter_remove_properties.reference index 57b0ff22a4b..23712ada17a 100644 --- a/tests/queries/0_stateless/01493_alter_remove_properties.reference +++ b/tests/queries/0_stateless/01493_alter_remove_properties.reference @@ -1,20 +1,20 @@ -CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date COMMENT \'Some comment\',\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date COMMENT \'Some comment\',\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 42 1764 43 str 2019-10-01 1 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String CODEC(ZSTD(10)),\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64 ALIAS column_default + 1,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 42 1764 0 str 2019-10-01 1 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64 MATERIALIZED column_default * 42,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 42 1764 0 str 2019-10-01 1 42 1764 33 trs 2020-01-01 2 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64 DEFAULT 42,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 42 1764 0 str 2019-10-01 1 42 1764 33 trs 2020-01-01 2 42 11 44 rts 2020-02-01 3 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nTTL column_comment + toIntervalMonth(2)\nSETTINGS index_granularity = 8192 42 1764 0 str 2019-10-01 1 42 1764 33 trs 2020-01-01 2 42 11 44 rts 2020-02-01 3 0 22 55 tsr 2020-03-01 4 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 -CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64 TTL column_comment + toIntervalMonth(1)\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.prop_table\n(\n `column_default` UInt64,\n `column_materialized` UInt64,\n `column_alias` UInt64,\n `column_codec` String,\n `column_comment` Date,\n `column_ttl` UInt64\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 4 diff --git a/tests/queries/0_stateless/01493_alter_remove_wrong_default.reference b/tests/queries/0_stateless/01493_alter_remove_wrong_default.reference index 27120d582e4..334df22a6f6 100644 --- a/tests/queries/0_stateless/01493_alter_remove_wrong_default.reference +++ b/tests/queries/0_stateless/01493_alter_remove_wrong_default.reference @@ -1 +1 @@ -CREATE TABLE default.default_table\n(\n `key` UInt64 DEFAULT 42,\n `value1` UInt64 MATERIALIZED key * key,\n `value2` UInt64 ALIAS value1 * key\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.default_table\n(\n `key` UInt64 DEFAULT 42,\n `value1` UInt64 MATERIALIZED key * key,\n `value2` UInt64 ALIAS value1 * key\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 diff --git a/tests/queries/0_stateless/01501_clickhouse_client_INSERT_exception.sh b/tests/queries/0_stateless/01501_clickhouse_client_INSERT_exception.sh index 5f4f9836d35..4e96f393f30 100755 --- a/tests/queries/0_stateless/01501_clickhouse_client_INSERT_exception.sh +++ b/tests/queries/0_stateless/01501_clickhouse_client_INSERT_exception.sh @@ -11,5 +11,8 @@ ${CLICKHOUSE_CLIENT} --input_format_parallel_parsing=0 -q "INSERT INTO data SELE # well for TSV it is ok, but for RowBinary: # Code: 33. DB::Exception: Cannot read all data. Bytes read: 1. Bytes expected: 4. # so check that the exception message contain the data source. -${CLICKHOUSE_CLIENT} --input_format_parallel_parsing=0 -q "INSERT INTO data FORMAT TSV " <<<2 |& grep -F -c 'data for INSERT was parsed from query' +${CLICKHOUSE_CLIENT} --input_format_parallel_parsing=0 -q "INSERT INTO data FORMAT TSV + " <<<2 |& grep -F -c 'data for INSERT was parsed from query' ${CLICKHOUSE_CLIENT} -q "SELECT * FROM data" + +$CLICKHOUSE_CLIENT -q "DROP TABLE data" diff --git a/tests/queries/0_stateless/01502_log_tinylog_deadlock_race.sh b/tests/queries/0_stateless/01502_log_tinylog_deadlock_race.sh index f0b5f0a3568..96d2e32f590 100755 --- a/tests/queries/0_stateless/01502_log_tinylog_deadlock_race.sh +++ b/tests/queries/0_stateless/01502_log_tinylog_deadlock_race.sh @@ -84,3 +84,6 @@ function test_with_engine { #test_with_engine StripeLog #test_with_engine Log test_with_engine Memory + +$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS t1" +$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS t2" diff --git a/tests/queries/0_stateless/01509_dictionary_preallocate.reference b/tests/queries/0_stateless/01509_dictionary_preallocate.reference index 9f0e494f583..b072d6673db 100644 --- a/tests/queries/0_stateless/01509_dictionary_preallocate.reference +++ b/tests/queries/0_stateless/01509_dictionary_preallocate.reference @@ -1,4 +1,4 @@ -CREATE DICTIONARY db_01509.dict\n(\n `key` UInt64,\n `value` String DEFAULT \'-\'\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT 9000 USER \'default\' TABLE \'data\' PASSWORD \'\' DB \'db_01509\'))\nLIFETIME(MIN 0 MAX 0)\nLAYOUT(SPARSE_HASHED()) +CREATE DICTIONARY db_01509.dict\n(\n `key` UInt64,\n `value` String DEFAULT \'-\'\n)\nPRIMARY KEY key\nSOURCE(CLICKHOUSE(HOST \'localhost\' PORT tcpPort() USER \'default\' TABLE \'data\' PASSWORD \'\' DB \'db_01509\'))\nLIFETIME(MIN 0 MAX 0)\nLAYOUT(SPARSE_HASHED()) - 0 1000 diff --git a/tests/queries/0_stateless/01509_dictionary_preallocate.sql b/tests/queries/0_stateless/01509_dictionary_preallocate.sql index a3c407ddae5..c5ed0e1fbde 100644 --- a/tests/queries/0_stateless/01509_dictionary_preallocate.sql +++ b/tests/queries/0_stateless/01509_dictionary_preallocate.sql @@ -21,7 +21,7 @@ CREATE DICTIONARY db_01509.dict value String DEFAULT '-' ) PRIMARY KEY key -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'data' PASSWORD '' DB 'db_01509')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'data' PASSWORD '' DB 'db_01509')) LAYOUT(SPARSE_HASHED()) LIFETIME(0); diff --git a/tests/queries/0_stateless/01513_defaults_on_defaults_no_column.reference b/tests/queries/0_stateless/01513_defaults_on_defaults_no_column.reference index 10eb384579e..f9366fee036 100644 --- a/tests/queries/0_stateless/01513_defaults_on_defaults_no_column.reference +++ b/tests/queries/0_stateless/01513_defaults_on_defaults_no_column.reference @@ -3,5 +3,5 @@ 1 1 1 [] [] [] 0 -CREATE TABLE default.defaults_on_defaults\n(\n `key` UInt64,\n `Arr.C1` Array(UInt32) DEFAULT emptyArrayUInt32(),\n `Arr.C2` Array(UInt32) DEFAULT arrayResize(emptyArrayUInt32(), length(Arr.C1)),\n `Arr.C3` Array(UInt32) ALIAS arrayResize(emptyArrayUInt32(), length(Arr.C2)),\n `Arr.C4` Array(UInt32) DEFAULT arrayResize(emptyArrayUInt32(), length(Arr.C3)),\n `ArrLen` UInt64 DEFAULT length(Arr.C4)\n)\nENGINE = MergeTree()\nORDER BY tuple()\nSETTINGS index_granularity = 8192 +CREATE TABLE default.defaults_on_defaults\n(\n `key` UInt64,\n `Arr.C1` Array(UInt32) DEFAULT emptyArrayUInt32(),\n `Arr.C2` Array(UInt32) DEFAULT arrayResize(emptyArrayUInt32(), length(Arr.C1)),\n `Arr.C3` Array(UInt32) ALIAS arrayResize(emptyArrayUInt32(), length(Arr.C2)),\n `Arr.C4` Array(UInt32) DEFAULT arrayResize(emptyArrayUInt32(), length(Arr.C3)),\n `ArrLen` UInt64 DEFAULT length(Arr.C4)\n)\nENGINE = MergeTree\nORDER BY tuple()\nSETTINGS index_granularity = 8192 1 diff --git a/tests/queries/0_stateless/01515_with_global_and_with_propagation.sql b/tests/queries/0_stateless/01515_with_global_and_with_propagation.sql index 93bdb9caf77..238bfa72071 100644 --- a/tests/queries/0_stateless/01515_with_global_and_with_propagation.sql +++ b/tests/queries/0_stateless/01515_with_global_and_with_propagation.sql @@ -1,4 +1,4 @@ -SET enable_global_with_statement = true; +SET enable_global_with_statement = 1; WITH 1 AS x SELECT x; WITH 1 AS x SELECT * FROM (SELECT x); diff --git a/tests/queries/0_stateless/01526_client_start_and_exit.expect b/tests/queries/0_stateless/01526_client_start_and_exit.expect index 003439ffa54..2ed7f2296e8 100755 --- a/tests/queries/0_stateless/01526_client_start_and_exit.expect +++ b/tests/queries/0_stateless/01526_client_start_and_exit.expect @@ -4,9 +4,7 @@ log_user 1 set timeout 5 match_max 100000 -if ![info exists env(CLICKHOUSE_PORT_TCP)] {set env(CLICKHOUSE_PORT_TCP) 9000} - -spawn bash -c "clickhouse-client --port $env(CLICKHOUSE_PORT_TCP) && echo $?" +spawn bash -c "$env(CLICKHOUSE_CLIENT) --port $env(CLICKHOUSE_PORT_TCP) && echo $?" expect ":) " send -- "\4" expect eof diff --git a/tests/queries/0_stateless/01526_complex_key_dict_direct_layout.sql b/tests/queries/0_stateless/01526_complex_key_dict_direct_layout.sql index ce2ba3c9020..c303b35386f 100644 --- a/tests/queries/0_stateless/01526_complex_key_dict_direct_layout.sql +++ b/tests/queries/0_stateless/01526_complex_key_dict_direct_layout.sql @@ -22,7 +22,7 @@ CREATE DICTIONARY db_01526.dict1 third_column String DEFAULT 'qqq' ) PRIMARY KEY key_column, second_column -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB 'db_01526')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB 'db_01526')) LAYOUT(COMPLEX_KEY_DIRECT()); SELECT dictGet('db_01526.dict1', 'third_column', (number, number + 1)) FROM numbers(4); diff --git a/tests/queries/0_stateless/01527_dist_sharding_key_dictGet_reload.sql b/tests/queries/0_stateless/01527_dist_sharding_key_dictGet_reload.sql index d8f6704b892..c813192a6d9 100644 --- a/tests/queries/0_stateless/01527_dist_sharding_key_dictGet_reload.sql +++ b/tests/queries/0_stateless/01527_dist_sharding_key_dictGet_reload.sql @@ -12,7 +12,7 @@ create table data_01527 engine=Memory() as select toUInt64(number) key from numb create table dist_01527 as data_01527 engine=Distributed('test_cluster_two_shards', currentDatabase(), data_01527, dictGetUInt64('db_01527_ranges.dict', 'shard', key)); create table db_01527_ranges.data engine=Memory() as select number key, number shard from numbers(100); -create dictionary db_01527_ranges.dict (key UInt64, shard UInt64) primary key key source(clickhouse(host '127.0.0.1' port 9000 table 'data' db 'db_01527_ranges' user 'default' password '')) lifetime(0) layout(hashed()); +create dictionary db_01527_ranges.dict (key UInt64, shard UInt64) primary key key source(clickhouse(host '127.0.0.1' port tcpPort() table 'data' db 'db_01527_ranges' user 'default' password '')) lifetime(0) layout(hashed()); system reload dictionary db_01527_ranges.dict; select _shard_num from dist_01527 where key=0; diff --git a/tests/queries/0_stateless/01532_primary_key_without_order_by_zookeeper.reference b/tests/queries/0_stateless/01532_primary_key_without_order_by_zookeeper.reference index 02d4fe64f8d..66aaf09f4d9 100644 --- a/tests/queries/0_stateless/01532_primary_key_without_order_by_zookeeper.reference +++ b/tests/queries/0_stateless/01532_primary_key_without_order_by_zookeeper.reference @@ -1,9 +1,9 @@ -CREATE TABLE default.merge_tree_pk\n(\n `key` UInt64,\n `value` String\n)\nENGINE = ReplacingMergeTree()\nPRIMARY KEY key\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.merge_tree_pk\n(\n `key` UInt64,\n `value` String\n)\nENGINE = ReplacingMergeTree\nPRIMARY KEY key\nORDER BY key\nSETTINGS index_granularity = 8192 1 a 2 b 1 c 2 b -CREATE TABLE default.merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String\n)\nENGINE = ReplacingMergeTree()\nPRIMARY KEY key\nORDER BY key\nSETTINGS index_granularity = 8192 +CREATE TABLE default.merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String\n)\nENGINE = ReplacingMergeTree\nPRIMARY KEY key\nORDER BY key\nSETTINGS index_granularity = 8192 1 a 2 b 1 c @@ -11,7 +11,7 @@ CREATE TABLE default.merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String 1 c 0 2 e 555 2 b 0 -CREATE TABLE default.merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String,\n `key2` UInt64\n)\nENGINE = ReplacingMergeTree()\nPRIMARY KEY key\nORDER BY (key, key2)\nSETTINGS index_granularity = 8192 +CREATE TABLE default.merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String,\n `key2` UInt64\n)\nENGINE = ReplacingMergeTree\nPRIMARY KEY key\nORDER BY (key, key2)\nSETTINGS index_granularity = 8192 CREATE TABLE default.replicated_merge_tree_pk_sql\n(\n `key` UInt64,\n `value` String\n)\nENGINE = ReplicatedReplacingMergeTree(\'/clickhouse/test/01532_primary_key_without\', \'r1\')\nPRIMARY KEY key\nORDER BY key\nSETTINGS index_granularity = 8192 1 a 2 b diff --git a/tests/queries/0_stateless/01545_url_file_format_settings.sql b/tests/queries/0_stateless/01545_url_file_format_settings.sql index 2ede999b1d0..21991db9854 100644 --- a/tests/queries/0_stateless/01545_url_file_format_settings.sql +++ b/tests/queries/0_stateless/01545_url_file_format_settings.sql @@ -15,5 +15,5 @@ select * from file('01545_url_file_format_settings.csv', CSV, 'a int, b int') se select * from url('http://127.0.0.1:8123/?query=select%201%2C%202%20format%20CSV%20settings%20format_csv_delimiter%3D%27/%27%3B%0A', CSV, 'a int, b int') settings format_csv_delimiter = '/'; - - +drop table file_delim; +drop table url_delim; diff --git a/tests/queries/0_stateless/01552_dict_fixedstring.sql b/tests/queries/0_stateless/01552_dict_fixedstring.sql index 7e0269f8e50..01d55656e3c 100644 --- a/tests/queries/0_stateless/01552_dict_fixedstring.sql +++ b/tests/queries/0_stateless/01552_dict_fixedstring.sql @@ -10,7 +10,7 @@ CREATE DICTIONARY dict s String ) PRIMARY KEY k -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER default TABLE 'src')) +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER default TABLE 'src')) LAYOUT(FLAT) LIFETIME(MIN 10 MAX 10); diff --git a/tests/queries/0_stateless/01563_distributed_query_finish.sh b/tests/queries/0_stateless/01563_distributed_query_finish.sh index 8189025a4b9..16e4ed8ebd1 100755 --- a/tests/queries/0_stateless/01563_distributed_query_finish.sh +++ b/tests/queries/0_stateless/01563_distributed_query_finish.sh @@ -11,7 +11,7 @@ drop table if exists dist_01247; drop table if exists data_01247; create table data_01247 engine=Memory() as select * from numbers(2); -create table dist_01247 as data_01247 engine=Distributed(test_cluster_two_shards, currentDatabase(), data_01247, number); +create table dist_01247 as data_01247 engine=Distributed(test_cluster_two_shards, '$CLICKHOUSE_DATABASE', data_01247, number); select * from dist_01247 format Null; EOL @@ -31,3 +31,6 @@ EOL # expect zero new network errors network_errors_after=$($CLICKHOUSE_CLIENT -q "SELECT value FROM system.errors WHERE name = 'NETWORK_ERROR'") echo NETWORK_ERROR=$(( network_errors_after-network_errors_before )) + +$CLICKHOUSE_CLIENT -q "drop table data_01247" +$CLICKHOUSE_CLIENT -q "drop table dist_01247" diff --git a/tests/queries/0_stateless/01582_distinct_optimization.sh b/tests/queries/0_stateless/01582_distinct_optimization.sh index f1ca484befb..8f3f9bb0d11 100755 --- a/tests/queries/0_stateless/01582_distinct_optimization.sh +++ b/tests/queries/0_stateless/01582_distinct_optimization.sh @@ -7,6 +7,6 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) $CLICKHOUSE_CLIENT --query="CREATE TABLE test_local (a String, b Int) Engine=TinyLog" $CLICKHOUSE_CLIENT --query="INSERT INTO test_local VALUES('a', 0), ('a', 1), ('b', 0)" echo "----" -$CLICKHOUSE_CLIENT --query="EXPLAIN PIPELINE SELECT DISTINCT b FROM (SELECT b FROM remote('127.0.0.{1,2}', currentDatabase(), test_local) GROUP BY a, b)" | grep -o "DistinctTransform" || true +$CLICKHOUSE_CLIENT --query="EXPLAIN PIPELINE SELECT DISTINCT b FROM (SELECT b FROM remote('127.0.0.{1,2}', '$CLICKHOUSE_DATABASE', test_local) GROUP BY a, b)" | grep -o "DistinctTransform" || true echo "----" -$CLICKHOUSE_CLIENT --query="EXPLAIN PIPELINE SELECT DISTINCT a, b, b + 1 FROM (SELECT a, b FROM remote('127.0.0.{1,2}', currentDatabase(), test_local) GROUP BY a, b)" | grep -o "DistinctTransform" || true +$CLICKHOUSE_CLIENT --query="EXPLAIN PIPELINE SELECT DISTINCT a, b, b + 1 FROM (SELECT a, b FROM remote('127.0.0.{1,2}', '$CLICKHOUSE_DATABASE', test_local) GROUP BY a, b)" | grep -o "DistinctTransform" || true diff --git a/tests/queries/1_stateful/00157_cache_dictionary.sql b/tests/queries/1_stateful/00157_cache_dictionary.sql index b2d363ae22e..368da1cc36a 100644 --- a/tests/queries/1_stateful/00157_cache_dictionary.sql +++ b/tests/queries/1_stateful/00157_cache_dictionary.sql @@ -1,20 +1,20 @@ CREATE DATABASE IF NOT EXISTS db_dict; DROP DICTIONARY IF EXISTS db_dict.cache_hits; -CREATE DICTIONARY db_dict.cache_hits -(WatchID UInt64, UserID UInt64, SearchPhrase String) -PRIMARY KEY WatchID -SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'hits' PASSWORD '' DB 'test')) -LIFETIME(MIN 1 MAX 10) +CREATE DICTIONARY db_dict.cache_hits +(WatchID UInt64, UserID UInt64, SearchPhrase String) +PRIMARY KEY WatchID +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'hits' PASSWORD '' DB 'test')) +LIFETIME(MIN 1 MAX 10) LAYOUT(CACHE(SIZE_IN_CELLS 1 QUERY_WAIT_TIMEOUT_MILLISECONDS 60000)); -SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr +SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr FROM test.hits PREWHERE WatchID % 5 == 0 GROUP BY WatchID order by length(arr) desc) WHERE arr = [0]; -SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr +SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr FROM test.hits PREWHERE WatchID % 7 == 0 GROUP BY WatchID order by length(arr) desc) WHERE arr = [0]; -SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr +SELECT count() FROM (SELECT WatchID, arrayDistinct(groupArray(dictGetUInt64( 'db_dict.cache_hits', 'UserID', toUInt64(WatchID)))) as arr FROM test.hits PREWHERE WatchID % 13 == 0 GROUP BY WatchID order by length(arr) desc) WHERE arr = [0]; DROP DICTIONARY IF EXISTS db_dict.cache_hits; diff --git a/tests/queries/query_test.py b/tests/queries/query_test.py index adaf9bc4e5e..59576842274 100644 --- a/tests/queries/query_test.py +++ b/tests/queries/query_test.py @@ -29,7 +29,7 @@ def check_result(result, error, return_code, reference, replace_map): def run_client(bin_prefix, port, query, reference, replace_map={}): # We can't use `text=True` since some tests may return binary data - client = subprocess.Popen([bin_prefix + '-client', '--port', str(port), '-m', '-n', '--testmode'], + client = subprocess.Popen([bin_prefix + '-client', '--port', str(port), '-m', '-n', '--testmode', '--use_antlr_parser=1'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) result, error = client.communicate(query.encode('utf-8')) assert client.returncode is not None, "Client should exit after processing all queries" @@ -37,14 +37,16 @@ def run_client(bin_prefix, port, query, reference, replace_map={}): check_result(result, error, client.returncode, reference, replace_map) -def run_shell(bin_prefix, tmp_dir, tcp_port, http_port, inter_port, database, path, reference, replace_map={}): +def run_shell(bin_prefix, server, database, path, reference, replace_map={}): env = { 'CLICKHOUSE_BINARY': bin_prefix, 'CLICKHOUSE_DATABASE': database, - 'CLICKHOUSE_PORT_TCP': str(tcp_port), - 'CLICKHOUSE_PORT_HTTP': str(http_port), - 'CLICKHOUSE_PORT_INTERSERVER': str(inter_port), - 'CLICKHOUSE_TMP': tmp_dir, + 'CLICKHOUSE_PORT_TCP': str(server.tcp_port), + 'CLICKHOUSE_PORT_TCP_SECURE': str(server.tcps_port), + 'CLICKHOUSE_PORT_HTTP': str(server.http_port), + 'CLICKHOUSE_PORT_INTERSERVER': str(server.inter_port), + 'CLICKHOUSE_TMP': server.tmp_dir, + 'CLICKHOUSE_CONFIG_CLIENT': server.client_config } shell = subprocess.Popen([path], env=env, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) result, error = shell.communicate() @@ -88,9 +90,6 @@ def test_sql_query(bin_prefix, sql_query, standalone_server): def test_shell_query(bin_prefix, shell_query, standalone_server): tcp_port = standalone_server.tcp_port - http_port = standalone_server.http_port - inter_port = standalone_server.inter_port - tmp_path = standalone_server.tmp_dir shell_path = shell_query + ".sh" reference_path = shell_query + ".reference" @@ -105,7 +104,7 @@ def test_shell_query(bin_prefix, shell_query, standalone_server): query = 'CREATE DATABASE {random};'.format(random=random_name) run_client(bin_prefix, tcp_port, query, b'') - run_shell(bin_prefix, tmp_path, tcp_port, http_port, inter_port, random_name, shell_path, reference, {random_name: 'default'}) + run_shell(bin_prefix, standalone_server, random_name, shell_path, reference, {random_name: 'default'}) query = "SELECT 'SHOW ORPHANED TABLES'; SELECT name FROM system.tables WHERE database != 'system' ORDER BY (database, name);" run_client(bin_prefix, tcp_port, query, b'SHOW ORPHANED TABLES\n') diff --git a/tests/queries/server.py b/tests/queries/server.py index b3c3ece0b4c..599de2400e3 100644 --- a/tests/queries/server.py +++ b/tests/queries/server.py @@ -24,6 +24,7 @@ class ServerThread(threading.Thread): self.server_config = os.path.join(self.etc_dir, 'server-config.xml') self.users_config = os.path.join(self.etc_dir, 'users.xml') self.dicts_config = os.path.join(self.etc_dir, 'dictionaries.xml') + self.client_config = os.path.join(self.etc_dir, 'client-config.xml') os.makedirs(self.log_dir) os.makedirs(self.etc_dir) @@ -43,6 +44,7 @@ class ServerThread(threading.Thread): '--tcp_port={tcp_port}'.format(tcp_port=self.tcp_port), '--http_port={http_port}'.format(http_port=self.http_port), '--interserver_http_port={inter_port}'.format(inter_port=self.inter_port), + # TODO: SSL certificate is not specified '--tcp_port_secure={tcps_port}'.format(tcps_port=self.tcps_port), ] with open(self.server_config, 'w') as f: @@ -55,6 +57,9 @@ class ServerThread(threading.Thread): with open(self.dicts_config, 'w') as f: f.write(ServerThread.DEFAULT_DICTIONARIES_CONFIG.format(tcp_port=self.tcp_port)) + with open(self.client_config, 'w') as f: + f.write(ServerThread.DEFAULT_CLIENT_CONFIG) + def run(self): retries = ServerThread.DEFAULT_RETRIES @@ -165,6 +170,13 @@ ServerThread.DEFAULT_SERVER_CONFIG = \ + + + TOPSECRET.TOPSECRET + [hidden] + + + @@ -253,6 +265,24 @@ ServerThread.DEFAULT_SERVER_CONFIG = \ + + + + true + + 127.0.0.1 + {tcp_port} + + foo + + + 127.0.0.2 + {tcp_port} + + foo + + + @@ -1084,3 +1114,20 @@ ServerThread.DEFAULT_DICTIONARIES_CONFIG = \ """ + +ServerThread.DEFAULT_CLIENT_CONFIG = \ +"""\ + + + + true + true + sslv2,sslv3 + true + + AcceptCertificateHandler + + + + +""" diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 0987d64abed..f76490c11ce 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -2,16 +2,10 @@ if (USE_CLANG_TIDY) set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}") endif () -if(MAKE_STATIC_LIBRARIES) - set(MAX_LINKER_MEMORY 3500) -else() - set(MAX_LINKER_MEMORY 2500) -endif() -include(../cmake/limit_jobs.cmake) - # Utils used in package add_subdirectory (config-processor) add_subdirectory (report) +add_subdirectory (syntax-analyzer) # Not used in package if (NOT DEFINED ENABLE_UTILS OR ENABLE_UTILS) diff --git a/utils/check-style/check-style b/utils/check-style/check-style index 56fd6843693..6727d5bd243 100755 --- a/utils/check-style/check-style +++ b/utils/check-style/check-style @@ -13,7 +13,7 @@ # and then to run formatter only for the specified files. ROOT_PATH=$(git rev-parse --show-toplevel) -EXCLUDE_DIRS='build/|integration/|widechar_width/|glibc-compatibility/|memcpy/|consistent-hashing' +EXCLUDE_DIRS='build/|integration/|widechar_width/|glibc-compatibility/|memcpy/|consistent-hashing/|Parsers/New' find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' 2>/dev/null | grep -vP $EXCLUDE_DIRS | @@ -36,32 +36,48 @@ find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' 2>/dev/n find -L $ROOT_PATH -type l 2>/dev/null | grep -v contrib && echo "^ Broken symlinks found" # Double whitespaces -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' 2>/dev/null | while read i; do $ROOT_PATH/utils/check-style/double-whitespaces.pl < $i || echo -e "^ File $i contains double whitespaces\n"; done +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' 2>/dev/null | + grep -vP $EXCLUDE_DIRS | + while read i; do $ROOT_PATH/utils/check-style/double-whitespaces.pl < $i || echo -e "^ File $i contains double whitespaces\n"; done # Unused ErrorCodes # NOTE: to fix automatically, replace echo with: # sed -i "/extern const int $code/d" $file -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -l -P 'extern const int [_A-Z]+' | while read file; do grep -P 'extern const int [_A-Z]+;' $file | sed -r -e 's/^.*?extern const int ([_A-Z]+);.*?$/\1/' | while read code; do grep -q "ErrorCodes::$code" $file || echo "ErrorCode $code is defined but not used in file $file"; done; done +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep -l -P 'extern const int [_A-Z]+' | while read file; do grep -P 'extern const int [_A-Z]+;' $file | sed -r -e 's/^.*?extern const int ([_A-Z]+);.*?$/\1/' | while read code; do grep -q "ErrorCodes::$code" $file || echo "ErrorCode $code is defined but not used in file $file"; done; done # Undefined ErrorCodes # NOTE: to fix automatically, replace echo with: # ( grep -q -F 'namespace ErrorCodes' $file && sed -i -r "0,/(\s*)extern const int [_A-Z]+/s//\1extern const int $code;\n&/" $file || awk '{ print; if (ns == 1) { ns = 2 }; if (ns == 2) { ns = 0; print "namespace ErrorCodes\n{\n extern const int '$code';\n}" } }; /namespace DB/ { ns = 1; };' < $file > ${file}.tmp && mv ${file}.tmp $file ) -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -l -P 'ErrorCodes::[_A-Z]+' | while read file; do grep -P 'ErrorCodes::[_A-Z]+' $file | sed -r -e 's/^.*?ErrorCodes::([_A-Z]+).*?$/\1/' | while read code; do grep -q "extern const int $code" $file || echo "ErrorCode $code is used in file $file but not defined"; done; done +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep -l -P 'ErrorCodes::[_A-Z]+' | while read file; do grep -P 'ErrorCodes::[_A-Z]+' $file | sed -r -e 's/^.*?ErrorCodes::([_A-Z]+).*?$/\1/' | while read code; do grep -q "extern const int $code" $file || echo "ErrorCode $code is used in file $file but not defined"; done; done # Duplicate ErrorCodes -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -l -P 'ErrorCodes::[_A-Z]+' | while read file; do grep -P 'extern const int [_A-Z]+;' $file | sort | uniq -c | grep -v -P ' +1 ' && echo "Duplicate ErrorCode in file $file"; done +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep -l -P 'ErrorCodes::[_A-Z]+' | while read file; do grep -P 'extern const int [_A-Z]+;' $file | sort | uniq -c | grep -v -P ' +1 ' && echo "Duplicate ErrorCode in file $file"; done # Three or more consecutive empty lines -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | while read file; do awk '/^$/ { ++i; if (i > 2) { print "More than two consecutive empty lines in file '$file'" } } /./ { i = 0 }' $file; done +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + while read file; do awk '/^$/ { ++i; if (i > 2) { print "More than two consecutive empty lines in file '$file'" } } /./ { i = 0 }' $file; done # Broken XML files (requires libxml2-utils) -find $ROOT_PATH/{src,base,programs,utils} -name '*.xml' | xargs xmllint --noout --nonet +find $ROOT_PATH/{src,base,programs,utils} -name '*.xml' | + grep -vP $EXCLUDE_DIRS | + xargs xmllint --noout --nonet # Machine translation to Russian is strictly prohibited -find $ROOT_PATH/docs/ru -name '*.md' | xargs grep -l -F 'machine_translated: true' +find $ROOT_PATH/docs/ru -name '*.md' | + grep -vP $EXCLUDE_DIRS | + xargs grep -l -F 'machine_translated: true' # Tests should not be named with "fail" in their names. It makes looking at the results less convenient. -find $ROOT_PATH/tests/queries -iname '*fail*' | grep . && echo 'Tests should not be named with "fail" in their names. It makes looking at the results less convenient when you search for "fail" substring in browser.' +find $ROOT_PATH/tests/queries -iname '*fail*' | + grep -vP $EXCLUDE_DIRS | + grep . && echo 'Tests should not be named with "fail" in their names. It makes looking at the results less convenient when you search for "fail" substring in browser.' # All the submodules should be from https://github.com/ find $ROOT_PATH -name '.gitmodules' | while read i; do grep -F 'url = ' $i | grep -v -F 'https://github.com/' && echo 'All the submodules should be from https://github.com/'; done @@ -90,7 +106,9 @@ find $ROOT_PATH -not -path $ROOT_PATH'/docker*' -not -path $ROOT_PATH'/contrib*' git status -uno | grep ya.make && echo "ya.make files should be generated with utils/generate-ya-make/generate-ya-make.sh" # Check that every header file has #pragma once in first line -find $ROOT_PATH/{src,programs,utils} -name '*.h' | while read file; do [[ $(head -n1 $file) != '#pragma once' ]] && echo "File $file must have '#pragma once' in first line"; done +find $ROOT_PATH/{src,programs,utils} -name '*.h' | + grep -vP $EXCLUDE_DIRS | + while read file; do [[ $(head -n1 $file) != '#pragma once' ]] && echo "File $file must have '#pragma once' in first line"; done # Check for executable bit on non-executable files find $ROOT_PATH/{src,base,programs,utils,tests,docs,website,cmake} '(' -name '*.cpp' -or -name '*.h' -or -name '*.sql' -or -name '*.xml' -or -name '*.reference' -or -name '*.txt' -or -name '*.md' ')' -and -executable | grep -P '.' && echo "These files should not be executable." @@ -101,10 +119,16 @@ find $ROOT_PATH/{src,base,programs,utils,tests,docs,website,cmake} -name '*.md' find $ROOT_PATH/{src,base,programs,utils,tests,docs,website,cmake} -name '*.md' -or -name '*.cpp' -or -name '*.h' | xargs grep -l -F $'\xFE\xFF' | grep -P '.' && echo "Files should not have UTF-16BE BOM" # Too many exclamation marks -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -F '!!!' | grep -P '.' && echo "Too many exclamation marks (looks dirty, unconfident)." +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep -F '!!!' | grep -P '.' && echo "Too many exclamation marks (looks dirty, unconfident)." # Trailing whitespaces -find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep -P ' $' | grep -P '.' && echo "^ Trailing whitespaces." +find $ROOT_PATH/{src,base,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep -P ' $' | grep -P '.' && echo "^ Trailing whitespaces." # Forbid stringstream because it's easy to use them incorrectly and hard to debug possible issues -find $ROOT_PATH/{src,programs,utils} -name '*.h' -or -name '*.cpp' | xargs grep 'std::[io]\?stringstream' | grep -v "STYLE_CHECK_ALLOW_STD_STRING_STREAM" && echo "Use WriteBufferFromOwnString or ReadBufferFromString instead of std::stringstream" +find $ROOT_PATH/{src,programs,utils} -name '*.h' -or -name '*.cpp' | + grep -vP $EXCLUDE_DIRS | + xargs grep 'std::[io]\?stringstream' | grep -v "STYLE_CHECK_ALLOW_STD_STRING_STREAM" && echo "Use WriteBufferFromOwnString or ReadBufferFromString instead of std::stringstream" diff --git a/utils/grammar-fuzzer/ClickHouseUnlexer.py b/utils/grammar-fuzzer/ClickHouseUnlexer.py new file mode 100644 index 00000000000..c91522bd7be --- /dev/null +++ b/utils/grammar-fuzzer/ClickHouseUnlexer.py @@ -0,0 +1,1771 @@ +# Generated by Grammarinator 19.3 + +from itertools import chain +from grammarinator.runtime import * + +charset_0 = list(chain(*multirange_diff(printable_unicode_ranges, [(39, 40),(92, 93)]))) +charset_1 = list(chain(range(97, 98), range(65, 66))) +charset_2 = list(chain(range(98, 99), range(66, 67))) +charset_3 = list(chain(range(99, 100), range(67, 68))) +charset_4 = list(chain(range(100, 101), range(68, 69))) +charset_5 = list(chain(range(101, 102), range(69, 70))) +charset_6 = list(chain(range(102, 103), range(70, 71))) +charset_7 = list(chain(range(103, 104), range(71, 72))) +charset_8 = list(chain(range(104, 105), range(72, 73))) +charset_9 = list(chain(range(105, 106), range(73, 74))) +charset_10 = list(chain(range(106, 107), range(74, 75))) +charset_11 = list(chain(range(107, 108), range(75, 76))) +charset_12 = list(chain(range(108, 109), range(76, 77))) +charset_13 = list(chain(range(109, 110), range(77, 78))) +charset_14 = list(chain(range(110, 111), range(78, 79))) +charset_15 = list(chain(range(111, 112), range(79, 80))) +charset_16 = list(chain(range(112, 113), range(80, 81))) +charset_17 = list(chain(range(113, 114), range(81, 82))) +charset_18 = list(chain(range(114, 115), range(82, 83))) +charset_19 = list(chain(range(115, 116), range(83, 84))) +charset_20 = list(chain(range(116, 117), range(84, 85))) +charset_21 = list(chain(range(117, 118), range(85, 86))) +charset_22 = list(chain(range(118, 119), range(86, 87))) +charset_23 = list(chain(range(119, 120), range(87, 88))) +charset_24 = list(chain(range(120, 121), range(88, 89))) +charset_25 = list(chain(range(121, 122), range(89, 90))) +charset_26 = list(chain(range(122, 123), range(90, 91))) +charset_27 = list(chain(range(97, 123), range(65, 91))) +charset_28 = list(chain(range(48, 58))) +charset_29 = list(chain(range(48, 58), range(97, 103), range(65, 71))) +charset_30 = list(chain(*multirange_diff(printable_unicode_ranges, [(92, 93),(92, 93)]))) +charset_31 = list(chain(range(32, 33), range(11, 12), range(12, 13), range(9, 10), range(13, 14), range(10, 11))) + + +class ClickHouseUnlexer(Grammarinator): + + def __init__(self, *, max_depth=float('inf'), weights=None, cooldown=1.0): + super(ClickHouseUnlexer, self).__init__() + self.unlexer = self + self.max_depth = max_depth + self.weights = weights or dict() + self.cooldown = cooldown + + def EOF(self, *args, **kwargs): + pass + + @depthcontrol + def INTERVAL_TYPE(self): + current = self.create_node(UnlexerRule(name='INTERVAL_TYPE')) + choice = self.choice([0 if [2, 2, 2, 2, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_0', i), 1) for i, w in enumerate([1, 1, 1, 1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_0', choice)] = self.unlexer.weights.get(('alt_0', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.SECOND() + elif choice == 1: + current += self.unlexer.MINUTE() + elif choice == 2: + current += self.unlexer.HOUR() + elif choice == 3: + current += self.unlexer.DAY() + elif choice == 4: + current += self.unlexer.WEEK() + elif choice == 5: + current += self.unlexer.MONTH() + elif choice == 6: + current += self.unlexer.QUARTER() + elif choice == 7: + current += self.unlexer.YEAR() + return current + INTERVAL_TYPE.min_depth = 2 + + @depthcontrol + def ALIAS(self): + current = self.create_node(UnlexerRule(name='ALIAS')) + current += self.unlexer.A() + current += self.unlexer.L() + current += self.unlexer.I() + current += self.unlexer.A() + current += self.unlexer.S() + return current + ALIAS.min_depth = 1 + + @depthcontrol + def ALL(self): + current = self.create_node(UnlexerRule(name='ALL')) + current += self.unlexer.A() + current += self.unlexer.L() + current += self.unlexer.L() + return current + ALL.min_depth = 1 + + @depthcontrol + def AND(self): + current = self.create_node(UnlexerRule(name='AND')) + current += self.unlexer.A() + current += self.unlexer.N() + current += self.unlexer.D() + return current + AND.min_depth = 1 + + @depthcontrol + def ANTI(self): + current = self.create_node(UnlexerRule(name='ANTI')) + current += self.unlexer.A() + current += self.unlexer.N() + current += self.unlexer.T() + current += self.unlexer.I() + return current + ANTI.min_depth = 1 + + @depthcontrol + def ANY(self): + current = self.create_node(UnlexerRule(name='ANY')) + current += self.unlexer.A() + current += self.unlexer.N() + current += self.unlexer.Y() + return current + ANY.min_depth = 1 + + @depthcontrol + def ARRAY(self): + current = self.create_node(UnlexerRule(name='ARRAY')) + current += self.unlexer.A() + current += self.unlexer.R() + current += self.unlexer.R() + current += self.unlexer.A() + current += self.unlexer.Y() + return current + ARRAY.min_depth = 1 + + @depthcontrol + def AS(self): + current = self.create_node(UnlexerRule(name='AS')) + current += self.unlexer.A() + current += self.unlexer.S() + return current + AS.min_depth = 1 + + @depthcontrol + def ASCENDING(self): + current = self.create_node(UnlexerRule(name='ASCENDING')) + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_9', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_9', choice)] = self.unlexer.weights.get(('alt_9', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.C() + elif choice == 1: + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.C() + current += self.unlexer.E() + current += self.unlexer.N() + current += self.unlexer.D() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + ASCENDING.min_depth = 1 + + @depthcontrol + def ASOF(self): + current = self.create_node(UnlexerRule(name='ASOF')) + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.O() + current += self.unlexer.F() + return current + ASOF.min_depth = 1 + + @depthcontrol + def BETWEEN(self): + current = self.create_node(UnlexerRule(name='BETWEEN')) + current += self.unlexer.B() + current += self.unlexer.E() + current += self.unlexer.T() + current += self.unlexer.W() + current += self.unlexer.E() + current += self.unlexer.E() + current += self.unlexer.N() + return current + BETWEEN.min_depth = 1 + + @depthcontrol + def BOTH(self): + current = self.create_node(UnlexerRule(name='BOTH')) + current += self.unlexer.B() + current += self.unlexer.O() + current += self.unlexer.T() + current += self.unlexer.H() + return current + BOTH.min_depth = 1 + + @depthcontrol + def BY(self): + current = self.create_node(UnlexerRule(name='BY')) + current += self.unlexer.B() + current += self.unlexer.Y() + return current + BY.min_depth = 1 + + @depthcontrol + def CASE(self): + current = self.create_node(UnlexerRule(name='CASE')) + current += self.unlexer.C() + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.E() + return current + CASE.min_depth = 1 + + @depthcontrol + def CAST(self): + current = self.create_node(UnlexerRule(name='CAST')) + current += self.unlexer.C() + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.T() + return current + CAST.min_depth = 1 + + @depthcontrol + def CLUSTER(self): + current = self.create_node(UnlexerRule(name='CLUSTER')) + current += self.unlexer.C() + current += self.unlexer.L() + current += self.unlexer.U() + current += self.unlexer.S() + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.R() + return current + CLUSTER.min_depth = 1 + + @depthcontrol + def COLLATE(self): + current = self.create_node(UnlexerRule(name='COLLATE')) + current += self.unlexer.C() + current += self.unlexer.O() + current += self.unlexer.L() + current += self.unlexer.L() + current += self.unlexer.A() + current += self.unlexer.T() + current += self.unlexer.E() + return current + COLLATE.min_depth = 1 + + @depthcontrol + def CREATE(self): + current = self.create_node(UnlexerRule(name='CREATE')) + current += self.unlexer.C() + current += self.unlexer.R() + current += self.unlexer.E() + current += self.unlexer.A() + current += self.unlexer.T() + current += self.unlexer.E() + return current + CREATE.min_depth = 1 + + @depthcontrol + def CROSS(self): + current = self.create_node(UnlexerRule(name='CROSS')) + current += self.unlexer.C() + current += self.unlexer.R() + current += self.unlexer.O() + current += self.unlexer.S() + current += self.unlexer.S() + return current + CROSS.min_depth = 1 + + @depthcontrol + def DATABASE(self): + current = self.create_node(UnlexerRule(name='DATABASE')) + current += self.unlexer.D() + current += self.unlexer.A() + current += self.unlexer.T() + current += self.unlexer.A() + current += self.unlexer.B() + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.E() + return current + DATABASE.min_depth = 1 + + @depthcontrol + def DAY(self): + current = self.create_node(UnlexerRule(name='DAY')) + current += self.unlexer.D() + current += self.unlexer.A() + current += self.unlexer.Y() + return current + DAY.min_depth = 1 + + @depthcontrol + def DEFAULT(self): + current = self.create_node(UnlexerRule(name='DEFAULT')) + current += self.unlexer.D() + current += self.unlexer.E() + current += self.unlexer.F() + current += self.unlexer.A() + current += self.unlexer.U() + current += self.unlexer.L() + current += self.unlexer.T() + return current + DEFAULT.min_depth = 1 + + @depthcontrol + def DELETE(self): + current = self.create_node(UnlexerRule(name='DELETE')) + current += self.unlexer.D() + current += self.unlexer.E() + current += self.unlexer.L() + current += self.unlexer.E() + current += self.unlexer.T() + current += self.unlexer.E() + return current + DELETE.min_depth = 1 + + @depthcontrol + def DESCENDING(self): + current = self.create_node(UnlexerRule(name='DESCENDING')) + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_12', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_12', choice)] = self.unlexer.weights.get(('alt_12', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.D() + current += self.unlexer.E() + current += self.unlexer.S() + current += self.unlexer.C() + elif choice == 1: + current += self.unlexer.D() + current += self.unlexer.E() + current += self.unlexer.S() + current += self.unlexer.C() + current += self.unlexer.E() + current += self.unlexer.N() + current += self.unlexer.D() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + DESCENDING.min_depth = 1 + + @depthcontrol + def DISK(self): + current = self.create_node(UnlexerRule(name='DISK')) + current += self.unlexer.D() + current += self.unlexer.I() + current += self.unlexer.S() + current += self.unlexer.K() + return current + DISK.min_depth = 1 + + @depthcontrol + def DISTINCT(self): + current = self.create_node(UnlexerRule(name='DISTINCT')) + current += self.unlexer.D() + current += self.unlexer.I() + current += self.unlexer.S() + current += self.unlexer.T() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.C() + current += self.unlexer.T() + return current + DISTINCT.min_depth = 1 + + @depthcontrol + def DROP(self): + current = self.create_node(UnlexerRule(name='DROP')) + current += self.unlexer.D() + current += self.unlexer.R() + current += self.unlexer.O() + current += self.unlexer.P() + return current + DROP.min_depth = 1 + + @depthcontrol + def ELSE(self): + current = self.create_node(UnlexerRule(name='ELSE')) + current += self.unlexer.E() + current += self.unlexer.L() + current += self.unlexer.S() + current += self.unlexer.E() + return current + ELSE.min_depth = 1 + + @depthcontrol + def END(self): + current = self.create_node(UnlexerRule(name='END')) + current += self.unlexer.E() + current += self.unlexer.N() + current += self.unlexer.D() + return current + END.min_depth = 1 + + @depthcontrol + def ENGINE(self): + current = self.create_node(UnlexerRule(name='ENGINE')) + current += self.unlexer.E() + current += self.unlexer.N() + current += self.unlexer.G() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.E() + return current + ENGINE.min_depth = 1 + + @depthcontrol + def EXISTS(self): + current = self.create_node(UnlexerRule(name='EXISTS')) + current += self.unlexer.E() + current += self.unlexer.X() + current += self.unlexer.I() + current += self.unlexer.S() + current += self.unlexer.T() + current += self.unlexer.S() + return current + EXISTS.min_depth = 1 + + @depthcontrol + def EXTRACT(self): + current = self.create_node(UnlexerRule(name='EXTRACT')) + current += self.unlexer.E() + current += self.unlexer.X() + current += self.unlexer.T() + current += self.unlexer.R() + current += self.unlexer.A() + current += self.unlexer.C() + current += self.unlexer.T() + return current + EXTRACT.min_depth = 1 + + @depthcontrol + def FINAL(self): + current = self.create_node(UnlexerRule(name='FINAL')) + current += self.unlexer.F() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.A() + current += self.unlexer.L() + return current + FINAL.min_depth = 1 + + @depthcontrol + def FIRST(self): + current = self.create_node(UnlexerRule(name='FIRST')) + current += self.unlexer.F() + current += self.unlexer.I() + current += self.unlexer.R() + current += self.unlexer.S() + current += self.unlexer.T() + return current + FIRST.min_depth = 1 + + @depthcontrol + def FORMAT(self): + current = self.create_node(UnlexerRule(name='FORMAT')) + current += self.unlexer.F() + current += self.unlexer.O() + current += self.unlexer.R() + current += self.unlexer.M() + current += self.unlexer.A() + current += self.unlexer.T() + return current + FORMAT.min_depth = 1 + + @depthcontrol + def FROM(self): + current = self.create_node(UnlexerRule(name='FROM')) + current += self.unlexer.F() + current += self.unlexer.R() + current += self.unlexer.O() + current += self.unlexer.M() + return current + FROM.min_depth = 1 + + @depthcontrol + def FULL(self): + current = self.create_node(UnlexerRule(name='FULL')) + current += self.unlexer.F() + current += self.unlexer.U() + current += self.unlexer.L() + current += self.unlexer.L() + return current + FULL.min_depth = 1 + + @depthcontrol + def GLOBAL(self): + current = self.create_node(UnlexerRule(name='GLOBAL')) + current += self.unlexer.G() + current += self.unlexer.L() + current += self.unlexer.O() + current += self.unlexer.B() + current += self.unlexer.A() + current += self.unlexer.L() + return current + GLOBAL.min_depth = 1 + + @depthcontrol + def GROUP(self): + current = self.create_node(UnlexerRule(name='GROUP')) + current += self.unlexer.G() + current += self.unlexer.R() + current += self.unlexer.O() + current += self.unlexer.U() + current += self.unlexer.P() + return current + GROUP.min_depth = 1 + + @depthcontrol + def HAVING(self): + current = self.create_node(UnlexerRule(name='HAVING')) + current += self.unlexer.H() + current += self.unlexer.A() + current += self.unlexer.V() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + HAVING.min_depth = 1 + + @depthcontrol + def HOUR(self): + current = self.create_node(UnlexerRule(name='HOUR')) + current += self.unlexer.H() + current += self.unlexer.O() + current += self.unlexer.U() + current += self.unlexer.R() + return current + HOUR.min_depth = 1 + + @depthcontrol + def IF(self): + current = self.create_node(UnlexerRule(name='IF')) + current += self.unlexer.I() + current += self.unlexer.F() + return current + IF.min_depth = 1 + + @depthcontrol + def IN(self): + current = self.create_node(UnlexerRule(name='IN')) + current += self.unlexer.I() + current += self.unlexer.N() + return current + IN.min_depth = 1 + + @depthcontrol + def INF(self): + current = self.create_node(UnlexerRule(name='INF')) + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_15', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_15', choice)] = self.unlexer.weights.get(('alt_15', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.F() + elif choice == 1: + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.F() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.I() + current += self.unlexer.T() + current += self.unlexer.Y() + return current + INF.min_depth = 1 + + @depthcontrol + def INNER(self): + current = self.create_node(UnlexerRule(name='INNER')) + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.N() + current += self.unlexer.E() + current += self.unlexer.R() + return current + INNER.min_depth = 1 + + @depthcontrol + def INSERT(self): + current = self.create_node(UnlexerRule(name='INSERT')) + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.R() + current += self.unlexer.T() + return current + INSERT.min_depth = 1 + + @depthcontrol + def INTERVAL(self): + current = self.create_node(UnlexerRule(name='INTERVAL')) + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.R() + current += self.unlexer.V() + current += self.unlexer.A() + current += self.unlexer.L() + return current + INTERVAL.min_depth = 1 + + @depthcontrol + def INTO(self): + current = self.create_node(UnlexerRule(name='INTO')) + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.T() + current += self.unlexer.O() + return current + INTO.min_depth = 1 + + @depthcontrol + def IS(self): + current = self.create_node(UnlexerRule(name='IS')) + current += self.unlexer.I() + current += self.unlexer.S() + return current + IS.min_depth = 1 + + @depthcontrol + def JOIN(self): + current = self.create_node(UnlexerRule(name='JOIN')) + current += self.unlexer.J() + current += self.unlexer.O() + current += self.unlexer.I() + current += self.unlexer.N() + return current + JOIN.min_depth = 1 + + @depthcontrol + def KEY(self): + current = self.create_node(UnlexerRule(name='KEY')) + current += self.unlexer.K() + current += self.unlexer.E() + current += self.unlexer.Y() + return current + KEY.min_depth = 1 + + @depthcontrol + def LAST(self): + current = self.create_node(UnlexerRule(name='LAST')) + current += self.unlexer.L() + current += self.unlexer.A() + current += self.unlexer.S() + current += self.unlexer.T() + return current + LAST.min_depth = 1 + + @depthcontrol + def LEADING(self): + current = self.create_node(UnlexerRule(name='LEADING')) + current += self.unlexer.L() + current += self.unlexer.E() + current += self.unlexer.A() + current += self.unlexer.D() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + LEADING.min_depth = 1 + + @depthcontrol + def LEFT(self): + current = self.create_node(UnlexerRule(name='LEFT')) + current += self.unlexer.L() + current += self.unlexer.E() + current += self.unlexer.F() + current += self.unlexer.T() + return current + LEFT.min_depth = 1 + + @depthcontrol + def LIKE(self): + current = self.create_node(UnlexerRule(name='LIKE')) + current += self.unlexer.L() + current += self.unlexer.I() + current += self.unlexer.K() + current += self.unlexer.E() + return current + LIKE.min_depth = 1 + + @depthcontrol + def LIMIT(self): + current = self.create_node(UnlexerRule(name='LIMIT')) + current += self.unlexer.L() + current += self.unlexer.I() + current += self.unlexer.M() + current += self.unlexer.I() + current += self.unlexer.T() + return current + LIMIT.min_depth = 1 + + @depthcontrol + def LOCAL(self): + current = self.create_node(UnlexerRule(name='LOCAL')) + current += self.unlexer.L() + current += self.unlexer.O() + current += self.unlexer.C() + current += self.unlexer.A() + current += self.unlexer.L() + return current + LOCAL.min_depth = 1 + + @depthcontrol + def MATERIALIZED(self): + current = self.create_node(UnlexerRule(name='MATERIALIZED')) + current += self.unlexer.M() + current += self.unlexer.A() + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.R() + current += self.unlexer.I() + current += self.unlexer.A() + current += self.unlexer.L() + current += self.unlexer.I() + current += self.unlexer.Z() + current += self.unlexer.E() + current += self.unlexer.D() + return current + MATERIALIZED.min_depth = 1 + + @depthcontrol + def MINUTE(self): + current = self.create_node(UnlexerRule(name='MINUTE')) + current += self.unlexer.M() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.U() + current += self.unlexer.T() + current += self.unlexer.E() + return current + MINUTE.min_depth = 1 + + @depthcontrol + def MONTH(self): + current = self.create_node(UnlexerRule(name='MONTH')) + current += self.unlexer.M() + current += self.unlexer.O() + current += self.unlexer.N() + current += self.unlexer.T() + current += self.unlexer.H() + return current + MONTH.min_depth = 1 + + @depthcontrol + def NAN_SQL(self): + current = self.create_node(UnlexerRule(name='NAN_SQL')) + current += self.unlexer.N() + current += self.unlexer.A() + current += self.unlexer.N() + return current + NAN_SQL.min_depth = 1 + + @depthcontrol + def NOT(self): + current = self.create_node(UnlexerRule(name='NOT')) + current += self.unlexer.N() + current += self.unlexer.O() + current += self.unlexer.T() + return current + NOT.min_depth = 1 + + @depthcontrol + def NULL_SQL(self): + current = self.create_node(UnlexerRule(name='NULL_SQL')) + current += self.unlexer.N() + current += self.unlexer.U() + current += self.unlexer.L() + current += self.unlexer.L() + return current + NULL_SQL.min_depth = 1 + + @depthcontrol + def NULLS(self): + current = self.create_node(UnlexerRule(name='NULLS')) + current += self.unlexer.N() + current += self.unlexer.U() + current += self.unlexer.L() + current += self.unlexer.L() + current += self.unlexer.S() + return current + NULLS.min_depth = 1 + + @depthcontrol + def OFFSET(self): + current = self.create_node(UnlexerRule(name='OFFSET')) + current += self.unlexer.O() + current += self.unlexer.F() + current += self.unlexer.F() + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.T() + return current + OFFSET.min_depth = 1 + + @depthcontrol + def ON(self): + current = self.create_node(UnlexerRule(name='ON')) + current += self.unlexer.O() + current += self.unlexer.N() + return current + ON.min_depth = 1 + + @depthcontrol + def OR(self): + current = self.create_node(UnlexerRule(name='OR')) + current += self.unlexer.O() + current += self.unlexer.R() + return current + OR.min_depth = 1 + + @depthcontrol + def ORDER(self): + current = self.create_node(UnlexerRule(name='ORDER')) + current += self.unlexer.O() + current += self.unlexer.R() + current += self.unlexer.D() + current += self.unlexer.E() + current += self.unlexer.R() + return current + ORDER.min_depth = 1 + + @depthcontrol + def OUTER(self): + current = self.create_node(UnlexerRule(name='OUTER')) + current += self.unlexer.O() + current += self.unlexer.U() + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.R() + return current + OUTER.min_depth = 1 + + @depthcontrol + def OUTFILE(self): + current = self.create_node(UnlexerRule(name='OUTFILE')) + current += self.unlexer.O() + current += self.unlexer.U() + current += self.unlexer.T() + current += self.unlexer.F() + current += self.unlexer.I() + current += self.unlexer.L() + current += self.unlexer.E() + return current + OUTFILE.min_depth = 1 + + @depthcontrol + def PARTITION(self): + current = self.create_node(UnlexerRule(name='PARTITION')) + current += self.unlexer.P() + current += self.unlexer.A() + current += self.unlexer.R() + current += self.unlexer.T() + current += self.unlexer.I() + current += self.unlexer.T() + current += self.unlexer.I() + current += self.unlexer.O() + current += self.unlexer.N() + return current + PARTITION.min_depth = 1 + + @depthcontrol + def PREWHERE(self): + current = self.create_node(UnlexerRule(name='PREWHERE')) + current += self.unlexer.P() + current += self.unlexer.R() + current += self.unlexer.E() + current += self.unlexer.W() + current += self.unlexer.H() + current += self.unlexer.E() + current += self.unlexer.R() + current += self.unlexer.E() + return current + PREWHERE.min_depth = 1 + + @depthcontrol + def PRIMARY(self): + current = self.create_node(UnlexerRule(name='PRIMARY')) + current += self.unlexer.P() + current += self.unlexer.R() + current += self.unlexer.I() + current += self.unlexer.M() + current += self.unlexer.A() + current += self.unlexer.R() + current += self.unlexer.Y() + return current + PRIMARY.min_depth = 1 + + @depthcontrol + def QUARTER(self): + current = self.create_node(UnlexerRule(name='QUARTER')) + current += self.unlexer.Q() + current += self.unlexer.U() + current += self.unlexer.A() + current += self.unlexer.R() + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.R() + return current + QUARTER.min_depth = 1 + + @depthcontrol + def RIGHT(self): + current = self.create_node(UnlexerRule(name='RIGHT')) + current += self.unlexer.R() + current += self.unlexer.I() + current += self.unlexer.G() + current += self.unlexer.H() + current += self.unlexer.T() + return current + RIGHT.min_depth = 1 + + @depthcontrol + def SAMPLE(self): + current = self.create_node(UnlexerRule(name='SAMPLE')) + current += self.unlexer.S() + current += self.unlexer.A() + current += self.unlexer.M() + current += self.unlexer.P() + current += self.unlexer.L() + current += self.unlexer.E() + return current + SAMPLE.min_depth = 1 + + @depthcontrol + def SECOND(self): + current = self.create_node(UnlexerRule(name='SECOND')) + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.C() + current += self.unlexer.O() + current += self.unlexer.N() + current += self.unlexer.D() + return current + SECOND.min_depth = 1 + + @depthcontrol + def SELECT(self): + current = self.create_node(UnlexerRule(name='SELECT')) + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.L() + current += self.unlexer.E() + current += self.unlexer.C() + current += self.unlexer.T() + return current + SELECT.min_depth = 1 + + @depthcontrol + def SEMI(self): + current = self.create_node(UnlexerRule(name='SEMI')) + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.M() + current += self.unlexer.I() + return current + SEMI.min_depth = 1 + + @depthcontrol + def SET(self): + current = self.create_node(UnlexerRule(name='SET')) + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.T() + return current + SET.min_depth = 1 + + @depthcontrol + def SETTINGS(self): + current = self.create_node(UnlexerRule(name='SETTINGS')) + current += self.unlexer.S() + current += self.unlexer.E() + current += self.unlexer.T() + current += self.unlexer.T() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + current += self.unlexer.S() + return current + SETTINGS.min_depth = 1 + + @depthcontrol + def TABLE(self): + current = self.create_node(UnlexerRule(name='TABLE')) + current += self.unlexer.T() + current += self.unlexer.A() + current += self.unlexer.B() + current += self.unlexer.L() + current += self.unlexer.E() + return current + TABLE.min_depth = 1 + + @depthcontrol + def TEMPORARY(self): + current = self.create_node(UnlexerRule(name='TEMPORARY')) + current += self.unlexer.T() + current += self.unlexer.E() + current += self.unlexer.M() + current += self.unlexer.P() + current += self.unlexer.O() + current += self.unlexer.R() + current += self.unlexer.A() + current += self.unlexer.R() + current += self.unlexer.Y() + return current + TEMPORARY.min_depth = 1 + + @depthcontrol + def THEN(self): + current = self.create_node(UnlexerRule(name='THEN')) + current += self.unlexer.T() + current += self.unlexer.H() + current += self.unlexer.E() + current += self.unlexer.N() + return current + THEN.min_depth = 1 + + @depthcontrol + def TO(self): + current = self.create_node(UnlexerRule(name='TO')) + current += self.unlexer.T() + current += self.unlexer.O() + return current + TO.min_depth = 1 + + @depthcontrol + def TOTALS(self): + current = self.create_node(UnlexerRule(name='TOTALS')) + current += self.unlexer.T() + current += self.unlexer.O() + current += self.unlexer.T() + current += self.unlexer.A() + current += self.unlexer.L() + current += self.unlexer.S() + return current + TOTALS.min_depth = 1 + + @depthcontrol + def TRAILING(self): + current = self.create_node(UnlexerRule(name='TRAILING')) + current += self.unlexer.T() + current += self.unlexer.R() + current += self.unlexer.A() + current += self.unlexer.I() + current += self.unlexer.L() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + TRAILING.min_depth = 1 + + @depthcontrol + def TRIM(self): + current = self.create_node(UnlexerRule(name='TRIM')) + current += self.unlexer.T() + current += self.unlexer.R() + current += self.unlexer.I() + current += self.unlexer.M() + return current + TRIM.min_depth = 1 + + @depthcontrol + def TTL(self): + current = self.create_node(UnlexerRule(name='TTL')) + current += self.unlexer.T() + current += self.unlexer.T() + current += self.unlexer.L() + return current + TTL.min_depth = 1 + + @depthcontrol + def UNION(self): + current = self.create_node(UnlexerRule(name='UNION')) + current += self.unlexer.U() + current += self.unlexer.N() + current += self.unlexer.I() + current += self.unlexer.O() + current += self.unlexer.N() + return current + UNION.min_depth = 1 + + @depthcontrol + def USING(self): + current = self.create_node(UnlexerRule(name='USING')) + current += self.unlexer.U() + current += self.unlexer.S() + current += self.unlexer.I() + current += self.unlexer.N() + current += self.unlexer.G() + return current + USING.min_depth = 1 + + @depthcontrol + def VALUES(self): + current = self.create_node(UnlexerRule(name='VALUES')) + current += self.unlexer.V() + current += self.unlexer.A() + current += self.unlexer.L() + current += self.unlexer.U() + current += self.unlexer.E() + current += self.unlexer.S() + return current + VALUES.min_depth = 1 + + @depthcontrol + def VOLUME(self): + current = self.create_node(UnlexerRule(name='VOLUME')) + current += self.unlexer.V() + current += self.unlexer.O() + current += self.unlexer.L() + current += self.unlexer.U() + current += self.unlexer.M() + current += self.unlexer.E() + return current + VOLUME.min_depth = 1 + + @depthcontrol + def WEEK(self): + current = self.create_node(UnlexerRule(name='WEEK')) + current += self.unlexer.W() + current += self.unlexer.E() + current += self.unlexer.E() + current += self.unlexer.K() + return current + WEEK.min_depth = 1 + + @depthcontrol + def WHEN(self): + current = self.create_node(UnlexerRule(name='WHEN')) + current += self.unlexer.W() + current += self.unlexer.H() + current += self.unlexer.E() + current += self.unlexer.N() + return current + WHEN.min_depth = 1 + + @depthcontrol + def WHERE(self): + current = self.create_node(UnlexerRule(name='WHERE')) + current += self.unlexer.W() + current += self.unlexer.H() + current += self.unlexer.E() + current += self.unlexer.R() + current += self.unlexer.E() + return current + WHERE.min_depth = 1 + + @depthcontrol + def WITH(self): + current = self.create_node(UnlexerRule(name='WITH')) + current += self.unlexer.W() + current += self.unlexer.I() + current += self.unlexer.T() + current += self.unlexer.H() + return current + WITH.min_depth = 1 + + @depthcontrol + def YEAR(self): + current = self.create_node(UnlexerRule(name='YEAR')) + current += self.unlexer.Y() + current += self.unlexer.E() + current += self.unlexer.A() + current += self.unlexer.R() + return current + YEAR.min_depth = 1 + + @depthcontrol + def IDENTIFIER(self): + current = self.create_node(UnlexerRule(name='IDENTIFIER')) + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_18', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_18', choice)] = self.unlexer.weights.get(('alt_18', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.LETTER() + elif choice == 1: + current += self.unlexer.UNDERSCORE() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_more(): + choice = self.choice([0 if [1, 1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_22', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_22', choice)] = self.unlexer.weights.get(('alt_22', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.LETTER() + elif choice == 1: + current += self.unlexer.UNDERSCORE() + elif choice == 2: + current += self.unlexer.DEC_DIGIT() + + return current + IDENTIFIER.min_depth = 1 + + @depthcontrol + def FLOATING_LITERAL(self): + current = self.create_node(UnlexerRule(name='FLOATING_LITERAL')) + choice = self.choice([0 if [2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_26', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_26', choice)] = self.unlexer.weights.get(('alt_26', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.HEXADECIMAL_LITERAL() + current += self.unlexer.DOT() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_more(): + current += self.unlexer.HEX_DIGIT() + + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_33', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_33', choice)] = self.unlexer.weights.get(('alt_33', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.P() + elif choice == 1: + current += self.unlexer.E() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_37', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_37', choice)] = self.unlexer.weights.get(('alt_37', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.PLUS() + elif choice == 1: + current += self.unlexer.DASH() + + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.DEC_DIGIT() + + + elif choice == 1: + current += self.unlexer.HEXADECIMAL_LITERAL() + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_40', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_40', choice)] = self.unlexer.weights.get(('alt_40', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.P() + elif choice == 1: + current += self.unlexer.E() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_44', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_44', choice)] = self.unlexer.weights.get(('alt_44', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.PLUS() + elif choice == 1: + current += self.unlexer.DASH() + + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.DEC_DIGIT() + + elif choice == 2: + current += self.unlexer.INTEGER_LITERAL() + current += self.unlexer.DOT() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_more(): + current += self.unlexer.DEC_DIGIT() + + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + current += self.unlexer.E() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_50', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_50', choice)] = self.unlexer.weights.get(('alt_50', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.PLUS() + elif choice == 1: + current += self.unlexer.DASH() + + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.DEC_DIGIT() + + + elif choice == 3: + current += self.unlexer.INTEGER_LITERAL() + current += self.unlexer.E() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_54', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_54', choice)] = self.unlexer.weights.get(('alt_54', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.PLUS() + elif choice == 1: + current += self.unlexer.DASH() + + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.DEC_DIGIT() + + return current + FLOATING_LITERAL.min_depth = 2 + + @depthcontrol + def HEXADECIMAL_LITERAL(self): + current = self.create_node(UnlexerRule(name='HEXADECIMAL_LITERAL')) + current += self.create_node(UnlexerRule(src='0')) + current += self.unlexer.X() + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.HEX_DIGIT() + + return current + HEXADECIMAL_LITERAL.min_depth = 1 + + @depthcontrol + def INTEGER_LITERAL(self): + current = self.create_node(UnlexerRule(name='INTEGER_LITERAL')) + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.DEC_DIGIT() + + return current + INTEGER_LITERAL.min_depth = 1 + + @depthcontrol + def STRING_LITERAL(self): + current = self.create_node(UnlexerRule(name='STRING_LITERAL')) + current += self.unlexer.QUOTE_SINGLE() + if self.unlexer.max_depth >= 0: + for _ in self.zero_or_more(): + choice = self.choice([0 if [0, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_59', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_59', choice)] = self.unlexer.weights.get(('alt_59', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += UnlexerRule(src=self.char_from_list(charset_0)) + elif choice == 1: + current += self.unlexer.BACKSLASH() + current += UnlexerRule(src=self.any_char()) + + current += self.unlexer.QUOTE_SINGLE() + return current + STRING_LITERAL.min_depth = 1 + + @depthcontrol + def A(self): + current = self.create_node(UnlexerRule(name='A')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_1))) + return current + A.min_depth = 0 + + @depthcontrol + def B(self): + current = self.create_node(UnlexerRule(name='B')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_2))) + return current + B.min_depth = 0 + + @depthcontrol + def C(self): + current = self.create_node(UnlexerRule(name='C')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_3))) + return current + C.min_depth = 0 + + @depthcontrol + def D(self): + current = self.create_node(UnlexerRule(name='D')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_4))) + return current + D.min_depth = 0 + + @depthcontrol + def E(self): + current = self.create_node(UnlexerRule(name='E')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_5))) + return current + E.min_depth = 0 + + @depthcontrol + def F(self): + current = self.create_node(UnlexerRule(name='F')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_6))) + return current + F.min_depth = 0 + + @depthcontrol + def G(self): + current = self.create_node(UnlexerRule(name='G')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_7))) + return current + G.min_depth = 0 + + @depthcontrol + def H(self): + current = self.create_node(UnlexerRule(name='H')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_8))) + return current + H.min_depth = 0 + + @depthcontrol + def I(self): + current = self.create_node(UnlexerRule(name='I')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_9))) + return current + I.min_depth = 0 + + @depthcontrol + def J(self): + current = self.create_node(UnlexerRule(name='J')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_10))) + return current + J.min_depth = 0 + + @depthcontrol + def K(self): + current = self.create_node(UnlexerRule(name='K')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_11))) + return current + K.min_depth = 0 + + @depthcontrol + def L(self): + current = self.create_node(UnlexerRule(name='L')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_12))) + return current + L.min_depth = 0 + + @depthcontrol + def M(self): + current = self.create_node(UnlexerRule(name='M')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_13))) + return current + M.min_depth = 0 + + @depthcontrol + def N(self): + current = self.create_node(UnlexerRule(name='N')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_14))) + return current + N.min_depth = 0 + + @depthcontrol + def O(self): + current = self.create_node(UnlexerRule(name='O')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_15))) + return current + O.min_depth = 0 + + @depthcontrol + def P(self): + current = self.create_node(UnlexerRule(name='P')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_16))) + return current + P.min_depth = 0 + + @depthcontrol + def Q(self): + current = self.create_node(UnlexerRule(name='Q')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_17))) + return current + Q.min_depth = 0 + + @depthcontrol + def R(self): + current = self.create_node(UnlexerRule(name='R')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_18))) + return current + R.min_depth = 0 + + @depthcontrol + def S(self): + current = self.create_node(UnlexerRule(name='S')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_19))) + return current + S.min_depth = 0 + + @depthcontrol + def T(self): + current = self.create_node(UnlexerRule(name='T')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_20))) + return current + T.min_depth = 0 + + @depthcontrol + def U(self): + current = self.create_node(UnlexerRule(name='U')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_21))) + return current + U.min_depth = 0 + + @depthcontrol + def V(self): + current = self.create_node(UnlexerRule(name='V')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_22))) + return current + V.min_depth = 0 + + @depthcontrol + def W(self): + current = self.create_node(UnlexerRule(name='W')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_23))) + return current + W.min_depth = 0 + + @depthcontrol + def X(self): + current = self.create_node(UnlexerRule(name='X')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_24))) + return current + X.min_depth = 0 + + @depthcontrol + def Y(self): + current = self.create_node(UnlexerRule(name='Y')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_25))) + return current + Y.min_depth = 0 + + @depthcontrol + def Z(self): + current = self.create_node(UnlexerRule(name='Z')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_26))) + return current + Z.min_depth = 0 + + @depthcontrol + def LETTER(self): + current = self.create_node(UnlexerRule(name='LETTER')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_27))) + return current + LETTER.min_depth = 0 + + @depthcontrol + def DEC_DIGIT(self): + current = self.create_node(UnlexerRule(name='DEC_DIGIT')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_28))) + return current + DEC_DIGIT.min_depth = 0 + + @depthcontrol + def HEX_DIGIT(self): + current = self.create_node(UnlexerRule(name='HEX_DIGIT')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_29))) + return current + HEX_DIGIT.min_depth = 0 + + @depthcontrol + def ARROW(self): + current = self.create_node(UnlexerRule(name='ARROW')) + current += self.create_node(UnlexerRule(src='->')) + return current + ARROW.min_depth = 0 + + @depthcontrol + def ASTERISK(self): + current = self.create_node(UnlexerRule(name='ASTERISK')) + current += self.create_node(UnlexerRule(src='*')) + return current + ASTERISK.min_depth = 0 + + @depthcontrol + def BACKQUOTE(self): + current = self.create_node(UnlexerRule(name='BACKQUOTE')) + current += self.create_node(UnlexerRule(src='`')) + return current + BACKQUOTE.min_depth = 0 + + @depthcontrol + def BACKSLASH(self): + current = self.create_node(UnlexerRule(name='BACKSLASH')) + current += self.create_node(UnlexerRule(src='\\')) + return current + BACKSLASH.min_depth = 0 + + @depthcontrol + def COLON(self): + current = self.create_node(UnlexerRule(name='COLON')) + current += self.create_node(UnlexerRule(src=':')) + return current + COLON.min_depth = 0 + + @depthcontrol + def COMMA(self): + current = self.create_node(UnlexerRule(name='COMMA')) + current += self.create_node(UnlexerRule(src=',')) + return current + COMMA.min_depth = 0 + + @depthcontrol + def CONCAT(self): + current = self.create_node(UnlexerRule(name='CONCAT')) + current += self.create_node(UnlexerRule(src='||')) + return current + CONCAT.min_depth = 0 + + @depthcontrol + def DASH(self): + current = self.create_node(UnlexerRule(name='DASH')) + current += self.create_node(UnlexerRule(src='-')) + return current + DASH.min_depth = 0 + + @depthcontrol + def DOT(self): + current = self.create_node(UnlexerRule(name='DOT')) + current += self.create_node(UnlexerRule(src='.')) + return current + DOT.min_depth = 0 + + @depthcontrol + def EQ_DOUBLE(self): + current = self.create_node(UnlexerRule(name='EQ_DOUBLE')) + current += self.create_node(UnlexerRule(src='==')) + return current + EQ_DOUBLE.min_depth = 0 + + @depthcontrol + def EQ_SINGLE(self): + current = self.create_node(UnlexerRule(name='EQ_SINGLE')) + current += self.create_node(UnlexerRule(src='=')) + return current + EQ_SINGLE.min_depth = 0 + + @depthcontrol + def GE(self): + current = self.create_node(UnlexerRule(name='GE')) + current += self.create_node(UnlexerRule(src='>=')) + return current + GE.min_depth = 0 + + @depthcontrol + def GT(self): + current = self.create_node(UnlexerRule(name='GT')) + current += self.create_node(UnlexerRule(src='>')) + return current + GT.min_depth = 0 + + @depthcontrol + def LBRACKET(self): + current = self.create_node(UnlexerRule(name='LBRACKET')) + current += self.create_node(UnlexerRule(src='[')) + return current + LBRACKET.min_depth = 0 + + @depthcontrol + def LE(self): + current = self.create_node(UnlexerRule(name='LE')) + current += self.create_node(UnlexerRule(src='<=')) + return current + LE.min_depth = 0 + + @depthcontrol + def LPAREN(self): + current = self.create_node(UnlexerRule(name='LPAREN')) + current += self.create_node(UnlexerRule(src='(')) + return current + LPAREN.min_depth = 0 + + @depthcontrol + def LT(self): + current = self.create_node(UnlexerRule(name='LT')) + current += self.create_node(UnlexerRule(src='<')) + return current + LT.min_depth = 0 + + @depthcontrol + def NOT_EQ(self): + current = self.create_node(UnlexerRule(name='NOT_EQ')) + choice = self.choice([0 if [0, 0][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_79', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_79', choice)] = self.unlexer.weights.get(('alt_79', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.create_node(UnlexerRule(src='!=')) + elif choice == 1: + current += self.create_node(UnlexerRule(src='<>')) + return current + NOT_EQ.min_depth = 0 + + @depthcontrol + def PERCENT(self): + current = self.create_node(UnlexerRule(name='PERCENT')) + current += self.create_node(UnlexerRule(src='%')) + return current + PERCENT.min_depth = 0 + + @depthcontrol + def PLUS(self): + current = self.create_node(UnlexerRule(name='PLUS')) + current += self.create_node(UnlexerRule(src='+')) + return current + PLUS.min_depth = 0 + + @depthcontrol + def QUERY(self): + current = self.create_node(UnlexerRule(name='QUERY')) + current += self.create_node(UnlexerRule(src='?')) + return current + QUERY.min_depth = 0 + + @depthcontrol + def QUOTE_SINGLE(self): + current = self.create_node(UnlexerRule(name='QUOTE_SINGLE')) + current += self.create_node(UnlexerRule(src='\'')) + return current + QUOTE_SINGLE.min_depth = 0 + + @depthcontrol + def RBRACKET(self): + current = self.create_node(UnlexerRule(name='RBRACKET')) + current += self.create_node(UnlexerRule(src=']')) + return current + RBRACKET.min_depth = 0 + + @depthcontrol + def RPAREN(self): + current = self.create_node(UnlexerRule(name='RPAREN')) + current += self.create_node(UnlexerRule(src=')')) + return current + RPAREN.min_depth = 0 + + @depthcontrol + def SEMICOLON(self): + current = self.create_node(UnlexerRule(name='SEMICOLON')) + current += self.create_node(UnlexerRule(src=';')) + return current + SEMICOLON.min_depth = 0 + + @depthcontrol + def SLASH(self): + current = self.create_node(UnlexerRule(name='SLASH')) + current += self.create_node(UnlexerRule(src='/')) + return current + SLASH.min_depth = 0 + + @depthcontrol + def UNDERSCORE(self): + current = self.create_node(UnlexerRule(name='UNDERSCORE')) + current += self.create_node(UnlexerRule(src='_')) + return current + UNDERSCORE.min_depth = 0 + + @depthcontrol + def SINGLE_LINE_COMMENT(self): + current = self.create_node(UnlexerRule(name='SINGLE_LINE_COMMENT')) + current += self.create_node(UnlexerRule(src='--')) + if self.unlexer.max_depth >= 0: + for _ in self.zero_or_more(): + current += UnlexerRule(src=self.char_from_list(charset_30)) + + choice = self.choice([0 if [0, 0, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_95', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_95', choice)] = self.unlexer.weights.get(('alt_95', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.create_node(UnlexerRule(src='\n')) + elif choice == 1: + current += self.create_node(UnlexerRule(src='\r')) + elif choice == 2: + current += self.unlexer.EOF() + return current + SINGLE_LINE_COMMENT.min_depth = 0 + + @depthcontrol + def MULTI_LINE_COMMENT(self): + current = self.create_node(UnlexerRule(name='MULTI_LINE_COMMENT')) + current += self.create_node(UnlexerRule(src='/*')) + if self.unlexer.max_depth >= 0: + for _ in self.zero_or_more(): + current += UnlexerRule(src=self.any_char()) + + current += self.create_node(UnlexerRule(src='*/')) + return current + MULTI_LINE_COMMENT.min_depth = 0 + + @depthcontrol + def WHITESPACE(self): + current = self.create_node(UnlexerRule(name='WHITESPACE')) + current += self.create_node(UnlexerRule(src=self.char_from_list(charset_31))) + return current + WHITESPACE.min_depth = 0 + diff --git a/utils/grammar-fuzzer/ClickHouseUnparser.py b/utils/grammar-fuzzer/ClickHouseUnparser.py new file mode 100644 index 00000000000..7fa5eb96d31 --- /dev/null +++ b/utils/grammar-fuzzer/ClickHouseUnparser.py @@ -0,0 +1,1815 @@ +# Generated by Grammarinator 19.3 + +from itertools import chain +from grammarinator.runtime import * + +import ClickHouseUnlexer + + +class ClickHouseUnparser(Grammarinator): + + def __init__(self, unlexer): + super(ClickHouseUnparser, self).__init__() + self.unlexer = unlexer + @depthcontrol + def queryList(self): + current = self.create_node(UnparserRule(name='queryList')) + current += self.queryStmt() + if self.unlexer.max_depth >= 8: + for _ in self.zero_or_more(): + current += self.unlexer.SEMICOLON() + current += self.queryStmt() + + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + current += self.unlexer.SEMICOLON() + + current += self.unlexer.EOF() + return current + queryList.min_depth = 8 + + @depthcontrol + def queryStmt(self): + current = self.create_node(UnparserRule(name='queryStmt')) + current += self.query() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.INTO() + current += self.unlexer.OUTFILE() + current += self.unlexer.STRING_LITERAL() + + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.FORMAT() + current += self.identifier() + + return current + queryStmt.min_depth = 7 + + @depthcontrol + def query(self): + current = self.create_node(UnparserRule(name='query')) + choice = self.choice([0 if [6, 7, 6, 6][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_108', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_108', choice)] = self.unlexer.weights.get(('alt_108', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.distributedStmt() + elif choice == 1: + current += self.insertStmt() + elif choice == 2: + current += self.selectUnionStmt() + elif choice == 3: + current += self.setStmt() + return current + query.min_depth = 6 + + @depthcontrol + def distributedStmt(self): + current = self.create_node(UnparserRule(name='distributedStmt')) + choice = self.choice([0 if [5, 6, 6][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_113', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_113', choice)] = self.unlexer.weights.get(('alt_113', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.createDatabaseStmt() + elif choice == 1: + current += self.createTableStmt() + elif choice == 2: + current += self.dropStmt() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.ON() + current += self.unlexer.CLUSTER() + current += self.identifier() + + return current + distributedStmt.min_depth = 5 + + @depthcontrol + def createDatabaseStmt(self): + current = self.create_node(UnparserRule(name='createDatabaseStmt')) + current += self.unlexer.CREATE() + current += self.unlexer.DATABASE() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.IF() + current += self.unlexer.NOT() + current += self.unlexer.EXISTS() + + current += self.databaseIdentifier() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.engineExpr() + + return current + createDatabaseStmt.min_depth = 4 + + @depthcontrol + def createTableStmt(self): + current = self.create_node(UnparserRule(name='createTableStmt')) + current += self.unlexer.CREATE() + current += self.unlexer.TABLE() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.IF() + current += self.unlexer.NOT() + current += self.unlexer.EXISTS() + + current += self.tableIdentifier() + current += self.schemaClause() + return current + createTableStmt.min_depth = 5 + + @depthcontrol + def schemaClause(self): + current = self.create_node(UnparserRule(name='schemaClause')) + choice = self.choice([0 if [8, 7, 5, 4][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_121', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_121', choice)] = self.unlexer.weights.get(('alt_121', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.schemaClause_SchemaDescriptionClause() + elif choice == 1: + current = self.schemaClause_SchemaAsSubqueryClause() + elif choice == 2: + current = self.schemaClause_SchemaAsTableClause() + elif choice == 3: + current = self.schemaClause_SchemaAsFunctionClause() + return current + schemaClause.min_depth = 4 + + @depthcontrol + def schemaClause_SchemaDescriptionClause(self): + current = self.create_node(UnparserRule(name='schemaClause_SchemaDescriptionClause')) + current += self.unlexer.LPAREN() + current += self.tableElementExpr() + if self.unlexer.max_depth >= 7: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.tableElementExpr() + + current += self.unlexer.RPAREN() + current += self.engineClause() + return current + schemaClause_SchemaDescriptionClause.min_depth = 7 + + @depthcontrol + def schemaClause_SchemaAsSubqueryClause(self): + current = self.create_node(UnparserRule(name='schemaClause_SchemaAsSubqueryClause')) + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.engineClause() + + current += self.unlexer.AS() + current += self.selectUnionStmt() + return current + schemaClause_SchemaAsSubqueryClause.min_depth = 6 + + @depthcontrol + def schemaClause_SchemaAsTableClause(self): + current = self.create_node(UnparserRule(name='schemaClause_SchemaAsTableClause')) + current += self.unlexer.AS() + current += self.tableIdentifier() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.engineClause() + + return current + schemaClause_SchemaAsTableClause.min_depth = 4 + + @depthcontrol + def schemaClause_SchemaAsFunctionClause(self): + current = self.create_node(UnparserRule(name='schemaClause_SchemaAsFunctionClause')) + current += self.unlexer.AS() + current += self.identifier() + current += self.unlexer.LPAREN() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.tableArgList() + + current += self.unlexer.RPAREN() + return current + schemaClause_SchemaAsFunctionClause.min_depth = 3 + + @depthcontrol + def engineClause(self): + current = self.create_node(UnparserRule(name='engineClause')) + current += self.engineExpr() + if self.unlexer.max_depth >= 6: + for _ in self.zero_or_one(): + current += self.orderByClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.partitionByClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.primaryKeyClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.sampleByClause() + + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.ttlClause() + + if self.unlexer.max_depth >= 6: + for _ in self.zero_or_one(): + current += self.settingsClause() + + return current + engineClause.min_depth = 4 + + @depthcontrol + def partitionByClause(self): + current = self.create_node(UnparserRule(name='partitionByClause')) + current += self.unlexer.PARTITION() + current += self.unlexer.BY() + current += self.columnExpr() + return current + partitionByClause.min_depth = 3 + + @depthcontrol + def primaryKeyClause(self): + current = self.create_node(UnparserRule(name='primaryKeyClause')) + current += self.unlexer.PRIMARY() + current += self.unlexer.KEY() + current += self.columnExpr() + return current + primaryKeyClause.min_depth = 3 + + @depthcontrol + def sampleByClause(self): + current = self.create_node(UnparserRule(name='sampleByClause')) + current += self.unlexer.SAMPLE() + current += self.unlexer.BY() + current += self.columnExpr() + return current + sampleByClause.min_depth = 3 + + @depthcontrol + def ttlClause(self): + current = self.create_node(UnparserRule(name='ttlClause')) + current += self.unlexer.TTL() + current += self.ttlExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.ttlExpr() + + return current + ttlClause.min_depth = 4 + + @depthcontrol + def engineExpr(self): + current = self.create_node(UnparserRule(name='engineExpr')) + current += self.unlexer.ENGINE() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + current += self.unlexer.EQ_SINGLE() + + current += self.identifier() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + current += self.unlexer.LPAREN() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.tableArgList() + + current += self.unlexer.RPAREN() + + return current + engineExpr.min_depth = 3 + + @depthcontrol + def tableElementExpr(self): + current = self.create_node(UnparserRule(name='tableElementExpr')) + current = self.tableElementExpr_TableElementColumn() + return current + tableElementExpr.min_depth = 6 + + @depthcontrol + def tableElementExpr_TableElementColumn(self): + current = self.create_node(UnparserRule(name='tableElementExpr_TableElementColumn')) + current += self.identifier() + current += self.columnTypeExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.tableColumnPropertyExpr() + + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.TTL() + current += self.columnExpr() + + return current + tableElementExpr_TableElementColumn.min_depth = 5 + + @depthcontrol + def tableColumnPropertyExpr(self): + current = self.create_node(UnparserRule(name='tableColumnPropertyExpr')) + choice = self.choice([0 if [2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_142', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_142', choice)] = self.unlexer.weights.get(('alt_142', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.DEFAULT() + elif choice == 1: + current += self.unlexer.MATERIALIZED() + elif choice == 2: + current += self.unlexer.ALIAS() + current += self.columnExpr() + return current + tableColumnPropertyExpr.min_depth = 3 + + @depthcontrol + def ttlExpr(self): + current = self.create_node(UnparserRule(name='ttlExpr')) + current += self.columnExpr() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_147', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_147', choice)] = self.unlexer.weights.get(('alt_147', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.DELETE() + elif choice == 1: + current += self.unlexer.TO() + current += self.unlexer.DISK() + current += self.unlexer.STRING_LITERAL() + elif choice == 2: + current += self.unlexer.TO() + current += self.unlexer.VOLUME() + current += self.unlexer.STRING_LITERAL() + + return current + ttlExpr.min_depth = 3 + + @depthcontrol + def dropStmt(self): + current = self.create_node(UnparserRule(name='dropStmt')) + choice = self.choice([0 if [5, 5][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_151', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_151', choice)] = self.unlexer.weights.get(('alt_151', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.dropStmt_DropDatabaseStmt() + elif choice == 1: + current = self.dropStmt_DropTableStmt() + return current + dropStmt.min_depth = 5 + + @depthcontrol + def dropStmt_DropDatabaseStmt(self): + current = self.create_node(UnparserRule(name='dropStmt_DropDatabaseStmt')) + current += self.unlexer.DROP() + current += self.unlexer.DATABASE() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.IF() + current += self.unlexer.EXISTS() + + current += self.databaseIdentifier() + return current + dropStmt_DropDatabaseStmt.min_depth = 4 + + @depthcontrol + def dropStmt_DropTableStmt(self): + current = self.create_node(UnparserRule(name='dropStmt_DropTableStmt')) + current += self.unlexer.DROP() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.TEMPORARY() + + current += self.unlexer.TABLE() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.IF() + current += self.unlexer.EXISTS() + + current += self.tableIdentifier() + return current + dropStmt_DropTableStmt.min_depth = 4 + + @depthcontrol + def insertStmt(self): + current = self.create_node(UnparserRule(name='insertStmt')) + current += self.unlexer.INSERT() + current += self.unlexer.INTO() + current += self.tableIdentifier() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.LPAREN() + current += self.identifier() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.identifier() + + current += self.unlexer.RPAREN() + + current += self.valuesClause() + return current + insertStmt.min_depth = 6 + + @depthcontrol + def valuesClause(self): + current = self.create_node(UnparserRule(name='valuesClause')) + choice = self.choice([0 if [5, 6][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_159', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_159', choice)] = self.unlexer.weights.get(('alt_159', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.VALUES() + current += self.valueTupleExpr() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.valueTupleExpr() + + elif choice == 1: + current += self.selectUnionStmt() + return current + valuesClause.min_depth = 5 + + @depthcontrol + def valueTupleExpr(self): + current = self.create_node(UnparserRule(name='valueTupleExpr')) + current += self.unlexer.LPAREN() + current += self.valueExprList() + current += self.unlexer.RPAREN() + return current + valueTupleExpr.min_depth = 4 + + @depthcontrol + def selectUnionStmt(self): + current = self.create_node(UnparserRule(name='selectUnionStmt')) + current += self.selectStmt() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_more(): + current += self.unlexer.UNION() + current += self.unlexer.ALL() + current += self.selectStmt() + + return current + selectUnionStmt.min_depth = 5 + + @depthcontrol + def selectStmt(self): + current = self.create_node(UnparserRule(name='selectStmt')) + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.withClause() + + current += self.unlexer.SELECT() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.DISTINCT() + + current += self.columnExprList() + if self.unlexer.max_depth >= 8: + for _ in self.zero_or_one(): + current += self.fromClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.sampleClause() + + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.arrayJoinClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.prewhereClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.whereClause() + + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.groupByClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.havingClause() + + if self.unlexer.max_depth >= 6: + for _ in self.zero_or_one(): + current += self.orderByClause() + + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.limitByClause() + + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.limitClause() + + if self.unlexer.max_depth >= 6: + for _ in self.zero_or_one(): + current += self.settingsClause() + + return current + selectStmt.min_depth = 4 + + @depthcontrol + def withClause(self): + current = self.create_node(UnparserRule(name='withClause')) + current += self.unlexer.WITH() + current += self.columnExprList() + return current + withClause.min_depth = 4 + + @depthcontrol + def fromClause(self): + current = self.create_node(UnparserRule(name='fromClause')) + current += self.unlexer.FROM() + current += self.joinExpr() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.FINAL() + + return current + fromClause.min_depth = 7 + + @depthcontrol + def sampleClause(self): + current = self.create_node(UnparserRule(name='sampleClause')) + current += self.unlexer.SAMPLE() + current += self.ratioExpr() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.OFFSET() + current += self.ratioExpr() + + return current + sampleClause.min_depth = 3 + + @depthcontrol + def arrayJoinClause(self): + current = self.create_node(UnparserRule(name='arrayJoinClause')) + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.LEFT() + + current += self.unlexer.ARRAY() + current += self.unlexer.JOIN() + current += self.columnExprList() + return current + arrayJoinClause.min_depth = 4 + + @depthcontrol + def prewhereClause(self): + current = self.create_node(UnparserRule(name='prewhereClause')) + current += self.unlexer.PREWHERE() + current += self.columnExpr() + return current + prewhereClause.min_depth = 3 + + @depthcontrol + def whereClause(self): + current = self.create_node(UnparserRule(name='whereClause')) + current += self.unlexer.WHERE() + current += self.columnExpr() + return current + whereClause.min_depth = 3 + + @depthcontrol + def groupByClause(self): + current = self.create_node(UnparserRule(name='groupByClause')) + current += self.unlexer.GROUP() + current += self.unlexer.BY() + current += self.columnExprList() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.WITH() + current += self.unlexer.TOTALS() + + return current + groupByClause.min_depth = 4 + + @depthcontrol + def havingClause(self): + current = self.create_node(UnparserRule(name='havingClause')) + current += self.unlexer.HAVING() + current += self.columnExpr() + return current + havingClause.min_depth = 3 + + @depthcontrol + def orderByClause(self): + current = self.create_node(UnparserRule(name='orderByClause')) + current += self.unlexer.ORDER() + current += self.unlexer.BY() + current += self.orderExprList() + return current + orderByClause.min_depth = 5 + + @depthcontrol + def limitByClause(self): + current = self.create_node(UnparserRule(name='limitByClause')) + current += self.unlexer.LIMIT() + current += self.limitExpr() + current += self.unlexer.BY() + current += self.columnExprList() + return current + limitByClause.min_depth = 4 + + @depthcontrol + def limitClause(self): + current = self.create_node(UnparserRule(name='limitClause')) + current += self.unlexer.LIMIT() + current += self.limitExpr() + return current + limitClause.min_depth = 3 + + @depthcontrol + def settingsClause(self): + current = self.create_node(UnparserRule(name='settingsClause')) + current += self.unlexer.SETTINGS() + current += self.settingExprList() + return current + settingsClause.min_depth = 5 + + @depthcontrol + def joinExpr(self): + current = self.create_node(UnparserRule(name='joinExpr')) + choice = self.choice([0 if [6, 8, 8, 8][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_181', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_181', choice)] = self.unlexer.weights.get(('alt_181', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.joinExpr_JoinExprTable() + elif choice == 1: + current = self.joinExpr_JoinExprParens() + elif choice == 2: + current = self.joinExpr_JoinExprOp() + elif choice == 3: + current = self.joinExpr_JoinExprCrossOp() + return current + joinExpr.min_depth = 6 + + @depthcontrol + def joinExpr_JoinExprTable(self): + current = self.create_node(UnparserRule(name='joinExpr_JoinExprTable')) + current += self.tableExpr() + return current + joinExpr_JoinExprTable.min_depth = 5 + + @depthcontrol + def joinExpr_JoinExprParens(self): + current = self.create_node(UnparserRule(name='joinExpr_JoinExprParens')) + current += self.unlexer.LPAREN() + current += self.joinExpr() + current += self.unlexer.RPAREN() + return current + joinExpr_JoinExprParens.min_depth = 7 + + @depthcontrol + def joinExpr_JoinExprOp(self): + current = self.create_node(UnparserRule(name='joinExpr_JoinExprOp')) + current += self.joinExpr() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_187', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_187', choice)] = self.unlexer.weights.get(('alt_187', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.GLOBAL() + elif choice == 1: + current += self.unlexer.LOCAL() + + current += self.joinOp() + current += self.unlexer.JOIN() + current += self.joinExpr() + current += self.joinConstraintClause() + return current + joinExpr_JoinExprOp.min_depth = 7 + + @depthcontrol + def joinExpr_JoinExprCrossOp(self): + current = self.create_node(UnparserRule(name='joinExpr_JoinExprCrossOp')) + current += self.joinExpr() + current += self.joinOpCross() + current += self.joinExpr() + return current + joinExpr_JoinExprCrossOp.min_depth = 7 + + @depthcontrol + def joinOp(self): + current = self.create_node(UnparserRule(name='joinOp')) + choice = self.choice([0 if [3, 3, 3][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_190', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_190', choice)] = self.unlexer.weights.get(('alt_190', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.joinOp_JoinOpInner() + elif choice == 1: + current = self.joinOp_JoinOpLeftRight() + elif choice == 2: + current = self.joinOp_JoinOpFull() + return current + joinOp.min_depth = 3 + + @depthcontrol + def joinOp_JoinOpInner(self): + current = self.create_node(UnparserRule(name='joinOp_JoinOpInner')) + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_194', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_194', choice)] = self.unlexer.weights.get(('alt_194', choice), 1) * self.unlexer.cooldown + if choice == 0: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.ANY() + + current += self.unlexer.INNER() + elif choice == 1: + current += self.unlexer.INNER() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.ANY() + + return current + joinOp_JoinOpInner.min_depth = 2 + + @depthcontrol + def joinOp_JoinOpLeftRight(self): + current = self.create_node(UnparserRule(name='joinOp_JoinOpLeftRight')) + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_199', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_199', choice)] = self.unlexer.weights.get(('alt_199', choice), 1) * self.unlexer.cooldown + if choice == 0: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_203', i), 1) for i, w in enumerate([1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_203', choice)] = self.unlexer.weights.get(('alt_203', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.OUTER() + elif choice == 1: + current += self.unlexer.SEMI() + elif choice == 2: + current += self.unlexer.ANTI() + elif choice == 3: + current += self.unlexer.ANY() + elif choice == 4: + current += self.unlexer.ASOF() + + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_209', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_209', choice)] = self.unlexer.weights.get(('alt_209', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.LEFT() + elif choice == 1: + current += self.unlexer.RIGHT() + elif choice == 1: + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_212', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_212', choice)] = self.unlexer.weights.get(('alt_212', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.LEFT() + elif choice == 1: + current += self.unlexer.RIGHT() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_216', i), 1) for i, w in enumerate([1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_216', choice)] = self.unlexer.weights.get(('alt_216', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.OUTER() + elif choice == 1: + current += self.unlexer.SEMI() + elif choice == 2: + current += self.unlexer.ANTI() + elif choice == 3: + current += self.unlexer.ANY() + elif choice == 4: + current += self.unlexer.ASOF() + + return current + joinOp_JoinOpLeftRight.min_depth = 2 + + @depthcontrol + def joinOp_JoinOpFull(self): + current = self.create_node(UnparserRule(name='joinOp_JoinOpFull')) + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_222', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_222', choice)] = self.unlexer.weights.get(('alt_222', choice), 1) * self.unlexer.cooldown + if choice == 0: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_226', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_226', choice)] = self.unlexer.weights.get(('alt_226', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.OUTER() + elif choice == 1: + current += self.unlexer.ANY() + + current += self.unlexer.FULL() + elif choice == 1: + current += self.unlexer.FULL() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_230', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_230', choice)] = self.unlexer.weights.get(('alt_230', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.OUTER() + elif choice == 1: + current += self.unlexer.ANY() + + return current + joinOp_JoinOpFull.min_depth = 2 + + @depthcontrol + def joinOpCross(self): + current = self.create_node(UnparserRule(name='joinOpCross')) + choice = self.choice([0 if [2, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_233', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_233', choice)] = self.unlexer.weights.get(('alt_233', choice), 1) * self.unlexer.cooldown + if choice == 0: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_237', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_237', choice)] = self.unlexer.weights.get(('alt_237', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.GLOBAL() + elif choice == 1: + current += self.unlexer.LOCAL() + + current += self.unlexer.CROSS() + current += self.unlexer.JOIN() + elif choice == 1: + current += self.unlexer.COMMA() + return current + joinOpCross.min_depth = 1 + + @depthcontrol + def joinConstraintClause(self): + current = self.create_node(UnparserRule(name='joinConstraintClause')) + choice = self.choice([0 if [4, 4, 4][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_240', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_240', choice)] = self.unlexer.weights.get(('alt_240', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.ON() + current += self.columnExprList() + elif choice == 1: + current += self.unlexer.USING() + current += self.unlexer.LPAREN() + current += self.columnExprList() + current += self.unlexer.RPAREN() + elif choice == 2: + current += self.unlexer.USING() + current += self.columnExprList() + return current + joinConstraintClause.min_depth = 4 + + @depthcontrol + def limitExpr(self): + current = self.create_node(UnparserRule(name='limitExpr')) + current += self.unlexer.INTEGER_LITERAL() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_245', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_245', choice)] = self.unlexer.weights.get(('alt_245', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.COMMA() + elif choice == 1: + current += self.unlexer.OFFSET() + current += self.unlexer.INTEGER_LITERAL() + + return current + limitExpr.min_depth = 2 + + @depthcontrol + def orderExprList(self): + current = self.create_node(UnparserRule(name='orderExprList')) + current += self.orderExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.orderExpr() + + return current + orderExprList.min_depth = 4 + + @depthcontrol + def orderExpr(self): + current = self.create_node(UnparserRule(name='orderExpr')) + current += self.columnExpr() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_250', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_250', choice)] = self.unlexer.weights.get(('alt_250', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.ASCENDING() + elif choice == 1: + current += self.unlexer.DESCENDING() + + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.NULLS() + choice = self.choice([0 if [2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_254', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_254', choice)] = self.unlexer.weights.get(('alt_254', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.FIRST() + elif choice == 1: + current += self.unlexer.LAST() + + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.COLLATE() + current += self.unlexer.STRING_LITERAL() + + return current + orderExpr.min_depth = 3 + + @depthcontrol + def ratioExpr(self): + current = self.create_node(UnparserRule(name='ratioExpr')) + current += self.unlexer.INTEGER_LITERAL() + current += self.unlexer.SLASH() + current += self.unlexer.INTEGER_LITERAL() + return current + ratioExpr.min_depth = 2 + + @depthcontrol + def settingExprList(self): + current = self.create_node(UnparserRule(name='settingExprList')) + current += self.settingExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.settingExpr() + + return current + settingExprList.min_depth = 4 + + @depthcontrol + def settingExpr(self): + current = self.create_node(UnparserRule(name='settingExpr')) + current += self.identifier() + current += self.unlexer.EQ_SINGLE() + current += self.literal() + return current + settingExpr.min_depth = 3 + + @depthcontrol + def setStmt(self): + current = self.create_node(UnparserRule(name='setStmt')) + current += self.unlexer.SET() + current += self.settingExprList() + return current + setStmt.min_depth = 5 + + @depthcontrol + def valueExprList(self): + current = self.create_node(UnparserRule(name='valueExprList')) + current += self.valueExpr() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.valueExpr() + + return current + valueExprList.min_depth = 3 + + @depthcontrol + def valueExpr(self): + current = self.create_node(UnparserRule(name='valueExpr')) + choice = self.choice([0 if [4, 6, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_260', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_260', choice)] = self.unlexer.weights.get(('alt_260', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.valueExpr_ValueExprLiteral() + elif choice == 1: + current = self.valueExpr_ValueExprTuple() + elif choice == 2: + current = self.valueExpr_ValueExprArray() + return current + valueExpr.min_depth = 2 + + @depthcontrol + def valueExpr_ValueExprLiteral(self): + current = self.create_node(UnparserRule(name='valueExpr_ValueExprLiteral')) + current += self.literal() + return current + valueExpr_ValueExprLiteral.min_depth = 3 + + @depthcontrol + def valueExpr_ValueExprTuple(self): + current = self.create_node(UnparserRule(name='valueExpr_ValueExprTuple')) + current += self.valueTupleExpr() + return current + valueExpr_ValueExprTuple.min_depth = 5 + + @depthcontrol + def valueExpr_ValueExprArray(self): + current = self.create_node(UnparserRule(name='valueExpr_ValueExprArray')) + current += self.unlexer.LBRACKET() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.valueExprList() + + current += self.unlexer.RBRACKET() + return current + valueExpr_ValueExprArray.min_depth = 1 + + @depthcontrol + def columnTypeExpr(self): + current = self.create_node(UnparserRule(name='columnTypeExpr')) + choice = self.choice([0 if [4, 5, 4, 6][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_265', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_265', choice)] = self.unlexer.weights.get(('alt_265', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.columnTypeExpr_ColumnTypeExprSimple() + elif choice == 1: + current = self.columnTypeExpr_ColumnTypeExprParam() + elif choice == 2: + current = self.columnTypeExpr_ColumnTypeExprEnum() + elif choice == 3: + current = self.columnTypeExpr_ColumnTypeExprComplex() + return current + columnTypeExpr.min_depth = 4 + + @depthcontrol + def columnTypeExpr_ColumnTypeExprSimple(self): + current = self.create_node(UnparserRule(name='columnTypeExpr_ColumnTypeExprSimple')) + current += self.identifier() + return current + columnTypeExpr_ColumnTypeExprSimple.min_depth = 3 + + @depthcontrol + def columnTypeExpr_ColumnTypeExprParam(self): + current = self.create_node(UnparserRule(name='columnTypeExpr_ColumnTypeExprParam')) + current += self.identifier() + current += self.unlexer.LPAREN() + current += self.columnParamList() + current += self.unlexer.RPAREN() + return current + columnTypeExpr_ColumnTypeExprParam.min_depth = 4 + + @depthcontrol + def columnTypeExpr_ColumnTypeExprEnum(self): + current = self.create_node(UnparserRule(name='columnTypeExpr_ColumnTypeExprEnum')) + current += self.identifier() + current += self.unlexer.LPAREN() + current += self.enumValue() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.enumValue() + + current += self.unlexer.RPAREN() + return current + columnTypeExpr_ColumnTypeExprEnum.min_depth = 3 + + @depthcontrol + def columnTypeExpr_ColumnTypeExprComplex(self): + current = self.create_node(UnparserRule(name='columnTypeExpr_ColumnTypeExprComplex')) + current += self.identifier() + current += self.unlexer.LPAREN() + current += self.columnTypeExpr() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.columnTypeExpr() + + current += self.unlexer.RPAREN() + return current + columnTypeExpr_ColumnTypeExprComplex.min_depth = 5 + + @depthcontrol + def columnExprList(self): + current = self.create_node(UnparserRule(name='columnExprList')) + current += self.columnExpr() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.columnExpr() + + return current + columnExprList.min_depth = 3 + + @depthcontrol + def columnExpr(self): + current = self.create_node(UnparserRule(name='columnExpr')) + choice = self.choice([0 if [4, 2, 5, 2, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_273', i), 1) for i, w in enumerate([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_273', choice)] = self.unlexer.weights.get(('alt_273', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.columnExpr_ColumnExprLiteral() + elif choice == 1: + current = self.columnExpr_ColumnExprAsterisk() + elif choice == 2: + current = self.columnExpr_ColumnExprTuple() + elif choice == 3: + current = self.columnExpr_ColumnExprArray() + elif choice == 4: + current = self.columnExpr_ColumnExprCase() + elif choice == 5: + current = self.columnExpr_ColumnExprExtract() + elif choice == 6: + current = self.columnExpr_ColumnExprTrim() + elif choice == 7: + current = self.columnExpr_ColumnExprInterval() + elif choice == 8: + current = self.columnExpr_ColumnExprIdentifier() + elif choice == 9: + current = self.columnExpr_ColumnExprFunction() + elif choice == 10: + current = self.columnExpr_ColumnExprArrayAccess() + elif choice == 11: + current = self.columnExpr_ColumnExprTupleAccess() + elif choice == 12: + current = self.columnExpr_ColumnExprUnaryOp() + elif choice == 13: + current = self.columnExpr_ColumnExprIsNull() + elif choice == 14: + current = self.columnExpr_ColumnExprBinaryOp() + elif choice == 15: + current = self.columnExpr_ColumnExprTernaryOp() + elif choice == 16: + current = self.columnExpr_ColumnExprBetween() + elif choice == 17: + current = self.columnExpr_ColumnExprAlias() + return current + columnExpr.min_depth = 2 + + @depthcontrol + def columnExpr_ColumnExprLiteral(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprLiteral')) + current += self.literal() + return current + columnExpr_ColumnExprLiteral.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprAsterisk(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprAsterisk')) + current += self.unlexer.ASTERISK() + return current + columnExpr_ColumnExprAsterisk.min_depth = 1 + + @depthcontrol + def columnExpr_ColumnExprTuple(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprTuple')) + current += self.unlexer.LPAREN() + current += self.columnExprList() + current += self.unlexer.RPAREN() + return current + columnExpr_ColumnExprTuple.min_depth = 4 + + @depthcontrol + def columnExpr_ColumnExprArray(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprArray')) + current += self.unlexer.LBRACKET() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.columnExprList() + + current += self.unlexer.RBRACKET() + return current + columnExpr_ColumnExprArray.min_depth = 1 + + @depthcontrol + def columnExpr_ColumnExprCase(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprCase')) + current += self.unlexer.CASE() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.columnExpr() + + if self.unlexer.max_depth >= 0: + for _ in self.one_or_more(): + current += self.unlexer.WHEN() + current += self.columnExpr() + current += self.unlexer.THEN() + current += self.columnExpr() + + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_one(): + current += self.unlexer.ELSE() + current += self.columnExpr() + + current += self.unlexer.END() + return current + columnExpr_ColumnExprCase.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprExtract(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprExtract')) + current += self.unlexer.EXTRACT() + current += self.unlexer.LPAREN() + current += self.unlexer.INTERVAL_TYPE() + current += self.unlexer.FROM() + current += self.columnExpr() + current += self.unlexer.RPAREN() + return current + columnExpr_ColumnExprExtract.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprTrim(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprTrim')) + current += self.unlexer.TRIM() + current += self.unlexer.LPAREN() + choice = self.choice([0 if [2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_295', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_295', choice)] = self.unlexer.weights.get(('alt_295', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.BOTH() + elif choice == 1: + current += self.unlexer.LEADING() + elif choice == 2: + current += self.unlexer.TRAILING() + current += self.unlexer.STRING_LITERAL() + current += self.unlexer.FROM() + current += self.columnExpr() + current += self.unlexer.RPAREN() + return current + columnExpr_ColumnExprTrim.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprInterval(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprInterval')) + current += self.unlexer.INTERVAL() + current += self.columnExpr() + current += self.unlexer.INTERVAL_TYPE() + return current + columnExpr_ColumnExprInterval.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprIdentifier(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprIdentifier')) + current += self.columnIdentifier() + return current + columnExpr_ColumnExprIdentifier.min_depth = 4 + + @depthcontrol + def columnExpr_ColumnExprFunction(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprFunction')) + current += self.identifier() + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + current += self.unlexer.LPAREN() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.columnParamList() + + current += self.unlexer.RPAREN() + + current += self.unlexer.LPAREN() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.columnArgList() + + current += self.unlexer.RPAREN() + return current + columnExpr_ColumnExprFunction.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprArrayAccess(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprArrayAccess')) + current += self.columnExpr() + current += self.unlexer.LBRACKET() + current += self.columnExpr() + current += self.unlexer.RBRACKET() + return current + columnExpr_ColumnExprArrayAccess.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprTupleAccess(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprTupleAccess')) + current += self.columnExpr() + current += self.unlexer.DOT() + current += self.unlexer.INTEGER_LITERAL() + return current + columnExpr_ColumnExprTupleAccess.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprUnaryOp(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprUnaryOp')) + current += self.unaryOp() + current += self.columnExpr() + return current + columnExpr_ColumnExprUnaryOp.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprIsNull(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprIsNull')) + current += self.columnExpr() + current += self.unlexer.IS() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.NOT() + + current += self.unlexer.NULL_SQL() + return current + columnExpr_ColumnExprIsNull.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprBinaryOp(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprBinaryOp')) + current += self.columnExpr() + current += self.binaryOp() + current += self.columnExpr() + return current + columnExpr_ColumnExprBinaryOp.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprTernaryOp(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprTernaryOp')) + current += self.columnExpr() + current += self.unlexer.QUERY() + current += self.columnExpr() + current += self.unlexer.COLON() + current += self.columnExpr() + return current + columnExpr_ColumnExprTernaryOp.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprBetween(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprBetween')) + current += self.columnExpr() + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.NOT() + + current += self.unlexer.BETWEEN() + current += self.columnExpr() + current += self.unlexer.AND() + current += self.columnExpr() + return current + columnExpr_ColumnExprBetween.min_depth = 3 + + @depthcontrol + def columnExpr_ColumnExprAlias(self): + current = self.create_node(UnparserRule(name='columnExpr_ColumnExprAlias')) + current += self.columnExpr() + current += self.unlexer.AS() + current += self.identifier() + return current + columnExpr_ColumnExprAlias.min_depth = 3 + + @depthcontrol + def columnParamList(self): + current = self.create_node(UnparserRule(name='columnParamList')) + current += self.literal() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.literal() + + return current + columnParamList.min_depth = 3 + + @depthcontrol + def columnArgList(self): + current = self.create_node(UnparserRule(name='columnArgList')) + current += self.columnArgExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.columnArgExpr() + + return current + columnArgList.min_depth = 4 + + @depthcontrol + def columnArgExpr(self): + current = self.create_node(UnparserRule(name='columnArgExpr')) + choice = self.choice([0 if [4, 3][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_306', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_306', choice)] = self.unlexer.weights.get(('alt_306', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.columnLambdaExpr() + elif choice == 1: + current += self.columnExpr() + return current + columnArgExpr.min_depth = 3 + + @depthcontrol + def columnLambdaExpr(self): + current = self.create_node(UnparserRule(name='columnLambdaExpr')) + choice = self.choice([0 if [3, 3][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_309', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_309', choice)] = self.unlexer.weights.get(('alt_309', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.LPAREN() + current += self.identifier() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.identifier() + + current += self.unlexer.RPAREN() + elif choice == 1: + current += self.identifier() + if self.unlexer.max_depth >= 3: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.identifier() + + current += self.unlexer.ARROW() + current += self.columnExpr() + return current + columnLambdaExpr.min_depth = 3 + + @depthcontrol + def columnIdentifier(self): + current = self.create_node(UnparserRule(name='columnIdentifier')) + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.tableIdentifier() + current += self.unlexer.DOT() + + current += self.identifier() + return current + columnIdentifier.min_depth = 3 + + @depthcontrol + def tableExpr(self): + current = self.create_node(UnparserRule(name='tableExpr')) + choice = self.choice([0 if [5, 4, 7, 6][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_315', i), 1) for i, w in enumerate([1, 1, 1, 1])]) + self.unlexer.weights[('alt_315', choice)] = self.unlexer.weights.get(('alt_315', choice), 1) * self.unlexer.cooldown + if choice == 0: + current = self.tableExpr_TableExprIdentifier() + elif choice == 1: + current = self.tableExpr_TableExprFunction() + elif choice == 2: + current = self.tableExpr_TableExprSubquery() + elif choice == 3: + current = self.tableExpr_TableExprAlias() + return current + tableExpr.min_depth = 4 + + @depthcontrol + def tableExpr_TableExprIdentifier(self): + current = self.create_node(UnparserRule(name='tableExpr_TableExprIdentifier')) + current += self.tableIdentifier() + return current + tableExpr_TableExprIdentifier.min_depth = 4 + + @depthcontrol + def tableExpr_TableExprFunction(self): + current = self.create_node(UnparserRule(name='tableExpr_TableExprFunction')) + current += self.identifier() + current += self.unlexer.LPAREN() + if self.unlexer.max_depth >= 5: + for _ in self.zero_or_one(): + current += self.tableArgList() + + current += self.unlexer.RPAREN() + return current + tableExpr_TableExprFunction.min_depth = 3 + + @depthcontrol + def tableExpr_TableExprSubquery(self): + current = self.create_node(UnparserRule(name='tableExpr_TableExprSubquery')) + current += self.unlexer.LPAREN() + current += self.selectUnionStmt() + current += self.unlexer.RPAREN() + return current + tableExpr_TableExprSubquery.min_depth = 6 + + @depthcontrol + def tableExpr_TableExprAlias(self): + current = self.create_node(UnparserRule(name='tableExpr_TableExprAlias')) + current += self.tableExpr() + current += self.unlexer.AS() + current += self.identifier() + return current + tableExpr_TableExprAlias.min_depth = 5 + + @depthcontrol + def tableIdentifier(self): + current = self.create_node(UnparserRule(name='tableIdentifier')) + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_one(): + current += self.databaseIdentifier() + current += self.unlexer.DOT() + + current += self.identifier() + return current + tableIdentifier.min_depth = 3 + + @depthcontrol + def tableArgList(self): + current = self.create_node(UnparserRule(name='tableArgList')) + current += self.tableArgExpr() + if self.unlexer.max_depth >= 4: + for _ in self.zero_or_more(): + current += self.unlexer.COMMA() + current += self.tableArgExpr() + + return current + tableArgList.min_depth = 4 + + @depthcontrol + def tableArgExpr(self): + current = self.create_node(UnparserRule(name='tableArgExpr')) + choice = self.choice([0 if [3, 4][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_323', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_323', choice)] = self.unlexer.weights.get(('alt_323', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.literal() + elif choice == 1: + current += self.tableIdentifier() + return current + tableArgExpr.min_depth = 3 + + @depthcontrol + def databaseIdentifier(self): + current = self.create_node(UnparserRule(name='databaseIdentifier')) + current += self.identifier() + return current + databaseIdentifier.min_depth = 3 + + @depthcontrol + def literal(self): + current = self.create_node(UnparserRule(name='literal')) + choice = self.choice([0 if [2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_326', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_326', choice)] = self.unlexer.weights.get(('alt_326', choice), 1) * self.unlexer.cooldown + if choice == 0: + if self.unlexer.max_depth >= 1: + for _ in self.zero_or_one(): + choice = self.choice([0 if [1, 1][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_331', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_331', choice)] = self.unlexer.weights.get(('alt_331', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.PLUS() + elif choice == 1: + current += self.unlexer.DASH() + + choice = self.choice([0 if [3, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_334', i), 1) for i, w in enumerate([1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_334', choice)] = self.unlexer.weights.get(('alt_334', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.FLOATING_LITERAL() + elif choice == 1: + current += self.unlexer.HEXADECIMAL_LITERAL() + elif choice == 2: + current += self.unlexer.INTEGER_LITERAL() + elif choice == 3: + current += self.unlexer.INF() + elif choice == 4: + current += self.unlexer.NAN_SQL() + elif choice == 1: + current += self.unlexer.STRING_LITERAL() + elif choice == 2: + current += self.unlexer.NULL_SQL() + return current + literal.min_depth = 2 + + @depthcontrol + def keyword(self): + current = self.create_node(UnparserRule(name='keyword')) + choice = self.choice([0 if [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_340', i), 1) for i, w in enumerate([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_340', choice)] = self.unlexer.weights.get(('alt_340', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.ALIAS() + elif choice == 1: + current += self.unlexer.ALL() + elif choice == 2: + current += self.unlexer.AND() + elif choice == 3: + current += self.unlexer.ANTI() + elif choice == 4: + current += self.unlexer.ANY() + elif choice == 5: + current += self.unlexer.ARRAY() + elif choice == 6: + current += self.unlexer.AS() + elif choice == 7: + current += self.unlexer.ASCENDING() + elif choice == 8: + current += self.unlexer.ASOF() + elif choice == 9: + current += self.unlexer.BETWEEN() + elif choice == 10: + current += self.unlexer.BOTH() + elif choice == 11: + current += self.unlexer.BY() + elif choice == 12: + current += self.unlexer.CASE() + elif choice == 13: + current += self.unlexer.CAST() + elif choice == 14: + current += self.unlexer.CLUSTER() + elif choice == 15: + current += self.unlexer.COLLATE() + elif choice == 16: + current += self.unlexer.CREATE() + elif choice == 17: + current += self.unlexer.CROSS() + elif choice == 18: + current += self.unlexer.DAY() + elif choice == 19: + current += self.unlexer.DATABASE() + elif choice == 20: + current += self.unlexer.DEFAULT() + elif choice == 21: + current += self.unlexer.DELETE() + elif choice == 22: + current += self.unlexer.DESCENDING() + elif choice == 23: + current += self.unlexer.DISK() + elif choice == 24: + current += self.unlexer.DISTINCT() + elif choice == 25: + current += self.unlexer.DROP() + elif choice == 26: + current += self.unlexer.ELSE() + elif choice == 27: + current += self.unlexer.END() + elif choice == 28: + current += self.unlexer.ENGINE() + elif choice == 29: + current += self.unlexer.EXISTS() + elif choice == 30: + current += self.unlexer.EXTRACT() + elif choice == 31: + current += self.unlexer.FINAL() + elif choice == 32: + current += self.unlexer.FIRST() + elif choice == 33: + current += self.unlexer.FORMAT() + elif choice == 34: + current += self.unlexer.FROM() + elif choice == 35: + current += self.unlexer.FULL() + elif choice == 36: + current += self.unlexer.GLOBAL() + elif choice == 37: + current += self.unlexer.GROUP() + elif choice == 38: + current += self.unlexer.HAVING() + elif choice == 39: + current += self.unlexer.HOUR() + elif choice == 40: + current += self.unlexer.IF() + elif choice == 41: + current += self.unlexer.IN() + elif choice == 42: + current += self.unlexer.INNER() + elif choice == 43: + current += self.unlexer.INSERT() + elif choice == 44: + current += self.unlexer.INTERVAL() + elif choice == 45: + current += self.unlexer.INTO() + elif choice == 46: + current += self.unlexer.IS() + elif choice == 47: + current += self.unlexer.JOIN() + elif choice == 48: + current += self.unlexer.KEY() + elif choice == 49: + current += self.unlexer.LAST() + elif choice == 50: + current += self.unlexer.LEADING() + elif choice == 51: + current += self.unlexer.LEFT() + elif choice == 52: + current += self.unlexer.LIKE() + elif choice == 53: + current += self.unlexer.LIMIT() + elif choice == 54: + current += self.unlexer.LOCAL() + elif choice == 55: + current += self.unlexer.MATERIALIZED() + elif choice == 56: + current += self.unlexer.MINUTE() + elif choice == 57: + current += self.unlexer.MONTH() + elif choice == 58: + current += self.unlexer.NOT() + elif choice == 59: + current += self.unlexer.NULLS() + elif choice == 60: + current += self.unlexer.OFFSET() + elif choice == 61: + current += self.unlexer.ON() + elif choice == 62: + current += self.unlexer.OR() + elif choice == 63: + current += self.unlexer.ORDER() + elif choice == 64: + current += self.unlexer.OUTER() + elif choice == 65: + current += self.unlexer.OUTFILE() + elif choice == 66: + current += self.unlexer.PARTITION() + elif choice == 67: + current += self.unlexer.PREWHERE() + elif choice == 68: + current += self.unlexer.PRIMARY() + elif choice == 69: + current += self.unlexer.QUARTER() + elif choice == 70: + current += self.unlexer.RIGHT() + elif choice == 71: + current += self.unlexer.SAMPLE() + elif choice == 72: + current += self.unlexer.SECOND() + elif choice == 73: + current += self.unlexer.SEMI() + elif choice == 74: + current += self.unlexer.SET() + elif choice == 75: + current += self.unlexer.SETTINGS() + elif choice == 76: + current += self.unlexer.TABLE() + elif choice == 77: + current += self.unlexer.TEMPORARY() + elif choice == 78: + current += self.unlexer.THEN() + elif choice == 79: + current += self.unlexer.TOTALS() + elif choice == 80: + current += self.unlexer.TRAILING() + elif choice == 81: + current += self.unlexer.TRIM() + elif choice == 82: + current += self.unlexer.TO() + elif choice == 83: + current += self.unlexer.TTL() + elif choice == 84: + current += self.unlexer.UNION() + elif choice == 85: + current += self.unlexer.USING() + elif choice == 86: + current += self.unlexer.VALUES() + elif choice == 87: + current += self.unlexer.VOLUME() + elif choice == 88: + current += self.unlexer.WEEK() + elif choice == 89: + current += self.unlexer.WHEN() + elif choice == 90: + current += self.unlexer.WHERE() + elif choice == 91: + current += self.unlexer.WITH() + elif choice == 92: + current += self.unlexer.YEAR() + return current + keyword.min_depth = 2 + + @depthcontrol + def identifier(self): + current = self.create_node(UnparserRule(name='identifier')) + choice = self.choice([0 if [2, 3, 3][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_434', i), 1) for i, w in enumerate([1, 1, 1])]) + self.unlexer.weights[('alt_434', choice)] = self.unlexer.weights.get(('alt_434', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.IDENTIFIER() + elif choice == 1: + current += self.unlexer.INTERVAL_TYPE() + elif choice == 2: + current += self.keyword() + return current + identifier.min_depth = 2 + + @depthcontrol + def unaryOp(self): + current = self.create_node(UnparserRule(name='unaryOp')) + choice = self.choice([0 if [1, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_438', i), 1) for i, w in enumerate([1, 1])]) + self.unlexer.weights[('alt_438', choice)] = self.unlexer.weights.get(('alt_438', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.DASH() + elif choice == 1: + current += self.unlexer.NOT() + return current + unaryOp.min_depth = 1 + + @depthcontrol + def binaryOp(self): + current = self.create_node(UnparserRule(name='binaryOp')) + choice = self.choice([0 if [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2][i] > self.unlexer.max_depth else w * self.unlexer.weights.get(('alt_441', i), 1) for i, w in enumerate([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])]) + self.unlexer.weights[('alt_441', choice)] = self.unlexer.weights.get(('alt_441', choice), 1) * self.unlexer.cooldown + if choice == 0: + current += self.unlexer.CONCAT() + elif choice == 1: + current += self.unlexer.ASTERISK() + elif choice == 2: + current += self.unlexer.SLASH() + elif choice == 3: + current += self.unlexer.PLUS() + elif choice == 4: + current += self.unlexer.DASH() + elif choice == 5: + current += self.unlexer.PERCENT() + elif choice == 6: + current += self.unlexer.EQ_DOUBLE() + elif choice == 7: + current += self.unlexer.EQ_SINGLE() + elif choice == 8: + current += self.unlexer.NOT_EQ() + elif choice == 9: + current += self.unlexer.LE() + elif choice == 10: + current += self.unlexer.GE() + elif choice == 11: + current += self.unlexer.LT() + elif choice == 12: + current += self.unlexer.GT() + elif choice == 13: + current += self.unlexer.AND() + elif choice == 14: + current += self.unlexer.OR() + elif choice == 15: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.NOT() + + current += self.unlexer.LIKE() + elif choice == 16: + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.GLOBAL() + + if self.unlexer.max_depth >= 2: + for _ in self.zero_or_one(): + current += self.unlexer.NOT() + + current += self.unlexer.IN() + return current + binaryOp.min_depth = 1 + + @depthcontrol + def enumValue(self): + current = self.create_node(UnparserRule(name='enumValue')) + current += self.unlexer.STRING_LITERAL() + current += self.unlexer.EQ_SINGLE() + current += self.unlexer.INTEGER_LITERAL() + return current + enumValue.min_depth = 2 + + default_rule = queryList + diff --git a/utils/grammar-fuzzer/README.md b/utils/grammar-fuzzer/README.md new file mode 100644 index 00000000000..b3f233c8648 --- /dev/null +++ b/utils/grammar-fuzzer/README.md @@ -0,0 +1,41 @@ +How to use Fuzzer +=== + +The fuzzer consists of auto-generated files: + + ClickHouseUnlexer.py + ClickHouseUnparser.py + +They are generated from grammar files (.g4) using Grammarinator: + + pip3 install grammarinator + grammarinator-process ClickHouseLexer.g4 ClickHouseParser.g4 -o fuzzer/ + +Then you can generate test input for ClickHouse client: + + cd fuzzer + grammarinator-generate \ + -r query_list \ # top-level rule + -o /tmp/sql_test_%d.sql \ # template for output test names + -n 10 \ # number of tests + -c 0.3 \ + -d 20 \ # depth of recursion + -p ClickHouseUnparser.py -l ClickHouseUnlexer.py \ # auto-generated unparser and unlexer + --test-transformers SpaceTransformer.single_line_whitespace \ # transform function to insert whitespace + +For more details see `grammarinator-generate --help`. As a test-transformer function also can be used `SpaceTransformer.multi_line_transformer` - both functions reside in `fuzzer/SpaceTransformer.py` file. + + +Parsing steps +=== + +1. Replace all operators with corresponding functions. +2. Replace all asterisks with columns - if it's inside function call, then expand it as multiple arguments. Warn about undeterministic invocations when functions have positional arguments. + +Old vs. new parser +=== + +- `a as b [c]` - accessing aliased array expression is not possible. +- `a as b . 1` - accessing aliased tuple expression is not possible. +- `between a is not null and b` - `between` operator should have lower priority than `is null`. +- `*.1` - accessing asterisk tuple expression is not possible. diff --git a/utils/grammar-fuzzer/SpaceTransformer.py b/utils/grammar-fuzzer/SpaceTransformer.py new file mode 100644 index 00000000000..ad96845c7e2 --- /dev/null +++ b/utils/grammar-fuzzer/SpaceTransformer.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from grammarinator.runtime.tree import * + +from itertools import tee, islice, zip_longest +import random + + +def single_line_whitespace(node): + return _whitespace(node, ' \t') + + +def multi_line_whitespace(node): + return _whitespace(node, ' \t\r\n') + + +def _whitespace(node, symbols): + for child in node.children: + _whitespace(child, symbols) + + # helper function to look ahead one child + def with_next(iterable): + items, nexts = tee(iterable, 2) + nexts = islice(nexts, 1, None) + return zip_longest(items, nexts) + + if isinstance(node, UnparserRule): + new_children = [] + for child, next_child in with_next(node.children): + if (not next_child or + next_child and isinstance(next_child, UnlexerRule) and next_child.name == 'DOT' or + isinstance(child, UnlexerRule) and child.name == 'DOT'): + new_children.append(child) + else: + new_children.extend([child, UnlexerRule(src=random.choice(symbols))]) + node.children = new_children + + return node diff --git a/utils/grammar-fuzzer/__init__.py b/utils/grammar-fuzzer/__init__.py new file mode 100644 index 00000000000..40a96afc6ff --- /dev/null +++ b/utils/grammar-fuzzer/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/utils/grammar/ClickHouseLexer.g4 b/utils/grammar/ClickHouseLexer.g4 deleted file mode 100644 index 4f9993a476a..00000000000 --- a/utils/grammar/ClickHouseLexer.g4 +++ /dev/null @@ -1,237 +0,0 @@ -lexer grammar ClickHouseLexer; - -LINE_COMMENT - : '--' ~[\r\n]* -> channel(HIDDEN) - ; - - // TOKENS, KEYWORDS - -K_ADD : A D D; -K_AFTER : A F T E R; -K_ALL : A L L; -K_ALIAS : A L I A S; -K_ALTER : A L T E R; -K_AND : A N D; -K_ANY : A N Y; -K_ARRAY : A R R A Y; -K_AS : A S; -K_ASCENDING : A S C E N D I N G; -K_ASC : A S C; -K_ASYNC : A S Y N C; -K_ATTACH : A T T A C H; -K_BETWEEN : B E T W E E N; -K_BY : B Y; -K_CASE : C A S E; -K_CAST : C A S T; -K_CHECK : C H E C K; -K_CLUSTER : C L U S T E R; -K_COLUMN : C O L U M N; -K_COLLATE : C O L L A T E; -K_CODEC : C O D E C; -K_CREATE : C R E A T E; -K_CROSS : C R O S S; -K_DAY : D A Y; -K_DELETE : D E L E T E; -K_DESCRIBE : D E S C R I B E; -K_DESCENDING : D E S C E N D I N G; -K_DESC : D E S C; -K_DATABASE : D A T A B A S E; -K_DATABASES : D A T A B A S E S; -K_DEFAULT : D E F A U L T; -K_DETACH : D E T A C H; -K_DISK : D I S K; -K_DISTINCT : D I S T I N C T; -K_DROP : D R O P; -K_ELSE : E L S E; -K_END : E N D; -K_ENGINE : E N G I N E; -K_EXISTS : E X I S T S; -K_FETCH : F E T C H; -K_FINAL : F I N A L; -K_FIRST : F I R S T; -K_FROM : F R O M; -K_FREEZE : F R E E Z E; -K_FORMAT : F O R M A T; -K_FULL : F U L L; -K_GLOBAL : G L O B A L; -K_GROUP : G R O U P; -K_HAVING : H A V I N G; -K_HOUR : H O U R; -K_ID : I D; -K_IF : I F; -K_INNER : I N N E R; -K_INSERT : I N S E R T; -K_INTERVAL : I N T E R V A L; -K_INTO : I N T O; -K_IN : I N; -K_IS : I S; -K_JOIN : J O I N; -K_KILL: K I L L; -K_LAST : L A S T; -K_LEFT : L E F T; -K_LIKE : L I K E; -K_LIMIT : L I M I T; -K_MAIN : M A I N; // not a clickhouse reserved word -K_MATERIALIZED : M A T E R I A L I Z E D; -K_MINUTE : M I N U T E; -K_MODIFY : M O D I F Y; -K_MONTH : M O N T H; -K_NOT : N O T; -K_NULL : N U L L; -K_NULLS : N U L L S; -K_OFFSET : O F F S E T; -K_ON : O N; -K_OPTIMIZE : O P T I M I Z E; -K_ORDER : O R D E R; -K_OR : O R; -K_OUTFILE : O U T F I L E; -K_PARTITION : P A R T I T I O N; -K_POPULATE : P O P U L A T E; -K_PREWHERE : P R E W H E R E; -K_PROCESSLIST : P R O C E S S L I S T; -K_QUERY : Q U E R Y; -K_RENAME : R E N A M E; -K_RETURN : R E T U R N; // not a clickhouse reserved word -K_RIGHT : R I G H T; -K_SAMPLE : S A M P L E; -K_SECOND : S E C O N D; -K_SELECT : S E L E C T; -K_SET : S E T; -K_SETTINGS : S E T T I N G S; -K_SHOW : S H O W; -K_SYNC : S Y N C; -K_TABLE : T A B L E; -K_TABLES : T A B L E S; -K_TEMPORARY : T E M P O R A R Y; -K_TEST : T E S T; -K_THEN : T H E N; -K_TOTALS : T O T A L S; -K_TO : T O; -K_TTL : T T L; -K_OUTER: O U T E R; -K_VALUES : V A L U E S; -K_VOLUME : V O L U M E; -K_VIEW : V I E W; -K_UNION : U N I O N; -K_USE : U S E; -K_USING : U S I N G; -K_WEEK : W E E K; -K_WHEN : W H E N; -K_WHERE : W H E R E; -K_WITH : W I T H; -K_YEAR : Y E A R; - -COLON : ':' ; -COMMA : ',' ; -SEMI : ';' ; -LPAREN : '(' ; -RPAREN : ')' ; -RARROW : '->' ; -LT : '<' ; -GT : '>' ; -QUESTION : '?' ; -STAR : '*' ; -PLUS : '+' ; -CONCAT : '||' ; -OR : '|' ; -DOLLAR : '$' ; -DOT : '.' ; -PERCENT : '%' ; -MINUS : '-' ; -DIVIDE : '/' ; -EQUALS : '==' ; -ASSIGN : '=' ; -NOT_EQUALS : '!=' ; -NOT_EQUALS2 : '<>' ; -LE : '<=' ; -GE : '>=' ; -LBRAKET : '[' ; -RBRAKET : ']' ; -LCURLY : '{' ; -RCURLY : '}' ; - - -T_ARRAY : 'Array' ; -T_TUPLE : 'Tuple' ; -T_NULLABLE : 'Nullable' ; -T_FLOAT32 : 'Float32' ; -T_FLOAT64 : 'Float64' ; -T_UINT8 : 'UInt8' ; -T_UINT16 : 'UInt16' ; -T_UINT32 : 'UInt32' ; -T_UINT64 : 'UInt64' ; -T_INT8 : 'Int8' ; -T_INT16 : 'Int16' ; -T_INT32 : 'Int32' ; -T_INT64 : 'Int64' ; -T_ENUM8 : 'Enum8' ; -T_ENUM16 : 'Enum16' ; -T_UUID : 'UUID' ; -T_DATE : 'Date' ; -T_DATETIME : 'DateTime' ; -T_STRING : 'String' ; -T_FIXEDSTRING : 'FixedString' ; -T_NULL : 'Null' ; -T_INTERVAL_YEAR : 'IntervalYear' ; -T_INTERVAL_MONTH : 'IntervalMonth' ; -T_INTERVAL_WEEK : 'IntervalWeek' ; -T_INTERVAL_DAY : 'IntervalDay' ; -T_INTERVAL_HOUR : 'IntervalHour' ; -T_INTERVAL_MINUTE : 'IntervalMinute' ; -T_INTERVAL_SECOND : 'IntervalSecond' ; -T_AGGREGATE_FUNCTION : 'AggregateFunction' ; -// lambda type has unknown name. - -IDENTIFIER - : [a-zA-Z_] [a-zA-Z_0-9]* - ; - -NUMERIC_LITERAL - : DIGIT+ ( '.' DIGIT* )? ( E [-+]? DIGIT+ )? - | '.' DIGIT+ ( E [-+]? DIGIT+ )? - ; - -STRING_LITERAL - : '\'' ( ~'\'' | '\\\'' )* '\'' - ; - -QUOTED_LITERAL - : '`' ( ~'`' )* '`' - ; - -SPACES - : [ \u000B\t\r\n] -> channel(HIDDEN) - ; - -UNEXPECTED_CHAR - : . - ; - -fragment DIGIT : [0-9]; - -fragment A : [aA]; -fragment B : [bB]; -fragment C : [cC]; -fragment D : [dD]; -fragment E : [eE]; -fragment F : [fF]; -fragment G : [gG]; -fragment H : [hH]; -fragment I : [iI]; -fragment J : [jJ]; -fragment K : [kK]; -fragment L : [lL]; -fragment M : [mM]; -fragment N : [nN]; -fragment O : [oO]; -fragment P : [pP]; -fragment Q : [qQ]; -fragment R : [rR]; -fragment S : [sS]; -fragment T : [tT]; -fragment U : [uU]; -fragment V : [vV]; -fragment W : [wW]; -fragment X : [xX]; -fragment Y : [yY]; -fragment Z : [zZ]; diff --git a/utils/grammar/ClickHouseParser.g4 b/utils/grammar/ClickHouseParser.g4 deleted file mode 100644 index 9ecf4fc93e4..00000000000 --- a/utils/grammar/ClickHouseParser.g4 +++ /dev/null @@ -1,593 +0,0 @@ -parser grammar ClickHouseParser; - -options { - tokenVocab=ClickHouseLexer; -} - -// эта грамматика написана по сорсам парсеров, имена правил примерно соответствуют парсерам в cpp. -// известные расхождения -// 1. скобки не обязательно сразу идут после имени функции. -// 2. многословные токены поделены на самостоятельные слова -// 3. для INSERT запроса не написана часть парсинга значений. -// 4. правило для expr переписано чтобы понизить глубину AST и сразу выходить на уровень expr - al - -parse - : ( query | err ) EOF - ; - -query - : show_tables_query - | select_query - | insert_query - | create_query - | rename_query - | drop_query - | alter_query - | use_query - | set_query - | optimize_query - | table_properties_query - | show_processlist_query - | check_query - | kill_query_query - ; - -// 1. QUERIES - -select_query - : select_query_main ( K_UNION K_ALL select_query_main ) * - query_outfile_step? - select_format_step? - ; - -select_query_main - : select_with_step? - select_select_step select_from_step? - K_FINAL? select_sample_step? - select_array_join_step? select_join_step? - select_prewhere_step? select_where_step? - select_groupby_step? select_having_step? - select_orderby_step? - select_limitby_step? select_limit_step? - settings_step? - ; - -select_with_step - : K_WITH select_expr_list - ; - -select_select_step - : K_SELECT K_DISTINCT? select_expr_list - ; - -select_from_step - : K_FROM ( full_table_name - | table_function - | subquery - ) select_alias? - ; - -select_array_join_step - : K_LEFT? K_ARRAY K_JOIN not_empty_expression_list - ; - -select_sample_step - : K_SAMPLE sample_ratio (K_OFFSET sample_ratio ) ? - ; - -sample_ratio - : NUMERIC_LITERAL ( DIVIDE NUMERIC_LITERAL ) ? - ; - -select_join_step - : K_GLOBAL? - ( K_ANY | K_ALL ) ( K_INNER | K_LEFT K_OUTER? | K_RIGHT K_OUTER? | K_FULL K_OUTER? ) K_JOIN select_join_right_part - ( K_USING LPAREN not_empty_expression_list RPAREN - | K_USING not_empty_expression_list - // | K_ON expr на самом деле нет. - ) - | K_GLOBAL? K_CROSS K_JOIN select_join_right_part - ; - -select_join_right_part - : identifier - | subquery - ; - -select_prewhere_step - : K_PREWHERE expression_with_optional_alias - ; - -select_where_step - : K_WHERE expression_with_optional_alias - ; - -select_groupby_step - : K_GROUP K_BY not_empty_expression_list ( K_WITH K_TOTALS ) ? - ; - -select_having_step - : K_HAVING expression_with_optional_alias - ; - -select_orderby_step - : K_ORDER K_BY order_by_expression_list - ; - -select_limit_step - : K_LIMIT NUMERIC_LITERAL ( COMMA NUMERIC_LITERAL )? - ; - -select_limitby_step - : K_LIMIT NUMERIC_LITERAL K_BY not_empty_expression_list - ; - -settings_step - : K_SETTINGS assignment_list - ; - -select_format_step - : K_FORMAT identifier - ; - -insert_query - : K_INSERT K_INTO full_table_name - ( K_ID ASSIGN STRING_LITERAL )? // wtf? - ( LPAREN column_name_list RPAREN )? - ( K_VALUES LPAREN literal (COMMA literal )* RPAREN(COMMA LPAREN literal (COMMA literal )* RPAREN)* // ch тут дальше не парсит. а я написал скобки - | K_FORMAT format_name // ch тут дальше не парсит, только доедает все пробелы или один перевод строки. pushMode() - | select_query ) - ; - -create_query - : ( K_CREATE | K_ATTACH ) K_TEMPORARY? - ( K_DATABASE ( K_IF K_NOT K_EXISTS ) ? database_name - | K_TABLE ( K_IF K_NOT K_EXISTS ) ? full_table_name ( K_ON K_CLUSTER cluster_name ) ? - ( LPAREN column_declaration_list RPAREN engine ( K_AS select_query ) ? - K_ORDER K_BY LPAREN order_by_expression_list RPAREN - (K_PARTITION K_BY partitionExpr=expr)? - (K_SAMPLE K_BY sampleExpr=expr)? - table_ttl_list? - settings_step? - | engine K_AS ( select_query - | full_table_name engine? // wtf - ) - ) - | K_MATERIALIZED? K_VIEW ( K_IF K_NOT K_EXISTS ) ? full_table_name - ( LPAREN column_declaration_list RPAREN ) ? engine? K_POPULATE? K_AS select_query - ) - ; - -rename_query - : K_RENAME K_TABLE full_table_name K_TO full_table_name ( COMMA full_table_name K_TO full_table_name )* ( K_ON K_CLUSTER cluster_name ) ? - ; - -drop_query - : ( K_DROP | K_DETACH ) - ( K_DATABASE ( K_IF K_EXISTS ) ? database_name ( K_ON K_CLUSTER cluster_name ) ? - | K_TABLE ( K_IF K_EXISTS ) ? full_table_name ( K_ON K_CLUSTER cluster_name ) ? - ) - ; - -alter_query - : K_ALTER K_TABLE full_table_name ( K_ON K_CLUSTER cluster_name ) ? - alter_query_element ( COMMA alter_query_element ) * - ; - -alter_query_element - : K_ADD K_COLUMN compound_name_type_pair ( K_AFTER column_name ) ? - | K_DROP K_COLUMN column_name - | K_MODIFY K_COLUMN compound_name_type_pair - | K_ATTACH K_PARTITION partition_name - | K_DETACH K_PARTITION partition_name - | K_DROP K_PARTITION partition_name - | K_FETCH K_PARTITION partition_name K_FROM STRING_LITERAL - | K_FREEZE K_PARTITION partition_name - ; - -clickhouse_type - : simple_type - | T_AGGREGATE_FUNCTION LPAREN function_name ( COMMA clickhouse_type ) * RPAREN - | T_ARRAY LPAREN clickhouse_type RPAREN - | T_TUPLE LPAREN clickhouse_type ( COMMA clickhouse_type ) * RPAREN - | T_NULLABLE LPAREN clickhouse_type RPAREN - ; - -simple_type - : T_UINT8 - | T_UINT16 - | T_UINT32 - | T_UINT64 - | T_INT8 - | T_INT16 - | T_INT32 - | T_INT64 - | T_FLOAT32 - | T_FLOAT64 - | T_ENUM8 LPAREN enum_entry ( COMMA enum_entry ) * LPAREN - | T_ENUM16 LPAREN enum_entry ( COMMA enum_entry ) * LPAREN - | T_UUID - | T_DATE - | T_DATETIME - | T_STRING - | T_INTERVAL_YEAR - | T_INTERVAL_MONTH - | T_INTERVAL_WEEK - | T_INTERVAL_DAY - | T_INTERVAL_HOUR - | T_INTERVAL_MINUTE - | T_INTERVAL_SECOND - | T_NULL - | T_FIXEDSTRING LPAREN NUMERIC_LITERAL LPAREN - ; - -enum_entry - : STRING_LITERAL ASSIGN NUMERIC_LITERAL - ; - -use_query - : K_USE database_name - ; - -set_query - : K_SET K_GLOBAL? assignment_list - ; - -assignment_list - : assignment ( COMMA assignment ) * - ; - -assignment - : identifier ASSIGN literal - ; - -kill_query_query - : K_KILL K_QUERY K_WHERE expression_with_optional_alias ( K_SYNC | K_ASYNC | K_TEST ) - ; - -optimize_query - : K_OPTIMIZE K_TABLE full_table_name ( K_PARTITION STRING_LITERAL ) ? K_FINAL? - ; - -table_properties_query - : ( K_EXISTS | ( K_DESCRIBE | K_DESC ) | K_SHOW K_CREATE ) K_TABLE full_table_name query_outfile_step? ( K_FORMAT format_name ) ? - ; - -show_tables_query - : K_SHOW ( K_DATABASES - | K_TABLES ( K_FROM database_name ) ? ( K_NOT? K_LIKE STRING_LITERAL ) ? ) - query_outfile_step? - ( K_FORMAT format_name ) ? - ; - -show_processlist_query - : K_SHOW K_PROCESSLIST query_outfile_step? ( K_FORMAT format_name ) ? - ; - -check_query - : K_CHECK K_TABLE full_table_name - ; - -// 2. QUERY ELEMENTS - -full_table_name - : ( database_name DOT ) ? table_name - ; - -partition_name - : identifier | STRING_LITERAL - ; - -cluster_name - : identifier | STRING_LITERAL - ; - -database_name - : identifier - ; - -table_name - : identifier - ; - -format_name - : identifier - ; - -query_outfile_step - : K_INTO K_OUTFILE STRING_LITERAL - ; - -engine - : K_ENGINE ASSIGN identifier_with_optional_parameters - ; - -identifier_with_optional_parameters - : identifier_with_parameters - | identifier - ; - -identifier_with_parameters - : function - | nested_table - ; - -order_by_expression_list - : order_by_element ( COMMA order_by_element ) * - ; - -order_by_element - : expression_with_optional_alias ( K_DESC | K_DESCENDING | K_ASC | K_ASCENDING ) ? ( K_NULLS ( K_FIRST | K_LAST ) ) ? ( K_COLLATE STRING_LITERAL ) ? - ; - -table_ttl_list - : K_TTL table_ttl_declaration ( COMMA table_ttl_declaration ) * - ; - -table_ttl_declaration - : ttlExpr=expr (K_DELETE | K_TO K_DISK diskVal=STRING_LITERAL | K_TO K_VOLUME volumeVal=STRING_LITERAL)? - ; - -nested_table - : identifier LPAREN name_type_pair_list RPAREN - ; - -name_type_pair_list - : name_type_pair ( COMMA name_type_pair ) * - ; - -name_type_pair - : identifier column_type - ; - -compound_name_type_pair - : compound_identifier column_type - ; - -column_declaration_list - : column_declaration ( COMMA column_declaration ) * - ; - -column_declaration - : column_name column_type (( K_DEFAULT | K_MATERIALIZED | K_ALIAS ) expr)? (K_CODEC(expr))? (K_TTL ttlExpr=expr)? - ; - -column_name - : identifier - ; - -column_type - : clickhouse_type - ; - -column_name_list - : column_name ( COMMA column_name ) * - ; - -select_expr_list - : select_expr ( COMMA select_expr) * - ; - -select_expr - : expr select_alias? - ; - -select_alias - : K_AS? alias_name - ; - -alias - : K_AS alias_name - ; - -alias_name - : identifier - ; - -table_function - : function - ; - - -subquery - : LPAREN select_query_main RPAREN - ; - -expression_with_optional_alias - : expr alias? - ; - -// EXPRESSIONS - -expr - : LPAREN expr RPAREN # ExprParen - | function # ExprFunction - | K_CASE expr? ( K_WHEN expr K_THEN expr ) ( K_WHEN expr K_THEN expr ) * K_ELSE expr K_END # ExprCase - | expr DOT expr # ExprTupleElement - | expr LBRAKET expr RBRAKET # ExprArrayElement - | MINUS expr # ExprUnaryMinus - | K_CAST LPAREN expr K_AS clickhouse_type RPAREN # ExprCast - | expr ( STAR | DIVIDE | PERCENT ) expr # ExprMul - | expr ( PLUS | MINUS ) expr # ExprAdd - | expr CONCAT expr # ExprConcat - | expr K_BETWEEN expr K_AND expr # ExprBetween - | expr ( EQUALS | ASSIGN | NOT_EQUALS | NOT_EQUALS2 | LE | GE | LT | GT | K_LIKE | K_NOT K_LIKE ) expr # ExprLogical - | expr ( K_IN | K_NOT K_IN | K_GLOBAL K_IN | K_GLOBAL K_NOT K_IN ) expr # ExprIn - | expr ( K_IS K_NULL | K_IS K_NOT K_NULL ) # ExprIsNull - | K_INTERVAL expr interval_unit # ExprInterval - | K_NOT expr # ExprNot - | expr K_AND expr # ExprAnd - | expr K_OR expr # ExprOr - | expr QUESTION expr COLON expr # ExprTernary - | ( LPAREN identifier ( COMMA identifier )* RPAREN | identifier ( COMMA identifier )* ) RARROW expr # ExprLambda - | subquery # ExprSubquery - | LPAREN not_empty_expression_list RPAREN # ExprList - | array # ExprArray - | literal # ExprLiteral - | compound_identifier # ExprId - | STAR # ExprStar - | expr alias # ExprWithAlias - ; - -interval_unit - : K_YEAR - | K_MONTH - | K_WEEK - | K_DAY - | K_HOUR - | K_MINUTE - | K_SECOND - ; -expression_list - : ( not_empty_expression_list )? - ; - -not_empty_expression_list - : expr ( COMMA expr )* - ; - -array - : LBRAKET expression_list RBRAKET - ; - -function - : function_name function_parameters? function_arguments - ; - -function_parameters - : LPAREN ( expr ( COMMA expr )* )? RPAREN - ; -function_arguments - : LPAREN ( expr ( COMMA expr )* )? RPAREN - ; - -function_name - : identifier - ; - -identifier - : QUOTED_LITERAL - | IDENTIFIER - // в данном случае мы разрешаем ключевым словам выступать в качестве имен колонок или функций. - | simple_type - | keyword - ; - -keyword - : K_ADD - | K_AFTER - | K_ALL - | K_ALIAS - | K_ALTER - | K_AND - | K_ANY - | K_ARRAY - | K_AS - | K_ASCENDING - | K_ASC - | K_ASYNC - | K_ATTACH - | K_BETWEEN - | K_BY - | K_CASE - | K_CHECK - | K_COLUMN - | K_COLLATE - | K_CREATE - | K_CROSS - | K_DESCRIBE - | K_DESCENDING - | K_DESC - | K_DATABASE - | K_DATABASES - | K_DEFAULT - | K_DETACH - | K_DISTINCT - | K_DROP - | K_ENGINE - | K_ELSE - | K_END - | K_EXISTS - | K_FINAL - | K_FIRST - | K_FROM - | K_FORMAT - | K_FULL - | K_GLOBAL - | K_GROUP - | K_HAVING - | K_ID - | K_IF - | K_INNER - | K_INSERT - | K_INTO - | K_IN - | K_IS - | K_JOIN - | K_KILL - | K_LAST - | K_LEFT - | K_LIKE - | K_LIMIT - | K_MAIN - | K_MATERIALIZED - | K_MODIFY - | K_NOT - | K_NULL - | K_NULLS - | K_OFFSET - | K_ON - | K_OPTIMIZE - | K_ORDER - | K_OR - | K_OUTFILE - | K_PARTITION - | K_POPULATE - | K_PREWHERE - | K_PROCESSLIST - | K_QUERY - | K_RENAME - | K_RETURN - | K_RIGHT - | K_SAMPLE - | K_SELECT - | K_SET - | K_SETTINGS - | K_SHOW - | K_SYNC - | K_TABLE - | K_TABLES - | K_TEMPORARY - | K_TEST - | K_THEN - | K_TOTALS - | K_TO - | K_OUTER - | K_VALUES - | K_VIEW - | K_UNION - | K_USE - | K_USING - | K_WHEN - | K_WHERE - | K_WITH - ; - -compound_identifier -: identifier DOT identifier -| identifier -; - - -literal - : K_NULL - | NUMERIC_LITERAL - | STRING_LITERAL - ; - -err - : UNEXPECTED_CHAR - { - throw new RuntimeException("UNEXPECTED_CHAR=" + $UNEXPECTED_CHAR.text); - } - ; diff --git a/utils/grammar/README.md b/utils/grammar/README.md deleted file mode 100644 index 03a611be69c..00000000000 --- a/utils/grammar/README.md +++ /dev/null @@ -1,8 +0,0 @@ -ClickHouse grammar for ANTLR4 -============================= - -Authors: Yuriy Galitskiy (orantius, https://github.com/duremar), Sergey Serebryanik (serebrserg, https://github.com/serebrserg), Efim Pyshnograev (graev). - -Initially developed for Yandex.Metrica product and published under Apache 2.0 license with permission from Yandex. It has also found its usage in DataGrip product. - -It is not used in ClickHouse directly and is not synchronized with ClickHouse C++ code. Neither supported or tested. Any help welcome. diff --git a/utils/syntax-analyzer/CMakeLists.txt b/utils/syntax-analyzer/CMakeLists.txt new file mode 100644 index 00000000000..77068f528be --- /dev/null +++ b/utils/syntax-analyzer/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(syntax-analyzer main.cpp) + +target_link_libraries(syntax-analyzer PRIVATE clickhouse_parsers_new dbms) diff --git a/utils/syntax-analyzer/main.cpp b/utils/syntax-analyzer/main.cpp new file mode 100644 index 00000000000..7f1d2c979ec --- /dev/null +++ b/utils/syntax-analyzer/main.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +using namespace DB; + +int main(int argc, const char **) +{ + if (argc > 1) + { + std::cerr << "No arguments needed. Reads query from input until EOF" << std::endl; + return 1; + } + + std::istreambuf_iterator begin(std::cin), end; + std::string query(begin, end); + + { + std::vector queries; + splitMultipartQuery(query, queries, 10000000, 10000); + for (const auto & q : queries) + { + std::cout << std::endl << "Query:" << std::endl; + std::cout << q << std::endl; + + ParserQuery parser(q.data() + q.size()); + ASTPtr orig_ast = parseQuery(parser, q, 10000000, 10000); + + std::cout << std::endl << "New AST:" << std::endl; + auto new_ast = parseQuery(q); + new_ast->dump(); + + auto old_ast = new_ast->convertToOld(); + if (orig_ast) + { + std::cout << std::endl << "Original AST:" << std::endl; + WriteBufferFromOStream buf(std::cout, 1); + orig_ast->dumpTree(buf); + std::cout << std::endl << "Original query:" << std::endl; + orig_ast->format({buf, false}); + std::cout << std::endl; + } + if (old_ast) + { + std::cout << std::endl << "Converted AST:" << std::endl; + WriteBufferFromOStream buf(std::cout, 1); + old_ast->dumpTree(buf); + std::cout << std::endl << "Converted query:" << std::endl; + old_ast->format({buf, false}); + std::cout << std::endl; + } + } + } +} From 764b06f28ba8669cc91a834d7700542e857cb687 Mon Sep 17 00:00:00 2001 From: jianmei zhang Date: Fri, 4 Dec 2020 11:18:44 +0800 Subject: [PATCH 47/48] Fix over-translation and update contents to latest on random-functions, encoding-functions and conditional-functions --- .../functions/conditional-functions.md | 179 ++++++++++++++++-- .../functions/encoding-functions.md | 70 ++++++- .../functions/random-functions.md | 2 +- 3 files changed, 234 insertions(+), 17 deletions(-) diff --git a/docs/zh/sql-reference/functions/conditional-functions.md b/docs/zh/sql-reference/functions/conditional-functions.md index b8e96620014..a804f723d6f 100644 --- a/docs/zh/sql-reference/functions/conditional-functions.md +++ b/docs/zh/sql-reference/functions/conditional-functions.md @@ -1,13 +1,108 @@ # 条件函数 {#tiao-jian-han-shu} -## 如果(cond,那么,否则),cond? 运算符然后:else {#ifcond-then-else-cond-operator-then-else} +## if {#if} + +控制条件分支。 与大多数系统不同,ClickHouse始终评估两个表达式 `then` 和 `else`。 + +**语法** + +``` sql +SELECT if(cond, then, else) +``` + +如果条件 `cond` 的计算结果为非零值,则返回表达式 `then` 的结果,并且跳过表达式 `else` 的结果(如果存在)。 如果 `cond` 为零或 `NULL`,则将跳过 `then` 表达式的结果,并返回 `else` 表达式的结果(如果存在)。 + +**参数** + +- `cond` – 条件结果可以为零或不为零。 类型是 UInt8,Nullable(UInt8) 或 NULL。 +- `then` - 如果满足条件则返回的表达式。 +- `else` - 如果不满足条件则返回的表达式。 + +**返回值** + +该函数执行 `then` 和 `else` 表达式并返回其结果,这取决于条件 `cond` 最终是否为零。 + +**示例** + +查询: + +``` sql +SELECT if(1, plus(2, 2), plus(2, 6)) +``` + +结果: + +``` text +┌─plus(2, 2)─┐ +│ 4 │ +└────────────┘ +``` + +查询: + +``` sql +SELECT if(0, plus(2, 2), plus(2, 6)) +``` + +结果: + +``` text +┌─plus(2, 6)─┐ +│ 8 │ +└────────────┘ +``` + +- `then` 和 `else` 必须具有最低的通用类型。 + +**示例:** + +给定表`LEFT_RIGHT`: + +``` sql +SELECT * +FROM LEFT_RIGHT + +┌─left─┬─right─┐ +│ ᴺᵁᴸᴸ │ 4 │ +│ 1 │ 3 │ +│ 2 │ 2 │ +│ 3 │ 1 │ +│ 4 │ ᴺᵁᴸᴸ │ +└──────┴───────┘ +``` + +下面的查询比较了 `left` 和 `right` 的值: + +``` sql +SELECT + left, + right, + if(left < right, 'left is smaller than right', 'right is greater or equal than left') AS is_smaller +FROM LEFT_RIGHT +WHERE isNotNull(left) AND isNotNull(right) + +┌─left─┬─right─┬─is_smaller──────────────────────────┐ +│ 1 │ 3 │ left is smaller than right │ +│ 2 │ 2 │ right is greater or equal than left │ +│ 3 │ 1 │ right is greater or equal than left │ +└──────┴───────┴─────────────────────────────────────┘ +``` + +注意:在此示例中未使用'NULL'值,请检查[条件中的NULL值](#null-values-in-conditionals) 部分。 + +## 三元运算符 {#ternary-operator} + +与 `if` 函数相同。 + +语法: `cond ? then : else` 如果`cond != 0`则返回`then`,如果`cond = 0`则返回`else`。 -`cond`必须是`UInt8`类型,`then`和`else`必须存在最低的共同类型。 -`then`和`else`可以是`NULL` +- `cond`必须是`UInt8`类型,`then`和`else`必须存在最低的共同类型。 -## 多 {#multiif} +- `then`和`else`可以是`NULL` + +## multiIf {#multiif} 允许您在查询中更紧凑地编写[CASE](../operators/index.md#operator_case)运算符。 @@ -27,18 +122,74 @@ **示例** -存在如下一张表 +再次使用表 `LEFT_RIGHT` 。 - ┌─x─┬────y─┐ - │ 1 │ ᴺᵁᴸᴸ │ - │ 2 │ 3 │ - └───┴──────┘ +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'left is greater', left = right, 'Both equal', 'Null value') AS result +FROM LEFT_RIGHT -执行查询 `SELECT multiIf(isNull(y), x, y < 3, y, NULL) FROM t_null`。结果: +┌─left─┬─right─┬─result──────────┐ +│ ᴺᵁᴸᴸ │ 4 │ Null value │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ left is greater │ +│ 4 │ ᴺᵁᴸᴸ │ Null value │ +└──────┴───────┴─────────────────┘ +``` +## 直接使用条件结果 {#using-conditional-results-directly} - ┌─multiIf(isNull(y), x, less(y, 3), y, NULL)─┐ - │ 1 │ - │ ᴺᵁᴸᴸ │ - └────────────────────────────────────────────┘ +条件结果始终为 `0`、 `1` 或 `NULL`。 因此,你可以像这样直接使用条件结果: + +``` sql +SELECT left < right AS is_small +FROM LEFT_RIGHT + +┌─is_small─┐ +│ ᴺᵁᴸᴸ │ +│ 1 │ +│ 0 │ +│ 0 │ +│ ᴺᵁᴸᴸ │ +└──────────┘ +``` + +## 条件中的NULL值 {#null-values-in-conditionals} + +当条件中包含 `NULL` 值时,结果也将为 `NULL`。 + +``` sql +SELECT + NULL < 1, + 2 < NULL, + NULL < NULL, + NULL = NULL + +┌─less(NULL, 1)─┬─less(2, NULL)─┬─less(NULL, NULL)─┬─equals(NULL, NULL)─┐ +│ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ +└───────────────┴───────────────┴──────────────────┴────────────────────┘ +``` + +因此,如果类型是 `Nullable`,你应该仔细构造查询。 + +以下示例说明这一点。 + +``` sql +SELECT + left, + right, + multiIf(left < right, 'left is smaller', left > right, 'right is smaller', 'Both equal') AS faulty_result +FROM LEFT_RIGHT + +┌─left─┬─right─┬─faulty_result────┐ +│ ᴺᵁᴸᴸ │ 4 │ Both equal │ +│ 1 │ 3 │ left is smaller │ +│ 2 │ 2 │ Both equal │ +│ 3 │ 1 │ right is smaller │ +│ 4 │ ᴺᵁᴸᴸ │ Both equal │ +└──────┴───────┴──────────────────┘ +``` [来源文章](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) diff --git a/docs/zh/sql-reference/functions/encoding-functions.md b/docs/zh/sql-reference/functions/encoding-functions.md index 39065f1d8b9..75e0118a88d 100644 --- a/docs/zh/sql-reference/functions/encoding-functions.md +++ b/docs/zh/sql-reference/functions/encoding-functions.md @@ -1,5 +1,71 @@ # 编码函数 {#bian-ma-han-shu} +## char {#char} + +返回长度为传递参数数量的字符串,并且每个字节都有对应参数的值。接受数字Numeric类型的多个参数。如果参数的值超出了UInt8数据类型的范围,则将其转换为UInt8,并可能进行舍入和溢出。 + +**语法** + +``` sql +char(number_1, [number_2, ..., number_n]); +``` + +**参数** + +- `number_1, number_2, ..., number_n` — 数值参数解释为整数。类型: [Int](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md). + +**返回值** + +- 给定字节数的字符串。 + +类型: `String`。 + +**示例** + +查询: + +``` sql +SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello +``` + +结果: + +``` text +┌─hello─┐ +│ hello │ +└───────┘ +``` + +你可以通过传递相应的字节来构造任意编码的字符串。 这是UTF-8的示例: + +查询: + +``` sql +SELECT char(0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5, 0xD1, 0x82) AS hello; +``` + +结果: + +``` text +┌─hello──┐ +│ привет │ +└────────┘ +``` + +查询: + +``` sql +SELECT char(0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD) AS hello; +``` + +结果: + +``` text +┌─hello─┐ +│ 你好 │ +└───────┘ +``` + ## hex {#hex} 接受`String`,`unsigned integer`,`Date`或`DateTime`类型的参数。返回包含参数的十六进制表示的字符串。使用大写字母`A-F`。不使用`0x`前缀或`h`后缀。对于字符串,所有字节都简单地编码为两个十六进制数字。数字转换为大端(«易阅读»)格式。对于数字,去除其中较旧的零,但仅限整个字节。例如,`hex(1)='01'`。 `Date`被编码为自Unix时间开始以来的天数。 `DateTime`编码为自Unix时间开始以来的秒数。 @@ -17,11 +83,11 @@ 接受FixedString(16)值。返回包含36个字符的文本格式的字符串。 -## 位掩码列表(num) {#bitmasktolistnum} +## bitmaskToList(num) {#bitmasktolistnum} 接受一个整数。返回一个字符串,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。列表使用逗号分割,按升序排列。 -## 位掩码阵列(num) {#bitmasktoarraynum} +## bitmaskToArray(num) {#bitmasktoarraynum} 接受一个整数。返回一个UInt64类型数组,其中包含一组2的幂列表,其列表中的所有值相加等于这个整数。数组中的数字按升序排列。 diff --git a/docs/zh/sql-reference/functions/random-functions.md b/docs/zh/sql-reference/functions/random-functions.md index d2d9fdf87a6..f058b98c779 100644 --- a/docs/zh/sql-reference/functions/random-functions.md +++ b/docs/zh/sql-reference/functions/random-functions.md @@ -6,7 +6,7 @@ 您可以向它传递任何类型的参数,但传递的参数将不会使用在任何随机数生成过程中。 此参数的唯一目的是防止公共子表达式消除,以便在相同的查询中使用相同的随机函数生成不同的随机数。 -## 兰德 {#rand} +## rand, rand32 {#rand} 返回一个UInt32类型的随机数字,所有UInt32类型的数字被生成的概率均相等。此函数线性同于的方式生成随机数。 From 93ec2db45bf15734b4fcbd3702c79290742a4081 Mon Sep 17 00:00:00 2001 From: "philip.han" Date: Fri, 4 Dec 2020 18:24:42 +0900 Subject: [PATCH 48/48] Fix typo --- src/Interpreters/ExpressionAnalyzer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interpreters/ExpressionAnalyzer.h b/src/Interpreters/ExpressionAnalyzer.h index 14fd601732e..6e87d0b7250 100644 --- a/src/Interpreters/ExpressionAnalyzer.h +++ b/src/Interpreters/ExpressionAnalyzer.h @@ -49,7 +49,7 @@ struct ExpressionAnalyzerData SubqueriesForSets subqueries_for_sets; PreparedSets prepared_sets; - /// Columns after ARRAY JOIN. It there is no ARRAY JOIN, it's source_columns. + /// Columns after ARRAY JOIN. If there is no ARRAY JOIN, it's source_columns. NamesAndTypesList columns_after_array_join; /// Columns after Columns after ARRAY JOIN and JOIN. If there is no JOIN, it's columns_after_array_join. NamesAndTypesList columns_after_join;