diff --git a/.gitmodules b/.gitmodules index 0a7a6b4a3f9..1d9d4d25baf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -168,9 +168,6 @@ [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/README.md b/README.md index a915570122d..496a6357f44 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,3 @@ ClickHouse® is an open-source column-oriented database management system that a * [Code Browser](https://clickhouse.tech/codebrowser/html_report/ClickHouse/index.html) with syntax highlight and navigation. * [Contacts](https://clickhouse.tech/#contacts) can help to get your questions answered if there are any. * You can also [fill this form](https://clickhouse.tech/#meet) to meet Yandex ClickHouse team in person. - -## Upcoming Events -* [China ClickHouse Community Meetup (online)](http://hdxu.cn/rhbfZ) on 26 June 2021. diff --git a/base/common/FunctorToStaticMethodAdaptor.h b/base/common/FunctorToStaticMethodAdaptor.h new file mode 100644 index 00000000000..9f55b52a79a --- /dev/null +++ b/base/common/FunctorToStaticMethodAdaptor.h @@ -0,0 +1,41 @@ +#include + +/** Adapt functor to static method where functor passed as context. + * Main use case to convert lambda into function that can be passed into JIT code. + */ +template +class FunctorToStaticMethodAdaptor : public FunctorToStaticMethodAdaptor +{ +}; + +template +class FunctorToStaticMethodAdaptor +{ +public: + static R call(C * ptr, Args &&... arguments) + { + return std::invoke(&C::operator(), ptr, std::forward(arguments)...); + } + + static R unsafeCall(char * ptr, Args &&... arguments) + { + C * ptr_typed = reinterpret_cast(ptr); + return std::invoke(&C::operator(), ptr_typed, std::forward(arguments)...); + } +}; + +template +class FunctorToStaticMethodAdaptor +{ +public: + static R call(C * ptr, Args &&... arguments) + { + return std::invoke(&C::operator(), ptr, std::forward(arguments)...); + } + + static R unsafeCall(char * ptr, Args &&... arguments) + { + C * ptr_typed = static_cast(ptr); + return std::invoke(&C::operator(), ptr_typed, std::forward(arguments)...); + } +}; diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 710c8c7fca5..164692fb893 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -34,7 +34,6 @@ endif() set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL 1) add_subdirectory (abseil-cpp-cmake) -add_subdirectory (antlr4-runtime-cmake) add_subdirectory (boost-cmake) add_subdirectory (cctz-cmake) add_subdirectory (consistent-hashing) diff --git a/contrib/antlr4-runtime b/contrib/antlr4-runtime deleted file mode 160000 index 672643e9a42..00000000000 --- a/contrib/antlr4-runtime +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 672643e9a427ef803abf13bc8cb4989606553d64 diff --git a/contrib/antlr4-runtime-cmake/CMakeLists.txt b/contrib/antlr4-runtime-cmake/CMakeLists.txt deleted file mode 100644 index 4f639a33ebf..00000000000 --- a/contrib/antlr4-runtime-cmake/CMakeLists.txt +++ /dev/null @@ -1,156 +0,0 @@ -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/contrib/libunwind b/contrib/libunwind index cdcc3d8c6f6..6b816d2fba3 160000 --- a/contrib/libunwind +++ b/contrib/libunwind @@ -1 +1 @@ -Subproject commit cdcc3d8c6f6e80a0886082704a0902d61d8d3ffe +Subproject commit 6b816d2fba3991f8fd6aaec17d92f68947eab667 diff --git a/docker/test/fasttest/run.sh b/docker/test/fasttest/run.sh index 6efdbf6178c..bba20f64e5a 100755 --- a/docker/test/fasttest/run.sh +++ b/docker/test/fasttest/run.sh @@ -160,7 +160,6 @@ function clone_submodules SUBMODULES_TO_UPDATE=( contrib/abseil-cpp - contrib/antlr4-runtime contrib/boost contrib/zlib-ng contrib/libxml2 @@ -374,12 +373,6 @@ function run_tests # Depends on AWS 01801_s3_cluster - # Depends on LLVM JIT - 01072_nullable_jit - 01852_jit_if - 01865_jit_comparison_constant_result - 01871_merge_tree_compile_expressions - # needs psql 01889_postgresql_protocol_null_fields diff --git a/docker/test/integration/runner/compose/docker_compose_postgres.yml b/docker/test/integration/runner/compose/docker_compose_postgres.yml index c4a506ad356..4b83ed21410 100644 --- a/docker/test/integration/runner/compose/docker_compose_postgres.yml +++ b/docker/test/integration/runner/compose/docker_compose_postgres.yml @@ -11,6 +11,7 @@ services: interval: 10s timeout: 5s retries: 5 + command: [ "postgres", "-c", "wal_level=logical", "-c", "max_replication_slots=2"] networks: default: aliases: @@ -22,4 +23,4 @@ services: volumes: - type: ${POSTGRES_LOGS_FS:-tmpfs} source: ${POSTGRES_DIR:-} - target: /postgres/ \ No newline at end of file + target: /postgres/ diff --git a/docker/test/stateless/run.sh b/docker/test/stateless/run.sh index 58b1d18a681..a7fb956bf94 100755 --- a/docker/test/stateless/run.sh +++ b/docker/test/stateless/run.sh @@ -35,7 +35,7 @@ if [ "$NUM_TRIES" -gt "1" ]; then # simpliest way to forward env variables to server sudo -E -u clickhouse /usr/bin/clickhouse-server --config /etc/clickhouse-server/config.xml --daemon else - service clickhouse-server start + sudo clickhouse start fi if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then diff --git a/docs/en/development/contrib.md b/docs/en/development/contrib.md index 64ca2387029..ac39c496c72 100644 --- a/docs/en/development/contrib.md +++ b/docs/en/development/contrib.md @@ -7,13 +7,13 @@ toc_title: Third-Party Libraries Used The list of third-party libraries can be obtained by the following query: -``` +``` sql SELECT library_name, license_type, license_path FROM system.licenses ORDER BY library_name COLLATE 'en' ``` [Example](https://gh-api.clickhouse.tech/play?user=play#U0VMRUNUIGxpYnJhcnlfbmFtZSwgbGljZW5zZV90eXBlLCBsaWNlbnNlX3BhdGggRlJPTSBzeXN0ZW0ubGljZW5zZXMgT1JERVIgQlkgbGlicmFyeV9uYW1lIENPTExBVEUgJ2VuJw==) -| library_name | license_type | license_path | +| library_name | license_type | license_path | |:-|:-|:-| | abseil-cpp | Apache | /contrib/abseil-cpp/LICENSE | | AMQP-CPP | Apache | /contrib/AMQP-CPP/LICENSE | @@ -89,3 +89,15 @@ SELECT library_name, license_type, license_path FROM system.licenses ORDER BY li | xz | Public Domain | /contrib/xz/COPYING | | zlib-ng | zLib | /contrib/zlib-ng/LICENSE.md | | zstd | BSD | /contrib/zstd/LICENSE | + +## Guidelines for adding new third-party libraries and maintaining custom changes in them {#adding-third-party-libraries} + +1. All external third-party code should reside in the dedicated directories under `contrib` directory of ClickHouse repo. Prefer Git submodules, when available. +2. Fork/mirror the official repo in [Clickhouse-extras](https://github.com/ClickHouse-Extras). Prefer official GitHub repos, when available. +3. Branch from the branch you want to integrate, e.g., `master` -> `clickhouse/master`, or `release/vX.Y.Z` -> `clickhouse/release/vX.Y.Z`. +4. All forks in [Clickhouse-extras](https://github.com/ClickHouse-Extras) can be automatically synchronized with upstreams. `clickhouse/...` branches will remain unaffected, since virtually nobody is going to use that naming pattern in their upstream repos. +5. Add submodules under `contrib` of ClickHouse repo that refer the above forks/mirrors. Set the submodules to track the corresponding `clickhouse/...` branches. +6. Every time the custom changes have to be made in the library code, a dedicated branch should be created, like `clickhouse/my-fix`. Then this branch should be merged into the branch, that is tracked by the submodule, e.g., `clickhouse/master` or `clickhouse/release/vX.Y.Z`. +7. No code should be pushed in any branch of the forks in [Clickhouse-extras](https://github.com/ClickHouse-Extras), whose names do not follow `clickhouse/...` pattern. +8. Always write the custom changes with the official repo in mind. Once the PR is merged from (a feature/fix branch in) your personal fork into the fork in [Clickhouse-extras](https://github.com/ClickHouse-Extras), and the submodule is bumped in ClickHouse repo, consider opening another PR from (a feature/fix branch in) the fork in [Clickhouse-extras](https://github.com/ClickHouse-Extras) to the official repo of the library. This will make sure, that 1) the contribution has more than a single use case and importance, 2) others will also benefit from it, 3) the change will not remain a maintenance burden solely on ClickHouse developers. +9. When a submodule needs to start using a newer code from the original branch (e.g., `master`), and since the custom changes might be merged in the branch it is tracking (e.g., `clickhouse/master`) and so it may diverge from its original counterpart (i.e., `master`), a careful merge should be carried out first, i.e., `master` -> `clickhouse/master`, and only then the submodule can be bumped in ClickHouse. diff --git a/docs/en/development/developer-instruction.md b/docs/en/development/developer-instruction.md index ac6d4a2b563..90f406f3ba8 100644 --- a/docs/en/development/developer-instruction.md +++ b/docs/en/development/developer-instruction.md @@ -237,6 +237,8 @@ The description of ClickHouse architecture can be found here: https://clickhouse The Code Style Guide: https://clickhouse.tech/docs/en/development/style/ +Adding third-party libraries: https://clickhouse.tech/docs/en/development/contrib/#adding-third-party-libraries + Writing tests: https://clickhouse.tech/docs/en/development/tests/ List of tasks: https://github.com/ClickHouse/ClickHouse/issues?q=is%3Aopen+is%3Aissue+label%3A%22easy+task%22 diff --git a/docs/en/development/style.md b/docs/en/development/style.md index 2151735c2f4..c495e3f0417 100644 --- a/docs/en/development/style.md +++ b/docs/en/development/style.md @@ -628,7 +628,7 @@ If the class is not intended for polymorphic use, you do not need to make functi **18.** Encodings. -Use UTF-8 everywhere. Use `std::string`and`char *`. Do not use `std::wstring`and`wchar_t`. +Use UTF-8 everywhere. Use `std::string` and `char *`. Do not use `std::wstring` and `wchar_t`. **19.** Logging. @@ -749,17 +749,9 @@ If your code in the `master` branch is not buildable yet, exclude it from the bu **1.** The C++20 standard library is used (experimental extensions are allowed), as well as `boost` and `Poco` frameworks. -**2.** If necessary, you can use any well-known libraries available in the OS package. +**2.** It is not allowed to use libraries from OS packages. It is also not allowed to use pre-installed libraries. All libraries should be placed in form of source code in `contrib` directory and built with ClickHouse. -If there is a good solution already available, then use it, even if it means you have to install another library. - -(But be prepared to remove bad libraries from code.) - -**3.** You can install a library that isn’t in the packages, if the packages do not have what you need or have an outdated version or the wrong type of compilation. - -**4.** If the library is small and does not have its own complex build system, put the source files in the `contrib` folder. - -**5.** Preference is always given to libraries that are already in use. +**3.** Preference is always given to libraries that are already in use. ## General Recommendations {#general-recommendations-1} diff --git a/docs/en/engines/database-engines/materialized-postgresql.md b/docs/en/engines/database-engines/materialized-postgresql.md new file mode 100644 index 00000000000..6b8c6e86952 --- /dev/null +++ b/docs/en/engines/database-engines/materialized-postgresql.md @@ -0,0 +1,71 @@ +--- +toc_priority: 30 +toc_title: MaterializedPostgreSQL +--- + +# MaterializedPostgreSQL {#materialize-postgresql} + +## Creating a Database {#creating-a-database} + +``` sql +CREATE DATABASE test_database +ENGINE = MaterializedPostgreSQL('postgres1:5432', 'postgres_database', 'postgres_user', 'postgres_password' + +SELECT * FROM test_database.postgres_table; +``` + + +## Settings {#settings} + +1. `materialized_postgresql_max_block_size` - Number of rows collected before flushing data into table. Default: `65536`. + +2. `materialized_postgresql_tables_list` - List of tables for MaterializedPostgreSQL database engine. Default: `whole database`. + +3. `materialized_postgresql_allow_automatic_update` - Allow to reload table in the background, when schema changes are detected. Default: `0` (`false`). + +``` sql +CREATE DATABASE test_database +ENGINE = MaterializedPostgreSQL('postgres1:5432', 'postgres_database', 'postgres_user', 'postgres_password' +SETTINGS materialized_postgresql_max_block_size = 65536, + materialized_postgresql_tables_list = 'table1,table2,table3'; + +SELECT * FROM test_database.table1; +``` + + +## Requirements {#requirements} + +- Setting `wal_level`to `logical` and `max_replication_slots` to at least `2` in the postgresql config file. + +- Each replicated table must have one of the following **replica identity**: + +1. **default** (primary key) + +2. **index** + +``` bash +postgres# CREATE TABLE postgres_table (a Integer NOT NULL, b Integer, c Integer NOT NULL, d Integer, e Integer NOT NULL); +postgres# CREATE unique INDEX postgres_table_index on postgres_table(a, c, e); +postgres# ALTER TABLE postgres_table REPLICA IDENTITY USING INDEX postgres_table_index; +``` + + +Primary key is always checked first. If it is absent, then index, defined as replica identity index, is checked. +If index is used as replica identity, there has to be only one such index in a table. +You can check what type is used for a specific table with the following command: + +``` bash +postgres# SELECT CASE relreplident + WHEN 'd' THEN 'default' + WHEN 'n' THEN 'nothing' + WHEN 'f' THEN 'full' + WHEN 'i' THEN 'index' + END AS replica_identity +FROM pg_class +WHERE oid = 'postgres_table'::regclass; +``` + + +## Warning {#warning} + +1. **TOAST** values convertion is not supported. Default value for the data type will be used. diff --git a/docs/en/engines/table-engines/integrations/materialized-postgresql.md b/docs/en/engines/table-engines/integrations/materialized-postgresql.md new file mode 100644 index 00000000000..70f61c5b550 --- /dev/null +++ b/docs/en/engines/table-engines/integrations/materialized-postgresql.md @@ -0,0 +1,46 @@ +--- +toc_priority: 12 +toc_title: MateriaziePostgreSQL +--- + +# MaterializedPostgreSQL {#materialize-postgresql} + +## Creating a Table {#creating-a-table} + +``` sql +CREATE TABLE test.postgresql_replica (key UInt64, value UInt64) +ENGINE = MaterializedPostgreSQL('postgres1:5432', 'postgres_database', 'postgresql_replica', 'postgres_user', 'postgres_password') +PRIMARY KEY key; +``` + + +## Requirements {#requirements} + +- Setting `wal_level`to `logical` and `max_replication_slots` to at least `2` in the postgresql config file. + +- A table with engine `MaterializedPostgreSQL` must have a primary key - the same as a replica identity index (default: primary key) of a postgres table (See [details on replica identity index](../../database-engines/materialized-postgresql.md#requirements)). + +- Only database `Atomic` is allowed. + + +## Virtual columns {#creating-a-table} + +- `_version` (`UInt64`) + +- `_sign` (`Int8`) + +These columns do not need to be added, when table is created. They are always accessible in `SELECT` query. +`_version` column equals `LSN` position in `WAL`, so it might be used to check how up-to-date replication is. + +``` sql +CREATE TABLE test.postgresql_replica (key UInt64, value UInt64) +ENGINE = MaterializedPostgreSQL('postgres1:5432', 'postgres_database', 'postgresql_replica', 'postgres_user', 'postgres_password') +PRIMARY KEY key; + +SELECT key, value, _version FROM test.postgresql_replica; +``` + + +## Warning {#warning} + +1. **TOAST** values convertion is not supported. Default value for the data type will be used. diff --git a/docs/en/sql-reference/functions/date-time-functions.md b/docs/en/sql-reference/functions/date-time-functions.md index 5d72bb099fe..db36a5b5637 100644 --- a/docs/en/sql-reference/functions/date-time-functions.md +++ b/docs/en/sql-reference/functions/date-time-functions.md @@ -80,6 +80,7 @@ SELECT toDateTime('2019-01-01 00:00:00', 'UTC') AS time_utc, toInt32(time_samoa) AS int32samoa FORMAT Vertical; ``` + Result: ```text @@ -1014,7 +1015,7 @@ Result: ## dateName {#dataname} -Returns part of date with specified date part. +Returns specified part of date. **Syntax** @@ -1024,13 +1025,13 @@ dateName(date_part, date) **Arguments** -- `date_part` - Date part. Possible values . -- `date` — Date [Date](../../sql-reference/data-types/date.md) or DateTime [DateTime](../../sql-reference/data-types/datetime.md), [DateTime64](../../sql-reference/data-types/datetime64.md). - +- `date_part` — Date part. Possible values: 'year', 'quarter', 'month', 'week', 'dayofyear', 'day', 'weekday', 'hour', 'minute', 'second'. [String](../../sql-reference/data-types/string.md). +- `date` — Date. [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md). +- `timezone` — Timezone. Optional. [String](../../sql-reference/data-types/string.md). **Returned value** -- Specified date part of date. +- The specified part of date. Type: [String](../../sql-reference/data-types/string.md#string) diff --git a/docs/en/sql-reference/functions/encoding-functions.md b/docs/en/sql-reference/functions/encoding-functions.md index b464e070acc..b6393e7b4e5 100644 --- a/docs/en/sql-reference/functions/encoding-functions.md +++ b/docs/en/sql-reference/functions/encoding-functions.md @@ -224,7 +224,7 @@ Accepts an integer. Returns an array of UInt64 numbers containing the list of po ## bitPositionsToArray(num) {#bitpositionstoarraynum} -Accepts an integer, argument will be converted to unsigned integer type. Returns an array of UInt64 numbers containing the list of positions of bits that equals 1. Numbers in the array are in ascending order. +Accepts an integer and converts it to an unsigned integer. Returns an array of `UInt64` numbers containing the list of positions of bits of `arg` that equal `1`, in ascending order. **Syntax** @@ -234,11 +234,13 @@ bitPositionsToArray(arg) **Arguments** -- `arg` — Integer value.Types: [Int/UInt](../../sql-reference/data-types/int-uint.md) +- `arg` — Integer value. [Int/UInt](../../sql-reference/data-types/int-uint.md). **Returned value** -An array of UInt64 numbers containing the list of positions of bits that equals 1. Numbers in the array are in ascending order. +- An array containing a list of positions of bits that equal `1`, in ascending order. + +Type: [Array](../../sql-reference/data-types/array.md)([UInt64](../../sql-reference/data-types/int-uint.md)). **Example** diff --git a/docs/ja/development/style.md b/docs/ja/development/style.md index f4b3f9c77dd..596e29f4414 100644 --- a/docs/ja/development/style.md +++ b/docs/ja/development/style.md @@ -749,19 +749,11 @@ CPU命令セットは、サーバー間でサポートされる最小のセッ ## 図書館 {#libraries} -**1.** C++20標準ライブラリが使用されています(実験的な拡張が許可されています)。 `boost` と `Poco` フレームワーク +**1.** The C++20 standard library is used (experimental extensions are allowed), as well as `boost` and `Poco` frameworks. -**2.** 必要に応じて、OSパッケージで利用可能な既知のライブラリを使用できます。 +**2.** It is not allowed to use libraries from OS packages. It is also not allowed to use pre-installed libraries. All libraries should be placed in form of source code in `contrib` directory and built with ClickHouse. -すでに利用可能な良い解決策がある場合は、別のライブラリをインストールする必要がある場合でも、それを使用してください。 - -(が準備をしておいてくださ去の悪い図書館からのコードです。) - -**3.** パッケージに必要なものがない場合や、古いバージョンや間違った種類のコンパイルがある場合は、パッケージにないライブラリをインストールできます。 - -**4.** ライブラリが小さく、独自の複雑なビルドシステムがない場合は、ソースファイルを `contrib` フォルダ。 - -**5.** すでに使用されているライブラリが優先されます。 +**3.** Preference is always given to libraries that are already in use. ## 一般的な推奨事項 {#general-recommendations-1} diff --git a/docs/ru/development/style.md b/docs/ru/development/style.md index de29e629ceb..6e1230b4831 100644 --- a/docs/ru/development/style.md +++ b/docs/ru/development/style.md @@ -824,17 +824,9 @@ The dictionary is configured incorrectly. **1.** Используются стандартная библиотека C++20 (допустимо использовать экспериментальные расширения) а также фреймворки `boost`, `Poco`. -**2.** При необходимости, можно использовать любые известные библиотеки, доступные в ОС из пакетов. +**2.** Библиотеки должны быть расположены в виде исходников в директории `contrib` и собираться вместе с ClickHouse. Не разрешено использовать библиотеки, доступные в пакетах ОС или любые другие способы установки библиотек в систему. -Если есть хорошее готовое решение, то оно используется, даже если для этого придётся установить ещё одну библиотеку. - -(Но будьте готовы к тому, что иногда вам придётся выкидывать плохие библиотеки из кода.) - -**3.** Если в пакетах нет нужной библиотеки, или её версия достаточно старая, или если она собрана не так, как нужно, то можно использовать библиотеку, устанавливаемую не из пакетов. - -**4.** Если библиотека достаточно маленькая и у неё нет своей системы сборки, то следует включить её файлы в проект, в директорию `contrib`. - -**5.** Предпочтение всегда отдаётся уже использующимся библиотекам. +**3.** Предпочтение отдаётся уже использующимся библиотекам. ## Общее {#obshchee-1} diff --git a/docs/ru/sql-reference/functions/date-time-functions.md b/docs/ru/sql-reference/functions/date-time-functions.md index 69f9a89f4cb..e7bd33bac45 100644 --- a/docs/ru/sql-reference/functions/date-time-functions.md +++ b/docs/ru/sql-reference/functions/date-time-functions.md @@ -27,40 +27,40 @@ SELECT Возвращает часовой пояс сервера. -**Синтаксис** +**Синтаксис** ``` sql timeZone() ``` -Псевдоним: `timezone`. +Синоним: `timezone`. **Возвращаемое значение** -- Часовой пояс. +- Часовой пояс. Тип: [String](../../sql-reference/data-types/string.md). ## toTimeZone {#totimezone} -Переводит дату или дату с временем в указанный часовой пояс. Часовой пояс - это атрибут типов `Date` и `DateTime`. Внутреннее значение (количество секунд) поля таблицы или результирующего столбца не изменяется, изменяется тип поля и, соответственно, его текстовое отображение. +Переводит дату или дату с временем в указанный часовой пояс. Часовой пояс - это атрибут типов `Date` и `DateTime`. Внутреннее значение (количество секунд) поля таблицы или результирующего столбца не изменяется, изменяется тип поля и, соответственно, его текстовое отображение. -**Синтаксис** +**Синтаксис** ``` sql toTimezone(value, timezone) ``` -Псевдоним: `toTimezone`. +Синоним: `toTimezone`. -**Аргументы** +**Аргументы** - `value` — время или дата с временем. [DateTime64](../../sql-reference/data-types/datetime64.md). - `timezone` — часовой пояс для возвращаемого значения. [String](../../sql-reference/data-types/string.md). **Возвращаемое значение** -- Дата с временем. +- Дата с временем. Тип: [DateTime](../../sql-reference/data-types/datetime.md). @@ -80,6 +80,7 @@ SELECT toDateTime('2019-01-01 00:00:00', 'UTC') AS time_utc, toInt32(time_samoa) AS int32samoa FORMAT Vertical; ``` + Результат: ```text @@ -102,21 +103,21 @@ int32samoa: 1546300800 Возвращает название часового пояса для значений типа [DateTime](../../sql-reference/data-types/datetime.md) и [DateTime64](../../sql-reference/data-types/datetime64.md). -**Синтаксис** +**Синтаксис** ``` sql timeZoneOf(value) ``` -Псевдоним: `timezoneOf`. +Синоним: `timezoneOf`. **Аргументы** -- `value` — Дата с временем. [DateTime](../../sql-reference/data-types/datetime.md) или [DateTime64](../../sql-reference/data-types/datetime64.md). +- `value` — Дата с временем. [DateTime](../../sql-reference/data-types/datetime.md) или [DateTime64](../../sql-reference/data-types/datetime64.md). **Возвращаемое значение** -- Название часового пояса. +- Название часового пояса. Тип: [String](../../sql-reference/data-types/string.md). @@ -145,15 +146,15 @@ SELECT timezoneOf(now()); timeZoneOffset(value) ``` -Псевдоним: `timezoneOffset`. +Синоним: `timezoneOffset`. **Аргументы** -- `value` — Дата с временем. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md). +- `value` — Дата с временем. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md). **Возвращаемое значение** -- Смещение в секундах от UTC. +- Смещение в секундах от UTC. Тип: [Int32](../../sql-reference/data-types/int-uint.md). @@ -626,7 +627,7 @@ SELECT now(), date_trunc('hour', now(), 'Europe/Moscow'); Добавляет интервал времени или даты к указанной дате или дате со временем. -**Синтаксис** +**Синтаксис** ``` sql date_add(unit, value, date) @@ -1025,6 +1026,45 @@ SELECT formatDateTime(toDate('2010-01-04'), '%g'); └────────────────────────────────────────────┘ ``` +## dateName {#dataname} + +Возвращает указанную часть даты. + +**Синтаксис** + +``` sql +dateName(date_part, date) +``` + +**Аргументы** + +- `date_part` — часть даты. Возможные значения: 'year', 'quarter', 'month', 'week', 'dayofyear', 'day', 'weekday', 'hour', 'minute', 'second'. [String](../../sql-reference/data-types/string.md). +- `date` — дата. [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md) или [DateTime64](../../sql-reference/data-types/datetime64.md). +- `timezone` — часовой пояс. Необязательный аргумент. [String](../../sql-reference/data-types/string.md). + +**Возвращаемое значение** + +- Указанная часть даты. + +Тип: [String](../../sql-reference/data-types/string.md#string). + +**Пример** + +Запрос: + +```sql +WITH toDateTime('2021-04-14 11:22:33') AS date_value +SELECT dateName('year', date_value), dateName('month', date_value), dateName('day', date_value); +``` + +Результат: + +```text +┌─dateName('year', date_value)─┬─dateName('month', date_value)─┬─dateName('day', date_value)─┐ +│ 2021 │ April │ 14 │ +└──────────────────────────────┴───────────────────────────────┴───────────────────────────── +``` + ## FROM\_UNIXTIME {#fromunixtime} Функция преобразует Unix timestamp в календарную дату и время. diff --git a/docs/ru/sql-reference/functions/encoding-functions.md b/docs/ru/sql-reference/functions/encoding-functions.md index 23e840a7898..161c1304b7c 100644 --- a/docs/ru/sql-reference/functions/encoding-functions.md +++ b/docs/ru/sql-reference/functions/encoding-functions.md @@ -223,3 +223,53 @@ SELECT reinterpretAsUInt64(reverse(unhex('FFF'))) AS num; ## bitmaskToArray(num) {#bitmasktoarraynum} Принимает целое число. Возвращает массив чисел типа UInt64, содержащий степени двойки, в сумме дающих исходное число; числа в массиве идут по возрастанию. + +## bitPositionsToArray(num) {#bitpositionstoarraynum} + +Принимает целое число и приводит его к беззнаковому виду. Возвращает массив `UInt64` чисел, который содержит список позиций битов `arg`, равных `1`, в порядке возрастания. + +**Синтаксис** + +```sql +bitPositionsToArray(arg) +``` + +**Аргументы** + +- `arg` — целое значение. [Int/UInt](../../sql-reference/data-types/int-uint.md). + +**Возвращаемое значение** + +- Массив, содержащий список позиций битов, равных `1`, в порядке возрастания. + +Тип: [Array](../../sql-reference/data-types/array.md)([UInt64](../../sql-reference/data-types/int-uint.md)). + +**Примеры** + +Запрос: + +``` sql +SELECT bitPositionsToArray(toInt8(1)) AS bit_positions; +``` + +Результат: + +``` text +┌─bit_positions─┐ +│ [0] │ +└───────────────┘ +``` + +Запрос: + +``` sql +select bitPositionsToArray(toInt8(-1)) as bit_positions; +``` + +Результат: + +``` text +┌─bit_positions─────┐ +│ [0,1,2,3,4,5,6,7] │ +└───────────────────┘ +``` diff --git a/docs/zh/development/style.md b/docs/zh/development/style.md index bb9bfde7b9b..dcbfbc79e33 100644 --- a/docs/zh/development/style.md +++ b/docs/zh/development/style.md @@ -742,19 +742,11 @@ CPU指令集是我们服务器中支持的最小集合。 目前,它是SSE 4.2 ## 库 {#ku} -**1.** 使用C++20标准库(允许实验性功能),以及 `boost` 和 `Poco` 框架。 +**1.** The C++20 standard library is used (experimental extensions are allowed), as well as `boost` and `Poco` frameworks. -**2.** 如有必要,您可以使用 OS 包中提供的任何已知库。 +**2.** It is not allowed to use libraries from OS packages. It is also not allowed to use pre-installed libraries. All libraries should be placed in form of source code in `contrib` directory and built with ClickHouse. -如果有一个好的解决方案已经可用,那就使用它,即使这意味着你必须安装另一个库。 - -(但要准备从代码中删除不好的库) - -**3.** 如果软件包没有您需要的软件包或者有过时的版本或错误的编译类型,则可以安装不在软件包中的库。 - -**4.** 如果库很小并且没有自己的复杂构建系统,请将源文件放在 `contrib` 文件夹中。 - -**5.** 始终优先考虑已经使用的库。 +**3.** Preference is always given to libraries that are already in use. ## 一般建议 {#yi-ban-jian-yi-1} diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 88f7564a7f2..9d7a4275dc1 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/programs/server/play.html b/programs/server/play.html index 0c039097ce1..066cd09d16a 100644 --- a/programs/server/play.html +++ b/programs/server/play.html @@ -44,6 +44,7 @@ --table-header-color: #F8F8F8; --table-hover-color: #FFF8EF; --null-color: #A88; + --link-color: #06D; } [data-theme="dark"] { @@ -61,6 +62,7 @@ --table-header-color: #102020; --table-hover-color: #003333; --null-color: #A88; + --link-color: #4BDAF7; } html, body @@ -275,6 +277,12 @@ font-size: 110%; color: #080; } + + a, a:visited + { + color: var(--link-color); + text-decoration: none; + } @@ -482,6 +490,7 @@ let cell = response.data[row_idx][col_idx]; let is_null = (cell === null); + let is_link = false; /// Test: SELECT number, toString(number) AS str, number % 2 ? number : NULL AS nullable, range(number) AS arr, CAST((['hello', 'world'], [number, number % 2]) AS Map(String, UInt64)) AS map FROM numbers(10) let text; @@ -491,9 +500,23 @@ text = JSON.stringify(cell); } else { text = cell; + + /// If it looks like URL, create a link. This is for convenience. + if (typeof(cell) == 'string' && cell.match(/^https?:\/\/\S+$/)) { + is_link = true; + } } - td.appendChild(document.createTextNode(text)); + let node = document.createTextNode(text); + if (is_link) { + let link = document.createElement('a'); + link.appendChild(node); + link.href = text; + link.setAttribute('target', '_blank'); + node = link; + } + + td.appendChild(node); td.className = column_classes[col_idx]; if (is_null) { td.className += ' null'; diff --git a/src/AggregateFunctions/AggregateFunctionAvg.h b/src/AggregateFunctions/AggregateFunctionAvg.h index 7cdef3bfe69..3835fd58c77 100644 --- a/src/AggregateFunctions/AggregateFunctionAvg.h +++ b/src/AggregateFunctions/AggregateFunctionAvg.h @@ -9,6 +9,14 @@ #include #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif namespace DB { @@ -85,13 +93,15 @@ struct AvgFraction * @tparam Derived When deriving from this class, use the child class name as in CRTP, e.g. * class Self : Agg. */ -template +template class AggregateFunctionAvgBase : public - IAggregateFunctionDataHelper, Derived> + IAggregateFunctionDataHelper, Derived> { public: + using Base = IAggregateFunctionDataHelper, Derived>; + using Numerator = TNumerator; + using Denominator = TDenominator; using Fraction = AvgFraction; - using Base = IAggregateFunctionDataHelper; explicit AggregateFunctionAvgBase(const DataTypes & argument_types_, UInt32 num_scale_ = 0, UInt32 denom_scale_ = 0) @@ -135,6 +145,77 @@ public: else assert_cast &>(to).getData().push_back(this->data(place).divide()); } + + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + bool can_be_compiled = true; + + for (const auto & argument : this->argument_types) + can_be_compiled &= canBeNativeType(*argument); + + auto return_type = getReturnType(); + can_be_compiled &= canBeNativeType(*return_type); + + return can_be_compiled; + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + b.CreateMemSet(aggregate_data_ptr, llvm::ConstantInt::get(b.getInt8Ty(), 0), sizeof(Fraction), llvm::assumeAligned(this->alignOfData())); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * numerator_type = toNativeType(b); + + auto * numerator_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, numerator_type->getPointerTo()); + auto * numerator_dst_value = b.CreateLoad(numerator_type, numerator_dst_ptr); + + auto * numerator_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, numerator_type->getPointerTo()); + auto * numerator_src_value = b.CreateLoad(numerator_type, numerator_src_ptr); + + auto * numerator_result_value = numerator_type->isIntegerTy() ? b.CreateAdd(numerator_dst_value, numerator_src_value) : b.CreateFAdd(numerator_dst_value, numerator_src_value); + b.CreateStore(numerator_result_value, numerator_dst_ptr); + + auto * denominator_type = toNativeType(b); + static constexpr size_t denominator_offset = offsetof(Fraction, denominator); + auto * denominator_dst_ptr = b.CreatePointerCast(b.CreateConstGEP1_32(nullptr, aggregate_data_dst_ptr, denominator_offset), denominator_type->getPointerTo()); + auto * denominator_src_ptr = b.CreatePointerCast(b.CreateConstGEP1_32(nullptr, aggregate_data_src_ptr, denominator_offset), denominator_type->getPointerTo()); + + auto * denominator_dst_value = b.CreateLoad(denominator_type, denominator_dst_ptr); + auto * denominator_src_value = b.CreateLoad(denominator_type, denominator_src_ptr); + + auto * denominator_result_value = denominator_type->isIntegerTy() ? b.CreateAdd(denominator_src_value, denominator_dst_value) : b.CreateFAdd(denominator_src_value, denominator_dst_value); + b.CreateStore(denominator_result_value, denominator_dst_ptr); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * numerator_type = toNativeType(b); + auto * numerator_ptr = b.CreatePointerCast(aggregate_data_ptr, numerator_type->getPointerTo()); + auto * numerator_value = b.CreateLoad(numerator_type, numerator_ptr); + + auto * denominator_type = toNativeType(b); + static constexpr size_t denominator_offset = offsetof(Fraction, denominator); + auto * denominator_ptr = b.CreatePointerCast(b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, denominator_offset), denominator_type->getPointerTo()); + auto * denominator_value = b.CreateLoad(denominator_type, denominator_ptr); + + auto * double_numerator = nativeCast(b, numerator_value, b.getDoubleTy()); + auto * double_denominator = nativeCast(b, denominator_value, b.getDoubleTy()); + + return b.CreateFDiv(double_numerator, double_denominator); + } + +#endif + private: UInt32 num_scale; UInt32 denom_scale; @@ -149,7 +230,12 @@ template class AggregateFunctionAvg final : public AggregateFunctionAvgBase, UInt64, AggregateFunctionAvg> { public: - using AggregateFunctionAvgBase, UInt64, AggregateFunctionAvg>::AggregateFunctionAvgBase; + using Base = AggregateFunctionAvgBase, UInt64, AggregateFunctionAvg>; + using Base::Base; + + using Numerator = typename Base::Numerator; + using Denominator = typename Base::Denominator; + using Fraction = typename Base::Fraction; void NO_SANITIZE_UNDEFINED add(AggregateDataPtr __restrict place, const IColumn ** columns, size_t row_num, Arena *) const final { @@ -158,5 +244,29 @@ public: } String getName() const final { return "avg"; } + +#if USE_EMBEDDED_COMPILER + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * numerator_type = toNativeType(b); + + auto * numerator_ptr = b.CreatePointerCast(aggregate_data_ptr, numerator_type->getPointerTo()); + auto * numerator_value = b.CreateLoad(numerator_type, numerator_ptr); + auto * value_cast_to_numerator = nativeCast(b, arguments_types[0], argument_values[0], numerator_type); + auto * numerator_result_value = numerator_type->isIntegerTy() ? b.CreateAdd(numerator_value, value_cast_to_numerator) : b.CreateFAdd(numerator_value, value_cast_to_numerator); + b.CreateStore(numerator_result_value, numerator_ptr); + + auto * denominator_type = toNativeType(b); + static constexpr size_t denominator_offset = offsetof(Fraction, denominator); + auto * denominator_ptr = b.CreatePointerCast(b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, denominator_offset), denominator_type->getPointerTo()); + auto * denominator_value_updated = b.CreateAdd(b.CreateLoad(denominator_type, denominator_ptr), llvm::ConstantInt::get(denominator_type, 1)); + b.CreateStore(denominator_value_updated, denominator_ptr); + } + +#endif + }; } diff --git a/src/AggregateFunctions/AggregateFunctionAvgWeighted.h b/src/AggregateFunctions/AggregateFunctionAvgWeighted.h index 5842e7311e9..80e18f1a141 100644 --- a/src/AggregateFunctions/AggregateFunctionAvgWeighted.h +++ b/src/AggregateFunctions/AggregateFunctionAvgWeighted.h @@ -28,19 +28,64 @@ public: MaxFieldType, AvgWeightedFieldType, AggregateFunctionAvgWeighted>; using Base::Base; - using ValueT = MaxFieldType; + using Numerator = typename Base::Numerator; + using Denominator = typename Base::Denominator; + using Fraction = typename Base::Fraction; void NO_SANITIZE_UNDEFINED add(AggregateDataPtr __restrict place, const IColumn ** columns, size_t row_num, Arena *) const override { const auto& weights = static_cast &>(*columns[1]); - this->data(place).numerator += static_cast( + this->data(place).numerator += static_cast( static_cast &>(*columns[0]).getData()[row_num]) * - static_cast(weights.getData()[row_num]); + static_cast(weights.getData()[row_num]); - this->data(place).denominator += static_cast>(weights.getData()[row_num]); + this->data(place).denominator += static_cast(weights.getData()[row_num]); } String getName() const override { return "avgWeighted"; } + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + bool can_be_compiled = Base::isCompilable(); + can_be_compiled &= canBeNativeType(); + + return can_be_compiled; + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * numerator_type = toNativeType(b); + + auto * numerator_ptr = b.CreatePointerCast(aggregate_data_ptr, numerator_type->getPointerTo()); + auto * numerator_value = b.CreateLoad(numerator_type, numerator_ptr); + + auto * argument = nativeCast(b, arguments_types[0], argument_values[0], numerator_type); + auto * weight = nativeCast(b, arguments_types[1], argument_values[1], numerator_type); + + llvm::Value * value_weight_multiplication = argument->getType()->isIntegerTy() ? b.CreateMul(argument, weight) : b.CreateFMul(argument, weight); + auto * numerator_result_value = numerator_type->isIntegerTy() ? b.CreateAdd(numerator_value, value_weight_multiplication) : b.CreateFAdd(numerator_value, value_weight_multiplication); + b.CreateStore(numerator_result_value, numerator_ptr); + + auto * denominator_type = toNativeType(b); + + static constexpr size_t denominator_offset = offsetof(Fraction, denominator); + auto * denominator_offset_ptr = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, denominator_offset); + auto * denominator_ptr = b.CreatePointerCast(denominator_offset_ptr, denominator_type->getPointerTo()); + + auto * weight_cast_to_denominator = nativeCast(b, arguments_types[1], argument_values[1], denominator_type); + + auto * denominator_value = b.CreateLoad(denominator_type, denominator_ptr); + auto * denominator_value_updated = denominator_type->isIntegerTy() ? b.CreateAdd(denominator_value, weight_cast_to_denominator) : b.CreateFAdd(denominator_value, weight_cast_to_denominator); + + b.CreateStore(denominator_value_updated, denominator_ptr); + } + +#endif + }; } diff --git a/src/AggregateFunctions/AggregateFunctionCount.h b/src/AggregateFunctions/AggregateFunctionCount.h index 9886b4e6828..0b4052c987b 100644 --- a/src/AggregateFunctions/AggregateFunctionCount.h +++ b/src/AggregateFunctions/AggregateFunctionCount.h @@ -10,6 +10,15 @@ #include #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif + namespace DB { @@ -107,6 +116,66 @@ public: AggregateFunctionPtr getOwnNullAdapter( const AggregateFunctionPtr &, const DataTypes & types, const Array & params, const AggregateFunctionProperties & /*properties*/) const override; + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + bool is_compilable = true; + for (const auto & argument_type : argument_types) + is_compilable &= canBeNativeType(*argument_type); + + return is_compilable; + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + b.CreateMemSet(aggregate_data_ptr, llvm::ConstantInt::get(b.getInt8Ty(), 0), sizeof(AggregateFunctionCountData), llvm::assumeAligned(this->alignOfData())); + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes &, const std::vector &) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * count_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + auto * count_value = b.CreateLoad(return_type, count_value_ptr); + auto * updated_count_value = b.CreateAdd(count_value, llvm::ConstantInt::get(return_type, 1)); + + b.CreateStore(updated_count_value, count_value_ptr); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * count_value_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, return_type->getPointerTo()); + auto * count_value_dst = b.CreateLoad(return_type, count_value_dst_ptr); + + auto * count_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, return_type->getPointerTo()); + auto * count_value_src = b.CreateLoad(return_type, count_value_src_ptr); + + auto * count_value_dst_updated = b.CreateAdd(count_value_dst, count_value_src); + + b.CreateStore(count_value_dst_updated, count_value_dst_ptr); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + auto * count_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + + return b.CreateLoad(return_type, count_value_ptr); + } + +#endif + }; @@ -155,6 +224,71 @@ public: { assert_cast(to).getData().push_back(data(place).count); } + + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + bool is_compilable = true; + for (const auto & argument_type : argument_types) + is_compilable &= canBeNativeType(*argument_type); + + + return is_compilable; + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + b.CreateMemSet(aggregate_data_ptr, llvm::ConstantInt::get(b.getInt8Ty(), 0), sizeof(AggregateFunctionCountData), llvm::assumeAligned(this->alignOfData())); + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes &, const std::vector & values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * is_null_value = b.CreateExtractValue(values[0], {1}); + auto * increment_value = b.CreateSelect(is_null_value, llvm::ConstantInt::get(return_type, 0), llvm::ConstantInt::get(return_type, 1)); + + auto * count_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + auto * count_value = b.CreateLoad(return_type, count_value_ptr); + auto * updated_count_value = b.CreateAdd(count_value, increment_value); + + b.CreateStore(updated_count_value, count_value_ptr); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * count_value_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, return_type->getPointerTo()); + auto * count_value_dst = b.CreateLoad(return_type, count_value_dst_ptr); + + auto * count_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, return_type->getPointerTo()); + auto * count_value_src = b.CreateLoad(return_type, count_value_src_ptr); + + auto * count_value_dst_updated = b.CreateAdd(count_value_dst, count_value_src); + + b.CreateStore(count_value_dst_updated, count_value_dst_ptr); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + auto * count_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + + return b.CreateLoad(return_type, count_value_ptr); + } + +#endif + }; } diff --git a/src/AggregateFunctions/AggregateFunctionIf.cpp b/src/AggregateFunctions/AggregateFunctionIf.cpp index 6d8a2f308c8..e7c48c8988c 100644 --- a/src/AggregateFunctions/AggregateFunctionIf.cpp +++ b/src/AggregateFunctions/AggregateFunctionIf.cpp @@ -106,6 +106,48 @@ public: this->nested_function->add(this->nestedPlace(place), &nested_column, row_num, arena); } } + +#if USE_EMBEDDED_COMPILER + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + const auto & nullable_type = arguments_types[0]; + const auto & nullable_value = argument_values[0]; + + auto * wrapped_value = b.CreateExtractValue(nullable_value, {0}); + auto * is_null_value = b.CreateExtractValue(nullable_value, {1}); + + const auto & predicate_type = arguments_types[argument_values.size() - 1]; + auto * predicate_value = argument_values[argument_values.size() - 1]; + auto * is_predicate_true = nativeBoolCast(b, predicate_type, predicate_value); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_null = llvm::BasicBlock::Create(head->getContext(), "if_null", head->getParent()); + auto * if_not_null = llvm::BasicBlock::Create(head->getContext(), "if_not_null", head->getParent()); + + b.CreateCondBr(b.CreateAnd(b.CreateNot(is_null_value), is_predicate_true), if_not_null, if_null); + + b.SetInsertPoint(if_null); + b.CreateBr(join_block); + + b.SetInsertPoint(if_not_null); + + if constexpr (result_is_nullable) + b.CreateStore(llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_ptr); + + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileAdd(b, aggregate_data_ptr_with_prefix_size_offset, { removeNullable(nullable_type) }, { wrapped_value }); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + +#endif + }; template @@ -168,6 +210,95 @@ public: } } +#if USE_EMBEDDED_COMPILER + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + /// TODO: Check + + llvm::IRBuilder<> & b = static_cast &>(builder); + + size_t arguments_size = arguments_types.size(); + + DataTypes non_nullable_types; + std::vector wrapped_values; + std::vector is_null_values; + + non_nullable_types.resize(arguments_size); + wrapped_values.resize(arguments_size); + is_null_values.resize(arguments_size); + + for (size_t i = 0; i < arguments_size; ++i) + { + const auto & argument_value = argument_values[i]; + + if (is_nullable[i]) + { + auto * wrapped_value = b.CreateExtractValue(argument_value, {0}); + + if constexpr (null_is_skipped) + is_null_values[i] = b.CreateExtractValue(argument_value, {1}); + + wrapped_values[i] = wrapped_value; + non_nullable_types[i] = removeNullable(arguments_types[i]); + } + else + { + wrapped_values[i] = argument_value; + non_nullable_types[i] = arguments_types[i]; + } + } + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * join_block_after_null_checks = llvm::BasicBlock::Create(head->getContext(), "join_block_after_null_checks", head->getParent()); + + if constexpr (null_is_skipped) + { + auto * values_have_null_ptr = b.CreateAlloca(b.getInt1Ty()); + b.CreateStore(b.getInt1(false), values_have_null_ptr); + + for (auto * is_null_value : is_null_values) + { + if (!is_null_value) + continue; + + auto * values_have_null = b.CreateLoad(b.getInt1Ty(), values_have_null_ptr); + b.CreateStore(b.CreateOr(values_have_null, is_null_value), values_have_null_ptr); + } + + b.CreateCondBr(b.CreateLoad(b.getInt1Ty(), values_have_null_ptr), join_block, join_block_after_null_checks); + } + + b.SetInsertPoint(join_block_after_null_checks); + + const auto & predicate_type = arguments_types[argument_values.size() - 1]; + auto * predicate_value = argument_values[argument_values.size() - 1]; + auto * is_predicate_true = nativeBoolCast(b, predicate_type, predicate_value); + + auto * if_true = llvm::BasicBlock::Create(head->getContext(), "if_true", head->getParent()); + auto * if_false = llvm::BasicBlock::Create(head->getContext(), "if_false", head->getParent()); + + b.CreateCondBr(is_predicate_true, if_true, if_false); + + b.SetInsertPoint(if_false); + b.CreateBr(join_block); + + b.SetInsertPoint(if_true); + + if constexpr (result_is_nullable) + b.CreateStore(llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_ptr); + + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileAdd(b, aggregate_data_ptr_with_prefix_size_offset, non_nullable_types, wrapped_values); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + +#endif + private: using Base = AggregateFunctionNullBase>; diff --git a/src/AggregateFunctions/AggregateFunctionIf.h b/src/AggregateFunctions/AggregateFunctionIf.h index 5ef8e3bc75a..153c80e87b2 100644 --- a/src/AggregateFunctions/AggregateFunctionIf.h +++ b/src/AggregateFunctions/AggregateFunctionIf.h @@ -5,6 +5,14 @@ #include #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif namespace DB { @@ -154,6 +162,76 @@ public: const Array & params, const AggregateFunctionProperties & properties) const override; AggregateFunctionPtr getNestedFunction() const override { return nested_func; } + + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + return nested_func->isCompilable(); + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + nested_func->compileCreate(builder, aggregate_data_ptr); + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + const auto & predicate_type = arguments_types[argument_values.size() - 1]; + auto * predicate_value = argument_values[argument_values.size() - 1]; + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_true = llvm::BasicBlock::Create(head->getContext(), "if_true", head->getParent()); + auto * if_false = llvm::BasicBlock::Create(head->getContext(), "if_false", head->getParent()); + + auto * is_predicate_true = nativeBoolCast(b, predicate_type, predicate_value); + + b.CreateCondBr(is_predicate_true, if_true, if_false); + + b.SetInsertPoint(if_true); + + size_t arguments_size_without_predicate = arguments_types.size() - 1; + + DataTypes argument_types_without_predicate; + std::vector argument_values_without_predicate; + + argument_types_without_predicate.resize(arguments_size_without_predicate); + argument_values_without_predicate.resize(arguments_size_without_predicate); + + for (size_t i = 0; i < arguments_size_without_predicate; ++i) + { + argument_types_without_predicate[i] = arguments_types[i]; + argument_values_without_predicate[i] = argument_values[i]; + } + + nested_func->compileAdd(builder, aggregate_data_ptr, argument_types_without_predicate, argument_values_without_predicate); + + b.CreateBr(join_block); + + b.SetInsertPoint(if_false); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + nested_func->compileMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + return nested_func->compileGetResult(builder, aggregate_data_ptr); + } + +#endif + + }; } diff --git a/src/AggregateFunctions/AggregateFunctionMinMaxAny.h b/src/AggregateFunctions/AggregateFunctionMinMaxAny.h index d4cb23e75e6..23dad0c097c 100644 --- a/src/AggregateFunctions/AggregateFunctionMinMaxAny.h +++ b/src/AggregateFunctions/AggregateFunctionMinMaxAny.h @@ -7,11 +7,20 @@ #include #include #include +#include #include #include #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif namespace DB { @@ -20,6 +29,7 @@ struct Settings; namespace ErrorCodes { extern const int ILLEGAL_TYPE_OF_ARGUMENT; + extern const int NOT_IMPLEMENTED; } /** Aggregate functions that store one of passed values. @@ -177,6 +187,265 @@ public: { return false; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = true; + + static llvm::Value * getValuePtrFromAggregateDataPtr(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + static constexpr size_t value_offset_from_structure = offsetof(SingleValueDataFixed, value); + + auto * type = toNativeType(builder); + auto * value_ptr_with_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, value_offset_from_structure); + auto * value_ptr = b.CreatePointerCast(value_ptr_with_offset, type->getPointerTo()); + + return value_ptr; + } + + static llvm::Value * getValueFromAggregateDataPtr(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * type = toNativeType(builder); + auto * value_ptr = getValuePtrFromAggregateDataPtr(builder, aggregate_data_ptr); + + return b.CreateLoad(type, value_ptr); + } + + static void compileChange(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_ptr = b.CreatePointerCast(aggregate_data_ptr, b.getInt1Ty()->getPointerTo()); + b.CreateStore(b.getInt1(true), has_value_ptr); + + auto * value_ptr = getValuePtrFromAggregateDataPtr(b, aggregate_data_ptr); + b.CreateStore(value_to_check, value_ptr); + } + + static void compileChangeMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + auto * value_src = getValueFromAggregateDataPtr(builder, aggregate_data_src_ptr); + + compileChange(builder, aggregate_data_dst_ptr, value_src); + } + + static void compileChangeFirstTime(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_ptr = b.CreatePointerCast(aggregate_data_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_value = b.CreateLoad(b.getInt1Ty(), has_value_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent()); + auto * if_should_not_change = llvm::BasicBlock::Create(head->getContext(), "if_should_not_change", head->getParent()); + + b.CreateCondBr(has_value_value, if_should_not_change, if_should_change); + + b.SetInsertPoint(if_should_not_change); + b.CreateBr(join_block); + + b.SetInsertPoint(if_should_change); + compileChange(builder, aggregate_data_ptr, value_to_check); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + static void compileChangeFirstTimeMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_dst = b.CreateLoad(b.getInt1Ty(), has_value_dst_ptr); + + auto * has_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_src = b.CreateLoad(b.getInt1Ty(), has_value_src_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent()); + auto * if_should_not_change = llvm::BasicBlock::Create(head->getContext(), "if_should_not_change", head->getParent()); + + b.CreateCondBr(b.CreateAnd(b.CreateNot(has_value_dst), has_value_src), if_should_change, if_should_not_change); + + b.SetInsertPoint(if_should_change); + compileChangeMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + b.CreateBr(join_block); + + b.SetInsertPoint(if_should_not_change); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + static void compileChangeEveryTime(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + compileChange(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeEveryTimeMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_src = b.CreateLoad(b.getInt1Ty(), has_value_src_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent()); + auto * if_should_not_change = llvm::BasicBlock::Create(head->getContext(), "if_should_not_change", head->getParent()); + + b.CreateCondBr(has_value_src, if_should_change, if_should_not_change); + + b.SetInsertPoint(if_should_change); + compileChangeMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + b.CreateBr(join_block); + + b.SetInsertPoint(if_should_not_change); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + template + static void compileChangeComparison(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_ptr = b.CreatePointerCast(aggregate_data_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_value = b.CreateLoad(b.getInt1Ty(), has_value_ptr); + + auto * value = getValueFromAggregateDataPtr(b, aggregate_data_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent()); + auto * if_should_not_change = llvm::BasicBlock::Create(head->getContext(), "if_should_not_change", head->getParent()); + + auto is_signed = std::numeric_limits::is_signed; + + llvm::Value * should_change_after_comparison = nullptr; + + if constexpr (is_less) + { + if (value_to_check->getType()->isIntegerTy()) + should_change_after_comparison = is_signed ? b.CreateICmpSLT(value_to_check, value) : b.CreateICmpULT(value_to_check, value); + else + should_change_after_comparison = b.CreateFCmpOLT(value_to_check, value); + } + else + { + if (value_to_check->getType()->isIntegerTy()) + should_change_after_comparison = is_signed ? b.CreateICmpSGT(value_to_check, value) : b.CreateICmpUGT(value_to_check, value); + else + should_change_after_comparison = b.CreateFCmpOGT(value_to_check, value); + } + + b.CreateCondBr(b.CreateOr(b.CreateNot(has_value_value), should_change_after_comparison), if_should_change, if_should_not_change); + + b.SetInsertPoint(if_should_change); + compileChange(builder, aggregate_data_ptr, value_to_check); + b.CreateBr(join_block); + + b.SetInsertPoint(if_should_not_change); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + template + static void compileChangeComparisonMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * has_value_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_dst = b.CreateLoad(b.getInt1Ty(), has_value_dst_ptr); + + auto * value_dst = getValueFromAggregateDataPtr(b, aggregate_data_dst_ptr); + + auto * has_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, b.getInt1Ty()->getPointerTo()); + auto * has_value_src = b.CreateLoad(b.getInt1Ty(), has_value_src_ptr); + + auto * value_src = getValueFromAggregateDataPtr(b, aggregate_data_src_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_should_change = llvm::BasicBlock::Create(head->getContext(), "if_should_change", head->getParent()); + auto * if_should_not_change = llvm::BasicBlock::Create(head->getContext(), "if_should_not_change", head->getParent()); + + auto is_signed = std::numeric_limits::is_signed; + + llvm::Value * should_change_after_comparison = nullptr; + + if constexpr (is_less) + { + if (value_src->getType()->isIntegerTy()) + should_change_after_comparison = is_signed ? b.CreateICmpSLT(value_src, value_dst) : b.CreateICmpULT(value_src, value_dst); + else + should_change_after_comparison = b.CreateFCmpOLT(value_src, value_dst); + } + else + { + if (value_src->getType()->isIntegerTy()) + should_change_after_comparison = is_signed ? b.CreateICmpSGT(value_src, value_dst) : b.CreateICmpUGT(value_src, value_dst); + else + should_change_after_comparison = b.CreateFCmpOGT(value_src, value_dst); + } + + b.CreateCondBr(b.CreateAnd(has_value_src, b.CreateOr(b.CreateNot(has_value_dst), should_change_after_comparison)), if_should_change, if_should_not_change); + + b.SetInsertPoint(if_should_change); + compileChangeMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + b.CreateBr(join_block); + + b.SetInsertPoint(if_should_not_change); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + + static void compileChangeIfLess(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + static constexpr bool is_less = true; + compileChangeComparison(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfLessMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + static constexpr bool is_less = true; + compileChangeComparisonMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + + static void compileChangeIfGreater(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + static constexpr bool is_less = false; + compileChangeComparison(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfGreaterMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + static constexpr bool is_less = false; + compileChangeComparisonMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + + static llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) + { + return getValueFromAggregateDataPtr(builder, aggregate_data_ptr); + } + +#endif + }; @@ -400,6 +669,13 @@ public: { return true; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = false; + +#endif + }; static_assert( @@ -576,6 +852,13 @@ public: { return false; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = false; + +#endif + }; @@ -593,6 +876,22 @@ struct AggregateFunctionMinData : Data bool changeIfBetter(const Self & to, Arena * arena) { return this->changeIfLess(to, arena); } static const char * name() { return "min"; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = Data::is_compilable; + + static void compileChangeIfBetter(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + Data::compileChangeIfLess(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfBetterMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + Data::compileChangeIfLessMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + +#endif }; template @@ -604,6 +903,22 @@ struct AggregateFunctionMaxData : Data bool changeIfBetter(const Self & to, Arena * arena) { return this->changeIfGreater(to, arena); } static const char * name() { return "max"; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = Data::is_compilable; + + static void compileChangeIfBetter(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + Data::compileChangeIfGreater(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfBetterMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + Data::compileChangeIfGreaterMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + +#endif }; template @@ -615,6 +930,22 @@ struct AggregateFunctionAnyData : Data bool changeIfBetter(const Self & to, Arena * arena) { return this->changeFirstTime(to, arena); } static const char * name() { return "any"; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = Data::is_compilable; + + static void compileChangeIfBetter(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + Data::compileChangeFirstTime(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfBetterMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + Data::compileChangeFirstTimeMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + +#endif }; template @@ -626,6 +957,22 @@ struct AggregateFunctionAnyLastData : Data bool changeIfBetter(const Self & to, Arena * arena) { return this->changeEveryTime(to, arena); } static const char * name() { return "anyLast"; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = Data::is_compilable; + + static void compileChangeIfBetter(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, llvm::Value * value_to_check) + { + Data::compileChangeEveryTime(builder, aggregate_data_ptr, value_to_check); + } + + static void compileChangeIfBetterMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) + { + Data::compileChangeEveryTimeMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + +#endif }; @@ -693,6 +1040,13 @@ struct AggregateFunctionAnyHeavyData : Data } static const char * name() { return "anyHeavy"; } + +#if USE_EMBEDDED_COMPILER + + static constexpr bool is_compilable = false; + +#endif + }; @@ -752,6 +1106,62 @@ public: { this->data(place).insertResultInto(to); } + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + if constexpr (!Data::is_compilable) + return false; + + return canBeNativeType(*this->argument_types[0]); + } + + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + b.CreateMemSet(aggregate_data_ptr, llvm::ConstantInt::get(b.getInt8Ty(), 0), this->sizeOfData(), llvm::assumeAligned(this->alignOfData())); + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes &, const std::vector & argument_values) const override + { + if constexpr (Data::is_compilable) + { + Data::compileChangeIfBetter(builder, aggregate_data_ptr, argument_values[0]); + } + else + { + throw Exception(getName() + " is not JIT-compilable", ErrorCodes::NOT_IMPLEMENTED); + } + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + if constexpr (Data::is_compilable) + { + Data::compileChangeIfBetterMerge(builder, aggregate_data_dst_ptr, aggregate_data_src_ptr); + } + else + { + throw Exception(getName() + " is not JIT-compilable", ErrorCodes::NOT_IMPLEMENTED); + } + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + if constexpr (Data::is_compilable) + { + return Data::compileGetResult(builder, aggregate_data_ptr); + } + else + { + throw Exception(getName() + " is not JIT-compilable", ErrorCodes::NOT_IMPLEMENTED); + } + } + +#endif }; } diff --git a/src/AggregateFunctions/AggregateFunctionNull.h b/src/AggregateFunctions/AggregateFunctionNull.h index a0e36d1bc3d..b7a67f2cc1b 100644 --- a/src/AggregateFunctions/AggregateFunctionNull.h +++ b/src/AggregateFunctions/AggregateFunctionNull.h @@ -6,9 +6,18 @@ #include #include #include +#include #include #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif namespace DB { @@ -183,6 +192,93 @@ public: } AggregateFunctionPtr getNestedFunction() const override { return nested_function; } + +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + return this->nested_function->isCompilable(); + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + if constexpr (result_is_nullable) + b.CreateMemSet(aggregate_data_ptr, llvm::ConstantInt::get(b.getInt8Ty(), 0), this->prefix_size, llvm::assumeAligned(this->alignOfData())); + + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileCreate(b, aggregate_data_ptr_with_prefix_size_offset); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + if constexpr (result_is_nullable) + { + auto * aggregate_data_is_null_dst_value = b.CreateLoad(aggregate_data_dst_ptr); + auto * aggregate_data_is_null_src_value = b.CreateLoad(aggregate_data_src_ptr); + + auto * is_src_null = nativeBoolCast(b, std::make_shared(), aggregate_data_is_null_src_value); + auto * is_null_result_value = b.CreateSelect(is_src_null, llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_is_null_dst_value); + b.CreateStore(is_null_result_value, aggregate_data_dst_ptr); + } + + auto * aggregate_data_dst_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_dst_ptr, this->prefix_size); + auto * aggregate_data_src_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_src_ptr, this->prefix_size); + + this->nested_function->compileMerge(b, aggregate_data_dst_ptr_with_prefix_size_offset, aggregate_data_src_ptr_with_prefix_size_offset); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, this->getReturnType()); + + llvm::Value * result = nullptr; + + if constexpr (result_is_nullable) + { + auto * place = b.CreateLoad(b.getInt8Ty(), aggregate_data_ptr); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_null = llvm::BasicBlock::Create(head->getContext(), "if_null", head->getParent()); + auto * if_not_null = llvm::BasicBlock::Create(head->getContext(), "if_not_null", head->getParent()); + + auto * nullable_value_ptr = b.CreateAlloca(return_type); + b.CreateStore(llvm::ConstantInt::getNullValue(return_type), nullable_value_ptr); + auto * nullable_value = b.CreateLoad(return_type, nullable_value_ptr); + + b.CreateCondBr(nativeBoolCast(b, std::make_shared(), place), if_not_null, if_null); + + b.SetInsertPoint(if_null); + b.CreateStore(b.CreateInsertValue(nullable_value, b.getInt1(true), {1}), nullable_value_ptr); + b.CreateBr(join_block); + + b.SetInsertPoint(if_not_null); + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + auto * nested_result = this->nested_function->compileGetResult(builder, aggregate_data_ptr_with_prefix_size_offset); + b.CreateStore(b.CreateInsertValue(nullable_value, nested_result, {0}), nullable_value_ptr); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + + result = b.CreateLoad(return_type, nullable_value_ptr); + } + else + { + result = this->nested_function->compileGetResult(b, aggregate_data_ptr); + } + + return result; + } + +#endif + }; @@ -226,6 +322,44 @@ public: if (!memoryIsByte(null_map, batch_size, 1)) this->setFlag(place); } + +#if USE_EMBEDDED_COMPILER + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + const auto & nullable_type = arguments_types[0]; + const auto & nullable_value = argument_values[0]; + + auto * wrapped_value = b.CreateExtractValue(nullable_value, {0}); + auto * is_null_value = b.CreateExtractValue(nullable_value, {1}); + + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_null = llvm::BasicBlock::Create(head->getContext(), "if_null", head->getParent()); + auto * if_not_null = llvm::BasicBlock::Create(head->getContext(), "if_not_null", head->getParent()); + + b.CreateCondBr(is_null_value, if_null, if_not_null); + + b.SetInsertPoint(if_null); + b.CreateBr(join_block); + + b.SetInsertPoint(if_not_null); + + if constexpr (result_is_nullable) + b.CreateStore(llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_ptr); + + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileAdd(b, aggregate_data_ptr_with_prefix_size_offset, { removeNullable(nullable_type) }, { wrapped_value }); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + +#endif + }; @@ -277,6 +411,90 @@ public: this->nested_function->add(this->nestedPlace(place), nested_columns, row_num, arena); } + +#if USE_EMBEDDED_COMPILER + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + size_t arguments_size = arguments_types.size(); + + DataTypes non_nullable_types; + std::vector wrapped_values; + std::vector is_null_values; + + non_nullable_types.resize(arguments_size); + wrapped_values.resize(arguments_size); + is_null_values.resize(arguments_size); + + for (size_t i = 0; i < arguments_size; ++i) + { + const auto & argument_value = argument_values[i]; + + if (is_nullable[i]) + { + auto * wrapped_value = b.CreateExtractValue(argument_value, {0}); + + if constexpr (null_is_skipped) + is_null_values[i] = b.CreateExtractValue(argument_value, {1}); + + wrapped_values[i] = wrapped_value; + non_nullable_types[i] = removeNullable(arguments_types[i]); + } + else + { + wrapped_values[i] = argument_value; + non_nullable_types[i] = arguments_types[i]; + } + } + + if constexpr (null_is_skipped) + { + auto * head = b.GetInsertBlock(); + + auto * join_block = llvm::BasicBlock::Create(head->getContext(), "join_block", head->getParent()); + auto * if_null = llvm::BasicBlock::Create(head->getContext(), "if_null", head->getParent()); + auto * if_not_null = llvm::BasicBlock::Create(head->getContext(), "if_not_null", head->getParent()); + + auto * values_have_null_ptr = b.CreateAlloca(b.getInt1Ty()); + b.CreateStore(b.getInt1(false), values_have_null_ptr); + + for (auto * is_null_value : is_null_values) + { + if (!is_null_value) + continue; + + auto * values_have_null = b.CreateLoad(b.getInt1Ty(), values_have_null_ptr); + b.CreateStore(b.CreateOr(values_have_null, is_null_value), values_have_null_ptr); + } + + b.CreateCondBr(b.CreateLoad(b.getInt1Ty(), values_have_null_ptr), if_null, if_not_null); + + b.SetInsertPoint(if_null); + b.CreateBr(join_block); + + b.SetInsertPoint(if_not_null); + + if constexpr (result_is_nullable) + b.CreateStore(llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_ptr); + + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileAdd(b, aggregate_data_ptr_with_prefix_size_offset, arguments_types, wrapped_values); + b.CreateBr(join_block); + + b.SetInsertPoint(join_block); + } + else + { + b.CreateStore(llvm::ConstantInt::get(b.getInt8Ty(), 1), aggregate_data_ptr); + auto * aggregate_data_ptr_with_prefix_size_offset = b.CreateConstGEP1_32(nullptr, aggregate_data_ptr, this->prefix_size); + this->nested_function->compileAdd(b, aggregate_data_ptr_with_prefix_size_offset, non_nullable_types, wrapped_values); + } + } + +#endif + private: enum { MAX_ARGS = 8 }; size_t number_of_arguments = 0; diff --git a/src/AggregateFunctions/AggregateFunctionSum.h b/src/AggregateFunctions/AggregateFunctionSum.h index 7261e56c044..4be2455d71e 100644 --- a/src/AggregateFunctions/AggregateFunctionSum.h +++ b/src/AggregateFunctions/AggregateFunctionSum.h @@ -12,6 +12,14 @@ #include +#if !defined(ARCADIA_BUILD) +# include +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +#endif namespace DB { @@ -385,6 +393,80 @@ public: column.getData().push_back(this->data(place).get()); } +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + if constexpr (Type == AggregateFunctionTypeSumKahan) + return false; + + bool can_be_compiled = true; + + for (const auto & argument_type : this->argument_types) + can_be_compiled &= canBeNativeType(*argument_type); + + auto return_type = getReturnType(); + can_be_compiled &= canBeNativeType(*return_type); + + return can_be_compiled; + } + + void compileCreate(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + auto * aggregate_sum_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + + b.CreateStore(llvm::Constant::getNullValue(return_type), aggregate_sum_ptr); + } + + void compileAdd(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr, const DataTypes & arguments_types, const std::vector & argument_values) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * sum_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + auto * sum_value = b.CreateLoad(return_type, sum_value_ptr); + + const auto & argument_type = arguments_types[0]; + const auto & argument_value = argument_values[0]; + + auto * value_cast_to_result = nativeCast(b, argument_type, argument_value, return_type); + auto * sum_result_value = sum_value->getType()->isIntegerTy() ? b.CreateAdd(sum_value, value_cast_to_result) : b.CreateFAdd(sum_value, value_cast_to_result); + + b.CreateStore(sum_result_value, sum_value_ptr); + } + + void compileMerge(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_dst_ptr, llvm::Value * aggregate_data_src_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + + auto * sum_value_dst_ptr = b.CreatePointerCast(aggregate_data_dst_ptr, return_type->getPointerTo()); + auto * sum_value_dst = b.CreateLoad(return_type, sum_value_dst_ptr); + + auto * sum_value_src_ptr = b.CreatePointerCast(aggregate_data_src_ptr, return_type->getPointerTo()); + auto * sum_value_src = b.CreateLoad(return_type, sum_value_src_ptr); + + auto * sum_return_value = sum_value_dst->getType()->isIntegerTy() ? b.CreateAdd(sum_value_dst, sum_value_src) : b.CreateFAdd(sum_value_dst, sum_value_src); + b.CreateStore(sum_return_value, sum_value_dst_ptr); + } + + llvm::Value * compileGetResult(llvm::IRBuilderBase & builder, llvm::Value * aggregate_data_ptr) const override + { + llvm::IRBuilder<> & b = static_cast &>(builder); + + auto * return_type = toNativeType(b, getReturnType()); + auto * sum_value_ptr = b.CreatePointerCast(aggregate_data_ptr, return_type->getPointerTo()); + + return b.CreateLoad(return_type, sum_value_ptr); + } + +#endif + private: UInt32 scale; }; diff --git a/src/AggregateFunctions/AggregateFunctionSumCount.h b/src/AggregateFunctions/AggregateFunctionSumCount.h index 1026b6272ba..4a913113ce2 100644 --- a/src/AggregateFunctions/AggregateFunctionSumCount.h +++ b/src/AggregateFunctions/AggregateFunctionSumCount.h @@ -48,6 +48,15 @@ public: String getName() const final { return "sumCount"; } +#if USE_EMBEDDED_COMPILER + + bool isCompilable() const override + { + return false; + } + +#endif + private: UInt32 scale; }; diff --git a/src/AggregateFunctions/IAggregateFunction.cpp b/src/AggregateFunctions/IAggregateFunction.cpp index 49e68449e18..55998d963bf 100644 --- a/src/AggregateFunctions/IAggregateFunction.cpp +++ b/src/AggregateFunctions/IAggregateFunction.cpp @@ -10,4 +10,44 @@ DataTypePtr IAggregateFunction::getStateType() const return std::make_shared(shared_from_this(), argument_types, parameters); } +String IAggregateFunction::getDescription() const +{ + String description; + + description += getName(); + + description += '('; + + for (const auto & parameter : parameters) + { + description += parameter.dump(); + description += ", "; + } + + if (!parameters.empty()) + { + description.pop_back(); + description.pop_back(); + } + + description += ')'; + + description += '('; + + for (const auto & argument_type : argument_types) + { + description += argument_type->getName(); + description += ", "; + } + + if (!argument_types.empty()) + { + description.pop_back(); + description.pop_back(); + } + + description += ')'; + + return description; +} } diff --git a/src/AggregateFunctions/IAggregateFunction.h b/src/AggregateFunctions/IAggregateFunction.h index e39ca460ea9..7acfa82a139 100644 --- a/src/AggregateFunctions/IAggregateFunction.h +++ b/src/AggregateFunctions/IAggregateFunction.h @@ -9,11 +9,21 @@ #include #include +#if !defined(ARCADIA_BUILD) +# include "config_core.h" +#endif + #include #include #include #include +namespace llvm +{ + class LLVMContext; + class Value; + class IRBuilderBase; +} namespace DB { @@ -208,6 +218,26 @@ public: const IColumn ** columns, Arena * arena) const = 0; + /** Insert result of aggregate function into result column with batch size. + * If destroy_place_after_insert is true. Then implementation of this method + * must destroy aggregate place if insert state into result column was successful. + * All places that were not inserted must be destroyed if there was exception during insert into result column. + */ + virtual void insertResultIntoBatch( + size_t batch_size, + AggregateDataPtr * places, + size_t place_offset, + IColumn & to, + Arena * arena, + bool destroy_place_after_insert) const = 0; + + /** Destroy batch of aggregate places. + */ + virtual void destroyBatch( + size_t batch_size, + AggregateDataPtr * places, + size_t place_offset) const noexcept = 0; + /** By default all NULLs are skipped during aggregation. * If it returns nullptr, the default one will be used. * If an aggregate function wants to use something instead of the default one, it overrides this function and returns its own null adapter. @@ -241,6 +271,40 @@ public: // of true window functions, so this hack-ish interface suffices. virtual bool isOnlyWindowFunction() const { return false; } + /// Description of AggregateFunction in form of name(parameters)(argument_types). + String getDescription() const; + +#if USE_EMBEDDED_COMPILER + + /// Is function JIT compilable + virtual bool isCompilable() const { return false; } + + /// compileCreate should generate code for initialization of aggregate function state in aggregate_data_ptr + virtual void compileCreate(llvm::IRBuilderBase & /*builder*/, llvm::Value * /*aggregate_data_ptr*/) const + { + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "{} is not JIT-compilable", getName()); + } + + /// compileAdd should generate code for updating aggregate function state stored in aggregate_data_ptr + virtual void compileAdd(llvm::IRBuilderBase & /*builder*/, llvm::Value * /*aggregate_data_ptr*/, const DataTypes & /*arguments_types*/, const std::vector & /*arguments_values*/) const + { + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "{} is not JIT-compilable", getName()); + } + + /// compileMerge should generate code for merging aggregate function states stored in aggregate_data_dst_ptr and aggregate_data_src_ptr + virtual void compileMerge(llvm::IRBuilderBase & /*builder*/, llvm::Value * /*aggregate_data_dst_ptr*/, llvm::Value * /*aggregate_data_src_ptr*/) const + { + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "{} is not JIT-compilable", getName()); + } + + /// compileGetResult should generate code for getting result value from aggregate function state stored in aggregate_data_ptr + virtual llvm::Value * compileGetResult(llvm::IRBuilderBase & /*builder*/, llvm::Value * /*aggregate_data_ptr*/) const + { + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "{} is not JIT-compilable", getName()); + } + +#endif + protected: DataTypes argument_types; Array parameters; @@ -415,6 +479,37 @@ public: static_cast(this)->add(place + place_offset, columns, i, arena); } } + + void insertResultIntoBatch(size_t batch_size, AggregateDataPtr * places, size_t place_offset, IColumn & to, Arena * arena, bool destroy_place_after_insert) const override + { + size_t batch_index = 0; + + try + { + for (; batch_index < batch_size; ++batch_index) + { + static_cast(this)->insertResultInto(places[batch_index] + place_offset, to, arena); + + if (destroy_place_after_insert) + static_cast(this)->destroy(places[batch_index] + place_offset); + } + } + catch (...) + { + for (size_t destroy_index = batch_index; destroy_index < batch_size; ++destroy_index) + static_cast(this)->destroy(places[destroy_index] + place_offset); + + throw; + } + } + + void destroyBatch(size_t batch_size, AggregateDataPtr * places, size_t place_offset) const noexcept override + { + for (size_t i = 0; i < batch_size; ++i) + { + static_cast(this)->destroy(places[i] + place_offset); + } + } }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 88a6113b8fa..272bea4f6d7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,7 +54,6 @@ 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) @@ -86,6 +85,7 @@ if (USE_AMQPCPP) endif() if (USE_LIBPQXX) + add_headers_and_sources(dbms Core/PostgreSQL) add_headers_and_sources(dbms Databases/PostgreSQL) add_headers_and_sources(dbms Storages/PostgreSQL) endif() @@ -222,12 +222,12 @@ endif() if (MAKE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES) add_library (dbms STATIC ${dbms_headers} ${dbms_sources}) - target_link_libraries (dbms PRIVATE clickhouse_parsers_new jemalloc libdivide ${DBMS_COMMON_LIBRARIES}) + target_link_libraries (dbms PRIVATE 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 clickhouse_parsers_new jemalloc libdivide) + target_link_libraries (clickhouse_interpreters PRIVATE jemalloc libdivide) list (APPEND all_modules dbms) # force all split libs to be linked if (OS_DARWIN) diff --git a/src/Common/MemorySanitizer.h b/src/Common/MemorySanitizer.h index 9e34e454090..b52f1d74a2b 100644 --- a/src/Common/MemorySanitizer.h +++ b/src/Common/MemorySanitizer.h @@ -7,6 +7,11 @@ #pragma clang diagnostic ignored "-Wreserved-id-macro" #endif +#undef __msan_unpoison +#undef __msan_test_shadow +#undef __msan_print_shadow +#undef __msan_unpoison_string + #define __msan_unpoison(X, Y) #define __msan_test_shadow(X, Y) (false) #define __msan_print_shadow(X, Y) diff --git a/src/Core/PostgreSQL/Connection.cpp b/src/Core/PostgreSQL/Connection.cpp new file mode 100644 index 00000000000..c423d75981e --- /dev/null +++ b/src/Core/PostgreSQL/Connection.cpp @@ -0,0 +1,74 @@ +#include "Connection.h" +#include + +namespace postgres +{ + +Connection::Connection(const ConnectionInfo & connection_info_, bool replication_, size_t num_tries_) + : connection_info(connection_info_), replication(replication_), num_tries(num_tries_) + , log(&Poco::Logger::get("PostgreSQLReplicaConnection")) +{ + if (replication) + { + connection_info = std::make_pair( + fmt::format("{} replication=database", connection_info.first), connection_info.second); + } +} + +void Connection::execWithRetry(const std::function & exec) +{ + for (size_t try_no = 0; try_no < num_tries; ++try_no) + { + try + { + pqxx::nontransaction tx(getRef()); + exec(tx); + break; + } + catch (const pqxx::broken_connection & e) + { + LOG_DEBUG(log, "Cannot execute query due to connection failure, attempt: {}/{}. (Message: {})", + try_no, num_tries, e.what()); + + if (try_no == num_tries) + throw; + } + } +} + +pqxx::connection & Connection::getRef() +{ + connect(); + assert(connection != nullptr); + return *connection; +} + +void Connection::tryUpdateConnection() +{ + try + { + updateConnection(); + } + catch (const pqxx::broken_connection & e) + { + LOG_ERROR(log, "Unable to update connection: {}", e.what()); + } +} + +void Connection::updateConnection() +{ + if (connection) + connection->close(); + /// Always throws if there is no connection. + connection = std::make_unique(connection_info.first); + if (replication) + connection->set_variable("default_transaction_isolation", "'repeatable read'"); + LOG_DEBUG(&Poco::Logger::get("PostgreSQLConnection"), "New connection to {}", connection_info.second); +} + +void Connection::connect() +{ + if (!connection || !connection->is_open()) + updateConnection(); +} +} diff --git a/src/Core/PostgreSQL/Connection.h b/src/Core/PostgreSQL/Connection.h new file mode 100644 index 00000000000..e01de419c17 --- /dev/null +++ b/src/Core/PostgreSQL/Connection.h @@ -0,0 +1,47 @@ +#pragma once + +#include // Y_IGNORE +#include +#include + +/* Methods to work with PostgreSQL connection object. + * Should only be used in case there has to be a single connection object, which + * is long-lived and there are no concurrent connection queries. + * Now only use case - for replication handler for replication from PostgreSQL. + * In all other integration engine use pool with failover. + **/ + +namespace Poco { class Logger; } + +namespace postgres +{ +using ConnectionInfo = std::pair; +using ConnectionPtr = std::unique_ptr; + +class Connection : private boost::noncopyable +{ +public: + Connection(const ConnectionInfo & connection_info_, bool replication_ = false, size_t num_tries = 3); + + void execWithRetry(const std::function & exec); + + pqxx::connection & getRef(); + + void connect(); + + void tryUpdateConnection(); + + const ConnectionInfo & getConnectionInfo() { return connection_info; } + +private: + void updateConnection(); + + ConnectionPtr connection; + ConnectionInfo connection_info; + + bool replication; + size_t num_tries; + + Poco::Logger * log; +}; +} diff --git a/src/Storages/PostgreSQL/ConnectionHolder.h b/src/Core/PostgreSQL/ConnectionHolder.h similarity index 100% rename from src/Storages/PostgreSQL/ConnectionHolder.h rename to src/Core/PostgreSQL/ConnectionHolder.h diff --git a/src/Storages/PostgreSQL/PoolWithFailover.cpp b/src/Core/PostgreSQL/PoolWithFailover.cpp similarity index 89% rename from src/Storages/PostgreSQL/PoolWithFailover.cpp rename to src/Core/PostgreSQL/PoolWithFailover.cpp index d3cf9c881e1..6bf756b8a12 100644 --- a/src/Storages/PostgreSQL/PoolWithFailover.cpp +++ b/src/Core/PostgreSQL/PoolWithFailover.cpp @@ -1,7 +1,7 @@ -#include +#include "PoolWithFailover.h" +#include "Utils.h" #include #include -#include namespace DB { @@ -14,18 +14,6 @@ namespace ErrorCodes namespace postgres { -String formatConnectionString(String dbname, String host, UInt16 port, String user, String password) -{ - DB::WriteBufferFromOwnString out; - out << "dbname=" << DB::quote << dbname - << " host=" << DB::quote << host - << " port=" << port - << " user=" << DB::quote << user - << " password=" << DB::quote << password - << " connect_timeout=10"; - return out.str(); -} - PoolWithFailover::PoolWithFailover( const Poco::Util::AbstractConfiguration & config, const String & config_prefix, size_t pool_size, size_t pool_wait_timeout_, size_t max_tries_) @@ -58,14 +46,14 @@ PoolWithFailover::PoolWithFailover( auto replica_user = config.getString(replica_name + ".user", user); auto replica_password = config.getString(replica_name + ".password", password); - auto connection_string = formatConnectionString(db, replica_host, replica_port, replica_user, replica_password); + auto connection_string = formatConnectionString(db, replica_host, replica_port, replica_user, replica_password).first; replicas_with_priority[priority].emplace_back(connection_string, pool_size); } } } else { - auto connection_string = formatConnectionString(db, host, port, user, password); + auto connection_string = formatConnectionString(db, host, port, user, password).first; replicas_with_priority[0].emplace_back(connection_string, pool_size); } } @@ -85,7 +73,7 @@ PoolWithFailover::PoolWithFailover( for (const auto & [host, port] : addresses) { LOG_DEBUG(&Poco::Logger::get("PostgreSQLPoolWithFailover"), "Adding address host: {}, port: {} to connection pool", host, port); - auto connection_string = formatConnectionString(database, host, port, user, password); + auto connection_string = formatConnectionString(database, host, port, user, password).first; replicas_with_priority[0].emplace_back(connection_string, pool_size); } } diff --git a/src/Storages/PostgreSQL/PoolWithFailover.h b/src/Core/PostgreSQL/PoolWithFailover.h similarity index 92% rename from src/Storages/PostgreSQL/PoolWithFailover.h rename to src/Core/PostgreSQL/PoolWithFailover.h index bd6f10d84e0..f4ae2c6cd1b 100644 --- a/src/Storages/PostgreSQL/PoolWithFailover.h +++ b/src/Core/PostgreSQL/PoolWithFailover.h @@ -1,16 +1,14 @@ #pragma once +#include "ConnectionHolder.h" #include #include -#include #include namespace postgres { -String formatConnectionString(String dbname, String host, UInt16 port, String user, String password); - class PoolWithFailover { diff --git a/src/Core/PostgreSQL/Utils.cpp b/src/Core/PostgreSQL/Utils.cpp new file mode 100644 index 00000000000..98e76da99d2 --- /dev/null +++ b/src/Core/PostgreSQL/Utils.cpp @@ -0,0 +1,19 @@ +#include "Utils.h" +#include + +namespace postgres +{ + +ConnectionInfo formatConnectionString(String dbname, String host, UInt16 port, String user, String password) +{ + DB::WriteBufferFromOwnString out; + out << "dbname=" << DB::quote << dbname + << " host=" << DB::quote << host + << " port=" << port + << " user=" << DB::quote << user + << " password=" << DB::quote << password + << " connect_timeout=10"; + return std::make_pair(out.str(), host + ':' + DB::toString(port)); +} + +} diff --git a/src/Core/PostgreSQL/Utils.h b/src/Core/PostgreSQL/Utils.h new file mode 100644 index 00000000000..34d66fefb70 --- /dev/null +++ b/src/Core/PostgreSQL/Utils.h @@ -0,0 +1,17 @@ +#pragma once + +#include // Y_IGNORE +#include +#include "Connection.h" +#include + +namespace pqxx +{ + using ReadTransaction = pqxx::read_transaction; + using ReplicationTransaction = pqxx::transaction; +} + +namespace postgres +{ +ConnectionInfo formatConnectionString(String dbname, String host, UInt16 port, String user, String password); +} diff --git a/src/Core/PostgreSQL/insertPostgreSQLValue.cpp b/src/Core/PostgreSQL/insertPostgreSQLValue.cpp new file mode 100644 index 00000000000..a72c6205cd5 --- /dev/null +++ b/src/Core/PostgreSQL/insertPostgreSQLValue.cpp @@ -0,0 +1,241 @@ +#include "insertPostgreSQLValue.h" + +#if USE_LIBPQXX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // Y_IGNORE + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int BAD_ARGUMENTS; +} + + +void insertDefaultPostgreSQLValue(IColumn & column, const IColumn & sample_column) +{ + column.insertFrom(sample_column, 0); +} + + +void insertPostgreSQLValue( + IColumn & column, std::string_view value, + const ExternalResultDescription::ValueType type, const DataTypePtr data_type, + std::unordered_map & array_info, size_t idx) +{ + switch (type) + { + + case ExternalResultDescription::ValueType::vtUInt8: + { + if (value == "t") + assert_cast(column).insertValue(1); + else if (value == "f") + assert_cast(column).insertValue(0); + else + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + } + case ExternalResultDescription::ValueType::vtUInt16: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtUInt32: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtUInt64: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtInt8: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtInt16: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtInt32: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtInt64: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtFloat32: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtFloat64: + assert_cast(column).insertValue(pqxx::from_string(value)); + break; + case ExternalResultDescription::ValueType::vtEnum8:[[fallthrough]]; + case ExternalResultDescription::ValueType::vtEnum16:[[fallthrough]]; + case ExternalResultDescription::ValueType::vtFixedString:[[fallthrough]]; + case ExternalResultDescription::ValueType::vtString: + assert_cast(column).insertData(value.data(), value.size()); + break; + case ExternalResultDescription::ValueType::vtUUID: + assert_cast(column).insert(parse(value.data(), value.size())); + break; + case ExternalResultDescription::ValueType::vtDate: + assert_cast(column).insertValue(UInt16{LocalDate{std::string(value)}.getDayNum()}); + break; + case ExternalResultDescription::ValueType::vtDateTime: + { + ReadBufferFromString in(value); + time_t time = 0; + readDateTimeText(time, in, assert_cast(data_type.get())->getTimeZone()); + if (time < 0) + time = 0; + assert_cast(column).insertValue(time); + break; + } + case ExternalResultDescription::ValueType::vtDateTime64:[[fallthrough]]; + case ExternalResultDescription::ValueType::vtDecimal32: [[fallthrough]]; + case ExternalResultDescription::ValueType::vtDecimal64: [[fallthrough]]; + case ExternalResultDescription::ValueType::vtDecimal128: [[fallthrough]]; + case ExternalResultDescription::ValueType::vtDecimal256: + { + ReadBufferFromString istr(value); + data_type->getDefaultSerialization()->deserializeWholeText(column, istr, FormatSettings{}); + break; + } + case ExternalResultDescription::ValueType::vtArray: + { + pqxx::array_parser parser{value}; + std::pair parsed = parser.get_next(); + + size_t dimension = 0, max_dimension = 0, expected_dimensions = array_info[idx].num_dimensions; + const auto parse_value = array_info[idx].pqxx_parser; + std::vector dimensions(expected_dimensions + 1); + + while (parsed.first != pqxx::array_parser::juncture::done) + { + if ((parsed.first == pqxx::array_parser::juncture::row_start) && (++dimension > expected_dimensions)) + throw Exception("Got more dimensions than expected", ErrorCodes::BAD_ARGUMENTS); + + else if (parsed.first == pqxx::array_parser::juncture::string_value) + dimensions[dimension].emplace_back(parse_value(parsed.second)); + + else if (parsed.first == pqxx::array_parser::juncture::null_value) + dimensions[dimension].emplace_back(array_info[idx].default_value); + + else if (parsed.first == pqxx::array_parser::juncture::row_end) + { + max_dimension = std::max(max_dimension, dimension); + + --dimension; + if (dimension == 0) + break; + + dimensions[dimension].emplace_back(Array(dimensions[dimension + 1].begin(), dimensions[dimension + 1].end())); + dimensions[dimension + 1].clear(); + } + + parsed = parser.get_next(); + } + + if (max_dimension < expected_dimensions) + throw Exception(ErrorCodes::BAD_ARGUMENTS, + "Got less dimensions than expected. ({} instead of {})", max_dimension, expected_dimensions); + + assert_cast(column).insert(Array(dimensions[1].begin(), dimensions[1].end())); + break; + } + } +} + + +void preparePostgreSQLArrayInfo( + std::unordered_map & array_info, size_t column_idx, const DataTypePtr data_type) +{ + const auto * array_type = typeid_cast(data_type.get()); + auto nested = array_type->getNestedType(); + + size_t count_dimensions = 1; + while (isArray(nested)) + { + ++count_dimensions; + nested = typeid_cast(nested.get())->getNestedType(); + } + + Field default_value = nested->getDefault(); + if (nested->isNullable()) + nested = static_cast(nested.get())->getNestedType(); + + WhichDataType which(nested); + std::function parser; + + if (which.isUInt8() || which.isUInt16()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isInt8() || which.isInt16()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isUInt32()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isInt32()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isUInt64()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isInt64()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isFloat32()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isFloat64()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isString() || which.isFixedString()) + parser = [](std::string & field) -> Field { return field; }; + else if (which.isDate()) + parser = [](std::string & field) -> Field { return UInt16{LocalDate{field}.getDayNum()}; }; + else if (which.isDateTime()) + parser = [nested](std::string & field) -> Field + { + ReadBufferFromString in(field); + time_t time = 0; + readDateTimeText(time, in, assert_cast(nested.get())->getTimeZone()); + return time; + }; + else if (which.isDecimal32()) + parser = [nested](std::string & field) -> Field + { + const auto & type = typeid_cast *>(nested.get()); + DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); + return convertFieldToType(field, res); + }; + else if (which.isDecimal64()) + parser = [nested](std::string & field) -> Field + { + const auto & type = typeid_cast *>(nested.get()); + DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); + return convertFieldToType(field, res); + }; + else if (which.isDecimal128()) + parser = [nested](std::string & field) -> Field + { + const auto & type = typeid_cast *>(nested.get()); + DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); + return convertFieldToType(field, res); + }; + else if (which.isDecimal256()) + parser = [nested](std::string & field) -> Field + { + const auto & type = typeid_cast *>(nested.get()); + DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); + return convertFieldToType(field, res); + }; + else + throw Exception(ErrorCodes::BAD_ARGUMENTS, "Type conversion to {} is not supported", nested->getName()); + + array_info[column_idx] = {count_dimensions, default_value, parser}; +} +} + +#endif diff --git a/src/Core/PostgreSQL/insertPostgreSQLValue.h b/src/Core/PostgreSQL/insertPostgreSQLValue.h new file mode 100644 index 00000000000..7acba4f09bd --- /dev/null +++ b/src/Core/PostgreSQL/insertPostgreSQLValue.h @@ -0,0 +1,38 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +#include "config_core.h" +#endif + +#if USE_LIBPQXX + +#include +#include +#include +#include + + +namespace DB +{ + +struct PostgreSQLArrayInfo +{ + size_t num_dimensions; + Field default_value; + std::function pqxx_parser; +}; + + +void insertPostgreSQLValue( + IColumn & column, std::string_view value, + const ExternalResultDescription::ValueType type, const DataTypePtr data_type, + std::unordered_map & array_info, size_t idx); + +void preparePostgreSQLArrayInfo( + std::unordered_map & array_info, size_t column_idx, const DataTypePtr data_type); + +void insertDefaultPostgreSQLValue(IColumn & column, const IColumn & sample_column); + +} + +#endif diff --git a/src/Core/Settings.h b/src/Core/Settings.h index 0197bfac7e4..31eaeaadbeb 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -93,6 +93,7 @@ class IColumn; M(Bool, distributed_directory_monitor_split_batch_on_failure, false, "Should StorageDistributed DirectoryMonitors try to split batch into smaller in case of failures.", 0) \ \ M(Bool, optimize_move_to_prewhere, true, "Allows disabling WHERE to PREWHERE optimization in SELECT queries from MergeTree.", 0) \ + M(Bool, optimize_move_to_prewhere_if_final, false, "If query has `FINAL`, the optimization `move_to_prewhere` is not always correct and it is enabled only if both settings `optimize_move_to_prewhere` and `optimize_move_to_prewhere_if_final` are turned on", 0) \ \ M(UInt64, replication_alter_partitions_sync, 1, "Wait for actions to manipulate the partitions. 0 - do not wait, 1 - wait for execution only of itself, 2 - wait for everyone.", 0) \ M(UInt64, replication_alter_columns_timeout, 60, "Wait for actions to change the table structure within the specified number of seconds. 0 - wait unlimited time.", 0) \ @@ -106,6 +107,8 @@ class IColumn; M(Bool, allow_suspicious_low_cardinality_types, false, "In CREATE TABLE statement allows specifying LowCardinality modifier for types of small fixed size (8 or less). Enabling this may increase merge times and memory consumption.", 0) \ M(Bool, compile_expressions, true, "Compile some scalar functions and operators to native code.", 0) \ M(UInt64, min_count_to_compile_expression, 3, "The number of identical expressions before they are JIT-compiled", 0) \ + M(Bool, compile_aggregate_expressions, true, "Compile aggregate functions to native code.", 0) \ + M(UInt64, min_count_to_compile_aggregate_expression, 0, "The number of identical aggreagte expressions before they are JIT-compiled", 0) \ M(UInt64, group_by_two_level_threshold, 100000, "From what number of keys, a two-level aggregation starts. 0 - the threshold is not set.", 0) \ M(UInt64, group_by_two_level_threshold_bytes, 50000000, "From what size of the aggregation state in bytes, a two-level aggregation begins to be used. 0 - the threshold is not set. Two-level aggregation is used when at least one of the thresholds is triggered.", 0) \ M(Bool, distributed_aggregation_memory_efficient, true, "Is the memory-saving mode of distributed aggregation enabled.", 0) \ @@ -429,6 +432,7 @@ class IColumn; M(Bool, cast_keep_nullable, false, "CAST operator keep Nullable for result data type", 0) \ M(Bool, alter_partition_verbose_result, false, "Output information about affected parts. Currently works only for FREEZE and ATTACH commands.", 0) \ M(Bool, allow_experimental_database_materialize_mysql, false, "Allow to create database with Engine=MaterializeMySQL(...).", 0) \ + M(Bool, allow_experimental_database_materialized_postgresql, false, "Allow to create database with Engine=MaterializedPostgreSQL(...).", 0) \ M(Bool, system_events_show_zero_values, false, "Include all metrics, even with zero values", 0) \ M(MySQLDataTypesSupport, mysql_datatypes_support_level, 0, "Which MySQL types should be converted to corresponding ClickHouse types (rather than being represented as String). Can be empty or any combination of 'decimal' or 'datetime64'. When empty MySQL's DECIMAL and DATETIME/TIMESTAMP with non-zero precision are seen as String on ClickHouse's side.", 0) \ M(Bool, optimize_trivial_insert_select, true, "Optimize trivial 'INSERT INTO table SELECT ... FROM TABLES' query", 0) \ @@ -445,7 +449,6 @@ class IColumn; M(Bool, allow_experimental_window_functions, false, "Allow experimental window functions", 0) \ M(Bool, allow_experimental_projection_optimization, false, "Enable projection optimization when processing SELECT queries", 0) \ M(Bool, force_optimize_projection, false, "If projection optimization is enabled, SELECT queries need to use projection", 0) \ - M(Bool, use_antlr_parser, false, "Parse incoming queries using ANTLR-generated experimental parser", 0) \ M(Bool, async_socket_for_remote, true, "Asynchronously read from socket executing remote query", 0) \ M(Bool, insert_null_as_default, true, "Insert DEFAULT values instead of NULL in INSERT SELECT (UNION ALL)", 0) \ \ diff --git a/src/DataStreams/PostgreSQLBlockInputStream.cpp b/src/DataStreams/PostgreSQLBlockInputStream.cpp index 4962473c69a..3956ce16afa 100644 --- a/src/DataStreams/PostgreSQLBlockInputStream.cpp +++ b/src/DataStreams/PostgreSQLBlockInputStream.cpp @@ -22,12 +22,9 @@ namespace DB { -namespace ErrorCodes -{ - extern const int BAD_ARGUMENTS; -} -PostgreSQLBlockInputStream::PostgreSQLBlockInputStream( +template +PostgreSQLBlockInputStream::PostgreSQLBlockInputStream( postgres::ConnectionHolderPtr connection_holder_, const std::string & query_str_, const Block & sample_block, @@ -35,25 +32,52 @@ PostgreSQLBlockInputStream::PostgreSQLBlockInputStream( : query_str(query_str_) , max_block_size(max_block_size_) , connection_holder(std::move(connection_holder_)) +{ + init(sample_block); +} + + +template +PostgreSQLBlockInputStream::PostgreSQLBlockInputStream( + std::shared_ptr tx_, + const std::string & query_str_, + const Block & sample_block, + const UInt64 max_block_size_, + bool auto_commit_) + : query_str(query_str_) + , tx(std::move(tx_)) + , max_block_size(max_block_size_) + , auto_commit(auto_commit_) +{ + init(sample_block); +} + + +template +void PostgreSQLBlockInputStream::init(const Block & sample_block) { description.init(sample_block); + for (const auto idx : collections::range(0, description.sample_block.columns())) - if (description.types[idx].first == ValueType::vtArray) - prepareArrayInfo(idx, description.sample_block.getByPosition(idx).type); + if (description.types[idx].first == ExternalResultDescription::ValueType::vtArray) + preparePostgreSQLArrayInfo(array_info, idx, description.sample_block.getByPosition(idx).type); + /// pqxx::stream_from uses COPY command, will get error if ';' is present if (query_str.ends_with(';')) query_str.resize(query_str.size() - 1); } -void PostgreSQLBlockInputStream::readPrefix() +template +void PostgreSQLBlockInputStream::readPrefix() { - tx = std::make_unique(connection_holder->get()); + tx = std::make_shared(connection_holder->get()); stream = std::make_unique(*tx, pqxx::from_query, std::string_view(query_str)); } -Block PostgreSQLBlockInputStream::readImpl() +template +Block PostgreSQLBlockInputStream::readImpl() { /// Check if pqxx::stream_from is finished if (!stream || !(*stream)) @@ -81,17 +105,22 @@ Block PostgreSQLBlockInputStream::readImpl() { ColumnNullable & column_nullable = assert_cast(*columns[idx]); const auto & data_type = assert_cast(*sample.type); - insertValue(column_nullable.getNestedColumn(), (*row)[idx], description.types[idx].first, data_type.getNestedType(), idx); + + insertPostgreSQLValue( + column_nullable.getNestedColumn(), (*row)[idx], + description.types[idx].first, data_type.getNestedType(), array_info, idx); + column_nullable.getNullMapData().emplace_back(0); } else { - insertValue(*columns[idx], (*row)[idx], description.types[idx].first, sample.type, idx); + insertPostgreSQLValue( + *columns[idx], (*row)[idx], description.types[idx].first, sample.type, array_info, idx); } } else { - insertDefaultValue(*columns[idx], *sample.column); + insertDefaultPostgreSQLValue(*columns[idx], *sample.column); } } @@ -104,216 +133,23 @@ Block PostgreSQLBlockInputStream::readImpl() } -void PostgreSQLBlockInputStream::readSuffix() +template +void PostgreSQLBlockInputStream::readSuffix() { if (stream) { stream->complete(); - tx->commit(); + + if (auto_commit) + tx->commit(); } } +template +class PostgreSQLBlockInputStream; -void PostgreSQLBlockInputStream::insertValue(IColumn & column, std::string_view value, - const ExternalResultDescription::ValueType type, const DataTypePtr data_type, size_t idx) -{ - switch (type) - { - case ValueType::vtUInt8: - { - if (value == "t") - assert_cast(column).insertValue(1); - else if (value == "f") - assert_cast(column).insertValue(0); - else - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - } - case ValueType::vtUInt16: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtUInt32: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtUInt64: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtInt8: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtInt16: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtInt32: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtInt64: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtFloat32: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtFloat64: - assert_cast(column).insertValue(pqxx::from_string(value)); - break; - case ValueType::vtFixedString:[[fallthrough]]; - case ValueType::vtEnum8: - case ValueType::vtEnum16: - case ValueType::vtString: - assert_cast(column).insertData(value.data(), value.size()); - break; - case ValueType::vtUUID: - assert_cast(column).insert(parse(value.data(), value.size())); - break; - case ValueType::vtDate: - assert_cast(column).insertValue(UInt16{LocalDate{std::string(value)}.getDayNum()}); - break; - case ValueType::vtDateTime: - { - ReadBufferFromString in(value); - time_t time = 0; - readDateTimeText(time, in, assert_cast(data_type.get())->getTimeZone()); - if (time < 0) - time = 0; - assert_cast(column).insertValue(time); - break; - } - case ValueType::vtDateTime64:[[fallthrough]]; - case ValueType::vtDecimal32: [[fallthrough]]; - case ValueType::vtDecimal64: [[fallthrough]]; - case ValueType::vtDecimal128: [[fallthrough]]; - case ValueType::vtDecimal256: - { - ReadBufferFromString istr(value); - data_type->getDefaultSerialization()->deserializeWholeText(column, istr, FormatSettings{}); - break; - } - case ValueType::vtArray: - { - pqxx::array_parser parser{value}; - std::pair parsed = parser.get_next(); - - size_t dimension = 0, max_dimension = 0, expected_dimensions = array_info[idx].num_dimensions; - const auto parse_value = array_info[idx].pqxx_parser; - std::vector dimensions(expected_dimensions + 1); - - while (parsed.first != pqxx::array_parser::juncture::done) - { - if ((parsed.first == pqxx::array_parser::juncture::row_start) && (++dimension > expected_dimensions)) - throw Exception("Got more dimensions than expected", ErrorCodes::BAD_ARGUMENTS); - - else if (parsed.first == pqxx::array_parser::juncture::string_value) - dimensions[dimension].emplace_back(parse_value(parsed.second)); - - else if (parsed.first == pqxx::array_parser::juncture::null_value) - dimensions[dimension].emplace_back(array_info[idx].default_value); - - else if (parsed.first == pqxx::array_parser::juncture::row_end) - { - max_dimension = std::max(max_dimension, dimension); - - --dimension; - if (dimension == 0) - break; - - dimensions[dimension].emplace_back(Array(dimensions[dimension + 1].begin(), dimensions[dimension + 1].end())); - dimensions[dimension + 1].clear(); - } - - parsed = parser.get_next(); - } - - if (max_dimension < expected_dimensions) - throw Exception(ErrorCodes::BAD_ARGUMENTS, - "Got less dimensions than expected. ({} instead of {})", max_dimension, expected_dimensions); - - assert_cast(column).insert(Array(dimensions[1].begin(), dimensions[1].end())); - break; - } - } -} - - -void PostgreSQLBlockInputStream::prepareArrayInfo(size_t column_idx, const DataTypePtr data_type) -{ - const auto * array_type = typeid_cast(data_type.get()); - auto nested = array_type->getNestedType(); - - size_t count_dimensions = 1; - while (isArray(nested)) - { - ++count_dimensions; - nested = typeid_cast(nested.get())->getNestedType(); - } - - Field default_value = nested->getDefault(); - if (nested->isNullable()) - nested = static_cast(nested.get())->getNestedType(); - - WhichDataType which(nested); - std::function parser; - - if (which.isUInt8() || which.isUInt16()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isInt8() || which.isInt16()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isUInt32()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isInt32()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isUInt64()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isInt64()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isFloat32()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isFloat64()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isString() || which.isFixedString()) - parser = [](std::string & field) -> Field { return field; }; - else if (which.isDate()) - parser = [](std::string & field) -> Field { return UInt16{LocalDate{field}.getDayNum()}; }; - else if (which.isDateTime()) - parser = [nested](std::string & field) -> Field - { - ReadBufferFromString in(field); - time_t time = 0; - readDateTimeText(time, in, assert_cast(nested.get())->getTimeZone()); - return time; - }; - else if (which.isDecimal32()) - parser = [nested](std::string & field) -> Field - { - const auto & type = typeid_cast *>(nested.get()); - DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); - return convertFieldToType(field, res); - }; - else if (which.isDecimal64()) - parser = [nested](std::string & field) -> Field - { - const auto & type = typeid_cast *>(nested.get()); - DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); - return convertFieldToType(field, res); - }; - else if (which.isDecimal128()) - parser = [nested](std::string & field) -> Field - { - const auto & type = typeid_cast *>(nested.get()); - DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); - return convertFieldToType(field, res); - }; - else if (which.isDecimal256()) - parser = [nested](std::string & field) -> Field - { - const auto & type = typeid_cast *>(nested.get()); - DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); - return convertFieldToType(field, res); - }; - else - throw Exception(ErrorCodes::BAD_ARGUMENTS, "Type conversion to {} is not supported", nested->getName()); - - array_info[column_idx] = {count_dimensions, default_value, parser}; -} +template +class PostgreSQLBlockInputStream; } diff --git a/src/DataStreams/PostgreSQLBlockInputStream.h b/src/DataStreams/PostgreSQLBlockInputStream.h index 27aefcbc2d7..31bff0789bb 100644 --- a/src/DataStreams/PostgreSQLBlockInputStream.h +++ b/src/DataStreams/PostgreSQLBlockInputStream.h @@ -9,54 +9,76 @@ #include #include #include -#include +#include +#include +#include namespace DB { +template class PostgreSQLBlockInputStream : public IBlockInputStream { + public: PostgreSQLBlockInputStream( postgres::ConnectionHolderPtr connection_holder_, - const std::string & query_str, + const String & query_str_, const Block & sample_block, const UInt64 max_block_size_); String getName() const override { return "PostgreSQL"; } Block getHeader() const override { return description.sample_block.cloneEmpty(); } -private: - using ValueType = ExternalResultDescription::ValueType; - void readPrefix() override; + +protected: + PostgreSQLBlockInputStream( + std::shared_ptr tx_, + const std::string & query_str_, + const Block & sample_block, + const UInt64 max_block_size_, + bool auto_commit_); + + String query_str; + std::shared_ptr tx; + std::unique_ptr stream; + +private: Block readImpl() override; void readSuffix() override; - void insertValue(IColumn & column, std::string_view value, - const ExternalResultDescription::ValueType type, const DataTypePtr data_type, size_t idx); - void insertDefaultValue(IColumn & column, const IColumn & sample_column) - { - column.insertFrom(sample_column, 0); - } - void prepareArrayInfo(size_t column_idx, const DataTypePtr data_type); + void init(const Block & sample_block); - String query_str; const UInt64 max_block_size; + bool auto_commit = true; ExternalResultDescription description; postgres::ConnectionHolderPtr connection_holder; - std::unique_ptr tx; - std::unique_ptr stream; - struct ArrayInfo + std::unordered_map array_info; +}; + + +/// Passes transaction object into PostgreSQLBlockInputStream and does not close transaction after read is finished. +template +class PostgreSQLTransactionBlockInputStream : public PostgreSQLBlockInputStream +{ +public: + using Base = PostgreSQLBlockInputStream; + + PostgreSQLTransactionBlockInputStream( + std::shared_ptr tx_, + const std::string & query_str_, + const Block & sample_block_, + const UInt64 max_block_size_) + : PostgreSQLBlockInputStream(tx_, query_str_, sample_block_, max_block_size_, false) {} + + void readPrefix() override { - size_t num_dimensions; - Field default_value; - std::function pqxx_parser; - }; - std::unordered_map array_info; + Base::stream = std::make_unique(*Base::tx, pqxx::from_query, std::string_view(Base::query_str)); + } }; } diff --git a/src/DataStreams/TTLAggregationAlgorithm.cpp b/src/DataStreams/TTLAggregationAlgorithm.cpp index 9a1cf45772f..66792dcfdb2 100644 --- a/src/DataStreams/TTLAggregationAlgorithm.cpp +++ b/src/DataStreams/TTLAggregationAlgorithm.cpp @@ -33,7 +33,8 @@ TTLAggregationAlgorithm::TTLAggregationAlgorithm( Aggregator::Params params(header, keys, aggregates, false, settings.max_rows_to_group_by, settings.group_by_overflow_mode, 0, 0, settings.max_bytes_before_external_group_by, settings.empty_result_for_aggregation_by_empty_set, - storage_.getContext()->getTemporaryVolume(), settings.max_threads, settings.min_free_disk_space_for_temporary_data); + storage_.getContext()->getTemporaryVolume(), settings.max_threads, settings.min_free_disk_space_for_temporary_data, + settings.compile_aggregate_expressions, settings.min_count_to_compile_aggregate_expression); aggregator = std::make_unique(params); } diff --git a/src/DataTypes/IDataType.h b/src/DataTypes/IDataType.h index 8e54036a21c..fb410336dcb 100644 --- a/src/DataTypes/IDataType.h +++ b/src/DataTypes/IDataType.h @@ -357,6 +357,7 @@ inline bool isTuple(const DataTypePtr & data_type) { return WhichDataType(data_t inline bool isArray(const DataTypePtr & data_type) { return WhichDataType(data_type).isArray(); } inline bool isMap(const DataTypePtr & data_type) { return WhichDataType(data_type).isMap(); } inline bool isNothing(const DataTypePtr & data_type) { return WhichDataType(data_type).isNothing(); } +inline bool isUUID(const DataTypePtr & data_type) { return WhichDataType(data_type).isUUID(); } template inline bool isUInt8(const T & data_type) diff --git a/src/DataTypes/Native.h b/src/DataTypes/Native.h index 0a13ce83590..88f99b60ed7 100644 --- a/src/DataTypes/Native.h +++ b/src/DataTypes/Native.h @@ -61,6 +61,44 @@ static inline llvm::Type * toNativeType(llvm::IRBuilderBase & builder, const IDa return nullptr; } +template +static inline llvm::Type * toNativeType(llvm::IRBuilderBase & builder) +{ + if constexpr (std::is_same_v || std::is_same_v) + return builder.getInt8Ty(); + else if constexpr (std::is_same_v || std::is_same_v) + return builder.getInt16Ty(); + else if constexpr (std::is_same_v || std::is_same_v) + return builder.getInt32Ty(); + else if constexpr (std::is_same_v || std::is_same_v) + return builder.getInt64Ty(); + else if constexpr (std::is_same_v) + return builder.getFloatTy(); + else if constexpr (std::is_same_v) + return builder.getDoubleTy(); + + return nullptr; +} + +template +static inline bool canBeNativeType() +{ + if constexpr (std::is_same_v || std::is_same_v) + return true; + else if constexpr (std::is_same_v || std::is_same_v) + return true; + else if constexpr (std::is_same_v || std::is_same_v) + return true; + else if constexpr (std::is_same_v || std::is_same_v) + return true; + else if constexpr (std::is_same_v) + return true; + else if constexpr (std::is_same_v) + return true; + + return false; +} + static inline bool canBeNativeType(const IDataType & type) { WhichDataType data_type(type); @@ -79,40 +117,62 @@ static inline llvm::Type * toNativeType(llvm::IRBuilderBase & builder, const Dat return toNativeType(builder, *type); } -static inline llvm::Value * nativeBoolCast(llvm::IRBuilder<> & b, const DataTypePtr & from, llvm::Value * value) +static inline llvm::Value * nativeBoolCast(llvm::IRBuilder<> & b, const DataTypePtr & from_type, llvm::Value * value) { - if (from->isNullable()) + if (from_type->isNullable()) { - auto * inner = nativeBoolCast(b, removeNullable(from), b.CreateExtractValue(value, {0})); + auto * inner = nativeBoolCast(b, removeNullable(from_type), b.CreateExtractValue(value, {0})); return b.CreateAnd(b.CreateNot(b.CreateExtractValue(value, {1})), inner); } auto * zero = llvm::Constant::getNullValue(value->getType()); + if (value->getType()->isIntegerTy()) return b.CreateICmpNE(value, zero); if (value->getType()->isFloatingPointTy()) return b.CreateFCmpONE(value, zero); /// QNaN is false - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot cast non-number {} to bool", from->getName()); + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot cast non-number {} to bool", from_type->getName()); } -static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, const DataTypePtr & from, llvm::Value * value, llvm::Type * to) +static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, const DataTypePtr & from, llvm::Value * value, llvm::Type * to_type) { - auto * n_from = value->getType(); + auto * from_type = value->getType(); - if (n_from == to) + if (from_type == to_type) return value; - else if (n_from->isIntegerTy() && to->isFloatingPointTy()) - return typeIsSigned(*from) ? b.CreateSIToFP(value, to) : b.CreateUIToFP(value, to); - else if (n_from->isFloatingPointTy() && to->isIntegerTy()) - return typeIsSigned(*from) ? b.CreateFPToSI(value, to) : b.CreateFPToUI(value, to); - else if (n_from->isIntegerTy() && to->isIntegerTy()) - return b.CreateIntCast(value, to, typeIsSigned(*from)); - else if (n_from->isFloatingPointTy() && to->isFloatingPointTy()) - return b.CreateFPCast(value, to); + else if (from_type->isIntegerTy() && to_type->isFloatingPointTy()) + return typeIsSigned(*from) ? b.CreateSIToFP(value, to_type) : b.CreateUIToFP(value, to_type); + else if (from_type->isFloatingPointTy() && to_type->isIntegerTy()) + return typeIsSigned(*from) ? b.CreateFPToSI(value, to_type) : b.CreateFPToUI(value, to_type); + else if (from_type->isIntegerTy() && to_type->isIntegerTy()) + return b.CreateIntCast(value, to_type, typeIsSigned(*from)); + else if (from_type->isFloatingPointTy() && to_type->isFloatingPointTy()) + return b.CreateFPCast(value, to_type); throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot cast {} to requested type", from->getName()); } +template +static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, llvm::Value * value, llvm::Type * to_type) +{ + auto * from_type = value->getType(); + + static constexpr bool from_type_is_signed = std::numeric_limits::is_signed; + + if (from_type == to_type) + return value; + else if (from_type->isIntegerTy() && to_type->isFloatingPointTy()) + return from_type_is_signed ? b.CreateSIToFP(value, to_type) : b.CreateUIToFP(value, to_type); + else if (from_type->isFloatingPointTy() && to_type->isIntegerTy()) + return from_type_is_signed ? b.CreateFPToSI(value, to_type) : b.CreateFPToUI(value, to_type); + else if (from_type->isIntegerTy() && to_type->isIntegerTy()) + return b.CreateIntCast(value, to_type, from_type_is_signed); + else if (from_type->isFloatingPointTy() && to_type->isFloatingPointTy()) + return b.CreateFPCast(value, to_type); + + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot cast {} to requested type", TypeName); +} + static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, const DataTypePtr & from, llvm::Value * value, const DataTypePtr & to) { auto * n_to = toNativeType(b, to); @@ -139,6 +199,37 @@ static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, const DataTypePtr return nativeCast(b, from, value, n_to); } +static inline std::pair nativeCastToCommon(llvm::IRBuilder<> & b, const DataTypePtr & lhs_type, llvm::Value * lhs, const DataTypePtr & rhs_type, llvm::Value * rhs) +{ + llvm::Type * common; + + bool lhs_is_signed = typeIsSigned(*lhs_type); + bool rhs_is_signed = typeIsSigned(*rhs_type); + + if (lhs->getType()->isIntegerTy() && rhs->getType()->isIntegerTy()) + { + /// if one integer has a sign bit, make sure the other does as well. llvm generates optimal code + /// (e.g. uses overflow flag on x86) for (word size + 1)-bit integer operations. + + size_t lhs_bit_width = lhs->getType()->getIntegerBitWidth() + (!lhs_is_signed && rhs_is_signed); + size_t rhs_bit_width = rhs->getType()->getIntegerBitWidth() + (!rhs_is_signed && lhs_is_signed); + + size_t max_bit_width = std::max(lhs_bit_width, rhs_bit_width); + common = b.getIntNTy(max_bit_width); + } + else + { + /// TODO: Check + /// (double, float) or (double, int_N where N <= double's mantissa width) -> double + common = b.getDoubleTy(); + } + + auto * cast_lhs_to_common = nativeCast(b, lhs_type, lhs, common); + auto * cast_rhs_to_common = nativeCast(b, rhs_type, rhs, common); + + return std::make_pair(cast_lhs_to_common, cast_rhs_to_common); +} + static inline llvm::Constant * getColumnNativeValue(llvm::IRBuilderBase & builder, const DataTypePtr & column_type, const IColumn & column, size_t index) { if (const auto * constant = typeid_cast(&column)) diff --git a/src/DataTypes/Serializations/SerializationMap.cpp b/src/DataTypes/Serializations/SerializationMap.cpp index 84e6fd3b897..fa882bef7ca 100644 --- a/src/DataTypes/Serializations/SerializationMap.cpp +++ b/src/DataTypes/Serializations/SerializationMap.cpp @@ -81,7 +81,7 @@ void SerializationMap::deserializeBinary(IColumn & column, ReadBuffer & istr) co template -void SerializationMap::serializeTextImpl(const IColumn & column, size_t row_num, WriteBuffer & ostr, Writer && writer) const +void SerializationMap::serializeTextImpl(const IColumn & column, size_t row_num, bool quote_key, WriteBuffer & ostr, Writer && writer) const { const auto & column_map = assert_cast(column); @@ -97,7 +97,16 @@ void SerializationMap::serializeTextImpl(const IColumn & column, size_t row_num, { if (i != offset) writeChar(',', ostr); - writer(key, nested_tuple.getColumn(0), i); + + if (quote_key) + { + writeChar('"', ostr); + writer(key, nested_tuple.getColumn(0), i); + writeChar('"', ostr); + } + else + writer(key, nested_tuple.getColumn(0), i); + writeChar(':', ostr); writer(value, nested_tuple.getColumn(1), i); } @@ -161,7 +170,7 @@ void SerializationMap::deserializeTextImpl(IColumn & column, ReadBuffer & istr, void SerializationMap::serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const { - serializeTextImpl(column, row_num, ostr, + serializeTextImpl(column, row_num, /*quote_key=*/ false, ostr, [&](const SerializationPtr & subcolumn_serialization, const IColumn & subcolumn, size_t pos) { subcolumn_serialization->serializeTextQuoted(subcolumn, pos, ostr, settings); @@ -170,7 +179,6 @@ void SerializationMap::serializeText(const IColumn & column, size_t row_num, Wri void SerializationMap::deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const { - deserializeTextImpl(column, istr, [&](const SerializationPtr & subcolumn_serialization, IColumn & subcolumn) { @@ -178,10 +186,13 @@ void SerializationMap::deserializeText(IColumn & column, ReadBuffer & istr, cons }); } - void SerializationMap::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const { - serializeTextImpl(column, row_num, ostr, + /// We need to double-quote integer keys to produce valid JSON. + const auto & column_key = assert_cast(column).getNestedData().getColumn(0); + bool quote_key = !WhichDataType(column_key.getDataType()).isStringOrFixedString(); + + serializeTextImpl(column, row_num, quote_key, ostr, [&](const SerializationPtr & subcolumn_serialization, const IColumn & subcolumn, size_t pos) { subcolumn_serialization->serializeTextJSON(subcolumn, pos, ostr, settings); diff --git a/src/DataTypes/Serializations/SerializationMap.h b/src/DataTypes/Serializations/SerializationMap.h index 6f72d5c2594..bf68689f1e4 100644 --- a/src/DataTypes/Serializations/SerializationMap.h +++ b/src/DataTypes/Serializations/SerializationMap.h @@ -61,7 +61,7 @@ public: private: template - void serializeTextImpl(const IColumn & column, size_t row_num, WriteBuffer & ostr, Writer && writer) const; + void serializeTextImpl(const IColumn & column, size_t row_num, bool quote_key, WriteBuffer & ostr, Writer && writer) const; template void deserializeTextImpl(IColumn & column, ReadBuffer & istr, Reader && reader) const; diff --git a/src/Databases/DatabaseAtomic.cpp b/src/Databases/DatabaseAtomic.cpp index b86581a6ab3..b69b74451c7 100644 --- a/src/Databases/DatabaseAtomic.cpp +++ b/src/Databases/DatabaseAtomic.cpp @@ -109,12 +109,11 @@ StoragePtr DatabaseAtomic::detachTable(const String & name) void DatabaseAtomic::dropTable(ContextPtr local_context, const String & table_name, bool no_delay) { - if (auto * mv = dynamic_cast(tryGetTable(table_name, local_context).get())) - { - /// Remove the inner table (if any) to avoid deadlock - /// (due to attempt to execute DROP from the worker thread) - mv->dropInnerTable(no_delay, local_context); - } + auto storage = tryGetTable(table_name, local_context); + /// Remove the inner table (if any) to avoid deadlock + /// (due to attempt to execute DROP from the worker thread) + if (storage) + storage->dropInnerTableIfAny(no_delay, local_context); String table_metadata_path = getObjectMetadataPath(table_name); String table_metadata_path_drop; @@ -568,4 +567,3 @@ void DatabaseAtomic::checkDetachedTableNotInUse(const UUID & uuid) } } - diff --git a/src/Databases/DatabaseFactory.cpp b/src/Databases/DatabaseFactory.cpp index 7e65bf398f9..48b923c4756 100644 --- a/src/Databases/DatabaseFactory.cpp +++ b/src/Databases/DatabaseFactory.cpp @@ -36,7 +36,8 @@ #if USE_LIBPQXX #include // Y_IGNORE -#include +#include +#include #endif namespace fs = std::filesystem; @@ -99,14 +100,14 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String const UUID & uuid = create.uuid; bool engine_may_have_arguments = engine_name == "MySQL" || engine_name == "MaterializeMySQL" || engine_name == "Lazy" || - engine_name == "Replicated" || engine_name == "PostgreSQL"; + engine_name == "Replicated" || engine_name == "PostgreSQL" || engine_name == "MaterializedPostgreSQL"; if (engine_define->engine->arguments && !engine_may_have_arguments) throw Exception("Database engine " + engine_name + " cannot have arguments", ErrorCodes::BAD_ARGUMENTS); bool has_unexpected_element = engine_define->engine->parameters || engine_define->partition_by || engine_define->primary_key || engine_define->order_by || engine_define->sample_by; - bool may_have_settings = endsWith(engine_name, "MySQL") || engine_name == "Replicated"; + bool may_have_settings = endsWith(engine_name, "MySQL") || engine_name == "Replicated" || engine_name == "MaterializedPostgreSQL"; if (has_unexpected_element || (!may_have_settings && engine_define->settings)) throw Exception("Database engine " + engine_name + " cannot have parameters, primary_key, order_by, sample_by, settings", ErrorCodes::UNKNOWN_ELEMENT_IN_AST); @@ -262,6 +263,41 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String return std::make_shared( context, metadata_path, engine_define, database_name, postgres_database_name, connection_pool, use_table_cache); } + else if (engine_name == "MaterializedPostgreSQL") + { + const ASTFunction * engine = engine_define->engine; + + if (!engine->arguments || engine->arguments->children.size() != 4) + { + throw Exception( + fmt::format("{} Database require host:port, database_name, username, password arguments ", engine_name), + ErrorCodes::BAD_ARGUMENTS); + } + + ASTs & engine_args = engine->arguments->children; + + for (auto & engine_arg : engine_args) + engine_arg = evaluateConstantExpressionOrIdentifierAsLiteral(engine_arg, context); + + const auto & host_port = safeGetLiteralValue(engine_args[0], engine_name); + const auto & postgres_database_name = safeGetLiteralValue(engine_args[1], engine_name); + const auto & username = safeGetLiteralValue(engine_args[2], engine_name); + const auto & password = safeGetLiteralValue(engine_args[3], engine_name); + + auto parsed_host_port = parseAddress(host_port, 5432); + auto connection_info = postgres::formatConnectionString(postgres_database_name, parsed_host_port.first, parsed_host_port.second, username, password); + + auto postgresql_replica_settings = std::make_unique(); + + if (engine_define->settings) + postgresql_replica_settings->loadFromQuery(*engine_define); + + return std::make_shared( + context, metadata_path, uuid, engine_define, create.attach, + database_name, postgres_database_name, connection_info, + std::move(postgresql_replica_settings)); + } + #endif diff --git a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp new file mode 100644 index 00000000000..742eb28c7a4 --- /dev/null +++ b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp @@ -0,0 +1,215 @@ +#include + +#if USE_LIBPQXX + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int NOT_IMPLEMENTED; + extern const int LOGICAL_ERROR; +} + +DatabaseMaterializedPostgreSQL::DatabaseMaterializedPostgreSQL( + ContextPtr context_, + const String & metadata_path_, + UUID uuid_, + const ASTStorage * database_engine_define_, + bool is_attach_, + const String & database_name_, + const String & postgres_database_name, + const postgres::ConnectionInfo & connection_info_, + std::unique_ptr settings_) + : DatabaseAtomic(database_name_, metadata_path_, uuid_, "DatabaseMaterializedPostgreSQL (" + database_name_ + ")", context_) + , database_engine_define(database_engine_define_->clone()) + , is_attach(is_attach_) + , remote_database_name(postgres_database_name) + , connection_info(connection_info_) + , settings(std::move(settings_)) +{ +} + + +void DatabaseMaterializedPostgreSQL::startSynchronization() +{ + replication_handler = std::make_unique( + /* replication_identifier */database_name, + remote_database_name, + database_name, + connection_info, + getContext(), + is_attach, + settings->materialized_postgresql_max_block_size.value, + settings->materialized_postgresql_allow_automatic_update, + /* is_materialized_postgresql_database = */ true, + settings->materialized_postgresql_tables_list.value); + + postgres::Connection connection(connection_info); + NameSet tables_to_replicate; + try + { + tables_to_replicate = replication_handler->fetchRequiredTables(connection); + } + catch (...) + { + LOG_ERROR(log, "Unable to load replicated tables list"); + throw; + } + + if (tables_to_replicate.empty()) + throw Exception(ErrorCodes::LOGICAL_ERROR, "Got empty list of tables to replicate"); + + for (const auto & table_name : tables_to_replicate) + { + /// Check nested ReplacingMergeTree table. + auto storage = DatabaseAtomic::tryGetTable(table_name, getContext()); + + if (storage) + { + /// Nested table was already created and synchronized. + storage = StorageMaterializedPostgreSQL::create(storage, getContext()); + } + else + { + /// Nested table does not exist and will be created by replication thread. + storage = StorageMaterializedPostgreSQL::create(StorageID(database_name, table_name), getContext()); + } + + /// Cache MaterializedPostgreSQL wrapper over nested table. + materialized_tables[table_name] = storage; + + /// Let replication thread know, which tables it needs to keep in sync. + replication_handler->addStorage(table_name, storage->as()); + } + + LOG_TRACE(log, "Loaded {} tables. Starting synchronization", materialized_tables.size()); + replication_handler->startup(); +} + + +void DatabaseMaterializedPostgreSQL::loadStoredObjects(ContextMutablePtr local_context, bool has_force_restore_data_flag, bool force_attach) +{ + DatabaseAtomic::loadStoredObjects(local_context, has_force_restore_data_flag, force_attach); + + try + { + startSynchronization(); + } + catch (...) + { + tryLogCurrentException(log, "Cannot load nested database objects for PostgreSQL database engine."); + + if (!force_attach) + throw; + } + +} + + +StoragePtr DatabaseMaterializedPostgreSQL::tryGetTable(const String & name, ContextPtr local_context) const +{ + /// In otder to define which table access is needed - to MaterializedPostgreSQL table (only in case of SELECT queries) or + /// to its nested ReplacingMergeTree table (in all other cases), the context of a query os modified. + /// Also if materialzied_tables set is empty - it means all access is done to ReplacingMergeTree tables - it is a case after + /// replication_handler was shutdown. + if (local_context->isInternalQuery() || materialized_tables.empty()) + { + return DatabaseAtomic::tryGetTable(name, local_context); + } + + /// Note: In select query we call MaterializedPostgreSQL table and it calls tryGetTable from its nested. + /// So the only point, where synchronization is needed - access to MaterializedPostgreSQL table wrapper over nested table. + std::lock_guard lock(tables_mutex); + auto table = materialized_tables.find(name); + + /// Return wrapper over ReplacingMergeTree table. If table synchronization just started, table will not + /// be accessible immediately. Table is considered to exist once its nested table was created. + if (table != materialized_tables.end() && table->second->as ()->hasNested()) + { + return table->second; + } + + return StoragePtr{}; +} + + +void DatabaseMaterializedPostgreSQL::createTable(ContextPtr local_context, const String & table_name, const StoragePtr & table, const ASTPtr & query) +{ + /// Create table query can only be called from replication thread. + if (local_context->isInternalQuery()) + { + DatabaseAtomic::createTable(local_context, table_name, table, query); + return; + } + + throw Exception(ErrorCodes::NOT_IMPLEMENTED, + "Create table query allowed only for ReplacingMergeTree engine and from synchronization thread"); +} + + +void DatabaseMaterializedPostgreSQL::shutdown() +{ + stopReplication(); + DatabaseAtomic::shutdown(); +} + + +void DatabaseMaterializedPostgreSQL::stopReplication() +{ + if (replication_handler) + replication_handler->shutdown(); + + /// Clear wrappers over nested, all access is not done to nested tables directly. + materialized_tables.clear(); +} + + +void DatabaseMaterializedPostgreSQL::dropTable(ContextPtr local_context, const String & table_name, bool no_delay) +{ + /// Modify context into nested_context and pass query to Atomic database. + DatabaseAtomic::dropTable(StorageMaterializedPostgreSQL::makeNestedTableContext(local_context), table_name, no_delay); +} + + +void DatabaseMaterializedPostgreSQL::drop(ContextPtr local_context) +{ + if (replication_handler) + replication_handler->shutdownFinal(); + + DatabaseAtomic::drop(StorageMaterializedPostgreSQL::makeNestedTableContext(local_context)); +} + + +DatabaseTablesIteratorPtr DatabaseMaterializedPostgreSQL::getTablesIterator( + ContextPtr local_context, const DatabaseOnDisk::FilterByNameFunction & filter_by_table_name) +{ + /// Modify context into nested_context and pass query to Atomic database. + return DatabaseAtomic::getTablesIterator(StorageMaterializedPostgreSQL::makeNestedTableContext(local_context), filter_by_table_name); +} + + +} + +#endif diff --git a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.h b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.h new file mode 100644 index 00000000000..7ca84f079ed --- /dev/null +++ b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.h @@ -0,0 +1,79 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +#include "config_core.h" +#endif + +#if USE_LIBPQXX + +#include +#include + +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +class PostgreSQLConnection; +using PostgreSQLConnectionPtr = std::shared_ptr; + + +class DatabaseMaterializedPostgreSQL : public DatabaseAtomic +{ + +public: + DatabaseMaterializedPostgreSQL( + ContextPtr context_, + const String & metadata_path_, + UUID uuid_, + const ASTStorage * database_engine_define_, + bool is_attach_, + const String & database_name_, + const String & postgres_database_name, + const postgres::ConnectionInfo & connection_info, + std::unique_ptr settings_); + + String getEngineName() const override { return "MaterializedPostgreSQL"; } + + String getMetadataPath() const override { return metadata_path; } + + void loadStoredObjects(ContextMutablePtr, bool, bool force_attach) override; + + DatabaseTablesIteratorPtr getTablesIterator( + ContextPtr context, const DatabaseOnDisk::FilterByNameFunction & filter_by_table_name) override; + + StoragePtr tryGetTable(const String & name, ContextPtr context) const override; + + void createTable(ContextPtr context, const String & name, const StoragePtr & table, const ASTPtr & query) override; + + void dropTable(ContextPtr local_context, const String & name, bool no_delay) override; + + void drop(ContextPtr local_context) override; + + void stopReplication(); + + void shutdown() override; + +private: + void startSynchronization(); + + ASTPtr database_engine_define; + bool is_attach; + String remote_database_name; + postgres::ConnectionInfo connection_info; + std::unique_ptr settings; + + std::shared_ptr replication_handler; + std::map materialized_tables; + mutable std::mutex tables_mutex; +}; + +} + +#endif diff --git a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp index 243ab9166be..c8ef5a44682 100644 --- a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp +++ b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp @@ -40,14 +40,14 @@ DatabasePostgreSQL::DatabasePostgreSQL( const ASTStorage * database_engine_define_, const String & dbname_, const String & postgres_dbname, - postgres::PoolWithFailoverPtr connection_pool_, - const bool cache_tables_) + postgres::PoolWithFailoverPtr pool_, + bool cache_tables_) : IDatabase(dbname_) , WithContext(context_->getGlobalContext()) , metadata_path(metadata_path_) , database_engine_define(database_engine_define_->clone()) , dbname(postgres_dbname) - , connection_pool(std::move(connection_pool_)) + , pool(std::move(pool_)) , cache_tables(cache_tables_) { cleaner_task = getContext()->getSchedulePool().createTask("PostgreSQLCleanerTask", [this]{ removeOutdatedTables(); }); @@ -59,7 +59,8 @@ bool DatabasePostgreSQL::empty() const { std::lock_guard lock(mutex); - auto tables_list = fetchTablesList(); + auto connection_holder = pool->get(); + auto tables_list = fetchPostgreSQLTablesList(connection_holder->get()); for (const auto & table_name : tables_list) if (!detached_or_dropped.count(table_name)) @@ -74,7 +75,8 @@ DatabaseTablesIteratorPtr DatabasePostgreSQL::getTablesIterator(ContextPtr local std::lock_guard lock(mutex); Tables tables; - auto table_names = fetchTablesList(); + auto connection_holder = pool->get(); + auto table_names = fetchPostgreSQLTablesList(connection_holder->get()); for (const auto & table_name : table_names) if (!detached_or_dropped.count(table_name)) @@ -84,21 +86,6 @@ DatabaseTablesIteratorPtr DatabasePostgreSQL::getTablesIterator(ContextPtr local } -std::unordered_set DatabasePostgreSQL::fetchTablesList() const -{ - std::unordered_set tables; - std::string query = "SELECT tablename FROM pg_catalog.pg_tables " - "WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema'"; - auto connection_holder = connection_pool->get(); - pqxx::read_transaction tx(connection_holder->get()); - - for (auto table_name : tx.stream(query)) - tables.insert(std::get<0>(table_name)); - - return tables; -} - - bool DatabasePostgreSQL::checkPostgresTable(const String & table_name) const { if (table_name.find('\'') != std::string::npos @@ -108,7 +95,7 @@ bool DatabasePostgreSQL::checkPostgresTable(const String & table_name) const "PostgreSQL table name cannot contain single quote or backslash characters, passed {}", table_name); } - auto connection_holder = connection_pool->get(); + auto connection_holder = pool->get(); pqxx::nontransaction tx(connection_holder->get()); try @@ -163,20 +150,15 @@ StoragePtr DatabasePostgreSQL::fetchTable(const String & table_name, ContextPtr if (!table_checked && !checkPostgresTable(table_name)) return StoragePtr{}; - auto use_nulls = local_context->getSettingsRef().external_table_functions_use_nulls; - auto columns = fetchPostgreSQLTableStructure(connection_pool->get(), doubleQuoteString(table_name), use_nulls); + auto connection_holder = pool->get(); + auto columns = fetchPostgreSQLTableStructure(connection_holder->get(), doubleQuoteString(table_name)).columns; if (!columns) return StoragePtr{}; auto storage = StoragePostgreSQL::create( - StorageID(database_name, table_name), - connection_pool, - table_name, - ColumnsDescription{*columns}, - ConstraintsDescription{}, - String{}, - local_context); + StorageID(database_name, table_name), pool, table_name, + ColumnsDescription{*columns}, ConstraintsDescription{}, String{}, local_context); if (cache_tables) cached_tables[table_name] = storage; @@ -298,7 +280,8 @@ void DatabasePostgreSQL::loadStoredObjects(ContextMutablePtr /* context */, bool void DatabasePostgreSQL::removeOutdatedTables() { std::lock_guard lock{mutex}; - auto actual_tables = fetchTablesList(); + auto connection_holder = pool->get(); + auto actual_tables = fetchPostgreSQLTablesList(connection_holder->get()); if (cache_tables) { diff --git a/src/Databases/PostgreSQL/DatabasePostgreSQL.h b/src/Databases/PostgreSQL/DatabasePostgreSQL.h index 3c3a67ec9d3..ea465390099 100644 --- a/src/Databases/PostgreSQL/DatabasePostgreSQL.h +++ b/src/Databases/PostgreSQL/DatabasePostgreSQL.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include namespace DB @@ -33,7 +33,7 @@ public: const ASTStorage * database_engine_define, const String & dbname_, const String & postgres_dbname, - postgres::PoolWithFailoverPtr connection_pool_, + postgres::PoolWithFailoverPtr pool_, bool cache_tables_); String getEngineName() const override { return "PostgreSQL"; } @@ -70,7 +70,7 @@ private: String metadata_path; ASTPtr database_engine_define; String dbname; - postgres::PoolWithFailoverPtr connection_pool; + postgres::PoolWithFailoverPtr pool; const bool cache_tables; mutable Tables cached_tables; @@ -78,9 +78,11 @@ private: BackgroundSchedulePool::TaskHolder cleaner_task; bool checkPostgresTable(const String & table_name) const; - std::unordered_set fetchTablesList() const; - StoragePtr fetchTable(const String & table_name, ContextPtr context, bool table_checked) const; + + StoragePtr fetchTable(const String & table_name, ContextPtr context, const bool table_checked) const; + void removeOutdatedTables(); + ASTPtr getColumnDeclaration(const DataTypePtr & data_type) const; }; diff --git a/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.cpp b/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.cpp index ea86fe94e8e..64d47720af9 100644 --- a/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.cpp +++ b/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.cpp @@ -12,7 +12,8 @@ #include #include #include -#include +#include +#include namespace DB @@ -25,7 +26,21 @@ namespace ErrorCodes } -static DataTypePtr convertPostgreSQLDataType(String & type, bool is_nullable, uint16_t dimensions, const std::function & recheck_array) +template +std::unordered_set fetchPostgreSQLTablesList(T & tx) +{ + std::unordered_set tables; + std::string query = "SELECT tablename FROM pg_catalog.pg_tables " + "WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema'"; + + for (auto table_name : tx.template stream(query)) + tables.insert(std::get<0>(table_name)); + + return tables; +} + + +static DataTypePtr convertPostgreSQLDataType(String & type, const std::function & recheck_array, bool is_nullable = false, uint16_t dimensions = 0) { DataTypePtr res; bool is_array = false; @@ -116,52 +131,51 @@ static DataTypePtr convertPostgreSQLDataType(String & type, bool is_nullable, ui } -std::shared_ptr fetchPostgreSQLTableStructure( - postgres::ConnectionHolderPtr connection_holder, const String & postgres_table_name, bool use_nulls) +template +std::shared_ptr readNamesAndTypesList( + T & tx, const String & postgres_table_name, const String & query, bool use_nulls, bool only_names_and_types) { auto columns = NamesAndTypes(); - if (postgres_table_name.find('\'') != std::string::npos - || postgres_table_name.find('\\') != std::string::npos) - { - throw Exception(ErrorCodes::BAD_ARGUMENTS, "PostgreSQL table name cannot contain single quote or backslash characters, passed {}", - postgres_table_name); - } - - std::string query = fmt::format( - "SELECT attname AS name, format_type(atttypid, atttypmod) AS type, " - "attnotnull AS not_null, attndims AS dims " - "FROM pg_attribute " - "WHERE attrelid = '{}'::regclass " - "AND NOT attisdropped AND attnum > 0", postgres_table_name); try { std::set recheck_arrays_indexes; { - pqxx::read_transaction tx(connection_holder->get()); auto stream{pqxx::stream_from::query(tx, query)}; - std::tuple row; size_t i = 0; auto recheck_array = [&]() { recheck_arrays_indexes.insert(i); }; - while (stream >> row) + + if (only_names_and_types) { - auto data_type = convertPostgreSQLDataType(std::get<1>(row), - use_nulls && (std::get<2>(row) == "f"), /// 'f' means that postgres `not_null` is false, i.e. value is nullable - std::get<3>(row), - recheck_array); - columns.push_back(NameAndTypePair(std::get<0>(row), data_type)); - ++i; + std::tuple row; + while (stream >> row) + { + columns.push_back(NameAndTypePair(std::get<0>(row), convertPostgreSQLDataType(std::get<1>(row), recheck_array))); + ++i; + } } + else + { + std::tuple row; + while (stream >> row) + { + auto data_type = convertPostgreSQLDataType(std::get<1>(row), + recheck_array, + use_nulls && (std::get<2>(row) == "f"), /// 'f' means that postgres `not_null` is false, i.e. value is nullable + std::get<3>(row)); + columns.push_back(NameAndTypePair(std::get<0>(row), data_type)); + ++i; + } + } + stream.complete(); - tx.commit(); } for (const auto & i : recheck_arrays_indexes) { const auto & name_and_type = columns[i]; - pqxx::nontransaction tx(connection_holder->get()); /// All rows must contain the same number of dimensions, so limit 1 is ok. If number of dimensions in all rows is not the same - /// such arrays are not able to be used as ClickHouse Array at all. pqxx::result result{tx.exec(fmt::format("SELECT array_ndims({}) FROM {} LIMIT 1", name_and_type.name, postgres_table_name))}; @@ -178,9 +192,7 @@ std::shared_ptr fetchPostgreSQLTableStructure( catch (const pqxx::undefined_table &) { - throw Exception(fmt::format( - "PostgreSQL table {}.{} does not exist", - connection_holder->get().dbname(), postgres_table_name), ErrorCodes::UNKNOWN_TABLE); + throw Exception(ErrorCodes::UNKNOWN_TABLE, "PostgreSQL table {} does not exist", postgres_table_name); } catch (Exception & e) { @@ -188,12 +200,101 @@ std::shared_ptr fetchPostgreSQLTableStructure( throw; } - if (columns.empty()) - return nullptr; - - return std::make_shared(NamesAndTypesList(columns.begin(), columns.end())); + return !columns.empty() ? std::make_shared(columns.begin(), columns.end()) : nullptr; } + +template +PostgreSQLTableStructure fetchPostgreSQLTableStructure( + T & tx, const String & postgres_table_name, bool use_nulls, bool with_primary_key, bool with_replica_identity_index) +{ + PostgreSQLTableStructure table; + + std::string query = fmt::format( + "SELECT attname AS name, format_type(atttypid, atttypmod) AS type, " + "attnotnull AS not_null, attndims AS dims " + "FROM pg_attribute " + "WHERE attrelid = {}::regclass " + "AND NOT attisdropped AND attnum > 0", quoteString(postgres_table_name)); + + table.columns = readNamesAndTypesList(tx, postgres_table_name, query, use_nulls, false); + + if (with_primary_key) + { + /// wiki.postgresql.org/wiki/Retrieve_primary_key_columns + query = fmt::format( + "SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS data_type " + "FROM pg_index i " + "JOIN pg_attribute a ON a.attrelid = i.indrelid " + "AND a.attnum = ANY(i.indkey) " + "WHERE i.indrelid = {}::regclass AND i.indisprimary", quoteString(postgres_table_name)); + + table.primary_key_columns = readNamesAndTypesList(tx, postgres_table_name, query, use_nulls, true); + } + + if (with_replica_identity_index && !table.primary_key_columns) + { + query = fmt::format( + "SELECT " + "a.attname AS column_name, " /// column name + "format_type(a.atttypid, a.atttypmod) as type " /// column type + "FROM " + "pg_class t, " + "pg_class i, " + "pg_index ix, " + "pg_attribute a " + "WHERE " + "t.oid = ix.indrelid " + "and i.oid = ix.indexrelid " + "and a.attrelid = t.oid " + "and a.attnum = ANY(ix.indkey) " + "and t.relkind = 'r' " /// simple tables + "and t.relname = {} " /// Connection is already done to a needed database, only table name is needed. + "and ix.indisreplident = 't' " /// index is is replica identity index + "ORDER BY a.attname", /// column names + quoteString(postgres_table_name)); + + table.replica_identity_columns = readNamesAndTypesList(tx, postgres_table_name, query, use_nulls, true); + } + + return table; +} + + +PostgreSQLTableStructure fetchPostgreSQLTableStructure(pqxx::connection & connection, const String & postgres_table_name, bool use_nulls) +{ + pqxx::ReadTransaction tx(connection); + auto result = fetchPostgreSQLTableStructure(tx, postgres_table_name, use_nulls, false, false); + tx.commit(); + return result; +} + + +std::unordered_set fetchPostgreSQLTablesList(pqxx::connection & connection) +{ + pqxx::ReadTransaction tx(connection); + auto result = fetchPostgreSQLTablesList(tx); + tx.commit(); + return result; +} + + +template +PostgreSQLTableStructure fetchPostgreSQLTableStructure( + pqxx::ReadTransaction & tx, const String & postgres_table_name, bool use_nulls, + bool with_primary_key, bool with_replica_identity_index); + +template +PostgreSQLTableStructure fetchPostgreSQLTableStructure( + pqxx::ReplicationTransaction & tx, const String & postgres_table_name, bool use_nulls, + bool with_primary_key, bool with_replica_identity_index); + +template +std::unordered_set fetchPostgreSQLTablesList(pqxx::work & tx); + +template +std::unordered_set fetchPostgreSQLTablesList(pqxx::ReadTransaction & tx); + } #endif diff --git a/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.h b/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.h index 331c1de49d2..07562cd69fa 100644 --- a/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.h +++ b/src/Databases/PostgreSQL/fetchPostgreSQLTableStructure.h @@ -5,15 +5,34 @@ #endif #if USE_LIBPQXX -#include +#include #include namespace DB { -std::shared_ptr fetchPostgreSQLTableStructure( - postgres::ConnectionHolderPtr connection_holder, const String & postgres_table_name, bool use_nulls); +struct PostgreSQLTableStructure +{ + std::shared_ptr columns = nullptr; + std::shared_ptr primary_key_columns = nullptr; + std::shared_ptr replica_identity_columns = nullptr; +}; + +using PostgreSQLTableStructurePtr = std::unique_ptr; + +std::unordered_set fetchPostgreSQLTablesList(pqxx::connection & connection); + +PostgreSQLTableStructure fetchPostgreSQLTableStructure( + pqxx::connection & connection, const String & postgres_table_name, bool use_nulls = true); + +template +PostgreSQLTableStructure fetchPostgreSQLTableStructure( + T & tx, const String & postgres_table_name, bool use_nulls = true, + bool with_primary_key = false, bool with_replica_identity_index = false); + +template +std::unordered_set fetchPostgreSQLTablesList(T & tx); } diff --git a/src/Dictionaries/PostgreSQLDictionarySource.cpp b/src/Dictionaries/PostgreSQLDictionarySource.cpp index a51beee8ee5..f1ca3d4855b 100644 --- a/src/Dictionaries/PostgreSQLDictionarySource.cpp +++ b/src/Dictionaries/PostgreSQLDictionarySource.cpp @@ -107,9 +107,10 @@ BlockInputStreamPtr PostgreSQLDictionarySource::loadKeys(const Columns & key_col BlockInputStreamPtr PostgreSQLDictionarySource::loadBase(const String & query) { - return std::make_shared(pool->get(), query, sample_block, max_block_size); + return std::make_shared>(pool->get(), query, sample_block, max_block_size); } + bool PostgreSQLDictionarySource::isModified() const { if (!configuration.invalidate_query.empty()) @@ -128,7 +129,7 @@ std::string PostgreSQLDictionarySource::doInvalidateQuery(const std::string & re Block invalidate_sample_block; ColumnPtr column(ColumnString::create()); invalidate_sample_block.insert(ColumnWithTypeAndName(column, std::make_shared(), "Sample Block")); - PostgreSQLBlockInputStream block_input_stream(pool->get(), request, invalidate_sample_block, 1); + PostgreSQLBlockInputStream<> block_input_stream(pool->get(), request, invalidate_sample_block, 1); return readInvalidateQuery(block_input_stream); } diff --git a/src/Dictionaries/PostgreSQLDictionarySource.h b/src/Dictionaries/PostgreSQLDictionarySource.h index 434b684cc6a..789f0d13966 100644 --- a/src/Dictionaries/PostgreSQLDictionarySource.h +++ b/src/Dictionaries/PostgreSQLDictionarySource.h @@ -11,8 +11,7 @@ #include #include #include -#include -#include +#include namespace DB diff --git a/src/Functions/CRC.cpp b/src/Functions/CRC.cpp index 6083e5ef16f..00aa631c85b 100644 --- a/src/Functions/CRC.cpp +++ b/src/Functions/CRC.cpp @@ -110,6 +110,11 @@ struct CRCFunctionWrapper throw Exception("Cannot apply function " + std::string(Impl::name) + " to Array argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } + [[noreturn]] static void uuid(const ColumnUUID::Container & /*offsets*/, size_t /*n*/, PaddedPODArray & /*res*/) + { + throw Exception("Cannot apply function " + std::string(Impl::name) + " to UUID argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + } + private: static ReturnType doCRC(const ColumnString::Chars & buf, size_t offset, size_t size) { diff --git a/src/Functions/EmptyImpl.h b/src/Functions/EmptyImpl.h index 164441135bd..c3117e0e52d 100644 --- a/src/Functions/EmptyImpl.h +++ b/src/Functions/EmptyImpl.h @@ -54,6 +54,12 @@ struct EmptyImpl prev_offset = offsets[i]; } } + + static void uuid(const ColumnUUID::Container & container, size_t n, PaddedPODArray & res) + { + for (size_t i = 0; i < n; ++i) + res[i] = negative ^ (container.data()->toUnderType() == 0); + } }; } diff --git a/src/Functions/FunctionStringOrArrayToT.h b/src/Functions/FunctionStringOrArrayToT.h index 158179fffe9..69f0741a741 100644 --- a/src/Functions/FunctionStringOrArrayToT.h +++ b/src/Functions/FunctionStringOrArrayToT.h @@ -8,6 +8,7 @@ #include #include #include +#include namespace DB @@ -43,7 +44,9 @@ public: DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override { if (!isStringOrFixedString(arguments[0]) - && !isArray(arguments[0]) && !isMap(arguments[0])) + && !isArray(arguments[0]) + && !isMap(arguments[0]) + && !isUUID(arguments[0])) throw Exception("Illegal type " + arguments[0]->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); return std::make_shared>(); @@ -51,7 +54,7 @@ public: bool useDefaultImplementationForConstants() const override { return true; } - ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t /*input_rows_count*/) const override + ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override { const ColumnPtr column = arguments[0].column; if (const ColumnString * col = checkAndGetColumn(column.get())) @@ -104,6 +107,14 @@ public: Impl::array(col_nested.getOffsets(), vec_res); return col_res; } + else if (const ColumnUUID * col_uuid = checkAndGetColumn(column.get())) + { + auto col_res = ColumnVector::create(); + typename ColumnVector::Container & vec_res = col_res->getData(); + vec_res.resize(col_uuid->size()); + Impl::uuid(col_uuid->getData(), input_rows_count, vec_res); + return col_res; + } else throw Exception("Illegal column " + arguments[0].column->getName() + " of argument of function " + getName(), ErrorCodes::ILLEGAL_COLUMN); diff --git a/src/Functions/FunctionsComparison.h b/src/Functions/FunctionsComparison.h index ce0f580e6f1..239a0b30398 100644 --- a/src/Functions/FunctionsComparison.h +++ b/src/Functions/FunctionsComparison.h @@ -1265,23 +1265,7 @@ public: assert(2 == types.size() && 2 == values.size()); auto & b = static_cast &>(builder); - auto * x = values[0]; - auto * y = values[1]; - if (!types[0]->equals(*types[1])) - { - llvm::Type * common; - if (x->getType()->isIntegerTy() && y->getType()->isIntegerTy()) - common = b.getIntNTy(std::max( - /// if one integer has a sign bit, make sure the other does as well. llvm generates optimal code - /// (e.g. uses overflow flag on x86) for (word size + 1)-bit integer operations. - x->getType()->getIntegerBitWidth() + (!typeIsSigned(*types[0]) && typeIsSigned(*types[1])), - y->getType()->getIntegerBitWidth() + (!typeIsSigned(*types[1]) && typeIsSigned(*types[0])))); - else - /// (double, float) or (double, int_N where N <= double's mantissa width) -> double - common = b.getDoubleTy(); - x = nativeCast(b, types[0], x, common); - y = nativeCast(b, types[1], y, common); - } + auto [x, y] = nativeCastToCommon(b, types[0], values[0], types[1], values[1]); auto * result = CompileOp::compile(b, x, y, typeIsSigned(*types[0]) || typeIsSigned(*types[1])); return b.CreateSelect(result, b.getInt8(1), b.getInt8(0)); } diff --git a/src/Functions/FunctionsJSON.h b/src/Functions/FunctionsJSON.h index b6bdf1be013..a8b1f014383 100644 --- a/src/Functions/FunctionsJSON.h +++ b/src/Functions/FunctionsJSON.h @@ -10,14 +10,20 @@ #include #include #include +#include +#include #include #include #include #include #include #include +#include #include +#include #include +#include +#include #include #include #include @@ -528,6 +534,7 @@ public: } }; + template using JSONExtractInt8Impl = JSONExtractNumericImpl; template @@ -625,6 +632,60 @@ struct JSONExtractTree } }; + class LowCardinalityNode : public Node + { + public: + LowCardinalityNode(DataTypePtr dictionary_type_, std::unique_ptr impl_) + : dictionary_type(dictionary_type_), impl(std::move(impl_)) {} + bool insertResultToColumn(IColumn & dest, const Element & element) override + { + auto from_col = dictionary_type->createColumn(); + if (impl->insertResultToColumn(*from_col, element)) + { + StringRef value = from_col->getDataAt(0); + assert_cast(dest).insertData(value.data, value.size); + return true; + } + return false; + } + private: + DataTypePtr dictionary_type; + std::unique_ptr impl; + }; + + class UUIDNode : public Node + { + public: + bool insertResultToColumn(IColumn & dest, const Element & element) override + { + if (!element.isString()) + return false; + + auto uuid = parseFromString(element.getString()); + assert_cast(dest).insert(uuid); + return true; + } + }; + + template + class DecimalNode : public Node + { + public: + DecimalNode(DataTypePtr data_type_) : data_type(data_type_) {} + bool insertResultToColumn(IColumn & dest, const Element & element) override + { + if (!element.isDouble()) + return false; + + const auto * type = assert_cast *>(data_type.get()); + auto result = convertToDecimal, DataTypeDecimal>(element.getDouble(), type->getScale()); + assert_cast &>(dest).insert(result); + return true; + } + private: + DataTypePtr data_type; + }; + class StringNode : public Node { public: @@ -864,6 +925,17 @@ struct JSONExtractTree case TypeIndex::Float64: return std::make_unique>(); case TypeIndex::String: return std::make_unique(); case TypeIndex::FixedString: return std::make_unique(); + case TypeIndex::UUID: return std::make_unique(); + case TypeIndex::LowCardinality: + { + auto dictionary_type = typeid_cast(type.get())->getDictionaryType(); + auto impl = build(function_name, dictionary_type); + return std::make_unique(dictionary_type, std::move(impl)); + } + case TypeIndex::Decimal256: return std::make_unique>(type); + case TypeIndex::Decimal128: return std::make_unique>(type); + case TypeIndex::Decimal64: return std::make_unique>(type); + case TypeIndex::Decimal32: return std::make_unique>(type); case TypeIndex::Enum8: return std::make_unique>(static_cast(*type).getValues()); case TypeIndex::Enum16: diff --git a/src/Functions/array/length.cpp b/src/Functions/array/length.cpp index a7fe2fb0662..768590c6313 100644 --- a/src/Functions/array/length.cpp +++ b/src/Functions/array/length.cpp @@ -5,7 +5,10 @@ namespace DB { - +namespace ErrorCodes +{ + extern const int ILLEGAL_TYPE_OF_ARGUMENT; +} /** Calculates the length of a string in bytes. */ @@ -35,6 +38,11 @@ struct LengthImpl for (size_t i = 0; i < size; ++i) res[i] = offsets[i] - offsets[i - 1]; } + + [[noreturn]] static void uuid(const ColumnUUID::Container &, size_t &, PaddedPODArray &) + { + throw Exception("Cannot apply function length to UUID argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + } }; diff --git a/src/Functions/isValidUTF8.cpp b/src/Functions/isValidUTF8.cpp index e3158bb709c..abdda53990d 100644 --- a/src/Functions/isValidUTF8.cpp +++ b/src/Functions/isValidUTF8.cpp @@ -317,6 +317,11 @@ SOFTWARE. { throw Exception("Cannot apply function isValidUTF8 to Array argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } + + [[noreturn]] static void uuid(const ColumnUUID::Container &, size_t &, PaddedPODArray &) + { + throw Exception("Cannot apply function isValidUTF8 to UUID argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + } }; struct NameIsValidUTF8 diff --git a/src/Functions/lengthUTF8.cpp b/src/Functions/lengthUTF8.cpp index c067fd4db3c..349635160a6 100644 --- a/src/Functions/lengthUTF8.cpp +++ b/src/Functions/lengthUTF8.cpp @@ -53,6 +53,11 @@ struct LengthUTF8Impl { throw Exception("Cannot apply function lengthUTF8 to Array argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } + + [[noreturn]] static void uuid(const ColumnUUID::Container &, size_t &, PaddedPODArray &) + { + throw Exception("Cannot apply function lengthUTF8 to UUID argument", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + } }; struct NameLengthUTF8 diff --git a/src/Functions/materialize.h b/src/Functions/materialize.h index 5d36a4b2340..376fb34a672 100644 --- a/src/Functions/materialize.h +++ b/src/Functions/materialize.h @@ -29,6 +29,11 @@ public: return name; } + bool isInjective(const ColumnsWithTypeAndName & /*sample_columns*/) const override + { + return true; + } + bool useDefaultImplementationForLowCardinalityColumns() const override { return false; } size_t getNumberOfArguments() const override diff --git a/src/Functions/toJSONString.cpp b/src/Functions/toJSONString.cpp index c5993232a0d..8e5e67219af 100644 --- a/src/Functions/toJSONString.cpp +++ b/src/Functions/toJSONString.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -13,7 +14,9 @@ namespace { public: static constexpr auto name = "toJSONString"; - static FunctionPtr create(ContextPtr) { return std::make_shared(); } + static FunctionPtr create(ContextPtr context) { return std::make_shared(context); } + + explicit FunctionToJSONString(ContextPtr context) : format_settings(getFormatSettings(context)) {} String getName() const override { return name; } @@ -35,7 +38,7 @@ namespace WriteBufferFromVector json(data_to); for (size_t i = 0; i < input_rows_count; ++i) { - serializer->serializeTextJSON(*arguments[0].column, i, json, FormatSettings()); + serializer->serializeTextJSON(*arguments[0].column, i, json, format_settings); writeChar(0, json); offsets_to[i] = json.count(); } @@ -43,6 +46,10 @@ namespace json.finalize(); return res; } + + private: + /// Affects only subset of part of settings related to json. + const FormatSettings format_settings; }; } diff --git a/src/Interpreters/ActionsDAG.cpp b/src/Interpreters/ActionsDAG.cpp index 9fa48f6ceab..1518706f0a6 100644 --- a/src/Interpreters/ActionsDAG.cpp +++ b/src/Interpreters/ActionsDAG.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/src/Interpreters/ActionsDAG.h b/src/Interpreters/ActionsDAG.h index 6c2513d0d92..9cd0057bb1a 100644 --- a/src/Interpreters/ActionsDAG.h +++ b/src/Interpreters/ActionsDAG.h @@ -27,8 +27,6 @@ using FunctionOverloadResolverPtr = std::shared_ptr; class IDataType; using DataTypePtr = std::shared_ptr; -class CompiledExpressionCache; - namespace JSONBuilder { class JSONMap; diff --git a/src/Interpreters/Aggregator.cpp b/src/Interpreters/Aggregator.cpp index da3d54ce21a..715d44eecf0 100644 --- a/src/Interpreters/Aggregator.cpp +++ b/src/Interpreters/Aggregator.cpp @@ -1,5 +1,6 @@ #include #include + #include #include #include @@ -21,6 +22,8 @@ #include #include #include +#include +#include namespace ProfileEvents @@ -211,6 +214,32 @@ void Aggregator::Params::explain(JSONBuilder::JSONMap & map) const } } +#if USE_EMBEDDED_COMPILER + +static CHJIT & getJITInstance() +{ + static CHJIT jit; + return jit; +} + +class CompiledAggregateFunctionsHolder final : public CompiledExpressionCacheEntry +{ +public: + explicit CompiledAggregateFunctionsHolder(CompiledAggregateFunctions compiled_function_) + : CompiledExpressionCacheEntry(compiled_function_.compiled_module.size) + , compiled_aggregate_functions(compiled_function_) + {} + + ~CompiledAggregateFunctionsHolder() override + { + getJITInstance().deleteCompiledModule(compiled_aggregate_functions.compiled_module); + } + + CompiledAggregateFunctions compiled_aggregate_functions; +}; + +#endif + Aggregator::Aggregator(const Params & params_) : params(params_) { @@ -262,8 +291,93 @@ Aggregator::Aggregator(const Params & params_) HashMethodContext::Settings cache_settings; cache_settings.max_threads = params.max_threads; aggregation_state_cache = AggregatedDataVariants::createCache(method_chosen, cache_settings); + +#if USE_EMBEDDED_COMPILER + compileAggregateFunctions(); +#endif + } +#if USE_EMBEDDED_COMPILER + +void Aggregator::compileAggregateFunctions() +{ + static std::unordered_map aggregate_functions_description_to_count; + static std::mutex mtx; + + if (!params.compile_aggregate_expressions) + return; + + std::vector functions_to_compile; + size_t aggregate_instructions_size = 0; + String functions_description; + + is_aggregate_function_compiled.resize(aggregate_functions.size()); + + /// Add values to the aggregate functions. + for (size_t i = 0; i < aggregate_functions.size(); ++i) + { + const auto * function = aggregate_functions[i]; + size_t offset_of_aggregate_function = offsets_of_aggregate_states[i]; + + if (function->isCompilable()) + { + AggregateFunctionWithOffset function_to_compile + { + .function = function, + .aggregate_data_offset = offset_of_aggregate_function + }; + + functions_to_compile.emplace_back(std::move(function_to_compile)); + + functions_description += function->getDescription(); + functions_description += ' '; + + functions_description += std::to_string(offset_of_aggregate_function); + functions_description += ' '; + } + + ++aggregate_instructions_size; + is_aggregate_function_compiled[i] = function->isCompilable(); + } + + if (functions_to_compile.empty()) + return; + + SipHash aggregate_functions_description_hash; + aggregate_functions_description_hash.update(functions_description); + + UInt128 aggregate_functions_description_hash_key; + aggregate_functions_description_hash.get128(aggregate_functions_description_hash_key); + + { + std::lock_guard lock(mtx); + + if (aggregate_functions_description_to_count[aggregate_functions_description_hash_key]++ < params.min_count_to_compile_aggregate_expression) + return; + + if (auto * compilation_cache = CompiledExpressionCacheFactory::instance().tryGetCache()) + { + auto [compiled_function_cache_entry, _] = compilation_cache->getOrSet(aggregate_functions_description_hash_key, [&] () + { + LOG_TRACE(log, "Compile expression {}", functions_description); + + auto compiled_aggregate_functions = compileAggregateFunctons(getJITInstance(), functions_to_compile, functions_description); + return std::make_shared(std::move(compiled_aggregate_functions)); + }); + + compiled_aggregate_functions_holder = std::static_pointer_cast(compiled_function_cache_entry); + } + else + { + LOG_TRACE(log, "Compile expression {}", functions_description); + auto compiled_aggregate_functions = compileAggregateFunctons(getJITInstance(), functions_to_compile, functions_description); + compiled_aggregate_functions_holder = std::make_shared(std::move(compiled_aggregate_functions)); + } + } +} + +#endif AggregatedDataVariants::Type Aggregator::chooseAggregationMethod() { @@ -431,11 +545,15 @@ AggregatedDataVariants::Type Aggregator::chooseAggregationMethod() return AggregatedDataVariants::Type::serialized; } - +template void Aggregator::createAggregateStates(AggregateDataPtr & aggregate_data) const { for (size_t j = 0; j < params.aggregates_size; ++j) { + if constexpr (skip_compiled_aggregate_functions) + if (is_aggregate_function_compiled[j]) + continue; + try { /** An exception may occur if there is a shortage of memory. @@ -447,14 +565,19 @@ void Aggregator::createAggregateStates(AggregateDataPtr & aggregate_data) const catch (...) { for (size_t rollback_j = 0; rollback_j < j; ++rollback_j) + { + if constexpr (skip_compiled_aggregate_functions) + if (is_aggregate_function_compiled[j]) + continue; + aggregate_functions[rollback_j]->destroy(aggregate_data + offsets_of_aggregate_states[rollback_j]); + } throw; } } } - /** It's interesting - if you remove `noinline`, then gcc for some reason will inline this function, and the performance decreases (~ 10%). * (Probably because after the inline of this function, more internal functions no longer be inlined.) * Inline does not make sense, since the inner loop is entirely inside this function. @@ -472,13 +595,25 @@ void NO_INLINE Aggregator::executeImpl( typename Method::State state(key_columns, key_sizes, aggregation_state_cache); if (!no_more_keys) - executeImplBatch(method, state, aggregates_pool, rows, aggregate_instructions, overflow_row); + { +#if USE_EMBEDDED_COMPILER + if (compiled_aggregate_functions_holder) + { + executeImplBatch(method, state, aggregates_pool, rows, aggregate_instructions, overflow_row); + } + else +#endif + { + executeImplBatch(method, state, aggregates_pool, rows, aggregate_instructions, overflow_row); + } + } else - executeImplBatch(method, state, aggregates_pool, rows, aggregate_instructions, overflow_row); + { + executeImplBatch(method, state, aggregates_pool, rows, aggregate_instructions, overflow_row); + } } - -template +template void NO_INLINE Aggregator::executeImplBatch( Method & method, typename Method::State & state, @@ -535,8 +670,6 @@ void NO_INLINE Aggregator::executeImplBatch( } } - /// Generic case. - std::unique_ptr places(new AggregateDataPtr[rows]); /// For all rows. @@ -555,7 +688,37 @@ void NO_INLINE Aggregator::executeImplBatch( emplace_result.setMapped(nullptr); aggregate_data = aggregates_pool->alignedAlloc(total_size_of_aggregate_states, align_aggregate_states); - createAggregateStates(aggregate_data); + +#if USE_EMBEDDED_COMPILER + if constexpr (use_compiled_functions) + { + const auto & compiled_aggregate_functions = compiled_aggregate_functions_holder->compiled_aggregate_functions; + compiled_aggregate_functions.create_aggregate_states_function(aggregate_data); + if (compiled_aggregate_functions.functions_count != aggregate_functions.size()) + { + static constexpr bool skip_compiled_aggregate_functions = true; + createAggregateStates(aggregate_data); + } + +#if defined(MEMORY_SANITIZER) + + /// We compile only functions that do not allocate some data in Arena. Only store necessary state in AggregateData place. + for (size_t aggregate_function_index = 0; aggregate_function_index < aggregate_functions.size(); ++aggregate_function_index) + { + if (!is_aggregate_function_compiled[aggregate_function_index]) + continue; + + auto aggregate_data_with_offset = aggregate_data + offsets_of_aggregate_states[aggregate_function_index]; + auto data_size = params.aggregates[aggregate_function_index].function->sizeOfData(); + __msan_unpoison(aggregate_data_with_offset, data_size); + } +#endif + } + else +#endif + { + createAggregateStates(aggregate_data); + } emplace_result.setMapped(aggregate_data); } @@ -577,9 +740,39 @@ void NO_INLINE Aggregator::executeImplBatch( places[i] = aggregate_data; } - /// Add values to the aggregate functions. - for (AggregateFunctionInstruction * inst = aggregate_instructions; inst->that; ++inst) +#if USE_EMBEDDED_COMPILER + if constexpr (use_compiled_functions) { + std::vector columns_data; + + for (size_t i = 0; i < aggregate_functions.size(); ++i) + { + if (!is_aggregate_function_compiled[i]) + continue; + + AggregateFunctionInstruction * inst = aggregate_instructions + i; + size_t arguments_size = inst->that->getArgumentTypes().size(); + + for (size_t argument_index = 0; argument_index < arguments_size; ++argument_index) + columns_data.emplace_back(getColumnData(inst->batch_arguments[argument_index])); + } + + auto add_into_aggregate_states_function = compiled_aggregate_functions_holder->compiled_aggregate_functions.add_into_aggregate_states_function; + add_into_aggregate_states_function(rows, columns_data.data(), places.get()); + } +#endif + + /// Add values to the aggregate functions. + for (size_t i = 0; i < aggregate_functions.size(); ++i) + { +#if USE_EMBEDDED_COMPILER + if constexpr (use_compiled_functions) + if (is_aggregate_function_compiled[i]) + continue; +#endif + + AggregateFunctionInstruction * inst = aggregate_instructions + i; + if (inst->offsets) inst->batch_that->addBatchArray(rows, places.get(), inst->state_offset, inst->batch_arguments, inst->offsets, aggregates_pool); else @@ -720,6 +913,7 @@ bool Aggregator::executeOnBlock(Columns columns, UInt64 num_rows, AggregatedData } } } + NestedColumnsHolder nested_columns_holder; AggregateFunctionInstructions aggregate_functions_instructions; prepareAggregateInstructions(columns, aggregate_columns, materialized_columns, aggregate_functions_instructions, nested_columns_holder); @@ -1025,9 +1219,23 @@ void Aggregator::convertToBlockImpl( raw_key_columns.push_back(column.get()); if (final) - convertToBlockImplFinal(method, data, std::move(raw_key_columns), final_aggregate_columns, arena); + { +#if USE_EMBEDDED_COMPILER + if (compiled_aggregate_functions_holder) + { + static constexpr bool use_compiled_functions = !Method::low_cardinality_optimization; + convertToBlockImplFinal(method, data, std::move(raw_key_columns), final_aggregate_columns, arena); + } + else +#endif + { + convertToBlockImplFinal(method, data, std::move(raw_key_columns), final_aggregate_columns, arena); + } + } else + { convertToBlockImplNotFinal(method, data, std::move(raw_key_columns), aggregate_columns); + } /// In order to release memory early. data.clearAndShrink(); } @@ -1101,7 +1309,7 @@ inline void Aggregator::insertAggregatesIntoColumns( } -template +template void NO_INLINE Aggregator::convertToBlockImplFinal( Method & method, Table & data, @@ -1121,11 +1329,98 @@ void NO_INLINE Aggregator::convertToBlockImplFinal( auto shuffled_key_sizes = method.shuffleKeyColumns(key_columns, key_sizes); const auto & key_sizes_ref = shuffled_key_sizes ? *shuffled_key_sizes : key_sizes; + PaddedPODArray places; + places.reserve(data.size()); + data.forEachValue([&](const auto & key, auto & mapped) { method.insertKeyIntoColumns(key, key_columns, key_sizes_ref); - insertAggregatesIntoColumns(mapped, final_aggregate_columns, arena); + places.emplace_back(mapped); + + /// Mark the cell as destroyed so it will not be destroyed in destructor. + mapped = nullptr; }); + + std::exception_ptr exception; + size_t aggregate_functions_destroy_index = 0; + + try + { +#if USE_EMBEDDED_COMPILER + if constexpr (use_compiled_functions) + { + /** For JIT compiled functions we need to resize columns before pass them into compiled code. + * insert_aggregates_into_columns_function function does not throw exception. + */ + std::vector columns_data; + + auto compiled_functions = compiled_aggregate_functions_holder->compiled_aggregate_functions; + + for (size_t i = 0; i < params.aggregates_size; ++i) + { + if (!is_aggregate_function_compiled[i]) + continue; + + auto & final_aggregate_column = final_aggregate_columns[i]; + final_aggregate_column = final_aggregate_column->cloneResized(places.size()); + columns_data.emplace_back(getColumnData(final_aggregate_column.get())); + } + + auto insert_aggregates_into_columns_function = compiled_functions.insert_aggregates_into_columns_function; + insert_aggregates_into_columns_function(places.size(), columns_data.data(), places.data()); + } +#endif + + for (; aggregate_functions_destroy_index < params.aggregates_size;) + { + if constexpr (use_compiled_functions) + { + if (is_aggregate_function_compiled[aggregate_functions_destroy_index]) + { + ++aggregate_functions_destroy_index; + continue; + } + } + + auto & final_aggregate_column = final_aggregate_columns[aggregate_functions_destroy_index]; + size_t offset = offsets_of_aggregate_states[aggregate_functions_destroy_index]; + + /** We increase aggregate_functions_destroy_index because by function contract if insertResultIntoBatch + * throws exception, it also must destroy all necessary states. + * Then code need to continue to destroy other aggregate function states with next function index. + */ + size_t destroy_index = aggregate_functions_destroy_index; + ++aggregate_functions_destroy_index; + + /// For State AggregateFunction ownership of aggregate place is passed to result column after insert + bool is_state = aggregate_functions[destroy_index]->isState(); + bool destroy_place_after_insert = !is_state; + + aggregate_functions[destroy_index]->insertResultIntoBatch(places.size(), places.data(), offset, *final_aggregate_column, arena, destroy_place_after_insert); + } + } + catch (...) + { + exception = std::current_exception(); + } + + for (; aggregate_functions_destroy_index < params.aggregates_size; ++aggregate_functions_destroy_index) + { + if constexpr (use_compiled_functions) + { + if (is_aggregate_function_compiled[aggregate_functions_destroy_index]) + { + ++aggregate_functions_destroy_index; + continue; + } + } + + size_t offset = offsets_of_aggregate_states[aggregate_functions_destroy_index]; + aggregate_functions[aggregate_functions_destroy_index]->destroyBatch(places.size(), places.data(), offset); + } + + if (exception) + std::rethrow_exception(exception); } template @@ -1545,7 +1840,7 @@ void NO_INLINE Aggregator::mergeDataNullKey( } -template +template void NO_INLINE Aggregator::mergeDataImpl( Table & table_dst, Table & table_src, @@ -1554,19 +1849,40 @@ void NO_INLINE Aggregator::mergeDataImpl( if constexpr (Method::low_cardinality_optimization) mergeDataNullKey(table_dst, table_src, arena); - table_src.mergeToViaEmplace(table_dst, - [&](AggregateDataPtr & __restrict dst, AggregateDataPtr & __restrict src, bool inserted) + table_src.mergeToViaEmplace(table_dst, [&](AggregateDataPtr & __restrict dst, AggregateDataPtr & __restrict src, bool inserted) { if (!inserted) { - for (size_t i = 0; i < params.aggregates_size; ++i) - aggregate_functions[i]->merge( - dst + offsets_of_aggregate_states[i], - src + offsets_of_aggregate_states[i], - arena); +#if USE_EMBEDDED_COMPILER + if constexpr (use_compiled_functions) + { + const auto & compiled_functions = compiled_aggregate_functions_holder->compiled_aggregate_functions; + compiled_functions.merge_aggregate_states_function(dst, src); - for (size_t i = 0; i < params.aggregates_size; ++i) - aggregate_functions[i]->destroy(src + offsets_of_aggregate_states[i]); + if (compiled_aggregate_functions_holder->compiled_aggregate_functions.functions_count != params.aggregates_size) + { + for (size_t i = 0; i < params.aggregates_size; ++i) + { + if (!is_aggregate_function_compiled[i]) + aggregate_functions[i]->merge(dst + offsets_of_aggregate_states[i], src + offsets_of_aggregate_states[i], arena); + } + + for (size_t i = 0; i < params.aggregates_size; ++i) + { + if (!is_aggregate_function_compiled[i]) + aggregate_functions[i]->destroy(src + offsets_of_aggregate_states[i]); + } + } + } + else +#endif + { + for (size_t i = 0; i < params.aggregates_size; ++i) + aggregate_functions[i]->merge(dst + offsets_of_aggregate_states[i], src + offsets_of_aggregate_states[i], arena); + + for (size_t i = 0; i < params.aggregates_size; ++i) + aggregate_functions[i]->destroy(src + offsets_of_aggregate_states[i]); + } } else { @@ -1575,6 +1891,7 @@ void NO_INLINE Aggregator::mergeDataImpl( src = nullptr; }); + table_src.clearAndShrink(); } @@ -1677,21 +1994,39 @@ void NO_INLINE Aggregator::mergeSingleLevelDataImpl( AggregatedDataVariants & current = *non_empty_data[result_num]; if (!no_more_keys) - mergeDataImpl( - getDataVariant(*res).data, - getDataVariant(current).data, - res->aggregates_pool); + { +#if USE_EMBEDDED_COMPILER + if (compiled_aggregate_functions_holder) + { + mergeDataImpl( + getDataVariant(*res).data, + getDataVariant(current).data, + res->aggregates_pool); + } + else +#endif + { + mergeDataImpl( + getDataVariant(*res).data, + getDataVariant(current).data, + res->aggregates_pool); + } + } else if (res->without_key) + { mergeDataNoMoreKeysImpl( getDataVariant(*res).data, res->without_key, getDataVariant(current).data, res->aggregates_pool); + } else + { mergeDataOnlyExistingKeysImpl( getDataVariant(*res).data, getDataVariant(current).data, res->aggregates_pool); + } /// `current` will not destroy the states of aggregate functions in the destructor current.aggregator = nullptr; @@ -1716,11 +2051,22 @@ void NO_INLINE Aggregator::mergeBucketImpl( return; AggregatedDataVariants & current = *data[result_num]; - - mergeDataImpl( - getDataVariant(*res).data.impls[bucket], - getDataVariant(current).data.impls[bucket], - arena); +#if USE_EMBEDDED_COMPILER + if (compiled_aggregate_functions_holder) + { + mergeDataImpl( + getDataVariant(*res).data.impls[bucket], + getDataVariant(current).data.impls[bucket], + arena); + } + else +#endif + { + mergeDataImpl( + getDataVariant(*res).data.impls[bucket], + getDataVariant(current).data.impls[bucket], + arena); + } } } diff --git a/src/Interpreters/Aggregator.h b/src/Interpreters/Aggregator.h index c8ab2d207a4..bb36ae54a5d 100644 --- a/src/Interpreters/Aggregator.h +++ b/src/Interpreters/Aggregator.h @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -851,6 +852,8 @@ using AggregatedDataVariantsPtr = std::shared_ptr; using ManyAggregatedDataVariants = std::vector; using ManyAggregatedDataVariantsPtr = std::shared_ptr; +class CompiledAggregateFunctionsHolder; + /** How are "total" values calculated with WITH TOTALS? * (For more details, see TotalsHavingTransform.) * @@ -907,6 +910,10 @@ public: size_t max_threads; const size_t min_free_disk_space; + + bool compile_aggregate_expressions; + size_t min_count_to_compile_aggregate_expression; + Params( const Block & src_header_, const ColumnNumbers & keys_, const AggregateDescriptions & aggregates_, @@ -916,6 +923,8 @@ public: bool empty_result_for_aggregation_by_empty_set_, VolumePtr tmp_volume_, size_t max_threads_, size_t min_free_disk_space_, + bool compile_aggregate_expressions_, + size_t min_count_to_compile_aggregate_expression_, const Block & intermediate_header_ = {}) : src_header(src_header_), intermediate_header(intermediate_header_), @@ -925,14 +934,16 @@ public: max_bytes_before_external_group_by(max_bytes_before_external_group_by_), empty_result_for_aggregation_by_empty_set(empty_result_for_aggregation_by_empty_set_), tmp_volume(tmp_volume_), max_threads(max_threads_), - min_free_disk_space(min_free_disk_space_) + min_free_disk_space(min_free_disk_space_), + compile_aggregate_expressions(compile_aggregate_expressions_), + min_count_to_compile_aggregate_expression(min_count_to_compile_aggregate_expression_) { } /// Only parameters that matter during merge. Params(const Block & intermediate_header_, const ColumnNumbers & keys_, const AggregateDescriptions & aggregates_, bool overflow_row_, size_t max_threads_) - : Params(Block(), keys_, aggregates_, overflow_row_, 0, OverflowMode::THROW, 0, 0, 0, false, nullptr, max_threads_, 0) + : Params(Block(), keys_, aggregates_, overflow_row_, 0, OverflowMode::THROW, 0, 0, 0, false, nullptr, max_threads_, 0, false, 0) { intermediate_header = intermediate_header_; } @@ -1074,11 +1085,22 @@ private: /// For external aggregation. TemporaryFiles temporary_files; +#if USE_EMBEDDED_COMPILER + std::shared_ptr compiled_aggregate_functions_holder; +#endif + + std::vector is_aggregate_function_compiled; + + /** Try to compile aggregate functions. + */ + void compileAggregateFunctions(); + /** Select the aggregation method based on the number and types of keys. */ AggregatedDataVariants::Type chooseAggregationMethod(); /** Create states of aggregate functions for one key. */ + template void createAggregateStates(AggregateDataPtr & aggregate_data) const; /** Call `destroy` methods for states of aggregate functions. @@ -1099,7 +1121,7 @@ private: AggregateDataPtr overflow_row) const; /// Specialization for a particular value no_more_keys. - template + template void executeImplBatch( Method & method, typename Method::State & state, @@ -1136,7 +1158,7 @@ private: Arena * arena) const; /// Merge data from hash table `src` into `dst`. - template + template void mergeDataImpl( Table & table_dst, Table & table_src, @@ -1180,7 +1202,7 @@ private: MutableColumns & final_aggregate_columns, Arena * arena) const; - template + template void convertToBlockImplFinal( Method & method, Table & data, diff --git a/src/Interpreters/AsynchronousMetrics.cpp b/src/Interpreters/AsynchronousMetrics.cpp index 2216be4390c..9803a2d8e9b 100644 --- a/src/Interpreters/AsynchronousMetrics.cpp +++ b/src/Interpreters/AsynchronousMetrics.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index a0fce58b472..9b204f12ab2 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -74,6 +73,7 @@ #include #include #include +#include #include #include #include diff --git a/src/Interpreters/Context.h b/src/Interpreters/Context.h index 7990bd7420b..2b53c737915 100644 --- a/src/Interpreters/Context.h +++ b/src/Interpreters/Context.h @@ -267,6 +267,9 @@ private: /// XXX: move this stuff to shared part instead. ContextMutablePtr buffer_context; /// Buffer context. Could be equal to this. + /// A flag, used to distinguish between user query and internal query to a database engine (MaterializePostgreSQL). + bool is_internal_query = false; + public: // Top-level OpenTelemetry trace context for the query. Makes sense only for a query context. OpenTelemetryTraceContext query_trace_context; @@ -742,6 +745,9 @@ public: void shutdown(); + bool isInternalQuery() const { return is_internal_query; } + void setInternalQuery(bool internal) { is_internal_query = internal; } + ActionLocksManagerPtr getActionLocksManager(); enum class ApplicationType diff --git a/src/Interpreters/DDLWorker.cpp b/src/Interpreters/DDLWorker.cpp index c6e58e7b5b2..4e51c346b6f 100644 --- a/src/Interpreters/DDLWorker.cpp +++ b/src/Interpreters/DDLWorker.cpp @@ -377,8 +377,8 @@ void DDLWorker::scheduleTasks(bool reinitialized) /// The following message is too verbose, but it can be useful too debug mysterious test failures in CI LOG_TRACE(log, "scheduleTasks: initialized={}, size_before_filtering={}, queue_size={}, " "entries={}..{}, " - "first_failed_task_name={}, current_tasks_size={}," - "last_current_task={}," + "first_failed_task_name={}, current_tasks_size={}, " + "last_current_task={}, " "last_skipped_entry_name={}", initialized, size_before_filtering, queue_nodes.size(), queue_nodes.empty() ? "none" : queue_nodes.front(), queue_nodes.empty() ? "none" : queue_nodes.back(), diff --git a/src/Interpreters/DatabaseCatalog.cpp b/src/Interpreters/DatabaseCatalog.cpp index 4ed4f258b29..0d0c82f1abc 100644 --- a/src/Interpreters/DatabaseCatalog.cpp +++ b/src/Interpreters/DatabaseCatalog.cpp @@ -28,6 +28,10 @@ # include #endif +#if USE_LIBPQXX +# include +#endif + namespace fs = std::filesystem; namespace CurrentMetrics @@ -234,6 +238,13 @@ DatabaseAndTable DatabaseCatalog::getTableImpl( return {}; } +#if USE_LIBPQXX + if (!context_->isInternalQuery() && (db_and_table.first->getEngineName() == "MaterializedPostgreSQL")) + { + db_and_table.second = std::make_shared(std::move(db_and_table.second), getContext()); + } +#endif + #if USE_MYSQL /// It's definitely not the best place for this logic, but behaviour must be consistent with DatabaseMaterializeMySQL::tryGetTable(...) if (db_and_table.first->getEngineName() == "MaterializeMySQL") @@ -245,6 +256,7 @@ DatabaseAndTable DatabaseCatalog::getTableImpl( return db_and_table; } + if (table_id.database_name == TEMPORARY_DATABASE) { /// For temporary tables UUIDs are set in Context::resolveStorageID(...). diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index e693d4ba988..0897efe08fb 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -231,7 +231,6 @@ void ExpressionAnalyzer::analyzeAggregation() if (has_aggregation) { - /// Find out aggregation keys. if (select_query) { @@ -252,6 +251,8 @@ void ExpressionAnalyzer::analyzeAggregation() /// Constant expressions have non-null column pointer at this stage. if (node->column && isColumnConst(*node->column)) { + select_query->group_by_with_constant_keys = true; + /// But don't remove last key column if no aggregate functions, otherwise aggregation will not work. if (!aggregate_descriptions.empty() || size > 1) { @@ -288,6 +289,11 @@ void ExpressionAnalyzer::analyzeAggregation() else aggregated_columns = temp_actions->getNamesAndTypesList(); + /// Constant expressions are already removed during first 'analyze' run. + /// So for second `analyze` information is taken from select_query. + if (select_query) + has_const_aggregation_keys = select_query->group_by_with_constant_keys; + for (const auto & desc : aggregate_descriptions) aggregated_columns.emplace_back(desc.column_name, desc.function->getReturnType()); } diff --git a/src/Interpreters/ExpressionAnalyzer.h b/src/Interpreters/ExpressionAnalyzer.h index fe00b3e9f88..ac5d281f337 100644 --- a/src/Interpreters/ExpressionAnalyzer.h +++ b/src/Interpreters/ExpressionAnalyzer.h @@ -65,6 +65,7 @@ struct ExpressionAnalyzerData bool has_aggregation = false; NamesAndTypesList aggregation_keys; + bool has_const_aggregation_keys = false; AggregateDescriptions aggregate_descriptions; WindowDescriptions window_descriptions; @@ -309,6 +310,7 @@ public: bool hasTableJoin() const { return syntax->ast_join; } const NamesAndTypesList & aggregationKeys() const { return aggregation_keys; } + bool hasConstAggregationKeys() const { return has_const_aggregation_keys; } const AggregateDescriptions & aggregates() const { return aggregate_descriptions; } const PreparedSets & getPreparedSets() const { return prepared_sets; } diff --git a/src/Interpreters/ExpressionJIT.cpp b/src/Interpreters/ExpressionJIT.cpp index b9fb1ae89d8..497aa56ab13 100644 --- a/src/Interpreters/ExpressionJIT.cpp +++ b/src/Interpreters/ExpressionJIT.cpp @@ -1,4 +1,6 @@ -#include +#if !defined(ARCADIA_BUILD) +# include "config_core.h" +#endif #if USE_EMBEDDED_COMPILER @@ -20,6 +22,7 @@ #include #include #include +#include #include namespace DB @@ -42,36 +45,30 @@ static Poco::Logger * getLogger() return &logger; } -class CompiledFunction +class CompiledFunctionHolder : public CompiledExpressionCacheEntry { public: - CompiledFunction(void * compiled_function_, CHJIT::CompiledModuleInfo module_info_) - : compiled_function(compiled_function_) - , module_info(std::move(module_info_)) + explicit CompiledFunctionHolder(CompiledFunction compiled_function_) + : CompiledExpressionCacheEntry(compiled_function_.compiled_module.size) + , compiled_function(compiled_function_) {} - void * getCompiledFunction() const { return compiled_function; } - - ~CompiledFunction() + ~CompiledFunctionHolder() override { - getJITInstance().deleteCompiledModule(module_info); + getJITInstance().deleteCompiledModule(compiled_function.compiled_module); } -private: - - void * compiled_function; - - CHJIT::CompiledModuleInfo module_info; + CompiledFunction compiled_function; }; class LLVMExecutableFunction : public IExecutableFunction { public: - explicit LLVMExecutableFunction(const std::string & name_, std::shared_ptr compiled_function_) + explicit LLVMExecutableFunction(const std::string & name_, std::shared_ptr compiled_function_holder_) : name(name_) - , compiled_function(compiled_function_) + , compiled_function_holder(compiled_function_holder_) { } @@ -104,8 +101,8 @@ public: columns[arguments.size()] = getColumnData(result_column.get()); - JITCompiledFunction jit_compiled_function_typed = reinterpret_cast(compiled_function->getCompiledFunction()); - jit_compiled_function_typed(input_rows_count, columns.data()); + auto jit_compiled_function = compiled_function_holder->compiled_function.compiled_function; + jit_compiled_function(input_rows_count, columns.data()); #if defined(MEMORY_SANITIZER) /// Memory sanitizer don't know about stores from JIT-ed code. @@ -135,7 +132,7 @@ public: private: std::string name; - std::shared_ptr compiled_function; + std::shared_ptr compiled_function_holder; }; class LLVMFunction : public IFunctionBase @@ -157,9 +154,9 @@ public: } } - void setCompiledFunction(std::shared_ptr compiled_function_) + void setCompiledFunction(std::shared_ptr compiled_function_holder_) { - compiled_function = compiled_function_; + compiled_function_holder = compiled_function_holder_; } bool isCompilable() const override { return true; } @@ -177,10 +174,10 @@ public: ExecutableFunctionPtr prepare(const ColumnsWithTypeAndName &) const override { - if (!compiled_function) + if (!compiled_function_holder) throw Exception(ErrorCodes::LOGICAL_ERROR, "Compiled function was not initialized {}", name); - return std::make_unique(name, compiled_function); + return std::make_unique(name, compiled_function_holder); } bool isDeterministic() const override @@ -269,7 +266,7 @@ private: CompileDAG dag; DataTypes argument_types; std::vector nested_functions; - std::shared_ptr compiled_function; + std::shared_ptr compiled_function_holder; }; static FunctionBasePtr compile( @@ -293,22 +290,19 @@ static FunctionBasePtr compile( auto [compiled_function_cache_entry, _] = compilation_cache->getOrSet(hash_key, [&] () { LOG_TRACE(getLogger(), "Compile expression {}", llvm_function->getName()); - CHJIT::CompiledModuleInfo compiled_module_info = compileFunction(getJITInstance(), *llvm_function); - auto * compiled_jit_function = getJITInstance().findCompiledFunction(compiled_module_info, llvm_function->getName()); - auto compiled_function = std::make_shared(compiled_jit_function, compiled_module_info); - - return std::make_shared(std::move(compiled_function), compiled_module_info.size); + auto compiled_function = compileFunction(getJITInstance(), *llvm_function); + return std::make_shared(compiled_function); }); - llvm_function->setCompiledFunction(compiled_function_cache_entry->getCompiledFunction()); + std::shared_ptr compiled_function_holder = std::static_pointer_cast(compiled_function_cache_entry); + llvm_function->setCompiledFunction(std::move(compiled_function_holder)); } else { - LOG_TRACE(getLogger(), "Compile expression {}", llvm_function->getName()); - CHJIT::CompiledModuleInfo compiled_module_info = compileFunction(getJITInstance(), *llvm_function); - auto * compiled_jit_function = getJITInstance().findCompiledFunction(compiled_module_info, llvm_function->getName()); - auto compiled_function = std::make_shared(compiled_jit_function, compiled_module_info); - llvm_function->setCompiledFunction(compiled_function); + auto compiled_function = compileFunction(getJITInstance(), *llvm_function); + auto compiled_function_holder = std::make_shared(compiled_function); + + llvm_function->setCompiledFunction(std::move(compiled_function_holder)); } return llvm_function; @@ -577,25 +571,6 @@ void ActionsDAG::compileFunctions(size_t min_count_to_compile_expression) } } -CompiledExpressionCacheFactory & CompiledExpressionCacheFactory::instance() -{ - static CompiledExpressionCacheFactory factory; - return factory; -} - -void CompiledExpressionCacheFactory::init(size_t cache_size) -{ - if (cache) - throw Exception(ErrorCodes::LOGICAL_ERROR, "CompiledExpressionCache was already initialized"); - - cache = std::make_unique(cache_size); -} - -CompiledExpressionCache * CompiledExpressionCacheFactory::tryGetCache() -{ - return cache.get(); -} - } #endif diff --git a/src/Interpreters/ExpressionJIT.h b/src/Interpreters/ExpressionJIT.h deleted file mode 100644 index 6b39acae799..00000000000 --- a/src/Interpreters/ExpressionJIT.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#if !defined(ARCADIA_BUILD) -# include "config_core.h" -#endif - -#if USE_EMBEDDED_COMPILER -# include -# include - -namespace DB -{ - -class CompiledFunction; - -class CompiledFunctionCacheEntry -{ -public: - CompiledFunctionCacheEntry(std::shared_ptr compiled_function_, size_t compiled_function_size_) - : compiled_function(std::move(compiled_function_)) - , compiled_function_size(compiled_function_size_) - {} - - std::shared_ptr getCompiledFunction() const { return compiled_function; } - - size_t getCompiledFunctionSize() const { return compiled_function_size; } - -private: - std::shared_ptr compiled_function; - - size_t compiled_function_size; -}; - -struct CompiledFunctionWeightFunction -{ - size_t operator()(const CompiledFunctionCacheEntry & compiled_function) const - { - return compiled_function.getCompiledFunctionSize(); - } -}; - -/** This child of LRUCache breaks one of it's invariants: total weight may be changed after insertion. - * We have to do so, because we don't known real memory consumption of generated LLVM code for every function. - */ -class CompiledExpressionCache : public LRUCache -{ -public: - using Base = LRUCache; - using Base::Base; -}; - -class CompiledExpressionCacheFactory -{ -private: - std::unique_ptr cache; - -public: - static CompiledExpressionCacheFactory & instance(); - - void init(size_t cache_size); - CompiledExpressionCache * tryGetCache(); -}; - -} - -#endif diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index de858bdbdc5..38f8cd8d642 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -151,7 +151,7 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create) throw Exception(ErrorCodes::UNKNOWN_DATABASE_ENGINE, "Unknown database engine: {}", serializeAST(*create.storage)); } - if (create.storage->engine->name == "Atomic" || create.storage->engine->name == "Replicated") + if (create.storage->engine->name == "Atomic" || create.storage->engine->name == "Replicated" || create.storage->engine->name == "MaterializedPostgreSQL") { if (create.attach && create.uuid == UUIDHelpers::Nil) throw Exception(ErrorCodes::INCORRECT_QUERY, "UUID must be specified for ATTACH. " @@ -217,6 +217,12 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create) "Enable allow_experimental_database_replicated to use it.", ErrorCodes::UNKNOWN_DATABASE_ENGINE); } + if (create.storage->engine->name == "MaterializedPostgreSQL" && !getContext()->getSettingsRef().allow_experimental_database_materialized_postgresql && !internal) + { + throw Exception("MaterializedPostgreSQL is an experimental database engine. " + "Enable allow_experimental_database_postgresql_replica to use it.", ErrorCodes::UNKNOWN_DATABASE_ENGINE); + } + DatabasePtr database = DatabaseFactory::get(create, metadata_path / "", getContext()); if (create.uuid != UUIDHelpers::Nil) diff --git a/src/Interpreters/InterpreterDropQuery.cpp b/src/Interpreters/InterpreterDropQuery.cpp index 3c515d58e0c..94d5fbf3ea7 100644 --- a/src/Interpreters/InterpreterDropQuery.cpp +++ b/src/Interpreters/InterpreterDropQuery.cpp @@ -20,6 +20,9 @@ # include #endif +#if USE_LIBPQXX +# include +#endif namespace DB { @@ -317,6 +320,10 @@ BlockIO InterpreterDropQuery::executeToDatabaseImpl(const ASTDropQuery & query, #endif if (auto * replicated = typeid_cast(database.get())) replicated->stopReplication(); +#if USE_LIBPQXX + if (auto * materialize_postgresql = typeid_cast(database.get())) + materialize_postgresql->stopReplication(); +#endif if (database->shouldBeEmptyOnDetach()) { @@ -398,4 +405,33 @@ void InterpreterDropQuery::extendQueryLogElemImpl(QueryLogElement & elem, const elem.query_kind = "Drop"; } +void InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind kind, ContextPtr global_context, ContextPtr current_context, const StorageID & target_table_id, bool no_delay) +{ + if (DatabaseCatalog::instance().tryGetTable(target_table_id, current_context)) + { + /// We create and execute `drop` query for internal table. + auto drop_query = std::make_shared(); + drop_query->database = target_table_id.database_name; + drop_query->table = target_table_id.table_name; + drop_query->kind = kind; + drop_query->no_delay = no_delay; + drop_query->if_exists = true; + ASTPtr ast_drop_query = drop_query; + /// FIXME We have to use global context to execute DROP query for inner table + /// to avoid "Not enough privileges" error if current user has only DROP VIEW ON mat_view_name privilege + /// and not allowed to drop inner table explicitly. Allowing to drop inner table without explicit grant + /// looks like expected behaviour and we have tests for it. + auto drop_context = Context::createCopy(global_context); + drop_context->getClientInfo().query_kind = ClientInfo::QueryKind::SECONDARY_QUERY; + if (auto txn = current_context->getZooKeeperMetadataTransaction()) + { + /// For Replicated database + drop_context->setQueryContext(std::const_pointer_cast(current_context)); + drop_context->initZooKeeperMetadataTransaction(txn, true); + } + InterpreterDropQuery drop_interpreter(ast_drop_query, drop_context); + drop_interpreter.execute(); + } +} + } diff --git a/src/Interpreters/InterpreterDropQuery.h b/src/Interpreters/InterpreterDropQuery.h index 16a08e95a3b..accadf690ca 100644 --- a/src/Interpreters/InterpreterDropQuery.h +++ b/src/Interpreters/InterpreterDropQuery.h @@ -26,6 +26,8 @@ public: void extendQueryLogElemImpl(QueryLogElement & elem, const ASTPtr &, ContextPtr) const override; + static void executeDropQuery(ASTDropQuery::Kind kind, ContextPtr global_context, ContextPtr current_context, const StorageID & target_table_id, bool no_delay); + private: AccessRightsElements getRequiredAccessForDDLOnCluster() const; ASTPtr query_ptr; diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index 181b60b7bf3..46622a8697d 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -506,7 +506,7 @@ InterpreterSelectQuery::InterpreterSelectQuery( result_header = getSampleBlockImpl(); }; - analyze(settings.optimize_move_to_prewhere); + analyze(shouldMoveToPrewhere()); bool need_analyze_again = false; if (analysis_result.prewhere_constant_filter_description.always_false || analysis_result.prewhere_constant_filter_description.always_true) @@ -1532,16 +1532,22 @@ void InterpreterSelectQuery::addEmptySourceToQueryPlan( } } -void InterpreterSelectQuery::addPrewhereAliasActions() +bool InterpreterSelectQuery::shouldMoveToPrewhere() { const Settings & settings = context->getSettingsRef(); + const ASTSelectQuery & query = getSelectQuery(); + return settings.optimize_move_to_prewhere && (!query.final() || settings.optimize_move_to_prewhere_if_final); +} + +void InterpreterSelectQuery::addPrewhereAliasActions() +{ auto & expressions = analysis_result; if (expressions.filter_info) { if (!expressions.prewhere_info) { const bool does_storage_support_prewhere = !input && !input_pipe && storage && storage->supportsPrewhere(); - if (does_storage_support_prewhere && settings.optimize_move_to_prewhere) + if (does_storage_support_prewhere && shouldMoveToPrewhere()) { /// Execute row level filter in prewhere as a part of "move to prewhere" optimization. expressions.prewhere_info = std::make_shared( @@ -2035,10 +2041,12 @@ void InterpreterSelectQuery::executeAggregation(QueryPlan & query_plan, const Ac settings.group_by_two_level_threshold, settings.group_by_two_level_threshold_bytes, settings.max_bytes_before_external_group_by, - settings.empty_result_for_aggregation_by_empty_set, + settings.empty_result_for_aggregation_by_empty_set || (keys.empty() && query_analyzer->hasConstAggregationKeys()), context->getTemporaryVolume(), settings.max_threads, - settings.min_free_disk_space_for_temporary_data); + settings.min_free_disk_space_for_temporary_data, + settings.compile_aggregate_expressions, + settings.min_count_to_compile_aggregate_expression); SortDescription group_by_sort_description; @@ -2140,7 +2148,9 @@ void InterpreterSelectQuery::executeRollupOrCube(QueryPlan & query_plan, Modific settings.empty_result_for_aggregation_by_empty_set, context->getTemporaryVolume(), settings.max_threads, - settings.min_free_disk_space_for_temporary_data); + settings.min_free_disk_space_for_temporary_data, + settings.compile_aggregate_expressions, + settings.min_count_to_compile_aggregate_expression); auto transform_params = std::make_shared(params, true); diff --git a/src/Interpreters/InterpreterSelectQuery.h b/src/Interpreters/InterpreterSelectQuery.h index c155ce0bc13..aec3b0b8bd3 100644 --- a/src/Interpreters/InterpreterSelectQuery.h +++ b/src/Interpreters/InterpreterSelectQuery.h @@ -118,6 +118,7 @@ private: ASTSelectQuery & getSelectQuery() { return query_ptr->as(); } void addPrewhereAliasActions(); + bool shouldMoveToPrewhere(); Block getSampleBlockImpl(); diff --git a/src/Interpreters/InterpreterSystemQuery.cpp b/src/Interpreters/InterpreterSystemQuery.cpp index f76d51e765b..bdeb4a30e9e 100644 --- a/src/Interpreters/InterpreterSystemQuery.cpp +++ b/src/Interpreters/InterpreterSystemQuery.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Interpreters/JIT/CHJIT.cpp b/src/Interpreters/JIT/CHJIT.cpp index 72a2ede5853..c06b4132309 100644 --- a/src/Interpreters/JIT/CHJIT.cpp +++ b/src/Interpreters/JIT/CHJIT.cpp @@ -80,6 +80,28 @@ private: llvm::TargetMachine & target_machine; }; +// class AssemblyPrinter +// { +// public: + +// explicit AssemblyPrinter(llvm::TargetMachine &target_machine_) +// : target_machine(target_machine_) +// { +// } + +// void print(llvm::Module & module) +// { +// llvm::legacy::PassManager pass_manager; +// target_machine.Options.MCOptions.AsmVerbose = true; +// if (target_machine.addPassesToEmitFile(pass_manager, llvm::errs(), nullptr, llvm::CodeGenFileType::CGFT_AssemblyFile)) +// throw Exception(ErrorCodes::CANNOT_COMPILE_CODE, "MachineCode cannot be printed"); + +// pass_manager.run(module); +// } +// private: +// llvm::TargetMachine & target_machine; +// }; + /** MemoryManager for module. * Keep total allocated size during RuntimeDyld linker execution. * Actual compiled code memory is stored in llvm::SectionMemoryManager member, we cannot use ZeroBase optimization here @@ -189,7 +211,7 @@ CHJIT::CHJIT() CHJIT::~CHJIT() = default; -CHJIT::CompiledModuleInfo CHJIT::compileModule(std::function compile_function) +CHJIT::CompiledModule CHJIT::compileModule(std::function compile_function) { std::lock_guard lock(jit_lock); @@ -210,7 +232,7 @@ std::unique_ptr CHJIT::createModuleForCompilation() return module; } -CHJIT::CompiledModuleInfo CHJIT::compileModule(std::unique_ptr module) +CHJIT::CompiledModule CHJIT::compileModule(std::unique_ptr module) { runOptimizationPassesOnModule(*module); @@ -234,7 +256,7 @@ CHJIT::CompiledModuleInfo CHJIT::compileModule(std::unique_ptr mod dynamic_linker.resolveRelocations(); module_memory_manager->getManager().finalizeMemory(); - CompiledModuleInfo module_info; + CompiledModule compiled_module; for (const auto & function : *module) { @@ -250,47 +272,29 @@ CHJIT::CompiledModuleInfo CHJIT::compileModule(std::unique_ptr mod throw Exception(ErrorCodes::CANNOT_COMPILE_CODE, "DynamicLinker could not found symbol {} after compilation", function_name); auto * jit_symbol_address = reinterpret_cast(jit_symbol.getAddress()); - - std::string symbol_name = std::to_string(current_module_key) + '_' + function_name; - name_to_symbol[symbol_name] = jit_symbol_address; - module_info.compiled_functions.emplace_back(std::move(function_name)); + compiled_module.function_name_to_symbol.emplace(std::move(function_name), jit_symbol_address); } - module_info.size = module_memory_manager->getAllocatedSize(); - module_info.identifier = current_module_key; + compiled_module.size = module_memory_manager->getAllocatedSize(); + compiled_module.identifier = current_module_key; module_identifier_to_memory_manager[current_module_key] = std::move(module_memory_manager); - compiled_code_size.fetch_add(module_info.size, std::memory_order_relaxed); + compiled_code_size.fetch_add(compiled_module.size, std::memory_order_relaxed); - return module_info; + return compiled_module; } -void CHJIT::deleteCompiledModule(const CHJIT::CompiledModuleInfo & module_info) +void CHJIT::deleteCompiledModule(const CHJIT::CompiledModule & module) { std::lock_guard lock(jit_lock); - auto module_it = module_identifier_to_memory_manager.find(module_info.identifier); + auto module_it = module_identifier_to_memory_manager.find(module.identifier); if (module_it == module_identifier_to_memory_manager.end()) - throw Exception(ErrorCodes::LOGICAL_ERROR, "There is no compiled module with identifier {}", module_info.identifier); - - for (const auto & function : module_info.compiled_functions) - name_to_symbol.erase(function); + throw Exception(ErrorCodes::LOGICAL_ERROR, "There is no compiled module with identifier {}", module.identifier); module_identifier_to_memory_manager.erase(module_it); - compiled_code_size.fetch_sub(module_info.size, std::memory_order_relaxed); -} - -void * CHJIT::findCompiledFunction(const CompiledModuleInfo & module_info, const std::string & function_name) const -{ - std::lock_guard lock(jit_lock); - - std::string symbol_name = std::to_string(module_info.identifier) + '_' + function_name; - auto it = name_to_symbol.find(symbol_name); - if (it != name_to_symbol.end()) - return it->second; - - return nullptr; + compiled_code_size.fetch_sub(module.size, std::memory_order_relaxed); } void CHJIT::registerExternalSymbol(const std::string & symbol_name, void * address) diff --git a/src/Interpreters/JIT/CHJIT.h b/src/Interpreters/JIT/CHJIT.h index 45a8aef50af..0a553be6bb3 100644 --- a/src/Interpreters/JIT/CHJIT.h +++ b/src/Interpreters/JIT/CHJIT.h @@ -9,9 +9,9 @@ #include #include -#include -#include -#include +#include // Y_IGNORE +#include // Y_IGNORE +#include // Y_IGNORE namespace DB { @@ -52,32 +52,31 @@ public: ~CHJIT(); - struct CompiledModuleInfo + struct CompiledModule { /// Size of compiled module code in bytes size_t size; + /// Module identifier. Should not be changed by client uint64_t identifier; - /// Vector of compiled function nameds. Should not be changed by client - std::vector compiled_functions; + + /// Vector of compiled functions. Should not be changed by client. + /// It is client responsibility to cast result function to right signature. + /// After call to deleteCompiledModule compiled functions from module become invalid. + std::unordered_map function_name_to_symbol; + }; /** Compile module. In compile function client responsibility is to fill module with necessary * IR code, then it will be compiled by CHJIT instance. - * Return compiled module info. + * Return compiled module. */ - CompiledModuleInfo compileModule(std::function compile_function); + CompiledModule compileModule(std::function compile_function); /** Delete compiled module. Pointers to functions from module become invalid after this call. * It is client responsibility to be sure that there are no pointers to compiled module code. */ - void deleteCompiledModule(const CompiledModuleInfo & module_info); - - /** Find compiled function using module_info, and function_name. - * It is client responsibility to case result function to right signature. - * After call to deleteCompiledModule compiled functions from module become invalid. - */ - void * findCompiledFunction(const CompiledModuleInfo & module_info, const std::string & function_name) const; + void deleteCompiledModule(const CompiledModule & module_info); /** Register external symbol for CHJIT instance to use, during linking. * It can be function, or global constant. @@ -93,7 +92,7 @@ private: std::unique_ptr createModuleForCompilation(); - CompiledModuleInfo compileModule(std::unique_ptr module); + CompiledModule compileModule(std::unique_ptr module); std::string getMangledName(const std::string & name_to_mangle) const; @@ -107,7 +106,6 @@ private: std::unique_ptr compiler; std::unique_ptr symbol_resolver; - std::unordered_map name_to_symbol; std::unordered_map> module_identifier_to_memory_manager; uint64_t current_module_key = 0; std::atomic compiled_code_size = 0; diff --git a/src/Interpreters/JIT/CompiledExpressionCache.cpp b/src/Interpreters/JIT/CompiledExpressionCache.cpp new file mode 100644 index 00000000000..98f4eec982d --- /dev/null +++ b/src/Interpreters/JIT/CompiledExpressionCache.cpp @@ -0,0 +1,34 @@ +#include "CompiledExpressionCache.h" + +#if USE_EMBEDDED_COMPILER + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int LOGICAL_ERROR; +} + +CompiledExpressionCacheFactory & CompiledExpressionCacheFactory::instance() +{ + static CompiledExpressionCacheFactory factory; + return factory; +} + +void CompiledExpressionCacheFactory::init(size_t cache_size) +{ + if (cache) + throw Exception(ErrorCodes::LOGICAL_ERROR, "CompiledExpressionCache was already initialized"); + + cache = std::make_unique(cache_size); +} + +CompiledExpressionCache * CompiledExpressionCacheFactory::tryGetCache() +{ + return cache.get(); +} + +} + +#endif diff --git a/src/Interpreters/JIT/CompiledExpressionCache.h b/src/Interpreters/JIT/CompiledExpressionCache.h new file mode 100644 index 00000000000..5182a77d77a --- /dev/null +++ b/src/Interpreters/JIT/CompiledExpressionCache.h @@ -0,0 +1,61 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +# include "config_core.h" +#endif + +#if USE_EMBEDDED_COMPILER +# include +# include +# include + +namespace DB +{ + +class CompiledExpressionCacheEntry +{ +public: + explicit CompiledExpressionCacheEntry(size_t compiled_expression_size_) + : compiled_expression_size(compiled_expression_size_) + {} + + size_t getCompiledExpressionSize() const { return compiled_expression_size; } + + virtual ~CompiledExpressionCacheEntry() {} + +private: + + size_t compiled_expression_size = 0; + +}; + +struct CompiledFunctionWeightFunction +{ + size_t operator()(const CompiledExpressionCacheEntry & compiled_function) const + { + return compiled_function.getCompiledExpressionSize(); + } +}; + +class CompiledExpressionCache : public LRUCache +{ +public: + using Base = LRUCache; + using Base::Base; +}; + +class CompiledExpressionCacheFactory +{ +private: + std::unique_ptr cache; + +public: + static CompiledExpressionCacheFactory & instance(); + + void init(size_t cache_size); + CompiledExpressionCache * tryGetCache(); +}; + +} + +#endif diff --git a/src/Interpreters/JIT/compileFunction.cpp b/src/Interpreters/JIT/compileFunction.cpp index 384b1a4a781..766c2290e42 100644 --- a/src/Interpreters/JIT/compileFunction.cpp +++ b/src/Interpreters/JIT/compileFunction.cpp @@ -250,20 +250,356 @@ static void compileFunction(llvm::Module & module, const IFunctionBase & functio b.CreateRetVoid(); } -CHJIT::CompiledModuleInfo compileFunction(CHJIT & jit, const IFunctionBase & function) +CompiledFunction compileFunction(CHJIT & jit, const IFunctionBase & function) { Stopwatch watch; - auto compiled_module_info = jit.compileModule([&](llvm::Module & module) + auto compiled_module = jit.compileModule([&](llvm::Module & module) { compileFunction(module, function); }); ProfileEvents::increment(ProfileEvents::CompileExpressionsMicroseconds, watch.elapsedMicroseconds()); - ProfileEvents::increment(ProfileEvents::CompileExpressionsBytes, compiled_module_info.size); + ProfileEvents::increment(ProfileEvents::CompileExpressionsBytes, compiled_module.size); ProfileEvents::increment(ProfileEvents::CompileFunction); - return compiled_module_info; + auto compiled_function_ptr = reinterpret_cast(compiled_module.function_name_to_symbol[function.getName()]); + assert(compiled_function_ptr); + + CompiledFunction result_compiled_function + { + .compiled_function = compiled_function_ptr, + .compiled_module = compiled_module + }; + + return result_compiled_function; +} + +static void compileCreateAggregateStatesFunctions(llvm::Module & module, const std::vector & functions, const std::string & name) +{ + auto & context = module.getContext(); + llvm::IRBuilder<> b(context); + + auto * aggregate_data_places_type = b.getInt8Ty()->getPointerTo(); + auto * create_aggregate_states_function_type = llvm::FunctionType::get(b.getVoidTy(), { aggregate_data_places_type }, false); + auto * create_aggregate_states_function = llvm::Function::Create(create_aggregate_states_function_type, llvm::Function::ExternalLinkage, name, module); + + auto * arguments = create_aggregate_states_function->args().begin(); + llvm::Value * aggregate_data_place_arg = arguments++; + + auto * entry = llvm::BasicBlock::Create(b.getContext(), "entry", create_aggregate_states_function); + b.SetInsertPoint(entry); + + std::vector columns(functions.size()); + for (const auto & function_to_compile : functions) + { + size_t aggregate_function_offset = function_to_compile.aggregate_data_offset; + const auto * aggregate_function = function_to_compile.function; + auto * aggregation_place_with_offset = b.CreateConstInBoundsGEP1_32(nullptr, aggregate_data_place_arg, aggregate_function_offset); + aggregate_function->compileCreate(b, aggregation_place_with_offset); + } + + b.CreateRetVoid(); +} + +static void compileAddIntoAggregateStatesFunctions(llvm::Module & module, const std::vector & functions, const std::string & name) +{ + auto & context = module.getContext(); + llvm::IRBuilder<> b(context); + + auto * size_type = b.getIntNTy(sizeof(size_t) * 8); + auto * places_type = b.getInt8Ty()->getPointerTo()->getPointerTo(); + auto * column_data_type = llvm::StructType::get(b.getInt8PtrTy(), b.getInt8PtrTy()); + + auto * aggregate_loop_func_declaration = llvm::FunctionType::get(b.getVoidTy(), { size_type, column_data_type->getPointerTo(), places_type }, false); + auto * aggregate_loop_func_definition = llvm::Function::Create(aggregate_loop_func_declaration, llvm::Function::ExternalLinkage, name, module); + + auto * arguments = aggregate_loop_func_definition->args().begin(); + llvm::Value * rows_count_arg = arguments++; + llvm::Value * columns_arg = arguments++; + llvm::Value * places_arg = arguments++; + + /// Initialize ColumnDataPlaceholder llvm representation of ColumnData + + auto * entry = llvm::BasicBlock::Create(b.getContext(), "entry", aggregate_loop_func_definition); + b.SetInsertPoint(entry); + + std::vector columns; + size_t previous_columns_size = 0; + + for (const auto & function : functions) + { + auto argument_types = function.function->getArgumentTypes(); + + ColumnDataPlaceholder data_placeholder; + + size_t function_arguments_size = argument_types.size(); + + for (size_t column_argument_index = 0; column_argument_index < function_arguments_size; ++column_argument_index) + { + const auto & argument_type = argument_types[column_argument_index]; + auto * data = b.CreateLoad(column_data_type, b.CreateConstInBoundsGEP1_32(column_data_type, columns_arg, previous_columns_size + column_argument_index)); + data_placeholder.data_init = b.CreatePointerCast(b.CreateExtractValue(data, {0}), toNativeType(b, removeNullable(argument_type))->getPointerTo()); + data_placeholder.null_init = argument_type->isNullable() ? b.CreateExtractValue(data, {1}) : nullptr; + columns.emplace_back(data_placeholder); + } + + previous_columns_size += function_arguments_size; + } + + /// Initialize loop + + auto * end = llvm::BasicBlock::Create(b.getContext(), "end", aggregate_loop_func_definition); + auto * loop = llvm::BasicBlock::Create(b.getContext(), "loop", aggregate_loop_func_definition); + + b.CreateCondBr(b.CreateICmpEQ(rows_count_arg, llvm::ConstantInt::get(size_type, 0)), end, loop); + + b.SetInsertPoint(loop); + + auto * counter_phi = b.CreatePHI(rows_count_arg->getType(), 2); + counter_phi->addIncoming(llvm::ConstantInt::get(size_type, 0), entry); + + auto * places_phi = b.CreatePHI(places_arg->getType(), 2); + places_phi->addIncoming(places_arg, entry); + + for (auto & col : columns) + { + col.data = b.CreatePHI(col.data_init->getType(), 2); + col.data->addIncoming(col.data_init, entry); + + if (col.null_init) + { + col.null = b.CreatePHI(col.null_init->getType(), 2); + col.null->addIncoming(col.null_init, entry); + } + } + + auto * aggregation_place = b.CreateLoad(b.getInt8Ty()->getPointerTo(), places_phi); + + previous_columns_size = 0; + for (const auto & function : functions) + { + size_t aggregate_function_offset = function.aggregate_data_offset; + const auto * aggregate_function_ptr = function.function; + + auto arguments_types = function.function->getArgumentTypes(); + std::vector arguments_values; + + size_t function_arguments_size = arguments_types.size(); + arguments_values.resize(function_arguments_size); + + for (size_t column_argument_index = 0; column_argument_index < function_arguments_size; ++column_argument_index) + { + auto * column_argument_data = columns[previous_columns_size + column_argument_index].data; + auto * column_argument_null_data = columns[previous_columns_size + column_argument_index].null; + + auto & argument_type = arguments_types[column_argument_index]; + + auto * value = b.CreateLoad(toNativeType(b, removeNullable(argument_type)), column_argument_data); + if (!argument_type->isNullable()) + { + arguments_values[column_argument_index] = value; + continue; + } + + auto * is_null = b.CreateICmpNE(b.CreateLoad(b.getInt8Ty(), column_argument_null_data), b.getInt8(0)); + auto * nullable_unitilized = llvm::Constant::getNullValue(toNativeType(b, argument_type)); + auto * nullable_value = b.CreateInsertValue(b.CreateInsertValue(nullable_unitilized, value, {0}), is_null, {1}); + arguments_values[column_argument_index] = nullable_value; + } + + auto * aggregation_place_with_offset = b.CreateConstInBoundsGEP1_32(nullptr, aggregation_place, aggregate_function_offset); + aggregate_function_ptr->compileAdd(b, aggregation_place_with_offset, arguments_types, arguments_values); + + previous_columns_size += function_arguments_size; + } + + /// End of loop + + auto * cur_block = b.GetInsertBlock(); + for (auto & col : columns) + { + col.data->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, col.data, 1), cur_block); + + if (col.null) + col.null->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, col.null, 1), cur_block); + } + + places_phi->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, places_phi, 1), cur_block); + + auto * value = b.CreateAdd(counter_phi, llvm::ConstantInt::get(size_type, 1)); + counter_phi->addIncoming(value, cur_block); + + b.CreateCondBr(b.CreateICmpEQ(value, rows_count_arg), end, loop); + + b.SetInsertPoint(end); + b.CreateRetVoid(); +} + +static void compileMergeAggregatesStates(llvm::Module & module, const std::vector & functions, const std::string & name) +{ + auto & context = module.getContext(); + llvm::IRBuilder<> b(context); + + auto * aggregate_data_places_type = b.getInt8Ty()->getPointerTo(); + auto * aggregate_loop_func_declaration = llvm::FunctionType::get(b.getVoidTy(), { aggregate_data_places_type, aggregate_data_places_type }, false); + auto * aggregate_loop_func = llvm::Function::Create(aggregate_loop_func_declaration, llvm::Function::ExternalLinkage, name, module); + + auto * arguments = aggregate_loop_func->args().begin(); + llvm::Value * aggregate_data_place_dst_arg = arguments++; + llvm::Value * aggregate_data_place_src_arg = arguments++; + + auto * entry = llvm::BasicBlock::Create(b.getContext(), "entry", aggregate_loop_func); + b.SetInsertPoint(entry); + + for (const auto & function_to_compile : functions) + { + size_t aggregate_function_offset = function_to_compile.aggregate_data_offset; + const auto * aggregate_function_ptr = function_to_compile.function; + + auto * aggregate_data_place_merge_dst_with_offset = b.CreateConstInBoundsGEP1_32(nullptr, aggregate_data_place_dst_arg, aggregate_function_offset); + auto * aggregate_data_place_merge_src_with_offset = b.CreateConstInBoundsGEP1_32(nullptr, aggregate_data_place_src_arg, aggregate_function_offset); + + aggregate_function_ptr->compileMerge(b, aggregate_data_place_merge_dst_with_offset, aggregate_data_place_merge_src_with_offset); + } + + b.CreateRetVoid(); +} + +static void compileInsertAggregatesIntoResultColumns(llvm::Module & module, const std::vector & functions, const std::string & name) +{ + auto & context = module.getContext(); + llvm::IRBuilder<> b(context); + + auto * size_type = b.getIntNTy(sizeof(size_t) * 8); + + auto * column_data_type = llvm::StructType::get(b.getInt8PtrTy(), b.getInt8PtrTy()); + auto * aggregate_data_places_type = b.getInt8Ty()->getPointerTo()->getPointerTo(); + auto * aggregate_loop_func_declaration = llvm::FunctionType::get(b.getVoidTy(), { size_type, column_data_type->getPointerTo(), aggregate_data_places_type }, false); + auto * aggregate_loop_func = llvm::Function::Create(aggregate_loop_func_declaration, llvm::Function::ExternalLinkage, name, module); + + auto * arguments = aggregate_loop_func->args().begin(); + llvm::Value * rows_count_arg = &*arguments++; + llvm::Value * columns_arg = &*arguments++; + llvm::Value * aggregate_data_places_arg = &*arguments++; + + auto * entry = llvm::BasicBlock::Create(b.getContext(), "entry", aggregate_loop_func); + b.SetInsertPoint(entry); + + std::vector columns(functions.size()); + for (size_t i = 0; i < functions.size(); ++i) + { + auto return_type = functions[i].function->getReturnType(); + auto * data = b.CreateLoad(column_data_type, b.CreateConstInBoundsGEP1_32(column_data_type, columns_arg, i)); + columns[i].data_init = b.CreatePointerCast(b.CreateExtractValue(data, {0}), toNativeType(b, removeNullable(return_type))->getPointerTo()); + columns[i].null_init = return_type->isNullable() ? b.CreateExtractValue(data, {1}) : nullptr; + } + + auto * end = llvm::BasicBlock::Create(b.getContext(), "end", aggregate_loop_func); + auto * loop = llvm::BasicBlock::Create(b.getContext(), "loop", aggregate_loop_func); + + b.CreateCondBr(b.CreateICmpEQ(rows_count_arg, llvm::ConstantInt::get(size_type, 0)), end, loop); + + b.SetInsertPoint(loop); + + auto * counter_phi = b.CreatePHI(rows_count_arg->getType(), 2); + counter_phi->addIncoming(llvm::ConstantInt::get(size_type, 0), entry); + + auto * aggregate_data_place_phi = b.CreatePHI(aggregate_data_places_type, 2); + aggregate_data_place_phi->addIncoming(aggregate_data_places_arg, entry); + + for (auto & col : columns) + { + col.data = b.CreatePHI(col.data_init->getType(), 2); + col.data->addIncoming(col.data_init, entry); + + if (col.null_init) + { + col.null = b.CreatePHI(col.null_init->getType(), 2); + col.null->addIncoming(col.null_init, entry); + } + } + + for (size_t i = 0; i < functions.size(); ++i) + { + size_t aggregate_function_offset = functions[i].aggregate_data_offset; + const auto * aggregate_function_ptr = functions[i].function; + + auto * aggregate_data_place = b.CreateLoad(b.getInt8Ty()->getPointerTo(), aggregate_data_place_phi); + auto * aggregation_place_with_offset = b.CreateConstInBoundsGEP1_32(nullptr, aggregate_data_place, aggregate_function_offset); + + auto * final_value = aggregate_function_ptr->compileGetResult(b, aggregation_place_with_offset); + + if (columns[i].null_init) + { + b.CreateStore(b.CreateExtractValue(final_value, {0}), columns[i].data); + b.CreateStore(b.CreateSelect(b.CreateExtractValue(final_value, {1}), b.getInt8(1), b.getInt8(0)), columns[i].null); + } + else + { + b.CreateStore(final_value, columns[i].data); + } + } + + /// End of loop + + auto * cur_block = b.GetInsertBlock(); + for (auto & col : columns) + { + col.data->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, col.data, 1), cur_block); + + if (col.null) + col.null->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, col.null, 1), cur_block); + } + + auto * value = b.CreateAdd(counter_phi, llvm::ConstantInt::get(size_type, 1), "", true, true); + counter_phi->addIncoming(value, cur_block); + + aggregate_data_place_phi->addIncoming(b.CreateConstInBoundsGEP1_32(nullptr, aggregate_data_place_phi, 1), cur_block); + + b.CreateCondBr(b.CreateICmpEQ(value, rows_count_arg), end, loop); + + b.SetInsertPoint(end); + b.CreateRetVoid(); +} + +CompiledAggregateFunctions compileAggregateFunctons(CHJIT & jit, const std::vector & functions, std::string functions_dump_name) +{ + std::string create_aggregate_states_functions_name = functions_dump_name + "_create"; + std::string add_aggregate_states_functions_name = functions_dump_name + "_add"; + std::string merge_aggregate_states_functions_name = functions_dump_name + "_merge"; + std::string insert_aggregate_states_functions_name = functions_dump_name + "_insert"; + + auto compiled_module = jit.compileModule([&](llvm::Module & module) + { + compileCreateAggregateStatesFunctions(module, functions, create_aggregate_states_functions_name); + compileAddIntoAggregateStatesFunctions(module, functions, add_aggregate_states_functions_name); + compileMergeAggregatesStates(module, functions, merge_aggregate_states_functions_name); + compileInsertAggregatesIntoResultColumns(module, functions, insert_aggregate_states_functions_name); + }); + + auto create_aggregate_states_function = reinterpret_cast(compiled_module.function_name_to_symbol[create_aggregate_states_functions_name]); + auto add_into_aggregate_states_function = reinterpret_cast(compiled_module.function_name_to_symbol[add_aggregate_states_functions_name]); + auto merge_aggregate_states_function = reinterpret_cast(compiled_module.function_name_to_symbol[merge_aggregate_states_functions_name]); + auto insert_aggregate_states_function = reinterpret_cast(compiled_module.function_name_to_symbol[insert_aggregate_states_functions_name]); + + assert(create_aggregate_states_function); + assert(add_into_aggregate_states_function); + assert(merge_aggregate_states_function); + assert(insert_aggregate_states_function); + + CompiledAggregateFunctions compiled_aggregate_functions + { + .create_aggregate_states_function = create_aggregate_states_function, + .add_into_aggregate_states_function = add_into_aggregate_states_function, + .merge_aggregate_states_function = merge_aggregate_states_function, + .insert_aggregates_into_columns_function = insert_aggregate_states_function, + + .functions_count = functions.size(), + .compiled_module = std::move(compiled_module) + }; + + return compiled_aggregate_functions; } } diff --git a/src/Interpreters/JIT/compileFunction.h b/src/Interpreters/JIT/compileFunction.h index e74d35e7aa8..5355227defe 100644 --- a/src/Interpreters/JIT/compileFunction.h +++ b/src/Interpreters/JIT/compileFunction.h @@ -7,6 +7,7 @@ #if USE_EMBEDDED_COMPILER #include +#include #include namespace DB @@ -28,18 +29,56 @@ struct ColumnData ColumnData getColumnData(const IColumn * column); using ColumnDataRowsSize = size_t; + using JITCompiledFunction = void (*)(ColumnDataRowsSize, ColumnData *); +struct CompiledFunction +{ + + JITCompiledFunction compiled_function; + + CHJIT::CompiledModule compiled_module; +}; + /** Compile function to native jit code using CHJIT instance. - * Function is compiled as single module. - * After this function execution, code for function will be compiled and can be queried using - * findCompiledFunction with function name. - * Compiled function can be safely casted to JITCompiledFunction type and must be called with - * valid ColumnData and ColumnDataRowsSize. - * It is important that ColumnData parameter of JITCompiledFunction is result column, - * and will be filled by compiled function. + * It is client responsibility to match ColumnData arguments size with + * function arguments size and additional ColumnData for result. */ -CHJIT::CompiledModuleInfo compileFunction(CHJIT & jit, const IFunctionBase & function); +CompiledFunction compileFunction(CHJIT & jit, const IFunctionBase & function); + +struct AggregateFunctionWithOffset +{ + const IAggregateFunction * function; + size_t aggregate_data_offset; +}; + +using JITCreateAggregateStatesFunction = void (*)(AggregateDataPtr); +using JITAddIntoAggregateStatesFunction = void (*)(ColumnDataRowsSize, ColumnData *, AggregateDataPtr *); +using JITMergeAggregateStatesFunction = void (*)(AggregateDataPtr, AggregateDataPtr); +using JITInsertAggregateStatesIntoColumnsFunction = void (*)(ColumnDataRowsSize, ColumnData *, AggregateDataPtr *); + +struct CompiledAggregateFunctions +{ + JITCreateAggregateStatesFunction create_aggregate_states_function; + JITAddIntoAggregateStatesFunction add_into_aggregate_states_function; + JITMergeAggregateStatesFunction merge_aggregate_states_function; + JITInsertAggregateStatesIntoColumnsFunction insert_aggregates_into_columns_function; + + /// Count of functions that were compiled + size_t functions_count; + + /// Compiled module. It is client responsibility to destroy it after functions are no longer required. + CHJIT::CompiledModule compiled_module; +}; + +/** Compile aggregate function to native jit code using CHJIT instance. + * + * JITCreateAggregateStatesFunction will initialize aggregate data ptr with initial aggregate states values. + * JITAddIntoAggregateStatesFunction will update aggregate states for aggregate functions with specified ColumnData. + * JITMergeAggregateStatesFunction will merge aggregate states for aggregate functions. + * JITInsertAggregateStatesIntoColumnsFunction will insert aggregate states for aggregate functions into result columns. + */ +CompiledAggregateFunctions compileAggregateFunctons(CHJIT & jit, const std::vector & functions, std::string functions_dump_name); } diff --git a/src/Interpreters/JoinedTables.cpp b/src/Interpreters/JoinedTables.cpp index 421fe7fcddd..7647b60458a 100644 --- a/src/Interpreters/JoinedTables.cpp +++ b/src/Interpreters/JoinedTables.cpp @@ -5,6 +5,8 @@ #include #include #include + +#include #include #include #include @@ -12,8 +14,7 @@ #include #include #include -#include -#include + #include #include #include @@ -33,6 +34,23 @@ namespace ErrorCodes namespace { +template +std::shared_ptr addASTChildrenTo(IAST & node, ASTPtr & children, Args && ... args) +{ + auto new_children = std::make_shared(std::forward(args)...); + children = new_children; + node.children.push_back(children); + return new_children; +} + +template +std::shared_ptr addASTChildren(IAST & node) +{ + auto children = std::make_shared(); + node.children.push_back(children); + return children; +} + void replaceJoinedTable(const ASTSelectQuery & select_query) { const ASTTablesInSelectQueryElement * join = select_query.join(); @@ -48,15 +66,30 @@ void replaceJoinedTable(const ASTSelectQuery & select_query) if (table_expr.database_and_table_name) { const auto & table_id = table_expr.database_and_table_name->as(); - String expr = "(SELECT * FROM " + backQuote(table_id.name()) + ") AS " + backQuote(table_id.shortName()); - + String table_name = table_id.name(); + String table_short_name = table_id.shortName(); // FIXME: since the expression "a as b" exposes both "a" and "b" names, which is not equivalent to "(select * from a) as b", // we can't replace aliased tables. // FIXME: long table names include database name, which we can't save within alias. if (table_id.alias.empty() && table_id.isShort()) { - ParserTableExpression parser; - table_expr = parseQuery(parser, expr, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH)->as(); + /// Build query of form '(SELECT * FROM table_name) AS table_short_name' + table_expr = ASTTableExpression(); + + auto subquery = addASTChildrenTo(table_expr, table_expr.subquery); + subquery->setAlias(table_short_name); + + auto sub_select_with_union = addASTChildren(*subquery); + auto list_of_selects = addASTChildrenTo(*sub_select_with_union, sub_select_with_union->list_of_selects); + + auto new_select = addASTChildren(*list_of_selects); + new_select->setExpression(ASTSelectQuery::Expression::SELECT, std::make_shared()); + addASTChildren(*new_select->select()); + new_select->setExpression(ASTSelectQuery::Expression::TABLES, std::make_shared()); + + auto tables_elem = addASTChildren(*new_select->tables()); + auto sub_table_expr = addASTChildrenTo(*tables_elem, tables_elem->table_expression); + addASTChildrenTo(*sub_table_expr, sub_table_expr->database_and_table_name, table_name); } } } diff --git a/src/Interpreters/evaluateConstantExpression.cpp b/src/Interpreters/evaluateConstantExpression.cpp index d91ea9208e4..f814e1d8c02 100644 --- a/src/Interpreters/evaluateConstantExpression.cpp +++ b/src/Interpreters/evaluateConstantExpression.cpp @@ -103,6 +103,24 @@ ASTPtr evaluateConstantExpressionForDatabaseName(const ASTPtr & node, ContextPtr return res; } +std::tuple evaluateDatabaseNameForMergeEngine(const ASTPtr & node, ContextPtr context) +{ + if (const auto * func = node->as(); func && func->name == "REGEXP") + { + if (func->arguments->children.size() != 1) + throw Exception("Arguments for REGEXP in Merge ENGINE should be 1", ErrorCodes::BAD_ARGUMENTS); + + auto * literal = func->arguments->children[0]->as(); + if (!literal || literal->value.safeGet().empty()) + throw Exception("Argument for REGEXP in Merge ENGINE should be a non empty String Literal", ErrorCodes::BAD_ARGUMENTS); + + return std::tuple{true, func->arguments->children[0]}; + } + + auto ast = evaluateConstantExpressionForDatabaseName(node, context); + return std::tuple{false, ast}; +} + namespace { using Conjunction = ColumnsWithTypeAndName; diff --git a/src/Interpreters/evaluateConstantExpression.h b/src/Interpreters/evaluateConstantExpression.h index b95982f5b99..3b817080fe0 100644 --- a/src/Interpreters/evaluateConstantExpression.h +++ b/src/Interpreters/evaluateConstantExpression.h @@ -53,4 +53,6 @@ ASTPtr evaluateConstantExpressionForDatabaseName(const ASTPtr & node, ContextPtr */ std::optional evaluateExpressionOverConstantCondition(const ASTPtr & node, const ExpressionActionsPtr & target_expr, size_t & limit); +// Evaluate database name or regexp for StorageMerge and TableFunction merge +std::tuple evaluateDatabaseNameForMergeEngine(const ASTPtr & node, ContextPtr context); } diff --git a/src/Interpreters/examples/jit_example.cpp b/src/Interpreters/examples/jit_example.cpp index 9694314b820..3fa2a901eac 100644 --- a/src/Interpreters/examples/jit_example.cpp +++ b/src/Interpreters/examples/jit_example.cpp @@ -1,5 +1,11 @@ #include +#if !defined(ARCADIA_BUILD) +# include "config_core.h" +#endif + +#if USE_EMBEDDED_COMPILER + #include #include @@ -18,7 +24,7 @@ int main(int argc, char **argv) jit.registerExternalSymbol("test_function", reinterpret_cast(&test_function)); - auto compiled_module_info = jit.compileModule([](llvm::Module & module) + auto compiled_module = jit.compileModule([](llvm::Module & module) { auto & context = module.getContext(); llvm::IRBuilder<> b (context); @@ -43,15 +49,27 @@ int main(int argc, char **argv) b.CreateRet(value); }); - for (const auto & compiled_function_name : compiled_module_info.compiled_functions) + for (const auto & [compiled_function_name, _] : compiled_module.function_name_to_symbol) { std::cerr << compiled_function_name << std::endl; } int64_t value = 5; - auto * test_name_function = reinterpret_cast(jit.findCompiledFunction(compiled_module_info, "test_name")); + auto * symbol = compiled_module.function_name_to_symbol["test_name"]; + auto * test_name_function = reinterpret_cast(symbol); auto result = test_name_function(&value); std::cerr << "Result " << result << std::endl; return 0; } + +#else + +int main(int argc, char **argv) +{ + (void)(argc); + (void)(argv); + return 0; +} + +#endif diff --git a/src/Interpreters/executeQuery.cpp b/src/Interpreters/executeQuery.cpp index c69a5bcd3e1..5b55754f00a 100644 --- a/src/Interpreters/executeQuery.cpp +++ b/src/Interpreters/executeQuery.cpp @@ -26,11 +26,6 @@ #include #include #include - -#if !defined(ARCADIA_BUILD) -# include // Y_IGNORE -#endif - #include #include #include @@ -166,11 +161,10 @@ static void logQuery(const String & query, ContextPtr context, bool internal) if (!comment.empty()) comment = fmt::format(" (comment: {})", comment); - LOG_DEBUG(&Poco::Logger::get("executeQuery"), "(from {}{}{}, using {} parser){} {}", + LOG_DEBUG(&Poco::Logger::get("executeQuery"), "(from {}{}{}){} {}", 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 ? "experimental" : "production"), comment, joinLines(query)); @@ -386,24 +380,10 @@ static std::tuple executeQueryImpl( String query_table; try { -#if !defined(ARCADIA_BUILD) - if (settings.use_antlr_parser) - { - ast = parseQuery(begin, end, max_query_size, settings.max_parser_depth, context->getCurrentDatabase()); - } - 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. diff --git a/src/Parsers/ASTSelectQuery.h b/src/Parsers/ASTSelectQuery.h index e9aaa4ab83b..3fc8efb5311 100644 --- a/src/Parsers/ASTSelectQuery.h +++ b/src/Parsers/ASTSelectQuery.h @@ -44,6 +44,7 @@ public: bool group_by_with_totals = false; bool group_by_with_rollup = false; bool group_by_with_cube = false; + bool group_by_with_constant_keys = false; bool limit_with_ties = false; ASTPtr & refSelect() { return getExpression(Expression::SELECT); } diff --git a/src/Parsers/New/AST/AlterTableQuery.cpp b/src/Parsers/New/AST/AlterTableQuery.cpp deleted file mode 100644 index e1ea54b61e5..00000000000 --- a/src/Parsers/New/AST/AlterTableQuery.cpp +++ /dev/null @@ -1,814 +0,0 @@ -#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::createAddProjection(bool if_not_exists, PtrTo element, PtrTo after) -{ - assert(element->getType() == TableElementExpr::ExprType::PROJECTION); - PtrTo query(new AlterTableClause(ClauseType::ADD_PROJECTION, {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::createClearColumn(bool if_exists, PtrTo identifier, PtrTo in) -{ - PtrTo query(new AlterTableClause(ClauseType::CLEAR_COLUMN, {identifier, in})); - query->if_exists = if_exists; - return query; -} - -PtrTo AlterTableClause::createClearIndex(bool if_exists, PtrTo identifier, PtrTo in) -{ - PtrTo query(new AlterTableClause(ClauseType::CLEAR_INDEX, {identifier, in})); - query->if_exists = if_exists; - return query; -} - -PtrTo AlterTableClause::createClearProjection(bool if_exists, PtrTo identifier, PtrTo in) -{ - PtrTo query(new AlterTableClause(ClauseType::CLEAR_PROJECTION, {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::createDropProjection(bool if_exists, PtrTo identifier) -{ - PtrTo query(new AlterTableClause(ClauseType::DROP_PROJECTION, {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::createMaterializeIndex(bool if_exists, PtrTo identifier, PtrTo in) -{ - PtrTo query(new AlterTableClause(ClauseType::MATERIALIZE_INDEX, {identifier, in})); - query->if_exists = if_exists; - return query; -} - -// static -PtrTo AlterTableClause::createMaterializeProjection(bool if_exists, PtrTo identifier, PtrTo in) -{ - PtrTo query(new AlterTableClause(ClauseType::MATERIALIZE_PROJECTION, {identifier, in})); - query->if_exists = if_exists; - return query; -} - -// 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::ADD_PROJECTION: - command->type = ASTAlterCommand::ADD_PROJECTION; - command->if_not_exists = if_not_exists; - command->projection_decl = get(ELEMENT)->convertToOld(); - if (has(AFTER)) command->projection = get(AFTER)->convertToOld(); - break; - - case ClauseType::ATTACH: - command->type = ASTAlterCommand::ATTACH_PARTITION; - command->partition = get(PARTITION)->convertToOld(); - - if (has(FROM)) - { - auto table = get(FROM)->convertToOld(); - command->from_database = table->as()->getDatabaseName(); - command->from_table = table->as()->shortName(); - command->replace = false; - command->type = ASTAlterCommand::REPLACE_PARTITION; - } - break; - - case ClauseType::CLEAR_COLUMN: - command->type = ASTAlterCommand::DROP_COLUMN; - command->if_exists = if_exists; - command->clear_column = true; - command->detach = false; - command->column = get(ELEMENT)->convertToOld(); - if (has(IN)) command->partition = get(IN)->convertToOld(); - break; - - case ClauseType::CLEAR_INDEX: - command->type = ASTAlterCommand::DROP_INDEX; - command->if_exists = if_exists; - command->clear_index = true; - command->detach = false; - command->index = get(ELEMENT)->convertToOld(); - if (has(IN)) command->partition = get(IN)->convertToOld(); - break; - - case ClauseType::CLEAR_PROJECTION: - command->type = ASTAlterCommand::DROP_PROJECTION; - command->if_exists = if_exists; - command->clear_projection = true; - command->detach = false; - command->projection = get(ELEMENT)->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(ELEMENT)->convertToOld(); - break; - - case ClauseType::DROP_INDEX: - command->type = ASTAlterCommand::DROP_INDEX; - command->if_exists = if_exists; - command->detach = false; - command->index = get(ELEMENT)->convertToOld(); - break; - - case ClauseType::DROP_PROJECTION: - command->type = ASTAlterCommand::DROP_PROJECTION; - command->if_exists = if_exists; - command->detach = false; - command->projection = get(ELEMENT)->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::MATERIALIZE_INDEX: - command->type = ASTAlterCommand::MATERIALIZE_INDEX; - command->if_exists = if_exists; - command->index = get(ELEMENT)->convertToOld(); - if (has(IN)) command->partition = get(IN)->convertToOld(); - break; - - case ClauseType::MATERIALIZE_PROJECTION: - command->type = ASTAlterCommand::MATERIALIZE_PROJECTION; - command->if_exists = if_exists; - command->projection = get(ELEMENT)->convertToOld(); - if (has(IN)) command->partition = get(IN)->convertToOld(); - 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 = get(TO)->convertToOld(); - command->to_database = table->as()->getDatabaseName(); - command->to_table = table->as()->shortName(); - } - 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 = get(FROM)->convertToOld(); - command->from_database = table->as()->getDatabaseName(); - command->from_table = table->as()->shortName(); - } - 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 = get(TABLE)->convertToOld(); - query->database = table->as()->getDatabaseName(); - query->table = table->as()->shortName(); - } - - 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::visitAlterTableClauseAddProjection(ClickHouseParser::AlterTableClauseAddProjectionContext * ctx) -{ - auto after = ctx->AFTER() ? visit(ctx->nestedIdentifier()).as>() : nullptr; - return AlterTableClause::createAddProjection(!!ctx->IF(), visit(ctx->tableProjectionDfnt()), 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::visitAlterTableClauseClearColumn(ClickHouseParser::AlterTableClauseClearColumnContext * ctx) -{ - auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; - return AlterTableClause::createClearColumn(!!ctx->IF(), visit(ctx->nestedIdentifier()), partition); -} - -antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseClearIndex(ClickHouseParser::AlterTableClauseClearIndexContext * ctx) -{ - auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; - return AlterTableClause::createClearIndex(!!ctx->IF(), visit(ctx->nestedIdentifier()), partition); -} - -antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseClearProjection(ClickHouseParser::AlterTableClauseClearProjectionContext * ctx) -{ - auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; - return AlterTableClause::createClearProjection(!!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::visitAlterTableClauseDropProjection(ClickHouseParser::AlterTableClauseDropProjectionContext * ctx) -{ - return AlterTableClause::createDropProjection(!!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::visitAlterTableClauseMaterializeIndex(ClickHouseParser::AlterTableClauseMaterializeIndexContext * ctx) -{ - auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; - return AlterTableClause::createMaterializeIndex(!!ctx->IF(), visit(ctx->nestedIdentifier()), partition); -} - -antlrcpp::Any ParseTreeVisitor::visitAlterTableClauseMaterializeProjection(ClickHouseParser::AlterTableClauseMaterializeProjectionContext * ctx) -{ - auto partition = ctx->partitionClause() ? visit(ctx->partitionClause()).as>() : nullptr; - return AlterTableClause::createMaterializeProjection(!!ctx->IF(), visit(ctx->nestedIdentifier()), partition); -} - -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 deleted file mode 100644 index 7e7783c49ad..00000000000 --- a/src/Parsers/New/AST/AlterTableQuery.h +++ /dev/null @@ -1,191 +0,0 @@ -#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 createAddProjection(bool if_not_exists, PtrTo element, PtrTo after); - static PtrTo createAttach(PtrTo clause, PtrTo from); - static PtrTo createClearColumn(bool if_exists, PtrTo identifier, PtrTo in); - static PtrTo createClearIndex(bool if_exists, PtrTo identifier, PtrTo in); - static PtrTo createClearProjection(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 createDropProjection(bool if_exists, PtrTo identifier); - static PtrTo createDropPartition(PtrTo clause); - static PtrTo createFreezePartition(PtrTo clause); - static PtrTo createMaterializeIndex(bool if_exists, PtrTo identifier, PtrTo in); - static PtrTo createMaterializeProjection(bool if_exists, PtrTo identifier, PtrTo in); - 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, INDEX or PROJECTION - ELEMENT = 0, // TableElementExpr (COLUMN, CONSTRAINT, INDEX, PROJECTION) - AFTER = 1, // Identifier (optional) - - // ATTACH/REPLACE - PARTITION = 0, // PartitionClause - FROM = 1, // TableIdentifier (optional) - - // CLEAR COLUMN, INDEX or PROJECTION - IN = 1, // PartitionClause - - // CODEC, COMMENT and RENAME - COLUMN = 0, // Identifier - 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, - ADD_PROJECTION, - ATTACH, - CLEAR_COLUMN, - CLEAR_INDEX, - CLEAR_PROJECTION, - CODEC, - COMMENT, - DELETE, - DETACH, - DROP_COLUMN, - DROP_INDEX, - DROP_PROJECTION, - DROP_PARTITION, - FREEZE_PARTITION, - MATERIALIZE_INDEX, - MATERIALIZE_PROJECTION, - 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 deleted file mode 100644 index 5fba573972b..00000000000 --- a/src/Parsers/New/AST/AttachQuery.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#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 = get(NAME)->convertToOld(); - query->database = table->as()->getDatabaseName(); - query->table = table->as()->shortName(); - } - 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 deleted file mode 100644 index f9b495b5b46..00000000000 --- a/src/Parsers/New/AST/AttachQuery.h +++ /dev/null @@ -1,32 +0,0 @@ -#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 deleted file mode 100644 index 87a7544ec34..00000000000 --- a/src/Parsers/New/AST/CheckQuery.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#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 = std::static_pointer_cast(get(NAME)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - - 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 deleted file mode 100644 index d29d2c42acd..00000000000 --- a/src/Parsers/New/AST/CheckQuery.h +++ /dev/null @@ -1,24 +0,0 @@ -#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 deleted file mode 100644 index 0bfcee594cd..00000000000 --- a/src/Parsers/New/AST/ColumnExpr.cpp +++ /dev/null @@ -1,588 +0,0 @@ -#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 deleted file mode 100644 index 6de707d6b2d..00000000000 --- a/src/Parsers/New/AST/ColumnExpr.h +++ /dev/null @@ -1,82 +0,0 @@ -#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 deleted file mode 100644 index a2947cf0f63..00000000000 --- a/src/Parsers/New/AST/ColumnTypeExpr.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#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 deleted file mode 100644 index 8c4f3c697e7..00000000000 --- a/src/Parsers/New/AST/ColumnTypeExpr.h +++ /dev/null @@ -1,62 +0,0 @@ -#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 deleted file mode 100644 index 9f6c79d592f..00000000000 --- a/src/Parsers/New/AST/CreateDatabaseQuery.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#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 deleted file mode 100644 index 3de16c3dc83..00000000000 --- a/src/Parsers/New/AST/CreateDatabaseQuery.h +++ /dev/null @@ -1,26 +0,0 @@ -#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 deleted file mode 100644 index 75413df495b..00000000000 --- a/src/Parsers/New/AST/CreateDictionaryQuery.cpp +++ /dev/null @@ -1,361 +0,0 @@ -#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 = get(NAME)->convertToOld(); - query->database = table->as()->getDatabaseName(); - query->table = table->as()->shortName(); - query->uuid = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) - : table->as()->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 deleted file mode 100644 index 3c5be3f391c..00000000000 --- a/src/Parsers/New/AST/CreateDictionaryQuery.h +++ /dev/null @@ -1,183 +0,0 @@ -#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 deleted file mode 100644 index 18501884f02..00000000000 --- a/src/Parsers/New/AST/CreateLiveViewQuery.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#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 = std::static_pointer_cast(get(NAME)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table->uuid; - } - - if (has(TIMEOUT)) - query->live_view_timeout.emplace(get(TIMEOUT)->convertToOld()->as()->value.get()); - - if (has(DESTINATION)) - query->to_table_id = get(DESTINATION)->convertToOld()->as()->getTableId(); - - 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 deleted file mode 100644 index dd6fe8a2528..00000000000 --- a/src/Parsers/New/AST/CreateLiveViewQuery.h +++ /dev/null @@ -1,39 +0,0 @@ -#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 deleted file mode 100644 index 2b8a1b18b5f..00000000000 --- a/src/Parsers/New/AST/CreateMaterializedViewQuery.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#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 = std::static_pointer_cast(get(NAME)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) : table->uuid; - } - - if (has(DESTINATION)) - query->to_table_id = get(DESTINATION)->convertToOld()->as()->getTableId(); - 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 deleted file mode 100644 index 6cd45132371..00000000000 --- a/src/Parsers/New/AST/CreateMaterializedViewQuery.h +++ /dev/null @@ -1,40 +0,0 @@ -#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 deleted file mode 100644 index 1767c08451a..00000000000 --- a/src/Parsers/New/AST/CreateTableQuery.cpp +++ /dev/null @@ -1,224 +0,0 @@ -#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(); - auto projection_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; - case TableElementExpr::ExprType::PROJECTION: - projection_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); - if (!projection_list->children.empty()) columns->set(columns->projections, projection_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 = get(NAME)->convertToOld(); - query->database = table->as()->getDatabaseName(); - query->table = table->as()->shortName(); - query->uuid = has(UUID) ? parseFromString(get(UUID)->convertToOld()->as()->value.get()) - : table->as()->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 = std::static_pointer_cast(get(SCHEMA)->convertToOld()); - query->as_database = table->getDatabaseName(); - query->as_table = table->shortName(); - 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 deleted file mode 100644 index 4fe19832b1d..00000000000 --- a/src/Parsers/New/AST/CreateTableQuery.h +++ /dev/null @@ -1,76 +0,0 @@ -#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 deleted file mode 100644 index 97244e82d52..00000000000 --- a/src/Parsers/New/AST/CreateViewQuery.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#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 = std::static_pointer_cast(get(NAME)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = table->uuid; - } - - query->attach = attach; - query->replace_view = replace; - query->if_not_exists = if_not_exists; - query->is_ordinary_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 deleted file mode 100644 index 41567c30cdc..00000000000 --- a/src/Parsers/New/AST/CreateViewQuery.h +++ /dev/null @@ -1,34 +0,0 @@ -#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 deleted file mode 100644 index 0cd06e27abe..00000000000 --- a/src/Parsers/New/AST/DDLQuery.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - - -namespace DB::AST -{ -} diff --git a/src/Parsers/New/AST/DDLQuery.h b/src/Parsers/New/AST/DDLQuery.h deleted file mode 100644 index 6aba46d29e3..00000000000 --- a/src/Parsers/New/AST/DDLQuery.h +++ /dev/null @@ -1,29 +0,0 @@ -#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 deleted file mode 100644 index b924b1b270b..00000000000 --- a/src/Parsers/New/AST/DescribeQuery.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#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 deleted file mode 100644 index e7323476a43..00000000000 --- a/src/Parsers/New/AST/DescribeQuery.h +++ /dev/null @@ -1,27 +0,0 @@ -#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 deleted file mode 100644 index 59a417a6fa9..00000000000 --- a/src/Parsers/New/AST/DropQuery.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#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; -} - -// static -PtrTo -DropQuery::createDropView(bool detach, bool if_exists, PtrTo identifier, PtrTo cluster) -{ - auto query = PtrTo(new DropQuery(cluster, QueryType::VIEW, {identifier})); - query->detach = detach; - query->if_exists = if_exists; - 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; - } - case QueryType::VIEW: - { - query->is_view = true; - 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); - if (ctx->VIEW()) - return DropQuery::createDropView(!!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 deleted file mode 100644 index cc70561e90f..00000000000 --- a/src/Parsers/New/AST/DropQuery.h +++ /dev/null @@ -1,46 +0,0 @@ -#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); - static PtrTo - createDropView(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, - VIEW, - }; - - 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 deleted file mode 100644 index 7127882c49d..00000000000 --- a/src/Parsers/New/AST/EngineExpr.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#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 deleted file mode 100644 index 809b398d834..00000000000 --- a/src/Parsers/New/AST/EngineExpr.h +++ /dev/null @@ -1,85 +0,0 @@ -#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 deleted file mode 100644 index d2b77319dcc..00000000000 --- a/src/Parsers/New/AST/ExistsQuery.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include - -#include -#include -#include -#include -#include - - -namespace DB::AST -{ - -ExistsQuery::ExistsQuery(QueryType type, bool temporary_, PtrList exprs) - : Query(exprs), query_type(type), temporary(temporary_) -{ -} - -// static -PtrTo ExistsQuery::createTable(QueryType type, bool temporary, PtrTo identifier) -{ - return PtrTo(new ExistsQuery(type, temporary, {identifier})); -} - -// static -PtrTo ExistsQuery::createDatabase(PtrTo identifier) -{ - return PtrTo(new ExistsQuery(QueryType::DATABASE, false, {identifier})); -} - -ASTPtr ExistsQuery::convertToOld() const -{ - std::shared_ptr query; - - switch(query_type) - { - case QueryType::DATABASE: - query = std::make_shared(); - tryGetIdentifierNameInto(get(IDENTIFIER)->convertToOld(), query->database); - return query; - - case QueryType::DICTIONARY: - query = std::make_shared(); - break; - case QueryType::TABLE: - query = std::make_shared(); - break; - case QueryType::VIEW: - query = std::make_shared(); - break; - } - - // FIXME: this won't work if table doesn't exist - auto table_id = std::static_pointer_cast(get(IDENTIFIER)->convertToOld()); - query->database = table_id->getDatabaseName(); - query->table = table_id->shortName(); - query->uuid = table_id->uuid; - query->temporary = temporary; - - return query; -} - -} - -namespace DB -{ - -using namespace AST; - -antlrcpp::Any ParseTreeVisitor::visitExistsTableStmt(ClickHouseParser::ExistsTableStmtContext *ctx) -{ - ExistsQuery::QueryType type; - if (ctx->DICTIONARY()) - type = ExistsQuery::QueryType::DICTIONARY; - else if (ctx->VIEW()) - type = ExistsQuery::QueryType::VIEW; - else // Query 'EXISTS ' is interptered as 'EXISTS TABLE ' - type = ExistsQuery::QueryType::TABLE; - - return ExistsQuery::createTable(type, !!ctx->TEMPORARY(), visit(ctx->tableIdentifier())); -} - -antlrcpp::Any ParseTreeVisitor::visitExistsDatabaseStmt(ClickHouseParser::ExistsDatabaseStmtContext *ctx) -{ - return ExistsQuery::createDatabase(visit(ctx->databaseIdentifier())); -} - -} diff --git a/src/Parsers/New/AST/ExistsQuery.h b/src/Parsers/New/AST/ExistsQuery.h deleted file mode 100644 index 5afe076b580..00000000000 --- a/src/Parsers/New/AST/ExistsQuery.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include - - -namespace DB::AST -{ - -class ExistsQuery : public Query -{ - public: - enum class QueryType - { - DICTIONARY, - TABLE, - VIEW, - DATABASE, - }; - - static PtrTo createTable(QueryType type, bool temporary, PtrTo identifier); - static PtrTo createDatabase(PtrTo identifier); - - ExistsQuery(QueryType type, bool temporary, PtrList exprs); - - ASTPtr convertToOld() const override; - - private: - enum ChildIndex : UInt8 - { - IDENTIFIER = 0, // DatabaseIdentifier or TableIdentifier - }; - - const QueryType query_type; - const bool temporary; -}; - -} diff --git a/src/Parsers/New/AST/ExplainQuery.cpp b/src/Parsers/New/AST/ExplainQuery.cpp deleted file mode 100644 index e6afd480f85..00000000000 --- a/src/Parsers/New/AST/ExplainQuery.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include - -#include -#include - - -namespace DB::AST -{ - -// static -PtrTo ExplainQuery::createExplainAST(PtrTo query) -{ - return PtrTo(new ExplainQuery(QueryType::AST, {query})); -} - -// static -PtrTo ExplainQuery::createExplainSyntax(PtrTo query) -{ - return PtrTo(new ExplainQuery(QueryType::SYNTAX, {query})); -} - -ExplainQuery::ExplainQuery(QueryType type, PtrList exprs) : Query{exprs}, query_type(type) -{ -} - -ASTPtr ExplainQuery::convertToOld() const -{ - ASTPtr query; - - switch (query_type) - { - case QueryType::AST: - query = std::make_shared(ASTExplainQuery::ParsedAST); - break; - case QueryType::SYNTAX: - query = std::make_shared(ASTExplainQuery::AnalyzedSyntax); - break; - } - - query->as()->setExplainedQuery(get(QUERY)->convertToOld()); - - return query; -} - -} - -namespace DB -{ - -using namespace DB::AST; - -antlrcpp::Any ParseTreeVisitor::visitExplainASTStmt(ClickHouseParser::ExplainASTStmtContext *ctx) -{ - return ExplainQuery::createExplainAST(visit(ctx->query()).as>()); -} - -antlrcpp::Any ParseTreeVisitor::visitExplainSyntaxStmt(ClickHouseParser::ExplainSyntaxStmtContext *ctx) -{ - return ExplainQuery::createExplainSyntax(visit(ctx->query()).as>()); -} - -} diff --git a/src/Parsers/New/AST/ExplainQuery.h b/src/Parsers/New/AST/ExplainQuery.h deleted file mode 100644 index 53bc63e7fd5..00000000000 --- a/src/Parsers/New/AST/ExplainQuery.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include - - -namespace DB::AST -{ - -class ExplainQuery : public Query -{ - public: - static PtrTo createExplainAST(PtrTo query); - static PtrTo createExplainSyntax(PtrTo query); - - ASTPtr convertToOld() const override; - - private: - enum ChildIndex : UInt8 - { - QUERY = 0, // Query - }; - - enum class QueryType - { - AST, - SYNTAX, - }; - - const QueryType query_type; - - ExplainQuery(QueryType type, PtrList exprs); -}; - -} diff --git a/src/Parsers/New/AST/INode.h b/src/Parsers/New/AST/INode.h deleted file mode 100644 index 68ad774e218..00000000000 --- a/src/Parsers/New/AST/INode.h +++ /dev/null @@ -1,103 +0,0 @@ -#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 deleted file mode 100644 index 17d4cfe2b2f..00000000000 --- a/src/Parsers/New/AST/Identifier.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#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 -{ - if (db) return std::make_shared(db->getName(), getName()); - else return std::make_shared(getName()); -} - -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 *) -{ - asm (""); // prevent symbol removal - __builtin_unreachable(); -} - -antlrcpp::Any ParseTreeVisitor::visitKeyword(ClickHouseParser::KeywordContext *) -{ - asm (""); // prevent symbol removal - __builtin_unreachable(); -} - -antlrcpp::Any ParseTreeVisitor::visitKeywordForAlias(ClickHouseParser::KeywordForAliasContext *) -{ - asm (""); // prevent symbol removal - __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 deleted file mode 100644 index 3d3688c30ef..00000000000 --- a/src/Parsers/New/AST/Identifier.h +++ /dev/null @@ -1,66 +0,0 @@ -#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 deleted file mode 100644 index 905748ba441..00000000000 --- a/src/Parsers/New/AST/InsertQuery.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#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 = get(IDENTIFIER)->convertToOld()->as()->getTableId(); - 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 deleted file mode 100644 index e7543d6e875..00000000000 --- a/src/Parsers/New/AST/InsertQuery.h +++ /dev/null @@ -1,73 +0,0 @@ -#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 deleted file mode 100644 index acbeae86897..00000000000 --- a/src/Parsers/New/AST/JoinExpr.cpp +++ /dev/null @@ -1,326 +0,0 @@ -#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 convertible 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 deleted file mode 100644 index 08117d6b6e8..00000000000 --- a/src/Parsers/New/AST/JoinExpr.h +++ /dev/null @@ -1,103 +0,0 @@ -#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 deleted file mode 100644 index 615b5ec3fe3..00000000000 --- a/src/Parsers/New/AST/KillQuery.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#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 deleted file mode 100644 index 61a73599cec..00000000000 --- a/src/Parsers/New/AST/KillQuery.h +++ /dev/null @@ -1,33 +0,0 @@ -#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 deleted file mode 100644 index b41c56d21f9..00000000000 --- a/src/Parsers/New/AST/LimitExpr.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#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 deleted file mode 100644 index 986806c2bd9..00000000000 --- a/src/Parsers/New/AST/LimitExpr.h +++ /dev/null @@ -1,24 +0,0 @@ -#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 deleted file mode 100644 index 30aacd3d590..00000000000 --- a/src/Parsers/New/AST/Literal.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#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 deleted file mode 100644 index 75790daed20..00000000000 --- a/src/Parsers/New/AST/Literal.h +++ /dev/null @@ -1,96 +0,0 @@ -#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 deleted file mode 100644 index 5977a2221b9..00000000000 --- a/src/Parsers/New/AST/OptimizeQuery.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#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 = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = table->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 deleted file mode 100644 index b94351518a7..00000000000 --- a/src/Parsers/New/AST/OptimizeQuery.h +++ /dev/null @@ -1,27 +0,0 @@ -#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 deleted file mode 100644 index 8511bc23276..00000000000 --- a/src/Parsers/New/AST/OrderExpr.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#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 deleted file mode 100644 index 2c13e7f5298..00000000000 --- a/src/Parsers/New/AST/OrderExpr.h +++ /dev/null @@ -1,33 +0,0 @@ -#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 deleted file mode 100644 index 1ef2ee935b6..00000000000 --- a/src/Parsers/New/AST/Query.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#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 deleted file mode 100644 index 2998d1f0146..00000000000 --- a/src/Parsers/New/AST/Query.h +++ /dev/null @@ -1,29 +0,0 @@ -#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 deleted file mode 100644 index 4216a8dcfdc..00000000000 --- a/src/Parsers/New/AST/README.md +++ /dev/null @@ -1,32 +0,0 @@ -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 deterministic, 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 deleted file mode 100644 index b9f56928227..00000000000 --- a/src/Parsers/New/AST/RatioExpr.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#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 deleted file mode 100644 index 8e48edbf6ea..00000000000 --- a/src/Parsers/New/AST/RatioExpr.h +++ /dev/null @@ -1,24 +0,0 @@ -#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 deleted file mode 100644 index 78a4530a20f..00000000000 --- a/src/Parsers/New/AST/RenameQuery.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#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 deleted file mode 100644 index 74909043d4d..00000000000 --- a/src/Parsers/New/AST/RenameQuery.h +++ /dev/null @@ -1,23 +0,0 @@ -#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 deleted file mode 100644 index 35eda09b473..00000000000 --- a/src/Parsers/New/AST/SelectUnionQuery.cpp +++ /dev/null @@ -1,444 +0,0 @@ -#include - -#include -#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; -} - -// PROJECTION SELECT Caluse - -ProjectionSelectStmt::ProjectionSelectStmt(PtrTo expr_list) - : INode(MAX_INDEX) -{ - set(COLUMNS, expr_list); -} - -void ProjectionSelectStmt::setWithClause(PtrTo clause) -{ - set(WITH, clause); -} - -void ProjectionSelectStmt::setGroupByClause(PtrTo clause) -{ - set(GROUP_BY, clause); -} - -void ProjectionSelectStmt::setOrderByClause(PtrTo clause) -{ - set(ORDER_BY, clause); -} - -ASTPtr ProjectionSelectStmt::convertToOld() const -{ - auto old_select = std::make_shared(); - - old_select->setExpression(ASTProjectionSelectQuery::Expression::SELECT, get(COLUMNS)->convertToOld()); - - if (has(WITH)) old_select->setExpression(ASTProjectionSelectQuery::Expression::WITH, get(WITH)->convertToOld()); - if (has(GROUP_BY)) old_select->setExpression(ASTProjectionSelectQuery::Expression::GROUP_BY, get(GROUP_BY)->convertToOld()); - if (has(ORDER_BY)) - { - ASTPtr order_expression; - auto expr_list = get(ORDER_BY)->convertToOld(); - if (expr_list->children.size() == 1) - { - order_expression = expr_list->children.front(); - } - else - { - auto function_node = std::make_shared(); - function_node->name = "tuple"; - function_node->arguments = expr_list; - function_node->children.push_back(expr_list); - order_expression = function_node; - } - old_select->setExpression(ASTProjectionSelectQuery::Expression::ORDER_BY, std::move(order_expression)); - } - - return old_select; -} - -// 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::visitProjectionOrderByClause(ClickHouseParser::ProjectionOrderByClauseContext *ctx) -{ - return std::make_shared(visit(ctx->columnExprList()).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::visitProjectionSelectStmt(ClickHouseParser::ProjectionSelectStmtContext *ctx) -{ - PtrTo column_list = visit(ctx->columnExprList()); - auto select_stmt = std::make_shared(column_list); - - if (ctx->withClause()) select_stmt->setWithClause(visit(ctx->withClause())); - if (ctx->groupByClause()) select_stmt->setGroupByClause(visit(ctx->groupByClause())); - if (ctx->projectionOrderByClause()) select_stmt->setOrderByClause(visit(ctx->projectionOrderByClause())); - - return select_stmt; -} - -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 deleted file mode 100644 index 587da271a78..00000000000 --- a/src/Parsers/New/AST/SelectUnionQuery.h +++ /dev/null @@ -1,193 +0,0 @@ -#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 ProjectionSelectStmt : public INode -{ - public: - ProjectionSelectStmt(PtrTo expr_list); - - void setWithClause(PtrTo clause); - void setGroupByClause(PtrTo clause); - void setOrderByClause(PtrTo clause); - - ASTPtr convertToOld() const override; - - private: - enum ChildIndex : UInt8 - { - COLUMNS = 0, // ColumnExprList - WITH, // WithClause (optional) - GROUP_BY, // GroupByClause (optional) - ORDER_BY, // OrderByClause (optional) - - MAX_INDEX, - }; -}; - -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 deleted file mode 100644 index 1f7087e21e3..00000000000 --- a/src/Parsers/New/AST/SetQuery.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#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 deleted file mode 100644 index 451371f6896..00000000000 --- a/src/Parsers/New/AST/SetQuery.h +++ /dev/null @@ -1,23 +0,0 @@ -#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 deleted file mode 100644 index e38b9d57ff8..00000000000 --- a/src/Parsers/New/AST/SettingExpr.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#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 deleted file mode 100644 index 8dad6166189..00000000000 --- a/src/Parsers/New/AST/SettingExpr.h +++ /dev/null @@ -1,25 +0,0 @@ -#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 deleted file mode 100644 index 613b5178e62..00000000000 --- a/src/Parsers/New/AST/ShowCreateQuery.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#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 = std::static_pointer_cast(get(IDENTIFIER)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = table->uuid; - - return query; - } - case QueryType::TABLE: - { - auto query = std::make_shared(); - - auto table = std::static_pointer_cast(get(IDENTIFIER)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = table->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 deleted file mode 100644 index 5f4d31bce60..00000000000 --- a/src/Parsers/New/AST/ShowCreateQuery.h +++ /dev/null @@ -1,36 +0,0 @@ -#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 deleted file mode 100644 index e6ea357dd70..00000000000 --- a/src/Parsers/New/AST/ShowQuery.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#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 deleted file mode 100644 index 93951676bbb..00000000000 --- a/src/Parsers/New/AST/ShowQuery.h +++ /dev/null @@ -1,32 +0,0 @@ -#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 deleted file mode 100644 index d2fda6a3fbc..00000000000 --- a/src/Parsers/New/AST/SystemQuery.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#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 = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - break; - case QueryType::FETCHES: - query->type = stop ? ASTSystemQuery::Type::STOP_FETCHES : ASTSystemQuery::Type::START_FETCHES; - { - auto table = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - break; - case QueryType::FLUSH_DISTRIBUTED: - query->type = ASTSystemQuery::Type::FLUSH_DISTRIBUTED; - { - auto table = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - 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 = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - break; - case QueryType::RELOAD_DICTIONARIES: - query->type = ASTSystemQuery::Type::RELOAD_DICTIONARIES; - break; - case QueryType::RELOAD_DICTIONARY: - query->type = ASTSystemQuery::Type::RELOAD_DICTIONARY; - { - auto table = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->getTableId().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 = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - break; - case QueryType::TTL_MERGES: - query->type = stop ? ASTSystemQuery::Type::STOP_TTL_MERGES : ASTSystemQuery::Type::START_TTL_MERGES; - { - auto table = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - } - 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 deleted file mode 100644 index 98a5cfd0932..00000000000 --- a/src/Parsers/New/AST/SystemQuery.h +++ /dev/null @@ -1,50 +0,0 @@ -#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 deleted file mode 100644 index 70855fee697..00000000000 --- a/src/Parsers/New/AST/TableElementExpr.cpp +++ /dev/null @@ -1,264 +0,0 @@ -#include - -#include -#include -#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})); -} - -// static -PtrTo -TableElementExpr::createProjection(PtrTo name, PtrTo query) -{ - return PtrTo(new TableElementExpr(ExprType::PROJECTION, {name, query})); -} - -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; - } - case ExprType::PROJECTION: - { - auto expr = std::make_shared(); - - expr->name = get(NAME)->getName(); - expr->set(expr->query, get(QUERY)->convertToOld()); - - 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::visitTableElementExprProjection(ClickHouseParser::TableElementExprProjectionContext *ctx) -{ - return visit(ctx->tableProjectionDfnt()); -} - -antlrcpp::Any ParseTreeVisitor::visitTableIndexDfnt(ClickHouseParser::TableIndexDfntContext *ctx) -{ - return TableElementExpr::createIndex( - visit(ctx->nestedIdentifier()), - visit(ctx->columnExpr()), - visit(ctx->columnTypeExpr()), - Literal::createNumber(ctx->DECIMAL_LITERAL())); -} - -antlrcpp::Any ParseTreeVisitor::visitTableProjectionDfnt(ClickHouseParser::TableProjectionDfntContext *ctx) -{ - return TableElementExpr::createProjection( - visit(ctx->nestedIdentifier()), - visit(ctx->projectionSelectStmt())); -} - -} diff --git a/src/Parsers/New/AST/TableElementExpr.h b/src/Parsers/New/AST/TableElementExpr.h deleted file mode 100644 index 18d1aa9c456..00000000000 --- a/src/Parsers/New/AST/TableElementExpr.h +++ /dev/null @@ -1,123 +0,0 @@ -#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, - PROJECTION, - }; - - 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); - - static PtrTo - createProjection(PtrTo name, PtrTo query); - - 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 - - // PROJECTION - QUERY = 1, // ColumnExpr - }; - - 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 deleted file mode 100644 index e14493c6bd6..00000000000 --- a/src/Parsers/New/AST/TableExpr.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#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->nestedIdentifier()) return std::make_shared(visit(ctx->nestedIdentifier()).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 deleted file mode 100644 index 1d893753023..00000000000 --- a/src/Parsers/New/AST/TableExpr.h +++ /dev/null @@ -1,81 +0,0 @@ -#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 Identifier - }; -}; - -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 deleted file mode 100644 index 43d7f7ed042..00000000000 --- a/src/Parsers/New/AST/TruncateQuery.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#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 deleted file mode 100644 index 463e561890f..00000000000 --- a/src/Parsers/New/AST/TruncateQuery.h +++ /dev/null @@ -1,25 +0,0 @@ -#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 deleted file mode 100644 index 4dd4d564c27..00000000000 --- a/src/Parsers/New/AST/UseQuery.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#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 deleted file mode 100644 index c71f271edb5..00000000000 --- a/src/Parsers/New/AST/UseQuery.h +++ /dev/null @@ -1,23 +0,0 @@ -#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 deleted file mode 100644 index 14d71007232..00000000000 --- a/src/Parsers/New/AST/WatchQuery.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#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 = std::static_pointer_cast(get(TABLE)->convertToOld()); - query->database = table->getDatabaseName(); - query->table = table->shortName(); - query->uuid = table->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 deleted file mode 100644 index 041f71b75ff..00000000000 --- a/src/Parsers/New/AST/WatchQuery.h +++ /dev/null @@ -1,26 +0,0 @@ -#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 deleted file mode 100644 index 4f9bde4bbbb..00000000000 --- a/src/Parsers/New/AST/fwd_decl.h +++ /dev/null @@ -1,91 +0,0 @@ -#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 ProjectionSelectStmt; -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 ProjectionOrderByClause = 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 deleted file mode 100644 index b045b0cc123..00000000000 --- a/src/Parsers/New/CMakeLists.txt +++ /dev/null @@ -1,93 +0,0 @@ -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}) - -target_compile_options (clickhouse_parsers_new - PRIVATE - -Wno-c++2a-compat - -Wno-deprecated-this-capture - -Wno-documentation-html - -Wno-documentation - -Wno-documentation-deprecated-sync - -Wno-shadow-field - -Wno-unused-parameter - -Wno-extra-semi - -Wno-inconsistent-missing-destructor-override -) - -# XXX: hack for old clang-10! -if (HAS_SUGGEST_DESTRUCTOR_OVERRIDE) - target_compile_options (clickhouse_parsers_new - PRIVATE - -Wno-suggest-destructor-override - ) -endif () - -# XXX: hack for old gcc-10! -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 deleted file mode 100644 index 71cccafae50..00000000000 --- a/src/Parsers/New/CharInputStream.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#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"); - } - - ++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 deleted file mode 100644 index 735f5c2bc38..00000000000 --- a/src/Parsers/New/CharInputStream.h +++ /dev/null @@ -1,34 +0,0 @@ -#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 deleted file mode 100644 index 7fb2a0effaa..00000000000 --- a/src/Parsers/New/ClickHouseLexer.cpp +++ /dev/null @@ -1,1603 +0,0 @@ - -// 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"AST", 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"MATERIALIZE", 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"PROJECTION", 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"AST", 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"MATERIALIZE", 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"PROJECTION", 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, 0xe0, 0x803, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, - 0x4, 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x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 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, - 0x169, 0xb6, 0x16b, 0xb7, 0x16d, 0xb8, 0x16f, 0xb9, 0x171, 0xba, 0x173, - 0xbb, 0x175, 0xbc, 0x177, 0xbd, 0x179, 0xbe, 0x17b, 0xbf, 0x17d, 0x2, - 0x17f, 0x2, 0x181, 0x2, 0x183, 0x2, 0x185, 0x2, 0x187, 0x2, 0x189, 0x2, - 0x18b, 0x2, 0x18d, 0x2, 0x18f, 0x2, 0x191, 0x2, 0x193, 0x2, 0x195, 0x2, - 0x197, 0x2, 0x199, 0x2, 0x19b, 0x2, 0x19d, 0x2, 0x19f, 0x2, 0x1a1, 0x2, - 0x1a3, 0x2, 0x1a5, 0x2, 0x1a7, 0x2, 0x1a9, 0x2, 0x1ab, 0x2, 0x1ad, 0x2, - 0x1af, 0x2, 0x1b1, 0x2, 0x1b3, 0x2, 0x1b5, 0x2, 0x1b7, 0x2, 0x1b9, 0xc0, - 0x1bb, 0xc1, 0x1bd, 0xc2, 0x1bf, 0xc3, 0x1c1, 0xc4, 0x1c3, 0xc5, 0x1c5, - 0xc6, 0x1c7, 0xc7, 0x1c9, 0xc8, 0x1cb, 0xc9,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0x2, 0x2, 0x139, 0x61c, 0x3, - 0x2, 0x2, 0x2, 0x13b, 0x621, 0x3, 0x2, 0x2, 0x2, 0x13d, 0x626, 0x3, - 0x2, 0x2, 0x2, 0x13f, 0x62e, 0x3, 0x2, 0x2, 0x2, 0x141, 0x638, 0x3, - 0x2, 0x2, 0x2, 0x143, 0x63b, 0x3, 0x2, 0x2, 0x2, 0x145, 0x63f, 0x3, - 0x2, 0x2, 0x2, 0x147, 0x646, 0x3, 0x2, 0x2, 0x2, 0x149, 0x64f, 0x3, - 0x2, 0x2, 0x2, 0x14b, 0x654, 0x3, 0x2, 0x2, 0x2, 0x14d, 0x65d, 0x3, - 0x2, 0x2, 0x2, 0x14f, 0x661, 0x3, 0x2, 0x2, 0x2, 0x151, 0x666, 0x3, - 0x2, 0x2, 0x2, 0x153, 0x66c, 0x3, 0x2, 0x2, 0x2, 0x155, 0x673, 0x3, - 0x2, 0x2, 0x2, 0x157, 0x677, 0x3, 0x2, 0x2, 0x2, 0x159, 0x67d, 0x3, - 0x2, 0x2, 0x2, 0x15b, 0x682, 0x3, 0x2, 0x2, 0x2, 0x15d, 0x689, 0x3, - 0x2, 0x2, 0x2, 0x15f, 0x68e, 0x3, 0x2, 0x2, 0x2, 0x161, 0x695, 0x3, - 0x2, 0x2, 0x2, 0x163, 0x69b, 0x3, 0x2, 0x2, 0x2, 0x165, 0x6a0, 0x3, - 0x2, 0x2, 0x2, 0x167, 0x6a5, 0x3, 0x2, 0x2, 0x2, 0x169, 0x6ab, 0x3, - 0x2, 0x2, 0x2, 0x16b, 0x6ba, 0x3, 0x2, 0x2, 0x2, 0x16d, 0x6bc, 0x3, - 0x2, 0x2, 0x2, 0x16f, 0x6c2, 0x3, 0x2, 0x2, 0x2, 0x171, 0x6f1, 0x3, - 0x2, 0x2, 0x2, 0x173, 0x73f, 0x3, 0x2, 0x2, 0x2, 0x175, 0x741, 0x3, - 0x2, 0x2, 0x2, 0x177, 0x748, 0x3, 0x2, 0x2, 0x2, 0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0x1f5, 0x7e3, 0x3, - 0x2, 0x2, 0x2, 0x1f7, 0x7f1, 0x3, 0x2, 0x2, 0x2, 0x1f9, 0x7ff, 0x3, - 0x2, 0x2, 0x2, 0x1fb, 0x1fc, 0x5, 0x17d, 0xbf, 0x2, 0x1fc, 0x1fd, 0x5, - 0x183, 0xc2, 0x2, 0x1fd, 0x1fe, 0x5, 0x183, 0xc2, 0x2, 0x1fe, 0x4, 0x3, - 0x2, 0x2, 0x2, 0x1ff, 0x200, 0x5, 0x17d, 0xbf, 0x2, 0x200, 0x201, 0x5, - 0x187, 0xc4, 0x2, 0x201, 0x202, 0x5, 0x1a3, 0xd2, 0x2, 0x202, 0x203, - 0x5, 0x185, 0xc3, 0x2, 0x203, 0x204, 0x5, 0x19f, 0xd0, 0x2, 0x204, 0x6, - 0x3, 0x2, 0x2, 0x2, 0x205, 0x206, 0x5, 0x17d, 0xbf, 0x2, 0x206, 0x207, - 0x5, 0x193, 0xca, 0x2, 0x207, 0x208, 0x5, 0x18d, 0xc7, 0x2, 0x208, 0x209, - 0x5, 0x17d, 0xbf, 0x2, 0x209, 0x20a, 0x5, 0x1a1, 0xd1, 0x2, 0x20a, 0x8, - 0x3, 0x2, 0x2, 0x2, 0x20b, 0x20c, 0x5, 0x17d, 0xbf, 0x2, 0x20c, 0x20d, - 0x5, 0x193, 0xca, 0x2, 0x20d, 0x20e, 0x5, 0x193, 0xca, 0x2, 0x20e, 0xa, - 0x3, 0x2, 0x2, 0x2, 0x20f, 0x210, 0x5, 0x17d, 0xbf, 0x2, 0x210, 0x211, - 0x5, 0x193, 0xca, 0x2, 0x211, 0x212, 0x5, 0x1a3, 0xd2, 0x2, 0x212, 0x213, - 0x5, 0x185, 0xc3, 0x2, 0x213, 0x214, 0x5, 0x19f, 0xd0, 0x2, 0x214, 0xc, - 0x3, 0x2, 0x2, 0x2, 0x215, 0x216, 0x5, 0x17d, 0xbf, 0x2, 0x216, 0x217, - 0x5, 0x197, 0xcc, 0x2, 0x217, 0x218, 0x5, 0x183, 0xc2, 0x2, 0x218, 0xe, - 0x3, 0x2, 0x2, 0x2, 0x219, 0x21a, 0x5, 0x17d, 0xbf, 0x2, 0x21a, 0x21b, - 0x5, 0x197, 0xcc, 0x2, 0x21b, 0x21c, 0x5, 0x1a3, 0xd2, 0x2, 0x21c, 0x21d, - 0x5, 0x18d, 0xc7, 0x2, 0x21d, 0x10, 0x3, 0x2, 0x2, 0x2, 0x21e, 0x21f, - 0x5, 0x17d, 0xbf, 0x2, 0x21f, 0x220, 0x5, 0x197, 0xcc, 0x2, 0x220, 0x221, - 0x5, 0x1ad, 0xd7, 0x2, 0x221, 0x12, 0x3, 0x2, 0x2, 0x2, 0x222, 0x223, - 0x5, 0x17d, 0xbf, 0x2, 0x223, 0x224, 0x5, 0x19f, 0xd0, 0x2, 0x224, 0x225, - 0x5, 0x19f, 0xd0, 0x2, 0x225, 0x226, 0x5, 0x17d, 0xbf, 0x2, 0x226, 0x227, - 0x5, 0x1ad, 0xd7, 0x2, 0x227, 0x14, 0x3, 0x2, 0x2, 0x2, 0x228, 0x229, - 0x5, 0x17d, 0xbf, 0x2, 0x229, 0x22a, 0x5, 0x1a1, 0xd1, 0x2, 0x22a, 0x16, - 0x3, 0x2, 0x2, 0x2, 0x22b, 0x22c, 0x5, 0x17d, 0xbf, 0x2, 0x22c, 0x22d, - 0x5, 0x1a1, 0xd1, 0x2, 0x22d, 0x22e, 0x5, 0x181, 0xc1, 0x2, 0x22e, 0x23a, - 0x3, 0x2, 0x2, 0x2, 0x22f, 0x230, 0x5, 0x17d, 0xbf, 0x2, 0x230, 0x231, - 0x5, 0x1a1, 0xd1, 0x2, 0x231, 0x232, 0x5, 0x181, 0xc1, 0x2, 0x232, 0x233, - 0x5, 0x185, 0xc3, 0x2, 0x233, 0x234, 0x5, 0x197, 0xcc, 0x2, 0x234, 0x235, - 0x5, 0x183, 0xc2, 0x2, 0x235, 0x236, 0x5, 0x18d, 0xc7, 0x2, 0x236, 0x237, - 0x5, 0x197, 0xcc, 0x2, 0x237, 0x238, 0x5, 0x189, 0xc5, 0x2, 0x238, 0x23a, - 0x3, 0x2, 0x2, 0x2, 0x239, 0x22b, 0x3, 0x2, 0x2, 0x2, 0x239, 0x22f, - 0x3, 0x2, 0x2, 0x2, 0x23a, 0x18, 0x3, 0x2, 0x2, 0x2, 0x23b, 0x23c, 0x5, - 0x17d, 0xbf, 0x2, 0x23c, 0x23d, 0x5, 0x1a1, 0xd1, 0x2, 0x23d, 0x23e, - 0x5, 0x199, 0xcd, 0x2, 0x23e, 0x23f, 0x5, 0x187, 0xc4, 0x2, 0x23f, 0x1a, - 0x3, 0x2, 0x2, 0x2, 0x240, 0x241, 0x5, 0x17d, 0xbf, 0x2, 0x241, 0x242, - 0x5, 0x1a1, 0xd1, 0x2, 0x242, 0x243, 0x5, 0x1a3, 0xd2, 0x2, 0x243, 0x1c, - 0x3, 0x2, 0x2, 0x2, 0x244, 0x245, 0x5, 0x17d, 0xbf, 0x2, 0x245, 0x246, - 0x5, 0x1a1, 0xd1, 0x2, 0x246, 0x247, 0x5, 0x1ad, 0xd7, 0x2, 0x247, 0x248, - 0x5, 0x197, 0xcc, 0x2, 0x248, 0x249, 0x5, 0x181, 0xc1, 0x2, 0x249, 0x1e, - 0x3, 0x2, 0x2, 0x2, 0x24a, 0x24b, 0x5, 0x17d, 0xbf, 0x2, 0x24b, 0x24c, - 0x5, 0x1a3, 0xd2, 0x2, 0x24c, 0x24d, 0x5, 0x1a3, 0xd2, 0x2, 0x24d, 0x24e, - 0x5, 0x17d, 0xbf, 0x2, 0x24e, 0x24f, 0x5, 0x181, 0xc1, 0x2, 0x24f, 0x250, - 0x5, 0x18b, 0xc6, 0x2, 0x250, 0x20, 0x3, 0x2, 0x2, 0x2, 0x251, 0x252, - 0x5, 0x17f, 0xc0, 0x2, 0x252, 0x253, 0x5, 0x185, 0xc3, 0x2, 0x253, 0x254, - 0x5, 0x1a3, 0xd2, 0x2, 0x254, 0x255, 0x5, 0x1a9, 0xd5, 0x2, 0x255, 0x256, - 0x5, 0x185, 0xc3, 0x2, 0x256, 0x257, 0x5, 0x185, 0xc3, 0x2, 0x257, 0x258, - 0x5, 0x197, 0xcc, 0x2, 0x258, 0x22, 0x3, 0x2, 0x2, 0x2, 0x259, 0x25a, - 0x5, 0x17f, 0xc0, 0x2, 0x25a, 0x25b, 0x5, 0x199, 0xcd, 0x2, 0x25b, 0x25c, - 0x5, 0x1a3, 0xd2, 0x2, 0x25c, 0x25d, 0x5, 0x18b, 0xc6, 0x2, 0x25d, 0x24, - 0x3, 0x2, 0x2, 0x2, 0x25e, 0x25f, 0x5, 0x17f, 0xc0, 0x2, 0x25f, 0x260, - 0x5, 0x1ad, 0xd7, 0x2, 0x260, 0x26, 0x3, 0x2, 0x2, 0x2, 0x261, 0x262, - 0x5, 0x181, 0xc1, 0x2, 0x262, 0x263, 0x5, 0x17d, 0xbf, 0x2, 0x263, 0x264, - 0x5, 0x1a1, 0xd1, 0x2, 0x264, 0x265, 0x5, 0x185, 0xc3, 0x2, 0x265, 0x28, - 0x3, 0x2, 0x2, 0x2, 0x266, 0x267, 0x5, 0x181, 0xc1, 0x2, 0x267, 0x268, - 0x5, 0x17d, 0xbf, 0x2, 0x268, 0x269, 0x5, 0x1a1, 0xd1, 0x2, 0x269, 0x26a, - 0x5, 0x1a3, 0xd2, 0x2, 0x26a, 0x2a, 0x3, 0x2, 0x2, 0x2, 0x26b, 0x26c, - 0x5, 0x181, 0xc1, 0x2, 0x26c, 0x26d, 0x5, 0x18b, 0xc6, 0x2, 0x26d, 0x26e, - 0x5, 0x185, 0xc3, 0x2, 0x26e, 0x26f, 0x5, 0x181, 0xc1, 0x2, 0x26f, 0x270, - 0x5, 0x191, 0xc9, 0x2, 0x270, 0x2c, 0x3, 0x2, 0x2, 0x2, 0x271, 0x272, - 0x5, 0x181, 0xc1, 0x2, 0x272, 0x273, 0x5, 0x193, 0xca, 0x2, 0x273, 0x274, - 0x5, 0x185, 0xc3, 0x2, 0x274, 0x275, 0x5, 0x17d, 0xbf, 0x2, 0x275, 0x276, - 0x5, 0x19f, 0xd0, 0x2, 0x276, 0x2e, 0x3, 0x2, 0x2, 0x2, 0x277, 0x278, - 0x5, 0x181, 0xc1, 0x2, 0x278, 0x279, 0x5, 0x193, 0xca, 0x2, 0x279, 0x27a, - 0x5, 0x1a5, 0xd3, 0x2, 0x27a, 0x27b, 0x5, 0x1a1, 0xd1, 0x2, 0x27b, 0x27c, - 0x5, 0x1a3, 0xd2, 0x2, 0x27c, 0x27d, 0x5, 0x185, 0xc3, 0x2, 0x27d, 0x27e, - 0x5, 0x19f, 0xd0, 0x2, 0x27e, 0x30, 0x3, 0x2, 0x2, 0x2, 0x27f, 0x280, - 0x5, 0x181, 0xc1, 0x2, 0x280, 0x281, 0x5, 0x199, 0xcd, 0x2, 0x281, 0x282, - 0x5, 0x183, 0xc2, 0x2, 0x282, 0x283, 0x5, 0x185, 0xc3, 0x2, 0x283, 0x284, - 0x5, 0x181, 0xc1, 0x2, 0x284, 0x32, 0x3, 0x2, 0x2, 0x2, 0x285, 0x286, - 0x5, 0x181, 0xc1, 0x2, 0x286, 0x287, 0x5, 0x199, 0xcd, 0x2, 0x287, 0x288, - 0x5, 0x193, 0xca, 0x2, 0x288, 0x289, 0x5, 0x193, 0xca, 0x2, 0x289, 0x28a, - 0x5, 0x17d, 0xbf, 0x2, 0x28a, 0x28b, 0x5, 0x1a3, 0xd2, 0x2, 0x28b, 0x28c, - 0x5, 0x185, 0xc3, 0x2, 0x28c, 0x34, 0x3, 0x2, 0x2, 0x2, 0x28d, 0x28e, - 0x5, 0x181, 0xc1, 0x2, 0x28e, 0x28f, 0x5, 0x199, 0xcd, 0x2, 0x28f, 0x290, - 0x5, 0x193, 0xca, 0x2, 0x290, 0x291, 0x5, 0x1a5, 0xd3, 0x2, 0x291, 0x292, - 0x5, 0x195, 0xcb, 0x2, 0x292, 0x293, 0x5, 0x197, 0xcc, 0x2, 0x293, 0x36, - 0x3, 0x2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a1, 0xd1, 0x2, 0x309, 0x30a, - 0x5, 0x181, 0xc1, 0x2, 0x30a, 0x30b, 0x5, 0x19f, 0xd0, 0x2, 0x30b, 0x30c, - 0x5, 0x18d, 0xc7, 0x2, 0x30c, 0x30d, 0x5, 0x17f, 0xc0, 0x2, 0x30d, 0x30e, - 0x5, 0x185, 0xc3, 0x2, 0x30e, 0x56, 0x3, 0x2, 0x2, 0x2, 0x30f, 0x310, - 0x5, 0x183, 0xc2, 0x2, 0x310, 0x311, 0x5, 0x185, 0xc3, 0x2, 0x311, 0x312, - 0x5, 0x1a3, 0xd2, 0x2, 0x312, 0x313, 0x5, 0x17d, 0xbf, 0x2, 0x313, 0x314, - 0x5, 0x181, 0xc1, 0x2, 0x314, 0x315, 0x5, 0x18b, 0xc6, 0x2, 0x315, 0x58, - 0x3, 0x2, 0x2, 0x2, 0x316, 0x317, 0x5, 0x183, 0xc2, 0x2, 0x317, 0x318, - 0x5, 0x18d, 0xc7, 0x2, 0x318, 0x319, 0x5, 0x181, 0xc1, 0x2, 0x319, 0x31a, - 0x5, 0x1a3, 0xd2, 0x2, 0x31a, 0x31b, 0x5, 0x18d, 0xc7, 0x2, 0x31b, 0x31c, - 0x5, 0x199, 0xcd, 0x2, 0x31c, 0x31d, 0x5, 0x197, 0xcc, 0x2, 0x31d, 0x31e, - 0x5, 0x17d, 0xbf, 0x2, 0x31e, 0x31f, 0x5, 0x19f, 0xd0, 0x2, 0x31f, 0x320, - 0x5, 0x18d, 0xc7, 0x2, 0x320, 0x321, 0x5, 0x185, 0xc3, 0x2, 0x321, 0x322, - 0x5, 0x1a1, 0xd1, 0x2, 0x322, 0x5a, 0x3, 0x2, 0x2, 0x2, 0x323, 0x324, - 0x5, 0x183, 0xc2, 0x2, 0x324, 0x325, 0x5, 0x18d, 0xc7, 0x2, 0x325, 0x326, - 0x5, 0x181, 0xc1, 0x2, 0x326, 0x327, 0x5, 0x1a3, 0xd2, 0x2, 0x327, 0x328, - 0x5, 0x18d, 0xc7, 0x2, 0x328, 0x329, 0x5, 0x199, 0xcd, 0x2, 0x329, 0x32a, - 0x5, 0x197, 0xcc, 0x2, 0x32a, 0x32b, 0x5, 0x17d, 0xbf, 0x2, 0x32b, 0x32c, - 0x5, 0x19f, 0xd0, 0x2, 0x32c, 0x32d, 0x5, 0x1ad, 0xd7, 0x2, 0x32d, 0x5c, - 0x3, 0x2, 0x2, 0x2, 0x32e, 0x32f, 0x5, 0x183, 0xc2, 0x2, 0x32f, 0x330, - 0x5, 0x18d, 0xc7, 0x2, 0x330, 0x331, 0x5, 0x1a1, 0xd1, 0x2, 0x331, 0x332, - 0x5, 0x191, 0xc9, 0x2, 0x332, 0x5e, 0x3, 0x2, 0x2, 0x2, 0x333, 0x334, - 0x5, 0x183, 0xc2, 0x2, 0x334, 0x335, 0x5, 0x18d, 0xc7, 0x2, 0x335, 0x336, - 0x5, 0x1a1, 0xd1, 0x2, 0x336, 0x337, 0x5, 0x1a3, 0xd2, 0x2, 0x337, 0x338, - 0x5, 0x18d, 0xc7, 0x2, 0x338, 0x339, 0x5, 0x197, 0xcc, 0x2, 0x339, 0x33a, - 0x5, 0x181, 0xc1, 0x2, 0x33a, 0x33b, 0x5, 0x1a3, 0xd2, 0x2, 0x33b, 0x60, - 0x3, 0x2, 0x2, 0x2, 0x33c, 0x33d, 0x5, 0x183, 0xc2, 0x2, 0x33d, 0x33e, - 0x5, 0x18d, 0xc7, 0x2, 0x33e, 0x33f, 0x5, 0x1a1, 0xd1, 0x2, 0x33f, 0x340, - 0x5, 0x1a3, 0xd2, 0x2, 0x340, 0x341, 0x5, 0x19f, 0xd0, 0x2, 0x341, 0x342, - 0x5, 0x18d, 0xc7, 0x2, 0x342, 0x343, 0x5, 0x17f, 0xc0, 0x2, 0x343, 0x344, - 0x5, 0x1a5, 0xd3, 0x2, 0x344, 0x345, 0x5, 0x1a3, 0xd2, 0x2, 0x345, 0x346, - 0x5, 0x185, 0xc3, 0x2, 0x346, 0x347, 0x5, 0x183, 0xc2, 0x2, 0x347, 0x62, - 0x3, 0x2, 0x2, 0x2, 0x348, 0x349, 0x5, 0x183, 0xc2, 0x2, 0x349, 0x34a, - 0x5, 0x19f, 0xd0, 0x2, 0x34a, 0x34b, 0x5, 0x199, 0xcd, 0x2, 0x34b, 0x34c, - 0x5, 0x19b, 0xce, 0x2, 0x34c, 0x64, 0x3, 0x2, 0x2, 0x2, 0x34d, 0x34e, - 0x5, 0x185, 0xc3, 0x2, 0x34e, 0x34f, 0x5, 0x193, 0xca, 0x2, 0x34f, 0x350, - 0x5, 0x1a1, 0xd1, 0x2, 0x350, 0x351, 0x5, 0x185, 0xc3, 0x2, 0x351, 0x66, - 0x3, 0x2, 0x2, 0x2, 0x352, 0x353, 0x5, 0x185, 0xc3, 0x2, 0x353, 0x354, - 0x5, 0x197, 0xcc, 0x2, 0x354, 0x355, 0x5, 0x183, 0xc2, 0x2, 0x355, 0x68, - 0x3, 0x2, 0x2, 0x2, 0x356, 0x357, 0x5, 0x185, 0xc3, 0x2, 0x357, 0x358, - 0x5, 0x197, 0xcc, 0x2, 0x358, 0x359, 0x5, 0x189, 0xc5, 0x2, 0x359, 0x35a, - 0x5, 0x18d, 0xc7, 0x2, 0x35a, 0x35b, 0x5, 0x197, 0xcc, 0x2, 0x35b, 0x35c, - 0x5, 0x185, 0xc3, 0x2, 0x35c, 0x6a, 0x3, 0x2, 0x2, 0x2, 0x35d, 0x35e, - 0x5, 0x185, 0xc3, 0x2, 0x35e, 0x35f, 0x5, 0x1a7, 0xd4, 0x2, 0x35f, 0x360, - 0x5, 0x185, 0xc3, 0x2, 0x360, 0x361, 0x5, 0x197, 0xcc, 0x2, 0x361, 0x362, - 0x5, 0x1a3, 0xd2, 0x2, 0x362, 0x363, 0x5, 0x1a1, 0xd1, 0x2, 0x363, 0x6c, - 0x3, 0x2, 0x2, 0x2, 0x364, 0x365, 0x5, 0x185, 0xc3, 0x2, 0x365, 0x366, - 0x5, 0x1ab, 0xd6, 0x2, 0x366, 0x367, 0x5, 0x18d, 0xc7, 0x2, 0x367, 0x368, - 0x5, 0x1a1, 0xd1, 0x2, 0x368, 0x369, 0x5, 0x1a3, 0xd2, 0x2, 0x369, 0x36a, - 0x5, 0x1a1, 0xd1, 0x2, 0x36a, 0x6e, 0x3, 0x2, 0x2, 0x2, 0x36b, 0x36c, - 0x5, 0x185, 0xc3, 0x2, 0x36c, 0x36d, 0x5, 0x1ab, 0xd6, 0x2, 0x36d, 0x36e, - 0x5, 0x19b, 0xce, 0x2, 0x36e, 0x36f, 0x5, 0x193, 0xca, 0x2, 0x36f, 0x370, - 0x5, 0x17d, 0xbf, 0x2, 0x370, 0x371, 0x5, 0x18d, 0xc7, 0x2, 0x371, 0x372, - 0x5, 0x197, 0xcc, 0x2, 0x372, 0x70, 0x3, 0x2, 0x2, 0x2, 0x373, 0x374, - 0x5, 0x185, 0xc3, 0x2, 0x374, 0x375, 0x5, 0x1ab, 0xd6, 0x2, 0x375, 0x376, - 0x5, 0x19b, 0xce, 0x2, 0x376, 0x377, 0x5, 0x19f, 0xd0, 0x2, 0x377, 0x378, - 0x5, 0x185, 0xc3, 0x2, 0x378, 0x379, 0x5, 0x1a1, 0xd1, 0x2, 0x379, 0x37a, - 0x5, 0x1a1, 0xd1, 0x2, 0x37a, 0x37b, 0x5, 0x18d, 0xc7, 0x2, 0x37b, 0x37c, - 0x5, 0x199, 0xcd, 0x2, 0x37c, 0x37d, 0x5, 0x197, 0xcc, 0x2, 0x37d, 0x72, - 0x3, 0x2, 0x2, 0x2, 0x37e, 0x37f, 0x5, 0x185, 0xc3, 0x2, 0x37f, 0x380, - 0x5, 0x1ab, 0xd6, 0x2, 0x380, 0x381, 0x5, 0x1a3, 0xd2, 0x2, 0x381, 0x382, - 0x5, 0x19f, 0xd0, 0x2, 0x382, 0x383, 0x5, 0x17d, 0xbf, 0x2, 0x383, 0x384, - 0x5, 0x181, 0xc1, 0x2, 0x384, 0x385, 0x5, 0x1a3, 0xd2, 0x2, 0x385, 0x74, - 0x3, 0x2, 0x2, 0x2, 0x386, 0x387, 0x5, 0x187, 0xc4, 0x2, 0x387, 0x388, - 0x5, 0x185, 0xc3, 0x2, 0x388, 0x389, 0x5, 0x1a3, 0xd2, 0x2, 0x389, 0x38a, - 0x5, 0x181, 0xc1, 0x2, 0x38a, 0x38b, 0x5, 0x18b, 0xc6, 0x2, 0x38b, 0x38c, - 0x5, 0x185, 0xc3, 0x2, 0x38c, 0x38d, 0x5, 0x1a1, 0xd1, 0x2, 0x38d, 0x76, - 0x3, 0x2, 0x2, 0x2, 0x38e, 0x38f, 0x5, 0x187, 0xc4, 0x2, 0x38f, 0x390, - 0x5, 0x18d, 0xc7, 0x2, 0x390, 0x391, 0x5, 0x197, 0xcc, 0x2, 0x391, 0x392, - 0x5, 0x17d, 0xbf, 0x2, 0x392, 0x393, 0x5, 0x193, 0xca, 0x2, 0x393, 0x78, - 0x3, 0x2, 0x2, 0x2, 0x394, 0x395, 0x5, 0x187, 0xc4, 0x2, 0x395, 0x396, - 0x5, 0x18d, 0xc7, 0x2, 0x396, 0x397, 0x5, 0x19f, 0xd0, 0x2, 0x397, 0x398, - 0x5, 0x1a1, 0xd1, 0x2, 0x398, 0x399, 0x5, 0x1a3, 0xd2, 0x2, 0x399, 0x7a, - 0x3, 0x2, 0x2, 0x2, 0x39a, 0x39b, 0x5, 0x187, 0xc4, 0x2, 0x39b, 0x39c, - 0x5, 0x193, 0xca, 0x2, 0x39c, 0x39d, 0x5, 0x1a5, 0xd3, 0x2, 0x39d, 0x39e, - 0x5, 0x1a1, 0xd1, 0x2, 0x39e, 0x39f, 0x5, 0x18b, 0xc6, 0x2, 0x39f, 0x7c, - 0x3, 0x2, 0x2, 0x2, 0x3a0, 0x3a1, 0x5, 0x187, 0xc4, 0x2, 0x3a1, 0x3a2, - 0x5, 0x199, 0xcd, 0x2, 0x3a2, 0x3a3, 0x5, 0x19f, 0xd0, 0x2, 0x3a3, 0x7e, - 0x3, 0x2, 0x2, 0x2, 0x3a4, 0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, 0x2, 0x3fb, 0x3fc, - 0x5, 0x187, 0xc4, 0x2, 0x3fc, 0x98, 0x3, 0x2, 0x2, 0x2, 0x3fd, 0x3fe, - 0x5, 0x18d, 0xc7, 0x2, 0x3fe, 0x3ff, 0x5, 0x193, 0xca, 0x2, 0x3ff, 0x400, - 0x5, 0x18d, 0xc7, 0x2, 0x400, 0x401, 0x5, 0x191, 0xc9, 0x2, 0x401, 0x402, - 0x5, 0x185, 0xc3, 0x2, 0x402, 0x9a, 0x3, 0x2, 0x2, 0x2, 0x403, 0x404, - 0x5, 0x18d, 0xc7, 0x2, 0x404, 0x405, 0x5, 0x197, 0xcc, 0x2, 0x405, 0x9c, - 0x3, 0x2, 0x2, 0x2, 0x406, 0x407, 0x5, 0x18d, 0xc7, 0x2, 0x407, 0x408, - 0x5, 0x197, 0xcc, 0x2, 0x408, 0x409, 0x5, 0x183, 0xc2, 0x2, 0x409, 0x40a, - 0x5, 0x185, 0xc3, 0x2, 0x40a, 0x40b, 0x5, 0x1ab, 0xd6, 0x2, 0x40b, 0x9e, - 0x3, 0x2, 0x2, 0x2, 0x40c, 0x40d, 0x5, 0x18d, 0xc7, 0x2, 0x40d, 0x40e, - 0x5, 0x197, 0xcc, 0x2, 0x40e, 0x40f, 0x5, 0x187, 0xc4, 0x2, 0x40f, 0x41a, - 0x3, 0x2, 0x2, 0x2, 0x410, 0x411, 0x5, 0x18d, 0xc7, 0x2, 0x411, 0x412, - 0x5, 0x197, 0xcc, 0x2, 0x412, 0x413, 0x5, 0x187, 0xc4, 0x2, 0x413, 0x414, - 0x5, 0x18d, 0xc7, 0x2, 0x414, 0x415, 0x5, 0x197, 0xcc, 0x2, 0x415, 0x416, - 0x5, 0x18d, 0xc7, 0x2, 0x416, 0x417, 0x5, 0x1a3, 0xd2, 0x2, 0x417, 0x418, - 0x5, 0x1ad, 0xd7, 0x2, 0x418, 0x41a, 0x3, 0x2, 0x2, 0x2, 0x419, 0x40c, - 0x3, 0x2, 0x2, 0x2, 0x419, 0x410, 0x3, 0x2, 0x2, 0x2, 0x41a, 0xa0, 0x3, - 0x2, 0x2, 0x2, 0x41b, 0x41c, 0x5, 0x18d, 0xc7, 0x2, 0x41c, 0x41d, 0x5, - 0x197, 0xcc, 0x2, 0x41d, 0x41e, 0x5, 0x18f, 0xc8, 0x2, 0x41e, 0x41f, - 0x5, 0x185, 0xc3, 0x2, 0x41f, 0x420, 0x5, 0x181, 0xc1, 0x2, 0x420, 0x421, - 0x5, 0x1a3, 0xd2, 0x2, 0x421, 0x422, 0x5, 0x18d, 0xc7, 0x2, 0x422, 0x423, - 0x5, 0x1a7, 0xd4, 0x2, 0x423, 0x424, 0x5, 0x185, 0xc3, 0x2, 0x424, 0xa2, - 0x3, 0x2, 0x2, 0x2, 0x425, 0x426, 0x5, 0x18d, 0xc7, 0x2, 0x426, 0x427, - 0x5, 0x197, 0xcc, 0x2, 0x427, 0x428, 0x5, 0x197, 0xcc, 0x2, 0x428, 0x429, - 0x5, 0x185, 0xc3, 0x2, 0x429, 0x42a, 0x5, 0x19f, 0xd0, 0x2, 0x42a, 0xa4, - 0x3, 0x2, 0x2, 0x2, 0x42b, 0x42c, 0x5, 0x18d, 0xc7, 0x2, 0x42c, 0x42d, - 0x5, 0x197, 0xcc, 0x2, 0x42d, 0x42e, 0x5, 0x1a1, 0xd1, 0x2, 0x42e, 0x42f, - 0x5, 0x185, 0xc3, 0x2, 0x42f, 0x430, 0x5, 0x19f, 0xd0, 0x2, 0x430, 0x431, - 0x5, 0x1a3, 0xd2, 0x2, 0x431, 0xa6, 0x3, 0x2, 0x2, 0x2, 0x432, 0x433, - 0x5, 0x18d, 0xc7, 0x2, 0x433, 0x434, 0x5, 0x197, 0xcc, 0x2, 0x434, 0x435, - 0x5, 0x1a3, 0xd2, 0x2, 0x435, 0x436, 0x5, 0x185, 0xc3, 0x2, 0x436, 0x437, - 0x5, 0x19f, 0xd0, 0x2, 0x437, 0x438, 0x5, 0x1a7, 0xd4, 0x2, 0x438, 0x439, - 0x5, 0x17d, 0xbf, 0x2, 0x439, 0x43a, 0x5, 0x193, 0xca, 0x2, 0x43a, 0xa8, - 0x3, 0x2, 0x2, 0x2, 0x43b, 0x43c, 0x5, 0x18d, 0xc7, 0x2, 0x43c, 0x43d, - 0x5, 0x197, 0xcc, 0x2, 0x43d, 0x43e, 0x5, 0x1a3, 0xd2, 0x2, 0x43e, 0x43f, - 0x5, 0x199, 0xcd, 0x2, 0x43f, 0xaa, 0x3, 0x2, 0x2, 0x2, 0x440, 0x441, - 0x5, 0x18d, 0xc7, 0x2, 0x441, 0x442, 0x5, 0x1a1, 0xd1, 0x2, 0x442, 0xac, - 0x3, 0x2, 0x2, 0x2, 0x443, 0x444, 0x5, 0x18d, 0xc7, 0x2, 0x444, 0x445, - 0x5, 0x1a1, 0xd1, 0x2, 0x445, 0x446, 0x5, 0x1f3, 0xfa, 0x2, 0x446, 0x447, - 0x5, 0x199, 0xcd, 0x2, 0x447, 0x448, 0x5, 0x17f, 0xc0, 0x2, 0x448, 0x449, - 0x5, 0x18f, 0xc8, 0x2, 0x449, 0x44a, 0x5, 0x185, 0xc3, 0x2, 0x44a, 0x44b, - 0x5, 0x181, 0xc1, 0x2, 0x44b, 0x44c, 0x5, 0x1a3, 0xd2, 0x2, 0x44c, 0x44d, - 0x5, 0x1f3, 0xfa, 0x2, 0x44d, 0x44e, 0x5, 0x18d, 0xc7, 0x2, 0x44e, 0x44f, - 0x5, 0x183, 0xc2, 0x2, 0x44f, 0xae, 0x3, 0x2, 0x2, 0x2, 0x450, 0x451, - 0x5, 0x18f, 0xc8, 0x2, 0x451, 0x452, 0x5, 0x199, 0xcd, 0x2, 0x452, 0x453, - 0x5, 0x18d, 0xc7, 0x2, 0x453, 0x454, 0x5, 0x197, 0xcc, 0x2, 0x454, 0xb0, - 0x3, 0x2, 0x2, 0x2, 0x455, 0x456, 0x5, 0x191, 0xc9, 0x2, 0x456, 0x457, - 0x5, 0x185, 0xc3, 0x2, 0x457, 0x458, 0x5, 0x1ad, 0xd7, 0x2, 0x458, 0xb2, - 0x3, 0x2, 0x2, 0x2, 0x459, 0x45a, 0x5, 0x191, 0xc9, 0x2, 0x45a, 0x45b, - 0x5, 0x18d, 0xc7, 0x2, 0x45b, 0x45c, 0x5, 0x193, 0xca, 0x2, 0x45c, 0x45d, - 0x5, 0x193, 0xca, 0x2, 0x45d, 0xb4, 0x3, 0x2, 0x2, 0x2, 0x45e, 0x45f, - 0x5, 0x193, 0xca, 0x2, 0x45f, 0x460, 0x5, 0x17d, 0xbf, 0x2, 0x460, 0x461, - 0x5, 0x1a1, 0xd1, 0x2, 0x461, 0x462, 0x5, 0x1a3, 0xd2, 0x2, 0x462, 0xb6, - 0x3, 0x2, 0x2, 0x2, 0x463, 0x464, 0x5, 0x193, 0xca, 0x2, 0x464, 0x465, - 0x5, 0x17d, 0xbf, 0x2, 0x465, 0x466, 0x5, 0x1ad, 0xd7, 0x2, 0x466, 0x467, - 0x5, 0x199, 0xcd, 0x2, 0x467, 0x468, 0x5, 0x1a5, 0xd3, 0x2, 0x468, 0x469, - 0x5, 0x1a3, 0xd2, 0x2, 0x469, 0xb8, 0x3, 0x2, 0x2, 0x2, 0x46a, 0x46b, - 0x5, 0x193, 0xca, 0x2, 0x46b, 0x46c, 0x5, 0x185, 0xc3, 0x2, 0x46c, 0x46d, - 0x5, 0x17d, 0xbf, 0x2, 0x46d, 0x46e, 0x5, 0x183, 0xc2, 0x2, 0x46e, 0x46f, - 0x5, 0x18d, 0xc7, 0x2, 0x46f, 0x470, 0x5, 0x197, 0xcc, 0x2, 0x470, 0x471, - 0x5, 0x189, 0xc5, 0x2, 0x471, 0xba, 0x3, 0x2, 0x2, 0x2, 0x472, 0x473, - 0x5, 0x193, 0xca, 0x2, 0x473, 0x474, 0x5, 0x185, 0xc3, 0x2, 0x474, 0x475, - 0x5, 0x187, 0xc4, 0x2, 0x475, 0x476, 0x5, 0x1a3, 0xd2, 0x2, 0x476, 0xbc, - 0x3, 0x2, 0x2, 0x2, 0x477, 0x478, 0x5, 0x193, 0xca, 0x2, 0x478, 0x479, - 0x5, 0x18d, 0xc7, 0x2, 0x479, 0x47a, 0x5, 0x187, 0xc4, 0x2, 0x47a, 0x47b, - 0x5, 0x185, 0xc3, 0x2, 0x47b, 0x47c, 0x5, 0x1a3, 0xd2, 0x2, 0x47c, 0x47d, - 0x5, 0x18d, 0xc7, 0x2, 0x47d, 0x47e, 0x5, 0x195, 0xcb, 0x2, 0x47e, 0x47f, - 0x5, 0x185, 0xc3, 0x2, 0x47f, 0xbe, 0x3, 0x2, 0x2, 0x2, 0x480, 0x481, - 0x5, 0x193, 0xca, 0x2, 0x481, 0x482, 0x5, 0x18d, 0xc7, 0x2, 0x482, 0x483, - 0x5, 0x191, 0xc9, 0x2, 0x483, 0x484, 0x5, 0x185, 0xc3, 0x2, 0x484, 0xc0, - 0x3, 0x2, 0x2, 0x2, 0x485, 0x486, 0x5, 0x193, 0xca, 0x2, 0x486, 0x487, - 0x5, 0x18d, 0xc7, 0x2, 0x487, 0x488, 0x5, 0x195, 0xcb, 0x2, 0x488, 0x489, - 0x5, 0x18d, 0xc7, 0x2, 0x489, 0x48a, 0x5, 0x1a3, 0xd2, 0x2, 0x48a, 0xc2, - 0x3, 0x2, 0x2, 0x2, 0x48b, 0x48c, 0x5, 0x193, 0xca, 0x2, 0x48c, 0x48d, - 0x5, 0x18d, 0xc7, 0x2, 0x48d, 0x48e, 0x5, 0x1a7, 0xd4, 0x2, 0x48e, 0x48f, - 0x5, 0x185, 0xc3, 0x2, 0x48f, 0xc4, 0x3, 0x2, 0x2, 0x2, 0x490, 0x491, - 0x5, 0x193, 0xca, 0x2, 0x491, 0x492, 0x5, 0x199, 0xcd, 0x2, 0x492, 0x493, - 0x5, 0x181, 0xc1, 0x2, 0x493, 0x494, 0x5, 0x17d, 0xbf, 0x2, 0x494, 0x495, - 0x5, 0x193, 0xca, 0x2, 0x495, 0xc6, 0x3, 0x2, 0x2, 0x2, 0x496, 0x497, - 0x5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0x1af, 0xd8, 0x2, 0x50c, 0x50d, - 0x5, 0x185, 0xc3, 0x2, 0x50d, 0xec, 0x3, 0x2, 0x2, 0x2, 0x50e, 0x50f, - 0x5, 0x199, 0xcd, 0x2, 0x50f, 0x510, 0x5, 0x19f, 0xd0, 0x2, 0x510, 0xee, - 0x3, 0x2, 0x2, 0x2, 0x511, 0x512, 0x5, 0x199, 0xcd, 0x2, 0x512, 0x513, - 0x5, 0x19f, 0xd0, 0x2, 0x513, 0x514, 0x5, 0x183, 0xc2, 0x2, 0x514, 0x515, - 0x5, 0x185, 0xc3, 0x2, 0x515, 0x516, 0x5, 0x19f, 0xd0, 0x2, 0x516, 0xf0, - 0x3, 0x2, 0x2, 0x2, 0x517, 0x518, 0x5, 0x199, 0xcd, 0x2, 0x518, 0x519, - 0x5, 0x1a5, 0xd3, 0x2, 0x519, 0x51a, 0x5, 0x1a3, 0xd2, 0x2, 0x51a, 0x51b, - 0x5, 0x185, 0xc3, 0x2, 0x51b, 0x51c, 0x5, 0x19f, 0xd0, 0x2, 0x51c, 0xf2, - 0x3, 0x2, 0x2, 0x2, 0x51d, 0x51e, 0x5, 0x199, 0xcd, 0x2, 0x51e, 0x51f, - 0x5, 0x1a5, 0xd3, 0x2, 0x51f, 0x520, 0x5, 0x1a3, 0xd2, 0x2, 0x520, 0x521, - 0x5, 0x187, 0xc4, 0x2, 0x521, 0x522, 0x5, 0x18d, 0xc7, 0x2, 0x522, 0x523, - 0x5, 0x193, 0xca, 0x2, 0x523, 0x524, 0x5, 0x185, 0xc3, 0x2, 0x524, 0xf4, - 0x3, 0x2, 0x2, 0x2, 0x525, 0x526, 0x5, 0x19b, 0xce, 0x2, 0x526, 0x527, - 0x5, 0x17d, 0xbf, 0x2, 0x527, 0x528, 0x5, 0x19f, 0xd0, 0x2, 0x528, 0x529, - 0x5, 0x1a3, 0xd2, 0x2, 0x529, 0x52a, 0x5, 0x18d, 0xc7, 0x2, 0x52a, 0x52b, - 0x5, 0x1a3, 0xd2, 0x2, 0x52b, 0x52c, 0x5, 0x18d, 0xc7, 0x2, 0x52c, 0x52d, - 0x5, 0x199, 0xcd, 0x2, 0x52d, 0x52e, 0x5, 0x197, 0xcc, 0x2, 0x52e, 0xf6, - 0x3, 0x2, 0x2, 0x2, 0x52f, 0x530, 0x5, 0x19b, 0xce, 0x2, 0x530, 0x531, - 0x5, 0x199, 0xcd, 0x2, 0x531, 0x532, 0x5, 0x19b, 0xce, 0x2, 0x532, 0x533, - 0x5, 0x1a5, 0xd3, 0x2, 0x533, 0x534, 0x5, 0x193, 0xca, 0x2, 0x534, 0x535, - 0x5, 0x17d, 0xbf, 0x2, 0x535, 0x536, 0x5, 0x1a3, 0xd2, 0x2, 0x536, 0x537, - 0x5, 0x185, 0xc3, 0x2, 0x537, 0xf8, 0x3, 0x2, 0x2, 0x2, 0x538, 0x539, - 0x5, 0x19b, 0xce, 0x2, 0x539, 0x53a, 0x5, 0x19f, 0xd0, 0x2, 0x53a, 0x53b, - 0x5, 0x185, 0xc3, 0x2, 0x53b, 0x53c, 0x5, 0x1a9, 0xd5, 0x2, 0x53c, 0x53d, - 0x5, 0x18b, 0xc6, 0x2, 0x53d, 0x53e, 0x5, 0x185, 0xc3, 0x2, 0x53e, 0x53f, - 0x5, 0x19f, 0xd0, 0x2, 0x53f, 0x540, 0x5, 0x185, 0xc3, 0x2, 0x540, 0xfa, - 0x3, 0x2, 0x2, 0x2, 0x541, 0x542, 0x5, 0x19b, 0xce, 0x2, 0x542, 0x543, - 0x5, 0x19f, 0xd0, 0x2, 0x543, 0x544, 0x5, 0x18d, 0xc7, 0x2, 0x544, 0x545, - 0x5, 0x195, 0xcb, 0x2, 0x545, 0x546, 0x5, 0x17d, 0xbf, 0x2, 0x546, 0x547, - 0x5, 0x19f, 0xd0, 0x2, 0x547, 0x548, 0x5, 0x1ad, 0xd7, 0x2, 0x548, 0xfc, - 0x3, 0x2, 0x2, 0x2, 0x549, 0x54a, 0x5, 0x19b, 0xce, 0x2, 0x54a, 0x54b, - 0x5, 0x19f, 0xd0, 0x2, 0x54b, 0x54c, 0x5, 0x199, 0xcd, 0x2, 0x54c, 0x54d, - 0x5, 0x18f, 0xc8, 0x2, 0x54d, 0x54e, 0x5, 0x185, 0xc3, 0x2, 0x54e, 0x54f, - 0x5, 0x181, 0xc1, 0x2, 0x54f, 0x550, 0x5, 0x1a3, 0xd2, 0x2, 0x550, 0x551, - 0x5, 0x18d, 0xc7, 0x2, 0x551, 0x552, 0x5, 0x199, 0xcd, 0x2, 0x552, 0x553, - 0x5, 0x197, 0xcc, 0x2, 0x553, 0xfe, 0x3, 0x2, 0x2, 0x2, 0x554, 0x555, - 0x5, 0x19d, 0xcf, 0x2, 0x555, 0x556, 0x5, 0x1a5, 0xd3, 0x2, 0x556, 0x557, - 0x5, 0x17d, 0xbf, 0x2, 0x557, 0x558, 0x5, 0x19f, 0xd0, 0x2, 0x558, 0x559, - 0x5, 0x1a3, 0xd2, 0x2, 0x559, 0x55a, 0x5, 0x185, 0xc3, 0x2, 0x55a, 0x55b, - 0x5, 0x19f, 0xd0, 0x2, 0x55b, 0x100, 0x3, 0x2, 0x2, 0x2, 0x55c, 0x55d, - 0x5, 0x19f, 0xd0, 0x2, 0x55d, 0x55e, 0x5, 0x17d, 0xbf, 0x2, 0x55e, 0x55f, - 0x5, 0x197, 0xcc, 0x2, 0x55f, 0x560, 0x5, 0x189, 0xc5, 0x2, 0x560, 0x561, - 0x5, 0x185, 0xc3, 0x2, 0x561, 0x102, 0x3, 0x2, 0x2, 0x2, 0x562, 0x563, - 0x5, 0x19f, 0xd0, 0x2, 0x563, 0x564, 0x5, 0x185, 0xc3, 0x2, 0x564, 0x565, - 0x5, 0x193, 0xca, 0x2, 0x565, 0x566, 0x5, 0x199, 0xcd, 0x2, 0x566, 0x567, - 0x5, 0x17d, 0xbf, 0x2, 0x567, 0x568, 0x5, 0x183, 0xc2, 0x2, 0x568, 0x104, - 0x3, 0x2, 0x2, 0x2, 0x569, 0x56a, 0x5, 0x19f, 0xd0, 0x2, 0x56a, 0x56b, - 0x5, 0x185, 0xc3, 0x2, 0x56b, 0x56c, 0x5, 0x195, 0xcb, 0x2, 0x56c, 0x56d, - 0x5, 0x199, 0xcd, 0x2, 0x56d, 0x56e, 0x5, 0x1a7, 0xd4, 0x2, 0x56e, 0x56f, - 0x5, 0x185, 0xc3, 0x2, 0x56f, 0x106, 0x3, 0x2, 0x2, 0x2, 0x570, 0x571, - 0x5, 0x19f, 0xd0, 0x2, 0x571, 0x572, 0x5, 0x185, 0xc3, 0x2, 0x572, 0x573, - 0x5, 0x197, 0xcc, 0x2, 0x573, 0x574, 0x5, 0x17d, 0xbf, 0x2, 0x574, 0x575, - 0x5, 0x195, 0xcb, 0x2, 0x575, 0x576, 0x5, 0x185, 0xc3, 0x2, 0x576, 0x108, - 0x3, 0x2, 0x2, 0x2, 0x577, 0x578, 0x5, 0x19f, 0xd0, 0x2, 0x578, 0x579, - 0x5, 0x185, 0xc3, 0x2, 0x579, 0x57a, 0x5, 0x19b, 0xce, 0x2, 0x57a, 0x57b, - 0x5, 0x193, 0xca, 0x2, 0x57b, 0x57c, 0x5, 0x17d, 0xbf, 0x2, 0x57c, 0x57d, - 0x5, 0x181, 0xc1, 0x2, 0x57d, 0x57e, 0x5, 0x185, 0xc3, 0x2, 0x57e, 0x10a, - 0x3, 0x2, 0x2, 0x2, 0x57f, 0x580, 0x5, 0x19f, 0xd0, 0x2, 0x580, 0x581, - 0x5, 0x185, 0xc3, 0x2, 0x581, 0x582, 0x5, 0x19b, 0xce, 0x2, 0x582, 0x583, - 0x5, 0x193, 0xca, 0x2, 0x583, 0x584, 0x5, 0x18d, 0xc7, 0x2, 0x584, 0x585, - 0x5, 0x181, 0xc1, 0x2, 0x585, 0x586, 0x5, 0x17d, 0xbf, 0x2, 0x586, 0x10c, - 0x3, 0x2, 0x2, 0x2, 0x587, 0x588, 0x5, 0x19f, 0xd0, 0x2, 0x588, 0x589, - 0x5, 0x185, 0xc3, 0x2, 0x589, 0x58a, 0x5, 0x19b, 0xce, 0x2, 0x58a, 0x58b, - 0x5, 0x193, 0xca, 0x2, 0x58b, 0x58c, 0x5, 0x18d, 0xc7, 0x2, 0x58c, 0x58d, - 0x5, 0x181, 0xc1, 0x2, 0x58d, 0x58e, 0x5, 0x17d, 0xbf, 0x2, 0x58e, 0x58f, - 0x5, 0x1a3, 0xd2, 0x2, 0x58f, 0x590, 0x5, 0x185, 0xc3, 0x2, 0x590, 0x591, - 0x5, 0x183, 0xc2, 0x2, 0x591, 0x10e, 0x3, 0x2, 0x2, 0x2, 0x592, 0x593, - 0x5, 0x19f, 0xd0, 0x2, 0x593, 0x594, 0x5, 0x18d, 0xc7, 0x2, 0x594, 0x595, - 0x5, 0x189, 0xc5, 0x2, 0x595, 0x596, 0x5, 0x18b, 0xc6, 0x2, 0x596, 0x597, - 0x5, 0x1a3, 0xd2, 0x2, 0x597, 0x110, 0x3, 0x2, 0x2, 0x2, 0x598, 0x599, - 0x5, 0x19f, 0xd0, 0x2, 0x599, 0x59a, 0x5, 0x199, 0xcd, 0x2, 0x59a, 0x59b, - 0x5, 0x193, 0xca, 0x2, 0x59b, 0x59c, 0x5, 0x193, 0xca, 0x2, 0x59c, 0x59d, - 0x5, 0x1a5, 0xd3, 0x2, 0x59d, 0x59e, 0x5, 0x19b, 0xce, 0x2, 0x59e, 0x112, - 0x3, 0x2, 0x2, 0x2, 0x59f, 0x5a0, 0x5, 0x1a1, 0xd1, 0x2, 0x5a0, 0x5a1, - 0x5, 0x17d, 0xbf, 0x2, 0x5a1, 0x5a2, 0x5, 0x195, 0xcb, 0x2, 0x5a2, 0x5a3, - 0x5, 0x19b, 0xce, 0x2, 0x5a3, 0x5a4, 0x5, 0x193, 0xca, 0x2, 0x5a4, 0x5a5, - 0x5, 0x185, 0xc3, 0x2, 0x5a5, 0x114, 0x3, 0x2, 0x2, 0x2, 0x5a6, 0x5a7, - 0x5, 0x1a1, 0xd1, 0x2, 0x5a7, 0x5a8, 0x5, 0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 0x5fe, 0x5, 0x185, 0xc3, 0x2, 0x5fe, 0x5ff, - 0x5, 0x195, 0xcb, 0x2, 0x5ff, 0x130, 0x3, 0x2, 0x2, 0x2, 0x600, 0x601, - 0x5, 0x1a3, 0xd2, 0x2, 0x601, 0x602, 0x5, 0x17d, 0xbf, 0x2, 0x602, 0x603, - 0x5, 0x17f, 0xc0, 0x2, 0x603, 0x604, 0x5, 0x193, 0xca, 0x2, 0x604, 0x605, - 0x5, 0x185, 0xc3, 0x2, 0x605, 0x132, 0x3, 0x2, 0x2, 0x2, 0x606, 0x607, - 0x5, 0x1a3, 0xd2, 0x2, 0x607, 0x608, 0x5, 0x17d, 0xbf, 0x2, 0x608, 0x609, - 0x5, 0x17f, 0xc0, 0x2, 0x609, 0x60a, 0x5, 0x193, 0xca, 0x2, 0x60a, 0x60b, - 0x5, 0x185, 0xc3, 0x2, 0x60b, 0x60c, 0x5, 0x1a1, 0xd1, 0x2, 0x60c, 0x134, - 0x3, 0x2, 0x2, 0x2, 0x60d, 0x60e, 0x5, 0x1a3, 0xd2, 0x2, 0x60e, 0x60f, - 0x5, 0x185, 0xc3, 0x2, 0x60f, 0x610, 0x5, 0x195, 0xcb, 0x2, 0x610, 0x611, - 0x5, 0x19b, 0xce, 0x2, 0x611, 0x612, 0x5, 0x199, 0xcd, 0x2, 0x612, 0x613, - 0x5, 0x19f, 0xd0, 0x2, 0x613, 0x614, 0x5, 0x17d, 0xbf, 0x2, 0x614, 0x615, - 0x5, 0x19f, 0xd0, 0x2, 0x615, 0x616, 0x5, 0x1ad, 0xd7, 0x2, 0x616, 0x136, - 0x3, 0x2, 0x2, 0x2, 0x617, 0x618, 0x5, 0x1a3, 0xd2, 0x2, 0x618, 0x619, - 0x5, 0x185, 0xc3, 0x2, 0x619, 0x61a, 0x5, 0x1a1, 0xd1, 0x2, 0x61a, 0x61b, - 0x5, 0x1a3, 0xd2, 0x2, 0x61b, 0x138, 0x3, 0x2, 0x2, 0x2, 0x61c, 0x61d, - 0x5, 0x1a3, 0xd2, 0x2, 0x61d, 0x61e, 0x5, 0x18b, 0xc6, 0x2, 0x61e, 0x61f, - 0x5, 0x185, 0xc3, 0x2, 0x61f, 0x620, 0x5, 0x197, 0xcc, 0x2, 0x620, 0x13a, - 0x3, 0x2, 0x2, 0x2, 0x621, 0x622, 0x5, 0x1a3, 0xd2, 0x2, 0x622, 0x623, - 0x5, 0x18d, 0xc7, 0x2, 0x623, 0x624, 0x5, 0x185, 0xc3, 0x2, 0x624, 0x625, - 0x5, 0x1a1, 0xd1, 0x2, 0x625, 0x13c, 0x3, 0x2, 0x2, 0x2, 0x626, 0x627, - 0x5, 0x1a3, 0xd2, 0x2, 0x627, 0x628, 0x5, 0x18d, 0xc7, 0x2, 0x628, 0x629, - 0x5, 0x195, 0xcb, 0x2, 0x629, 0x62a, 0x5, 0x185, 0xc3, 0x2, 0x62a, 0x62b, - 0x5, 0x199, 0xcd, 0x2, 0x62b, 0x62c, 0x5, 0x1a5, 0xd3, 0x2, 0x62c, 0x62d, - 0x5, 0x1a3, 0xd2, 0x2, 0x62d, 0x13e, 0x3, 0x2, 0x2, 0x2, 0x62e, 0x62f, - 0x5, 0x1a3, 0xd2, 0x2, 0x62f, 0x630, 0x5, 0x18d, 0xc7, 0x2, 0x630, 0x631, - 0x5, 0x195, 0xcb, 0x2, 0x631, 0x632, 0x5, 0x185, 0xc3, 0x2, 0x632, 0x633, - 0x5, 0x1a1, 0xd1, 0x2, 0x633, 0x634, 0x5, 0x1a3, 0xd2, 0x2, 0x634, 0x635, - 0x5, 0x17d, 0xbf, 0x2, 0x635, 0x636, 0x5, 0x195, 0xcb, 0x2, 0x636, 0x637, - 0x5, 0x19b, 0xce, 0x2, 0x637, 0x140, 0x3, 0x2, 0x2, 0x2, 0x638, 0x639, - 0x5, 0x1a3, 0xd2, 0x2, 0x639, 0x63a, 0x5, 0x199, 0xcd, 0x2, 0x63a, 0x142, - 0x3, 0x2, 0x2, 0x2, 0x63b, 0x63c, 0x5, 0x1a3, 0xd2, 0x2, 0x63c, 0x63d, - 0x5, 0x199, 0xcd, 0x2, 0x63d, 0x63e, 0x5, 0x19b, 0xce, 0x2, 0x63e, 0x144, - 0x3, 0x2, 0x2, 0x2, 0x63f, 0x640, 0x5, 0x1a3, 0xd2, 0x2, 0x640, 0x641, - 0x5, 0x199, 0xcd, 0x2, 0x641, 0x642, 0x5, 0x1a3, 0xd2, 0x2, 0x642, 0x643, - 0x5, 0x17d, 0xbf, 0x2, 0x643, 0x644, 0x5, 0x193, 0xca, 0x2, 0x644, 0x645, - 0x5, 0x1a1, 0xd1, 0x2, 0x645, 0x146, 0x3, 0x2, 0x2, 0x2, 0x646, 0x647, - 0x5, 0x1a3, 0xd2, 0x2, 0x647, 0x648, 0x5, 0x19f, 0xd0, 0x2, 0x648, 0x649, - 0x5, 0x17d, 0xbf, 0x2, 0x649, 0x64a, 0x5, 0x18d, 0xc7, 0x2, 0x64a, 0x64b, - 0x5, 0x193, 0xca, 0x2, 0x64b, 0x64c, 0x5, 0x18d, 0xc7, 0x2, 0x64c, 0x64d, - 0x5, 0x197, 0xcc, 0x2, 0x64d, 0x64e, 0x5, 0x189, 0xc5, 0x2, 0x64e, 0x148, - 0x3, 0x2, 0x2, 0x2, 0x64f, 0x650, 0x5, 0x1a3, 0xd2, 0x2, 0x650, 0x651, - 0x5, 0x19f, 0xd0, 0x2, 0x651, 0x652, 0x5, 0x18d, 0xc7, 0x2, 0x652, 0x653, - 0x5, 0x195, 0xcb, 0x2, 0x653, 0x14a, 0x3, 0x2, 0x2, 0x2, 0x654, 0x655, - 0x5, 0x1a3, 0xd2, 0x2, 0x655, 0x656, 0x5, 0x19f, 0xd0, 0x2, 0x656, 0x657, - 0x5, 0x1a5, 0xd3, 0x2, 0x657, 0x658, 0x5, 0x197, 0xcc, 0x2, 0x658, 0x659, - 0x5, 0x181, 0xc1, 0x2, 0x659, 0x65a, 0x5, 0x17d, 0xbf, 0x2, 0x65a, 0x65b, - 0x5, 0x1a3, 0xd2, 0x2, 0x65b, 0x65c, 0x5, 0x185, 0xc3, 0x2, 0x65c, 0x14c, - 0x3, 0x2, 0x2, 0x2, 0x65d, 0x65e, 0x5, 0x1a3, 0xd2, 0x2, 0x65e, 0x65f, - 0x5, 0x1a3, 0xd2, 0x2, 0x65f, 0x660, 0x5, 0x193, 0xca, 0x2, 0x660, 0x14e, - 0x3, 0x2, 0x2, 0x2, 0x661, 0x662, 0x5, 0x1a3, 0xd2, 0x2, 0x662, 0x663, - 0x5, 0x1ad, 0xd7, 0x2, 0x663, 0x664, 0x5, 0x19b, 0xce, 0x2, 0x664, 0x665, - 0x5, 0x185, 0xc3, 0x2, 0x665, 0x150, 0x3, 0x2, 0x2, 0x2, 0x666, 0x667, - 0x5, 0x1a5, 0xd3, 0x2, 0x667, 0x668, 0x5, 0x197, 0xcc, 0x2, 0x668, 0x669, - 0x5, 0x18d, 0xc7, 0x2, 0x669, 0x66a, 0x5, 0x199, 0xcd, 0x2, 0x66a, 0x66b, - 0x5, 0x197, 0xcc, 0x2, 0x66b, 0x152, 0x3, 0x2, 0x2, 0x2, 0x66c, 0x66d, - 0x5, 0x1a5, 0xd3, 0x2, 0x66d, 0x66e, 0x5, 0x19b, 0xce, 0x2, 0x66e, 0x66f, - 0x5, 0x183, 0xc2, 0x2, 0x66f, 0x670, 0x5, 0x17d, 0xbf, 0x2, 0x670, 0x671, - 0x5, 0x1a3, 0xd2, 0x2, 0x671, 0x672, 0x5, 0x185, 0xc3, 0x2, 0x672, 0x154, - 0x3, 0x2, 0x2, 0x2, 0x673, 0x674, 0x5, 0x1a5, 0xd3, 0x2, 0x674, 0x675, - 0x5, 0x1a1, 0xd1, 0x2, 0x675, 0x676, 0x5, 0x185, 0xc3, 0x2, 0x676, 0x156, - 0x3, 0x2, 0x2, 0x2, 0x677, 0x678, 0x5, 0x1a5, 0xd3, 0x2, 0x678, 0x679, - 0x5, 0x1a1, 0xd1, 0x2, 0x679, 0x67a, 0x5, 0x18d, 0xc7, 0x2, 0x67a, 0x67b, - 0x5, 0x197, 0xcc, 0x2, 0x67b, 0x67c, 0x5, 0x189, 0xc5, 0x2, 0x67c, 0x158, - 0x3, 0x2, 0x2, 0x2, 0x67d, 0x67e, 0x5, 0x1a5, 0xd3, 0x2, 0x67e, 0x67f, - 0x5, 0x1a5, 0xd3, 0x2, 0x67f, 0x680, 0x5, 0x18d, 0xc7, 0x2, 0x680, 0x681, - 0x5, 0x183, 0xc2, 0x2, 0x681, 0x15a, 0x3, 0x2, 0x2, 0x2, 0x682, 0x683, - 0x5, 0x1a7, 0xd4, 0x2, 0x683, 0x684, 0x5, 0x17d, 0xbf, 0x2, 0x684, 0x685, - 0x5, 0x193, 0xca, 0x2, 0x685, 0x686, 0x5, 0x1a5, 0xd3, 0x2, 0x686, 0x687, - 0x5, 0x185, 0xc3, 0x2, 0x687, 0x688, 0x5, 0x1a1, 0xd1, 0x2, 0x688, 0x15c, - 0x3, 0x2, 0x2, 0x2, 0x689, 0x68a, 0x5, 0x1a7, 0xd4, 0x2, 0x68a, 0x68b, - 0x5, 0x18d, 0xc7, 0x2, 0x68b, 0x68c, 0x5, 0x185, 0xc3, 0x2, 0x68c, 0x68d, - 0x5, 0x1a9, 0xd5, 0x2, 0x68d, 0x15e, 0x3, 0x2, 0x2, 0x2, 0x68e, 0x68f, - 0x5, 0x1a7, 0xd4, 0x2, 0x68f, 0x690, 0x5, 0x199, 0xcd, 0x2, 0x690, 0x691, - 0x5, 0x193, 0xca, 0x2, 0x691, 0x692, 0x5, 0x1a5, 0xd3, 0x2, 0x692, 0x693, - 0x5, 0x195, 0xcb, 0x2, 0x693, 0x694, 0x5, 0x185, 0xc3, 0x2, 0x694, 0x160, - 0x3, 0x2, 0x2, 0x2, 0x695, 0x696, 0x5, 0x1a9, 0xd5, 0x2, 0x696, 0x697, - 0x5, 0x17d, 0xbf, 0x2, 0x697, 0x698, 0x5, 0x1a3, 0xd2, 0x2, 0x698, 0x699, - 0x5, 0x181, 0xc1, 0x2, 0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x2, 0x6ff, 0x702, - 0x5, 0x1e1, 0xf1, 0x2, 0x700, 0x702, 0x5, 0x1c7, 0xe4, 0x2, 0x701, 0x6ff, - 0x3, 0x2, 0x2, 0x2, 0x701, 0x700, 0x3, 0x2, 0x2, 0x2, 0x701, 0x702, - 0x3, 0x2, 0x2, 0x2, 0x702, 0x704, 0x3, 0x2, 0x2, 0x2, 0x703, 0x705, - 0x5, 0x1b5, 0xdb, 0x2, 0x704, 0x703, 0x3, 0x2, 0x2, 0x2, 0x705, 0x706, - 0x3, 0x2, 0x2, 0x2, 0x706, 0x704, 0x3, 0x2, 0x2, 0x2, 0x706, 0x707, - 0x3, 0x2, 0x2, 0x2, 0x707, 0x740, 0x3, 0x2, 0x2, 0x2, 0x708, 0x70b, - 0x5, 0x179, 0xbd, 0x2, 0x709, 0x70c, 0x5, 0x19b, 0xce, 0x2, 0x70a, 0x70c, - 0x5, 0x185, 0xc3, 0x2, 0x70b, 0x709, 0x3, 0x2, 0x2, 0x2, 0x70b, 0x70a, - 0x3, 0x2, 0x2, 0x2, 0x70c, 0x70f, 0x3, 0x2, 0x2, 0x2, 0x70d, 0x710, - 0x5, 0x1e1, 0xf1, 0x2, 0x70e, 0x710, 0x5, 0x1c7, 0xe4, 0x2, 0x70f, 0x70d, - 0x3, 0x2, 0x2, 0x2, 0x70f, 0x70e, 0x3, 0x2, 0x2, 0x2, 0x70f, 0x710, - 0x3, 0x2, 0x2, 0x2, 0x710, 0x712, 0x3, 0x2, 0x2, 0x2, 0x711, 0x713, - 0x5, 0x1b5, 0xdb, 0x2, 0x712, 0x711, 0x3, 0x2, 0x2, 0x2, 0x713, 0x714, - 0x3, 0x2, 0x2, 0x2, 0x714, 0x712, 0x3, 0x2, 0x2, 0x2, 0x714, 0x715, - 0x3, 0x2, 0x2, 0x2, 0x715, 0x740, 0x3, 0x2, 0x2, 0x2, 0x716, 0x717, - 0x5, 0x177, 0xbc, 0x2, 0x717, 0x71b, 0x5, 0x1c9, 0xe5, 0x2, 0x718, 0x71a, - 0x5, 0x1b5, 0xdb, 0x2, 0x719, 0x718, 0x3, 0x2, 0x2, 0x2, 0x71a, 0x71d, - 0x3, 0x2, 0x2, 0x2, 0x71b, 0x719, 0x3, 0x2, 0x2, 0x2, 0x71b, 0x71c, - 0x3, 0x2, 0x2, 0x2, 0x71c, 0x71e, 0x3, 0x2, 0x2, 0x2, 0x71d, 0x71b, - 0x3, 0x2, 0x2, 0x2, 0x71e, 0x721, 0x5, 0x185, 0xc3, 0x2, 0x71f, 0x722, - 0x5, 0x1e1, 0xf1, 0x2, 0x720, 0x722, 0x5, 0x1c7, 0xe4, 0x2, 0x721, 0x71f, - 0x3, 0x2, 0x2, 0x2, 0x721, 0x720, 0x3, 0x2, 0x2, 0x2, 0x721, 0x722, - 0x3, 0x2, 0x2, 0x2, 0x722, 0x724, 0x3, 0x2, 0x2, 0x2, 0x723, 0x725, - 0x5, 0x1b5, 0xdb, 0x2, 0x724, 0x723, 0x3, 0x2, 0x2, 0x2, 0x725, 0x726, - 0x3, 0x2, 0x2, 0x2, 0x726, 0x724, 0x3, 0x2, 0x2, 0x2, 0x726, 0x727, - 0x3, 0x2, 0x2, 0x2, 0x727, 0x740, 0x3, 0x2, 0x2, 0x2, 0x728, 0x729, - 0x5, 0x1c9, 0xe5, 0x2, 0x729, 0x72a, 0x5, 0x177, 0xbc, 0x2, 0x72a, 0x72d, - 0x5, 0x185, 0xc3, 0x2, 0x72b, 0x72e, 0x5, 0x1e1, 0xf1, 0x2, 0x72c, 0x72e, - 0x5, 0x1c7, 0xe4, 0x2, 0x72d, 0x72b, 0x3, 0x2, 0x2, 0x2, 0x72d, 0x72c, - 0x3, 0x2, 0x2, 0x2, 0x72d, 0x72e, 0x3, 0x2, 0x2, 0x2, 0x72e, 0x730, - 0x3, 0x2, 0x2, 0x2, 0x72f, 0x731, 0x5, 0x1b5, 0xdb, 0x2, 0x730, 0x72f, - 0x3, 0x2, 0x2, 0x2, 0x731, 0x732, 0x3, 0x2, 0x2, 0x2, 0x732, 0x730, - 0x3, 0x2, 0x2, 0x2, 0x732, 0x733, 0x3, 0x2, 0x2, 0x2, 0x733, 0x740, - 0x3, 0x2, 0x2, 0x2, 0x734, 0x735, 0x5, 0x177, 0xbc, 0x2, 0x735, 0x738, - 0x5, 0x185, 0xc3, 0x2, 0x736, 0x739, 0x5, 0x1e1, 0xf1, 0x2, 0x737, 0x739, - 0x5, 0x1c7, 0xe4, 0x2, 0x738, 0x736, 0x3, 0x2, 0x2, 0x2, 0x738, 0x737, - 0x3, 0x2, 0x2, 0x2, 0x738, 0x739, 0x3, 0x2, 0x2, 0x2, 0x739, 0x73b, - 0x3, 0x2, 0x2, 0x2, 0x73a, 0x73c, 0x5, 0x1b5, 0xdb, 0x2, 0x73b, 0x73a, - 0x3, 0x2, 0x2, 0x2, 0x73c, 0x73d, 0x3, 0x2, 0x2, 0x2, 0x73d, 0x73b, - 0x3, 0x2, 0x2, 0x2, 0x73d, 0x73e, 0x3, 0x2, 0x2, 0x2, 0x73e, 0x740, - 0x3, 0x2, 0x2, 0x2, 0x73f, 0x6f3, 0x3, 0x2, 0x2, 0x2, 0x73f, 0x708, - 0x3, 0x2, 0x2, 0x2, 0x73f, 0x716, 0x3, 0x2, 0x2, 0x2, 0x73f, 0x728, - 0x3, 0x2, 0x2, 0x2, 0x73f, 0x734, 0x3, 0x2, 0x2, 0x2, 0x740, 0x174, - 0x3, 0x2, 0x2, 0x2, 0x741, 0x743, 0x7, 0x32, 0x2, 0x2, 0x742, 0x744, - 0x5, 0x1b3, 0xda, 0x2, 0x743, 0x742, 0x3, 0x2, 0x2, 0x2, 0x744, 0x745, - 0x3, 0x2, 0x2, 0x2, 0x745, 0x743, 0x3, 0x2, 0x2, 0x2, 0x745, 0x746, - 0x3, 0x2, 0x2, 0x2, 0x746, 0x176, 0x3, 0x2, 0x2, 0x2, 0x747, 0x749, - 0x5, 0x1b5, 0xdb, 0x2, 0x748, 0x747, 0x3, 0x2, 0x2, 0x2, 0x749, 0x74a, - 0x3, 0x2, 0x2, 0x2, 0x74a, 0x748, 0x3, 0x2, 0x2, 0x2, 0x74a, 0x74b, - 0x3, 0x2, 0x2, 0x2, 0x74b, 0x178, 0x3, 0x2, 0x2, 0x2, 0x74c, 0x74d, - 0x7, 0x32, 0x2, 0x2, 0x74d, 0x74f, 0x5, 0x1ab, 0xd6, 0x2, 0x74e, 0x750, - 0x5, 0x1b7, 0xdc, 0x2, 0x74f, 0x74e, 0x3, 0x2, 0x2, 0x2, 0x750, 0x751, - 0x3, 0x2, 0x2, 0x2, 0x751, 0x74f, 0x3, 0x2, 0x2, 0x2, 0x751, 0x752, - 0x3, 0x2, 0x2, 0x2, 0x752, 0x17a, 0x3, 0x2, 0x2, 0x2, 0x753, 0x75d, - 0x5, 0x1e7, 0xf4, 0x2, 0x754, 0x75c, 0xa, 0x4, 0x2, 0x2, 0x755, 0x756, - 0x5, 0x1bf, 0xe0, 0x2, 0x756, 0x757, 0xb, 0x2, 0x2, 0x2, 0x757, 0x75c, - 0x3, 0x2, 0x2, 0x2, 0x758, 0x759, 0x5, 0x1e7, 0xf4, 0x2, 0x759, 0x75a, - 0x5, 0x1e7, 0xf4, 0x2, 0x75a, 0x75c, 0x3, 0x2, 0x2, 0x2, 0x75b, 0x754, - 0x3, 0x2, 0x2, 0x2, 0x75b, 0x755, 0x3, 0x2, 0x2, 0x2, 0x75b, 0x758, - 0x3, 0x2, 0x2, 0x2, 0x75c, 0x75f, 0x3, 0x2, 0x2, 0x2, 0x75d, 0x75b, - 0x3, 0x2, 0x2, 0x2, 0x75d, 0x75e, 0x3, 0x2, 0x2, 0x2, 0x75e, 0x760, - 0x3, 0x2, 0x2, 0x2, 0x75f, 0x75d, 0x3, 0x2, 0x2, 0x2, 0x760, 0x761, - 0x5, 0x1e7, 0xf4, 0x2, 0x761, 0x17c, 0x3, 0x2, 0x2, 0x2, 0x762, 0x763, - 0x9, 0x5, 0x2, 0x2, 0x763, 0x17e, 0x3, 0x2, 0x2, 0x2, 0x764, 0x765, - 0x9, 0x6, 0x2, 0x2, 0x765, 0x180, 0x3, 0x2, 0x2, 0x2, 0x766, 0x767, - 0x9, 0x7, 0x2, 0x2, 0x767, 0x182, 0x3, 0x2, 0x2, 0x2, 0x768, 0x769, - 0x9, 0x8, 0x2, 0x2, 0x769, 0x184, 0x3, 0x2, 0x2, 0x2, 0x76a, 0x76b, - 0x9, 0x9, 0x2, 0x2, 0x76b, 0x186, 0x3, 0x2, 0x2, 0x2, 0x76c, 0x76d, - 0x9, 0xa, 0x2, 0x2, 0x76d, 0x188, 0x3, 0x2, 0x2, 0x2, 0x76e, 0x76f, - 0x9, 0xb, 0x2, 0x2, 0x76f, 0x18a, 0x3, 0x2, 0x2, 0x2, 0x770, 0x771, - 0x9, 0xc, 0x2, 0x2, 0x771, 0x18c, 0x3, 0x2, 0x2, 0x2, 0x772, 0x773, - 0x9, 0xd, 0x2, 0x2, 0x773, 0x18e, 0x3, 0x2, 0x2, 0x2, 0x774, 0x775, - 0x9, 0xe, 0x2, 0x2, 0x775, 0x190, 0x3, 0x2, 0x2, 0x2, 0x776, 0x777, - 0x9, 0xf, 0x2, 0x2, 0x777, 0x192, 0x3, 0x2, 0x2, 0x2, 0x778, 0x779, - 0x9, 0x10, 0x2, 0x2, 0x779, 0x194, 0x3, 0x2, 0x2, 0x2, 0x77a, 0x77b, - 0x9, 0x11, 0x2, 0x2, 0x77b, 0x196, 0x3, 0x2, 0x2, 0x2, 0x77c, 0x77d, - 0x9, 0x12, 0x2, 0x2, 0x77d, 0x198, 0x3, 0x2, 0x2, 0x2, 0x77e, 0x77f, - 0x9, 0x13, 0x2, 0x2, 0x77f, 0x19a, 0x3, 0x2, 0x2, 0x2, 0x780, 0x781, - 0x9, 0x14, 0x2, 0x2, 0x781, 0x19c, 0x3, 0x2, 0x2, 0x2, 0x782, 0x783, - 0x9, 0x15, 0x2, 0x2, 0x783, 0x19e, 0x3, 0x2, 0x2, 0x2, 0x784, 0x785, - 0x9, 0x16,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, 0x2, 0x2, 0x2, 0x7fa, 0x7fc, 0x9, 0x24, 0x2, 0x2, 0x7fb, 0x7fa, - 0x3, 0x2, 0x2, 0x2, 0x7fc, 0x7fd, 0x3, 0x2, 0x2, 0x2, 0x7fd, 0x7fe, - 0x8, 0xfc, 0x2, 0x2, 0x7fe, 0x1f8, 0x3, 0x2, 0x2, 0x2, 0x7ff, 0x800, - 0x9, 0x25, 0x2, 0x2, 0x800, 0x801, 0x3, 0x2, 0x2, 0x2, 0x801, 0x802, - 0x8, 0xfd, 0x2, 0x2, 0x802, 0x1fa, 0x3, 0x2, 0x2, 0x2, 0x26, 0x2, 0x239, - 0x419, 0x6ba, 0x6c9, 0x6ce, 0x6d0, 0x6db, 0x6dd, 0x6ea, 0x6ec, 0x6f1, - 0x6f8, 0x6fd, 0x701, 0x706, 0x70b, 0x70f, 0x714, 0x71b, 0x721, 0x726, - 0x72d, 0x732, 0x738, 0x73d, 0x73f, 0x745, 0x74a, 0x751, 0x75b, 0x75d, - 0x7cb, 0x7e9, 0x7f7, 0x7fb, 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.h b/src/Parsers/New/ClickHouseLexer.h deleted file mode 100644 index 1cce0ee0bd7..00000000000 --- a/src/Parsers/New/ClickHouseLexer.h +++ /dev/null @@ -1,98 +0,0 @@ - -// 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, AST = 13, ASYNC = 14, - ATTACH = 15, BETWEEN = 16, BOTH = 17, BY = 18, CASE = 19, CAST = 20, - CHECK = 21, CLEAR = 22, CLUSTER = 23, CODEC = 24, COLLATE = 25, COLUMN = 26, - COMMENT = 27, CONSTRAINT = 28, CREATE = 29, CROSS = 30, CUBE = 31, DATABASE = 32, - DATABASES = 33, DATE = 34, DAY = 35, DEDUPLICATE = 36, DEFAULT = 37, - DELAY = 38, DELETE = 39, DESC = 40, DESCENDING = 41, DESCRIBE = 42, - DETACH = 43, DICTIONARIES = 44, DICTIONARY = 45, DISK = 46, DISTINCT = 47, - DISTRIBUTED = 48, DROP = 49, ELSE = 50, END = 51, ENGINE = 52, EVENTS = 53, - EXISTS = 54, EXPLAIN = 55, EXPRESSION = 56, EXTRACT = 57, FETCHES = 58, - FINAL = 59, FIRST = 60, FLUSH = 61, FOR = 62, FORMAT = 63, FREEZE = 64, - FROM = 65, FULL = 66, FUNCTION = 67, GLOBAL = 68, GRANULARITY = 69, - GROUP = 70, HAVING = 71, HIERARCHICAL = 72, HOUR = 73, ID = 74, IF = 75, - ILIKE = 76, IN = 77, INDEX = 78, INF = 79, INJECTIVE = 80, INNER = 81, - INSERT = 82, INTERVAL = 83, INTO = 84, IS = 85, IS_OBJECT_ID = 86, JOIN = 87, - KEY = 88, KILL = 89, LAST = 90, LAYOUT = 91, LEADING = 92, LEFT = 93, - LIFETIME = 94, LIKE = 95, LIMIT = 96, LIVE = 97, LOCAL = 98, LOGS = 99, - MATERIALIZE = 100, MATERIALIZED = 101, MAX = 102, MERGES = 103, MIN = 104, - MINUTE = 105, MODIFY = 106, MONTH = 107, MOVE = 108, MUTATION = 109, - NAN_SQL = 110, NO = 111, NOT = 112, NULL_SQL = 113, NULLS = 114, OFFSET = 115, - ON = 116, OPTIMIZE = 117, OR = 118, ORDER = 119, OUTER = 120, OUTFILE = 121, - PARTITION = 122, POPULATE = 123, PREWHERE = 124, PRIMARY = 125, PROJECTION = 126, - QUARTER = 127, RANGE = 128, RELOAD = 129, REMOVE = 130, RENAME = 131, - REPLACE = 132, REPLICA = 133, REPLICATED = 134, RIGHT = 135, ROLLUP = 136, - SAMPLE = 137, SECOND = 138, SELECT = 139, SEMI = 140, SENDS = 141, SET = 142, - SETTINGS = 143, SHOW = 144, SOURCE = 145, START = 146, STOP = 147, SUBSTRING = 148, - SYNC = 149, SYNTAX = 150, SYSTEM = 151, TABLE = 152, TABLES = 153, TEMPORARY = 154, - TEST = 155, THEN = 156, TIES = 157, TIMEOUT = 158, TIMESTAMP = 159, - TO = 160, TOP = 161, TOTALS = 162, TRAILING = 163, TRIM = 164, TRUNCATE = 165, - TTL = 166, TYPE = 167, UNION = 168, UPDATE = 169, USE = 170, USING = 171, - UUID = 172, VALUES = 173, VIEW = 174, VOLUME = 175, WATCH = 176, WEEK = 177, - WHEN = 178, WHERE = 179, WITH = 180, YEAR = 181, JSON_FALSE = 182, JSON_TRUE = 183, - IDENTIFIER = 184, FLOATING_LITERAL = 185, OCTAL_LITERAL = 186, DECIMAL_LITERAL = 187, - HEXADECIMAL_LITERAL = 188, STRING_LITERAL = 189, ARROW = 190, ASTERISK = 191, - BACKQUOTE = 192, BACKSLASH = 193, COLON = 194, COMMA = 195, CONCAT = 196, - DASH = 197, DOT = 198, EQ_DOUBLE = 199, EQ_SINGLE = 200, GE = 201, GT = 202, - LBRACE = 203, LBRACKET = 204, LE = 205, LPAREN = 206, LT = 207, NOT_EQ = 208, - PERCENT = 209, PLUS = 210, QUERY = 211, QUOTE_DOUBLE = 212, QUOTE_SINGLE = 213, - RBRACE = 214, RBRACKET = 215, RPAREN = 216, SEMICOLON = 217, SLASH = 218, - UNDERSCORE = 219, MULTI_LINE_COMMENT = 220, SINGLE_LINE_COMMENT = 221, - WHITESPACE = 222 - }; - - 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 deleted file mode 100644 index 174f838f19d..00000000000 --- a/src/Parsers/New/ClickHouseParser.cpp +++ /dev/null @@ -1,20220 +0,0 @@ - -// 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(232); - _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(218); - query(); - setState(222); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::INTO) { - setState(219); - match(ClickHouseParser::INTO); - setState(220); - match(ClickHouseParser::OUTFILE); - setState(221); - match(ClickHouseParser::STRING_LITERAL); - } - setState(226); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FORMAT) { - setState(224); - match(ClickHouseParser::FORMAT); - setState(225); - identifierOrNull(); - } - setState(229); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::SEMICOLON) { - setState(228); - match(ClickHouseParser::SEMICOLON); - } - break; - } - - case ClickHouseParser::INSERT: { - enterOuterAlt(_localctx, 2); - setState(231); - 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(252); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 4, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(234); - alterStmt(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(235); - attachStmt(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(236); - checkStmt(); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(237); - createStmt(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(238); - describeStmt(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(239); - dropStmt(); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(240); - existsStmt(); - break; - } - - case 8: { - enterOuterAlt(_localctx, 8); - setState(241); - explainStmt(); - break; - } - - case 9: { - enterOuterAlt(_localctx, 9); - setState(242); - killStmt(); - break; - } - - case 10: { - enterOuterAlt(_localctx, 10); - setState(243); - optimizeStmt(); - break; - } - - case 11: { - enterOuterAlt(_localctx, 11); - setState(244); - renameStmt(); - break; - } - - case 12: { - enterOuterAlt(_localctx, 12); - setState(245); - selectUnionStmt(); - break; - } - - case 13: { - enterOuterAlt(_localctx, 13); - setState(246); - setStmt(); - break; - } - - case 14: { - enterOuterAlt(_localctx, 14); - setState(247); - showStmt(); - break; - } - - case 15: { - enterOuterAlt(_localctx, 15); - setState(248); - systemStmt(); - break; - } - - case 16: { - enterOuterAlt(_localctx, 16); - setState(249); - truncateStmt(); - break; - } - - case 17: { - enterOuterAlt(_localctx, 17); - setState(250); - useStmt(); - break; - } - - case 18: { - enterOuterAlt(_localctx, 18); - setState(251); - 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(254); - match(ClickHouseParser::ALTER); - setState(255); - match(ClickHouseParser::TABLE); - setState(256); - tableIdentifier(); - setState(258); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(257); - clusterClause(); - } - setState(260); - alterTableClause(); - setState(265); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(261); - match(ClickHouseParser::COMMA); - setState(262); - alterTableClause(); - setState(267); - _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); -} -//----------------- 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); -} -//----------------- 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); -} -//----------------- AlterTableClauseClearProjectionContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearProjectionContext::CLEAR() { - return getToken(ClickHouseParser::CLEAR, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearProjectionContext::PROJECTION() { - return getToken(ClickHouseParser::PROJECTION, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseClearProjectionContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearProjectionContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearProjectionContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearProjectionContext::IN() { - return getToken(ClickHouseParser::IN, 0); -} - -ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseClearProjectionContext::partitionClause() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseClearProjectionContext::AlterTableClauseClearProjectionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseClearProjectionContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseClearProjection(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); -} -//----------------- 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); -} -//----------------- 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); -} -//----------------- 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); -} -//----------------- 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); -} -//----------------- AlterTableClauseMaterializeIndexContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeIndexContext::MATERIALIZE() { - return getToken(ClickHouseParser::MATERIALIZE, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeIndexContext::INDEX() { - return getToken(ClickHouseParser::INDEX, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseMaterializeIndexContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeIndexContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeIndexContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeIndexContext::IN() { - return getToken(ClickHouseParser::IN, 0); -} - -ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseMaterializeIndexContext::partitionClause() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseMaterializeIndexContext::AlterTableClauseMaterializeIndexContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseMaterializeIndexContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseMaterializeIndex(this); - else - return visitor->visitChildren(this); -} -//----------------- AlterTableClauseMaterializeProjectionContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::MATERIALIZE() { - return getToken(ClickHouseParser::MATERIALIZE, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::PROJECTION() { - return getToken(ClickHouseParser::PROJECTION, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::IN() { - return getToken(ClickHouseParser::IN, 0); -} - -ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseMaterializeProjectionContext::partitionClause() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseMaterializeProjectionContext::AlterTableClauseMaterializeProjectionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseMaterializeProjectionContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseMaterializeProjection(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); -} -//----------------- 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); -} -//----------------- AlterTableClauseClearColumnContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearColumnContext::CLEAR() { - return getToken(ClickHouseParser::CLEAR, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearColumnContext::COLUMN() { - return getToken(ClickHouseParser::COLUMN, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseClearColumnContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearColumnContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearColumnContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearColumnContext::IN() { - return getToken(ClickHouseParser::IN, 0); -} - -ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseClearColumnContext::partitionClause() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseClearColumnContext::AlterTableClauseClearColumnContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseClearColumnContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseClearColumn(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); -} -//----------------- AlterTableClauseClearIndexContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearIndexContext::CLEAR() { - return getToken(ClickHouseParser::CLEAR, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearIndexContext::INDEX() { - return getToken(ClickHouseParser::INDEX, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseClearIndexContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearIndexContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearIndexContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseClearIndexContext::IN() { - return getToken(ClickHouseParser::IN, 0); -} - -ClickHouseParser::PartitionClauseContext* ClickHouseParser::AlterTableClauseClearIndexContext::partitionClause() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseClearIndexContext::AlterTableClauseClearIndexContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseClearIndexContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseClearIndex(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); -} -//----------------- 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); -} -//----------------- 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); -} -//----------------- AlterTableClauseDropProjectionContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseDropProjectionContext::DROP() { - return getToken(ClickHouseParser::DROP, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseDropProjectionContext::PROJECTION() { - return getToken(ClickHouseParser::PROJECTION, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseDropProjectionContext::nestedIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseDropProjectionContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseDropProjectionContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -ClickHouseParser::AlterTableClauseDropProjectionContext::AlterTableClauseDropProjectionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseDropProjectionContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseDropProjection(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); -} -//----------------- 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); -} -//----------------- AlterTableClauseAddProjectionContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::ADD() { - return getToken(ClickHouseParser::ADD, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::PROJECTION() { - return getToken(ClickHouseParser::PROJECTION, 0); -} - -ClickHouseParser::TableProjectionDfntContext* ClickHouseParser::AlterTableClauseAddProjectionContext::tableProjectionDfnt() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::IF() { - return getToken(ClickHouseParser::IF, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::NOT() { - return getToken(ClickHouseParser::NOT, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::AlterTableClauseAddProjectionContext::AFTER() { - return getToken(ClickHouseParser::AFTER, 0); -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::AlterTableClauseAddProjectionContext::nestedIdentifier() { - return getRuleContext(0); -} - -ClickHouseParser::AlterTableClauseAddProjectionContext::AlterTableClauseAddProjectionContext(AlterTableClauseContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::AlterTableClauseAddProjectionContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitAlterTableClauseAddProjection(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(482); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 35, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(268); - match(ClickHouseParser::ADD); - setState(269); - match(ClickHouseParser::COLUMN); - setState(273); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 7, _ctx)) { - case 1: { - setState(270); - match(ClickHouseParser::IF); - setState(271); - match(ClickHouseParser::NOT); - setState(272); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(275); - tableColumnDfnt(); - setState(278); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::AFTER) { - setState(276); - match(ClickHouseParser::AFTER); - setState(277); - nestedIdentifier(); - } - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(280); - match(ClickHouseParser::ADD); - setState(281); - match(ClickHouseParser::INDEX); - setState(285); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 9, _ctx)) { - case 1: { - setState(282); - match(ClickHouseParser::IF); - setState(283); - match(ClickHouseParser::NOT); - setState(284); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(287); - tableIndexDfnt(); - setState(290); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::AFTER) { - setState(288); - match(ClickHouseParser::AFTER); - setState(289); - nestedIdentifier(); - } - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(292); - match(ClickHouseParser::ADD); - setState(293); - match(ClickHouseParser::PROJECTION); - setState(297); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 11, _ctx)) { - case 1: { - setState(294); - match(ClickHouseParser::IF); - setState(295); - match(ClickHouseParser::NOT); - setState(296); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(299); - tableProjectionDfnt(); - setState(302); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::AFTER) { - setState(300); - match(ClickHouseParser::AFTER); - setState(301); - nestedIdentifier(); - } - break; - } - - case 4: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 4); - setState(304); - match(ClickHouseParser::ATTACH); - setState(305); - partitionClause(); - setState(308); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FROM) { - setState(306); - match(ClickHouseParser::FROM); - setState(307); - tableIdentifier(); - } - break; - } - - case 5: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 5); - setState(310); - match(ClickHouseParser::CLEAR); - setState(311); - match(ClickHouseParser::COLUMN); - setState(314); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 14, _ctx)) { - case 1: { - setState(312); - match(ClickHouseParser::IF); - setState(313); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(316); - nestedIdentifier(); - setState(319); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::IN) { - setState(317); - match(ClickHouseParser::IN); - setState(318); - partitionClause(); - } - break; - } - - case 6: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 6); - setState(321); - match(ClickHouseParser::CLEAR); - setState(322); - match(ClickHouseParser::INDEX); - setState(325); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 16, _ctx)) { - case 1: { - setState(323); - match(ClickHouseParser::IF); - setState(324); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(327); - nestedIdentifier(); - setState(330); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::IN) { - setState(328); - match(ClickHouseParser::IN); - setState(329); - partitionClause(); - } - break; - } - - case 7: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 7); - setState(332); - match(ClickHouseParser::CLEAR); - setState(333); - match(ClickHouseParser::PROJECTION); - setState(336); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 18, _ctx)) { - case 1: { - setState(334); - match(ClickHouseParser::IF); - setState(335); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(338); - nestedIdentifier(); - setState(341); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::IN) { - setState(339); - match(ClickHouseParser::IN); - setState(340); - partitionClause(); - } - break; - } - - case 8: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 8); - setState(343); - match(ClickHouseParser::COMMENT); - setState(344); - match(ClickHouseParser::COLUMN); - setState(347); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 20, _ctx)) { - case 1: { - setState(345); - match(ClickHouseParser::IF); - setState(346); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(349); - nestedIdentifier(); - setState(350); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 9: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 9); - setState(352); - match(ClickHouseParser::DELETE); - setState(353); - match(ClickHouseParser::WHERE); - setState(354); - columnExpr(0); - break; - } - - case 10: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 10); - setState(355); - match(ClickHouseParser::DETACH); - setState(356); - partitionClause(); - break; - } - - case 11: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 11); - setState(357); - match(ClickHouseParser::DROP); - setState(358); - match(ClickHouseParser::COLUMN); - setState(361); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 21, _ctx)) { - case 1: { - setState(359); - match(ClickHouseParser::IF); - setState(360); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(363); - nestedIdentifier(); - break; - } - - case 12: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 12); - setState(364); - match(ClickHouseParser::DROP); - setState(365); - match(ClickHouseParser::INDEX); - setState(368); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 22, _ctx)) { - case 1: { - setState(366); - match(ClickHouseParser::IF); - setState(367); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(370); - nestedIdentifier(); - break; - } - - case 13: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 13); - setState(371); - match(ClickHouseParser::DROP); - setState(372); - match(ClickHouseParser::PROJECTION); - setState(375); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 23, _ctx)) { - case 1: { - setState(373); - match(ClickHouseParser::IF); - setState(374); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(377); - nestedIdentifier(); - break; - } - - case 14: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 14); - setState(378); - match(ClickHouseParser::DROP); - setState(379); - partitionClause(); - break; - } - - case 15: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 15); - setState(380); - match(ClickHouseParser::FREEZE); - setState(382); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::PARTITION) { - setState(381); - partitionClause(); - } - break; - } - - case 16: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 16); - setState(384); - match(ClickHouseParser::MATERIALIZE); - setState(385); - match(ClickHouseParser::INDEX); - setState(388); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 25, _ctx)) { - case 1: { - setState(386); - match(ClickHouseParser::IF); - setState(387); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(390); - nestedIdentifier(); - setState(393); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::IN) { - setState(391); - match(ClickHouseParser::IN); - setState(392); - partitionClause(); - } - break; - } - - case 17: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 17); - setState(395); - match(ClickHouseParser::MATERIALIZE); - setState(396); - match(ClickHouseParser::PROJECTION); - setState(399); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 27, _ctx)) { - case 1: { - setState(397); - match(ClickHouseParser::IF); - setState(398); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(401); - nestedIdentifier(); - setState(404); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::IN) { - setState(402); - match(ClickHouseParser::IN); - setState(403); - partitionClause(); - } - break; - } - - case 18: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 18); - setState(406); - match(ClickHouseParser::MODIFY); - setState(407); - match(ClickHouseParser::COLUMN); - setState(410); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 29, _ctx)) { - case 1: { - setState(408); - match(ClickHouseParser::IF); - setState(409); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(412); - nestedIdentifier(); - setState(413); - codecExpr(); - break; - } - - case 19: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 19); - setState(415); - match(ClickHouseParser::MODIFY); - setState(416); - match(ClickHouseParser::COLUMN); - setState(419); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 30, _ctx)) { - case 1: { - setState(417); - match(ClickHouseParser::IF); - setState(418); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(421); - nestedIdentifier(); - setState(422); - match(ClickHouseParser::COMMENT); - setState(423); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 20: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 20); - setState(425); - match(ClickHouseParser::MODIFY); - setState(426); - match(ClickHouseParser::COLUMN); - setState(429); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 31, _ctx)) { - case 1: { - setState(427); - match(ClickHouseParser::IF); - setState(428); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(431); - nestedIdentifier(); - setState(432); - match(ClickHouseParser::REMOVE); - setState(433); - tableColumnPropertyType(); - break; - } - - case 21: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 21); - setState(435); - match(ClickHouseParser::MODIFY); - setState(436); - match(ClickHouseParser::COLUMN); - setState(439); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 32, _ctx)) { - case 1: { - setState(437); - match(ClickHouseParser::IF); - setState(438); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(441); - tableColumnDfnt(); - break; - } - - case 22: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 22); - setState(442); - match(ClickHouseParser::MODIFY); - setState(443); - match(ClickHouseParser::ORDER); - setState(444); - match(ClickHouseParser::BY); - setState(445); - columnExpr(0); - break; - } - - case 23: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 23); - setState(446); - match(ClickHouseParser::MODIFY); - setState(447); - ttlClause(); - break; - } - - case 24: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 24); - setState(448); - match(ClickHouseParser::MOVE); - setState(449); - partitionClause(); - setState(459); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 33, _ctx)) { - case 1: { - setState(450); - match(ClickHouseParser::TO); - setState(451); - match(ClickHouseParser::DISK); - setState(452); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 2: { - setState(453); - match(ClickHouseParser::TO); - setState(454); - match(ClickHouseParser::VOLUME); - setState(455); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 3: { - setState(456); - match(ClickHouseParser::TO); - setState(457); - match(ClickHouseParser::TABLE); - setState(458); - tableIdentifier(); - break; - } - - } - break; - } - - case 25: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 25); - setState(461); - match(ClickHouseParser::REMOVE); - setState(462); - match(ClickHouseParser::TTL); - break; - } - - case 26: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 26); - setState(463); - match(ClickHouseParser::RENAME); - setState(464); - match(ClickHouseParser::COLUMN); - setState(467); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 34, _ctx)) { - case 1: { - setState(465); - match(ClickHouseParser::IF); - setState(466); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(469); - nestedIdentifier(); - setState(470); - match(ClickHouseParser::TO); - setState(471); - nestedIdentifier(); - break; - } - - case 27: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 27); - setState(473); - match(ClickHouseParser::REPLACE); - setState(474); - partitionClause(); - setState(475); - match(ClickHouseParser::FROM); - setState(476); - tableIdentifier(); - break; - } - - case 28: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 28); - setState(478); - match(ClickHouseParser::UPDATE); - setState(479); - assignmentExprList(); - setState(480); - 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(484); - assignmentExpr(); - setState(489); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(485); - match(ClickHouseParser::COMMA); - setState(486); - assignmentExpr(); - setState(491); - _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(492); - nestedIdentifier(); - setState(493); - match(ClickHouseParser::EQ_SINGLE); - setState(494); - 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(496); - _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(503); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 37, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(498); - match(ClickHouseParser::PARTITION); - setState(499); - columnExpr(0); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(500); - match(ClickHouseParser::PARTITION); - setState(501); - match(ClickHouseParser::ID); - setState(502); - 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(505); - match(ClickHouseParser::ATTACH); - setState(506); - match(ClickHouseParser::DICTIONARY); - setState(507); - tableIdentifier(); - setState(509); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(508); - 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(511); - match(ClickHouseParser::CHECK); - setState(512); - match(ClickHouseParser::TABLE); - setState(513); - tableIdentifier(); - setState(515); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::PARTITION) { - setState(514); - 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(654); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 71, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(517); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(518); - match(ClickHouseParser::DATABASE); - setState(522); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 40, _ctx)) { - case 1: { - setState(519); - match(ClickHouseParser::IF); - setState(520); - match(ClickHouseParser::NOT); - setState(521); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(524); - databaseIdentifier(); - setState(526); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(525); - clusterClause(); - } - setState(529); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ENGINE) { - setState(528); - engineExpr(); - } - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(531); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(532); - match(ClickHouseParser::DICTIONARY); - setState(536); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 43, _ctx)) { - case 1: { - setState(533); - match(ClickHouseParser::IF); - setState(534); - match(ClickHouseParser::NOT); - setState(535); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(538); - tableIdentifier(); - setState(540); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::UUID) { - setState(539); - uuidClause(); - } - setState(543); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(542); - clusterClause(); - } - setState(545); - dictionarySchemaClause(); - setState(546); - dictionaryEngineClause(); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(548); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(549); - match(ClickHouseParser::LIVE); - setState(550); - match(ClickHouseParser::VIEW); - setState(554); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 46, _ctx)) { - case 1: { - setState(551); - match(ClickHouseParser::IF); - setState(552); - match(ClickHouseParser::NOT); - setState(553); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(556); - tableIdentifier(); - setState(558); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::UUID) { - setState(557); - uuidClause(); - } - setState(561); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(560); - clusterClause(); - } - setState(568); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WITH) { - setState(563); - match(ClickHouseParser::WITH); - setState(564); - match(ClickHouseParser::TIMEOUT); - setState(566); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::DECIMAL_LITERAL) { - setState(565); - match(ClickHouseParser::DECIMAL_LITERAL); - } - } - setState(571); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TO) { - setState(570); - destinationClause(); - } - setState(574); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 52, _ctx)) { - case 1: { - setState(573); - tableSchemaClause(); - break; - } - - } - setState(576); - subqueryClause(); - break; - } - - case 4: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 4); - setState(578); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(579); - match(ClickHouseParser::MATERIALIZED); - setState(580); - match(ClickHouseParser::VIEW); - setState(584); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 53, _ctx)) { - case 1: { - setState(581); - match(ClickHouseParser::IF); - setState(582); - match(ClickHouseParser::NOT); - setState(583); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(586); - tableIdentifier(); - setState(588); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::UUID) { - setState(587); - uuidClause(); - } - setState(591); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(590); - clusterClause(); - } - setState(594); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::AS || _la == ClickHouseParser::LPAREN) { - setState(593); - tableSchemaClause(); - } - setState(601); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::TO: { - setState(596); - destinationClause(); - break; - } - - case ClickHouseParser::ENGINE: { - setState(597); - engineClause(); - setState(599); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::POPULATE) { - setState(598); - match(ClickHouseParser::POPULATE); - } - break; - } - - default: - throw NoViableAltException(this); - } - setState(603); - subqueryClause(); - break; - } - - case 5: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 5); - setState(605); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(607); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TEMPORARY) { - setState(606); - match(ClickHouseParser::TEMPORARY); - } - setState(609); - match(ClickHouseParser::TABLE); - setState(613); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 60, _ctx)) { - case 1: { - setState(610); - match(ClickHouseParser::IF); - setState(611); - match(ClickHouseParser::NOT); - setState(612); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(615); - tableIdentifier(); - setState(617); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::UUID) { - setState(616); - uuidClause(); - } - setState(620); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(619); - clusterClause(); - } - setState(623); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 63, _ctx)) { - case 1: { - setState(622); - tableSchemaClause(); - break; - } - - } - setState(626); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ENGINE) { - setState(625); - engineClause(); - } - setState(629); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::AS) { - setState(628); - subqueryClause(); - } - break; - } - - case 6: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 6); - setState(631); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ATTACH - - || _la == ClickHouseParser::CREATE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(634); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OR) { - setState(632); - match(ClickHouseParser::OR); - setState(633); - match(ClickHouseParser::REPLACE); - } - setState(636); - match(ClickHouseParser::VIEW); - setState(640); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 67, _ctx)) { - case 1: { - setState(637); - match(ClickHouseParser::IF); - setState(638); - match(ClickHouseParser::NOT); - setState(639); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(642); - tableIdentifier(); - setState(644); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::UUID) { - setState(643); - uuidClause(); - } - setState(647); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(646); - clusterClause(); - } - setState(650); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 70, _ctx)) { - case 1: { - setState(649); - tableSchemaClause(); - break; - } - - } - setState(652); - 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(656); - match(ClickHouseParser::LPAREN); - setState(657); - dictionaryAttrDfnt(); - setState(662); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(658); - match(ClickHouseParser::COMMA); - setState(659); - dictionaryAttrDfnt(); - setState(664); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(665); - 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(667); - identifier(); - setState(668); - columnTypeExpr(); - setState(690); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 74, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(688); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 73, _ctx)) { - case 1: { - setState(669); - - if (!(!_localctx->attrs.count("default"))) throw FailedPredicateException(this, "!$attrs.count(\"default\")"); - setState(670); - match(ClickHouseParser::DEFAULT); - setState(671); - literal(); - _localctx->attrs.insert("default"); - break; - } - - case 2: { - setState(674); - - if (!(!_localctx->attrs.count("expression"))) throw FailedPredicateException(this, "!$attrs.count(\"expression\")"); - setState(675); - match(ClickHouseParser::EXPRESSION); - setState(676); - columnExpr(0); - _localctx->attrs.insert("expression"); - break; - } - - case 3: { - setState(679); - - if (!(!_localctx->attrs.count("hierarchical"))) throw FailedPredicateException(this, "!$attrs.count(\"hierarchical\")"); - setState(680); - match(ClickHouseParser::HIERARCHICAL); - _localctx->attrs.insert("hierarchical"); - break; - } - - case 4: { - setState(682); - - if (!(!_localctx->attrs.count("injective"))) throw FailedPredicateException(this, "!$attrs.count(\"injective\")"); - setState(683); - match(ClickHouseParser::INJECTIVE); - _localctx->attrs.insert("injective"); - break; - } - - case 5: { - setState(685); - - if (!(!_localctx->attrs.count("is_object_id"))) throw FailedPredicateException(this, "!$attrs.count(\"is_object_id\")"); - setState(686); - match(ClickHouseParser::IS_OBJECT_ID); - _localctx->attrs.insert("is_object_id"); - break; - } - - } - } - setState(692); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 74, _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(694); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 75, _ctx)) { - case 1: { - setState(693); - dictionaryPrimaryKeyClause(); - break; - } - - } - setState(718); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 77, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(716); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 76, _ctx)) { - case 1: { - setState(696); - - if (!(!_localctx->clauses.count("source"))) throw FailedPredicateException(this, "!$clauses.count(\"source\")"); - setState(697); - sourceClause(); - _localctx->clauses.insert("source"); - break; - } - - case 2: { - setState(700); - - if (!(!_localctx->clauses.count("lifetime"))) throw FailedPredicateException(this, "!$clauses.count(\"lifetime\")"); - setState(701); - lifetimeClause(); - _localctx->clauses.insert("lifetime"); - break; - } - - case 3: { - setState(704); - - if (!(!_localctx->clauses.count("layout"))) throw FailedPredicateException(this, "!$clauses.count(\"layout\")"); - setState(705); - layoutClause(); - _localctx->clauses.insert("layout"); - break; - } - - case 4: { - setState(708); - - if (!(!_localctx->clauses.count("range"))) throw FailedPredicateException(this, "!$clauses.count(\"range\")"); - setState(709); - rangeClause(); - _localctx->clauses.insert("range"); - break; - } - - case 5: { - setState(712); - - if (!(!_localctx->clauses.count("settings"))) throw FailedPredicateException(this, "!$clauses.count(\"settings\")"); - setState(713); - dictionarySettingsClause(); - _localctx->clauses.insert("settings"); - break; - } - - } - } - setState(720); - _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; -} - -//----------------- 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(721); - match(ClickHouseParser::PRIMARY); - setState(722); - match(ClickHouseParser::KEY); - setState(723); - 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(725); - identifier(); - setState(732); - _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::AST: - 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::MATERIALIZE: - 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(726); - identifier(); - setState(729); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::LPAREN) { - setState(727); - match(ClickHouseParser::LPAREN); - setState(728); - 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(731); - 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(734); - match(ClickHouseParser::SOURCE); - setState(735); - match(ClickHouseParser::LPAREN); - setState(736); - identifier(); - setState(737); - match(ClickHouseParser::LPAREN); - setState(741); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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(738); - dictionaryArgExpr(); - setState(743); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(744); - match(ClickHouseParser::RPAREN); - setState(745); - 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(747); - match(ClickHouseParser::LIFETIME); - setState(748); - match(ClickHouseParser::LPAREN); - setState(758); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::DECIMAL_LITERAL: { - setState(749); - match(ClickHouseParser::DECIMAL_LITERAL); - break; - } - - case ClickHouseParser::MIN: { - setState(750); - match(ClickHouseParser::MIN); - setState(751); - match(ClickHouseParser::DECIMAL_LITERAL); - setState(752); - match(ClickHouseParser::MAX); - setState(753); - match(ClickHouseParser::DECIMAL_LITERAL); - break; - } - - case ClickHouseParser::MAX: { - setState(754); - match(ClickHouseParser::MAX); - setState(755); - match(ClickHouseParser::DECIMAL_LITERAL); - setState(756); - match(ClickHouseParser::MIN); - setState(757); - match(ClickHouseParser::DECIMAL_LITERAL); - break; - } - - default: - throw NoViableAltException(this); - } - setState(760); - 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(762); - match(ClickHouseParser::LAYOUT); - setState(763); - match(ClickHouseParser::LPAREN); - setState(764); - identifier(); - setState(765); - match(ClickHouseParser::LPAREN); - setState(769); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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(766); - dictionaryArgExpr(); - setState(771); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(772); - match(ClickHouseParser::RPAREN); - setState(773); - 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(775); - match(ClickHouseParser::RANGE); - setState(776); - match(ClickHouseParser::LPAREN); - setState(787); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::MIN: { - setState(777); - match(ClickHouseParser::MIN); - setState(778); - identifier(); - setState(779); - match(ClickHouseParser::MAX); - setState(780); - identifier(); - break; - } - - case ClickHouseParser::MAX: { - setState(782); - match(ClickHouseParser::MAX); - setState(783); - identifier(); - setState(784); - match(ClickHouseParser::MIN); - setState(785); - identifier(); - break; - } - - default: - throw NoViableAltException(this); - } - setState(789); - 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(791); - match(ClickHouseParser::SETTINGS); - setState(792); - match(ClickHouseParser::LPAREN); - setState(793); - settingExprList(); - setState(794); - 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(796); - match(ClickHouseParser::ON); - setState(797); - match(ClickHouseParser::CLUSTER); - setState(800); - _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::AST: - 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::MATERIALIZE: - 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(798); - identifier(); - break; - } - - case ClickHouseParser::STRING_LITERAL: { - setState(799); - 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(802); - match(ClickHouseParser::UUID); - setState(803); - 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(805); - match(ClickHouseParser::TO); - setState(806); - 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(808); - match(ClickHouseParser::AS); - setState(809); - 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(826); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 86, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(811); - match(ClickHouseParser::LPAREN); - setState(812); - tableElementExpr(); - setState(817); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(813); - match(ClickHouseParser::COMMA); - setState(814); - tableElementExpr(); - setState(819); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(820); - match(ClickHouseParser::RPAREN); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(822); - match(ClickHouseParser::AS); - setState(823); - tableIdentifier(); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(824); - match(ClickHouseParser::AS); - setState(825); - 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(828); - engineExpr(); - setState(855); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 88, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(853); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 87, _ctx)) { - case 1: { - setState(829); - - if (!(!_localctx->clauses.count("orderByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"orderByClause\")"); - setState(830); - orderByClause(); - _localctx->clauses.insert("orderByClause"); - break; - } - - case 2: { - setState(833); - - if (!(!_localctx->clauses.count("partitionByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"partitionByClause\")"); - setState(834); - partitionByClause(); - _localctx->clauses.insert("partitionByClause"); - break; - } - - case 3: { - setState(837); - - if (!(!_localctx->clauses.count("primaryKeyClause"))) throw FailedPredicateException(this, "!$clauses.count(\"primaryKeyClause\")"); - setState(838); - primaryKeyClause(); - _localctx->clauses.insert("primaryKeyClause"); - break; - } - - case 4: { - setState(841); - - if (!(!_localctx->clauses.count("sampleByClause"))) throw FailedPredicateException(this, "!$clauses.count(\"sampleByClause\")"); - setState(842); - sampleByClause(); - _localctx->clauses.insert("sampleByClause"); - break; - } - - case 5: { - setState(845); - - if (!(!_localctx->clauses.count("ttlClause"))) throw FailedPredicateException(this, "!$clauses.count(\"ttlClause\")"); - setState(846); - ttlClause(); - _localctx->clauses.insert("ttlClause"); - break; - } - - case 6: { - setState(849); - - if (!(!_localctx->clauses.count("settingsClause"))) throw FailedPredicateException(this, "!$clauses.count(\"settingsClause\")"); - setState(850); - settingsClause(); - _localctx->clauses.insert("settingsClause"); - break; - } - - } - } - setState(857); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 88, _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(858); - match(ClickHouseParser::PARTITION); - setState(859); - match(ClickHouseParser::BY); - setState(860); - 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(862); - match(ClickHouseParser::PRIMARY); - setState(863); - match(ClickHouseParser::KEY); - setState(864); - 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(866); - match(ClickHouseParser::SAMPLE); - setState(867); - match(ClickHouseParser::BY); - setState(868); - 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(870); - match(ClickHouseParser::TTL); - setState(871); - ttlExpr(); - setState(876); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 89, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(872); - match(ClickHouseParser::COMMA); - setState(873); - ttlExpr(); - } - setState(878); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 89, _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(879); - match(ClickHouseParser::ENGINE); - setState(881); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::EQ_SINGLE) { - setState(880); - match(ClickHouseParser::EQ_SINGLE); - } - setState(883); - identifierOrNull(); - setState(889); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 92, _ctx)) { - case 1: { - setState(884); - match(ClickHouseParser::LPAREN); - setState(886); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(885); - columnExprList(); - } - setState(888); - 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); -} - -//----------------- TableElementExprProjectionContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::TableElementExprProjectionContext::PROJECTION() { - return getToken(ClickHouseParser::PROJECTION, 0); -} - -ClickHouseParser::TableProjectionDfntContext* ClickHouseParser::TableElementExprProjectionContext::tableProjectionDfnt() { - return getRuleContext(0); -} - -ClickHouseParser::TableElementExprProjectionContext::TableElementExprProjectionContext(TableElementExprContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::TableElementExprProjectionContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitTableElementExprProjection(this); - else - return visitor->visitChildren(this); -} -//----------------- 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(901); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 93, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(891); - tableColumnDfnt(); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(892); - match(ClickHouseParser::CONSTRAINT); - setState(893); - identifier(); - setState(894); - match(ClickHouseParser::CHECK); - setState(895); - columnExpr(0); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(897); - match(ClickHouseParser::INDEX); - setState(898); - tableIndexDfnt(); - break; - } - - case 4: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 4); - setState(899); - match(ClickHouseParser::PROJECTION); - setState(900); - tableProjectionDfnt(); - 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(935); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 102, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(903); - nestedIdentifier(); - setState(904); - columnTypeExpr(); - setState(906); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ALIAS - - || _la == ClickHouseParser::DEFAULT || _la == ClickHouseParser::MATERIALIZED) { - setState(905); - tableColumnPropertyExpr(); - } - setState(910); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::COMMENT) { - setState(908); - match(ClickHouseParser::COMMENT); - setState(909); - match(ClickHouseParser::STRING_LITERAL); - } - setState(913); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::CODEC) { - setState(912); - codecExpr(); - } - setState(917); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TTL) { - setState(915); - match(ClickHouseParser::TTL); - setState(916); - columnExpr(0); - } - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(919); - nestedIdentifier(); - setState(921); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 98, _ctx)) { - case 1: { - setState(920); - columnTypeExpr(); - break; - } - - } - setState(923); - tableColumnPropertyExpr(); - setState(926); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::COMMENT) { - setState(924); - match(ClickHouseParser::COMMENT); - setState(925); - match(ClickHouseParser::STRING_LITERAL); - } - setState(929); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::CODEC) { - setState(928); - codecExpr(); - } - setState(933); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TTL) { - setState(931); - match(ClickHouseParser::TTL); - setState(932); - 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(937); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ALIAS - - || _la == ClickHouseParser::DEFAULT || _la == ClickHouseParser::MATERIALIZED)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(938); - 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(940); - nestedIdentifier(); - setState(941); - columnExpr(0); - setState(942); - match(ClickHouseParser::TYPE); - setState(943); - columnTypeExpr(); - setState(944); - match(ClickHouseParser::GRANULARITY); - setState(945); - match(ClickHouseParser::DECIMAL_LITERAL); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- TableProjectionDfntContext ------------------------------------------------------------------ - -ClickHouseParser::TableProjectionDfntContext::TableProjectionDfntContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -ClickHouseParser::NestedIdentifierContext* ClickHouseParser::TableProjectionDfntContext::nestedIdentifier() { - return getRuleContext(0); -} - -ClickHouseParser::ProjectionSelectStmtContext* ClickHouseParser::TableProjectionDfntContext::projectionSelectStmt() { - return getRuleContext(0); -} - - -size_t ClickHouseParser::TableProjectionDfntContext::getRuleIndex() const { - return ClickHouseParser::RuleTableProjectionDfnt; -} - -antlrcpp::Any ClickHouseParser::TableProjectionDfntContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitTableProjectionDfnt(this); - else - return visitor->visitChildren(this); -} - -ClickHouseParser::TableProjectionDfntContext* ClickHouseParser::tableProjectionDfnt() { - TableProjectionDfntContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 72, ClickHouseParser::RuleTableProjectionDfnt); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(947); - nestedIdentifier(); - setState(948); - projectionSelectStmt(); - - } - 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, 74, ClickHouseParser::RuleCodecExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(950); - match(ClickHouseParser::CODEC); - setState(951); - match(ClickHouseParser::LPAREN); - setState(952); - codecArgExpr(); - setState(957); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(953); - match(ClickHouseParser::COMMA); - setState(954); - codecArgExpr(); - setState(959); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(960); - 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, 76, ClickHouseParser::RuleCodecArgExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(962); - identifier(); - setState(968); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::LPAREN) { - setState(963); - match(ClickHouseParser::LPAREN); - setState(965); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(964); - columnExprList(); - } - setState(967); - 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, 78, ClickHouseParser::RuleTtlExpr); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(970); - columnExpr(0); - setState(978); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 106, _ctx)) { - case 1: { - setState(971); - match(ClickHouseParser::DELETE); - break; - } - - case 2: { - setState(972); - match(ClickHouseParser::TO); - setState(973); - match(ClickHouseParser::DISK); - setState(974); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 3: { - setState(975); - match(ClickHouseParser::TO); - setState(976); - match(ClickHouseParser::VOLUME); - setState(977); - 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, 80, ClickHouseParser::RuleDescribeStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(980); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::DESC - - || _la == ClickHouseParser::DESCRIBE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(982); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 107, _ctx)) { - case 1: { - setState(981); - match(ClickHouseParser::TABLE); - break; - } - - } - setState(984); - 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::VIEW() { - return getToken(ClickHouseParser::VIEW, 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, 82, ClickHouseParser::RuleDropStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1017); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 115, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(986); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::DETACH - - || _la == ClickHouseParser::DROP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(987); - match(ClickHouseParser::DATABASE); - setState(990); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 108, _ctx)) { - case 1: { - setState(988); - match(ClickHouseParser::IF); - setState(989); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(992); - databaseIdentifier(); - setState(994); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(993); - clusterClause(); - } - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(996); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::DETACH - - || _la == ClickHouseParser::DROP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1003); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::DICTIONARY: { - setState(997); - match(ClickHouseParser::DICTIONARY); - break; - } - - case ClickHouseParser::TABLE: - case ClickHouseParser::TEMPORARY: { - setState(999); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TEMPORARY) { - setState(998); - match(ClickHouseParser::TEMPORARY); - } - setState(1001); - match(ClickHouseParser::TABLE); - break; - } - - case ClickHouseParser::VIEW: { - setState(1002); - match(ClickHouseParser::VIEW); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1007); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 112, _ctx)) { - case 1: { - setState(1005); - match(ClickHouseParser::IF); - setState(1006); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(1009); - tableIdentifier(); - setState(1011); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(1010); - clusterClause(); - } - setState(1015); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::NO) { - setState(1013); - match(ClickHouseParser::NO); - setState(1014); - 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) { -} - - -size_t ClickHouseParser::ExistsStmtContext::getRuleIndex() const { - return ClickHouseParser::RuleExistsStmt; -} - -void ClickHouseParser::ExistsStmtContext::copyFrom(ExistsStmtContext *ctx) { - ParserRuleContext::copyFrom(ctx); -} - -//----------------- ExistsTableStmtContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::ExistsTableStmtContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -ClickHouseParser::TableIdentifierContext* ClickHouseParser::ExistsTableStmtContext::tableIdentifier() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::ExistsTableStmtContext::DICTIONARY() { - return getToken(ClickHouseParser::DICTIONARY, 0); -} - -tree::TerminalNode* ClickHouseParser::ExistsTableStmtContext::TABLE() { - return getToken(ClickHouseParser::TABLE, 0); -} - -tree::TerminalNode* ClickHouseParser::ExistsTableStmtContext::VIEW() { - return getToken(ClickHouseParser::VIEW, 0); -} - -tree::TerminalNode* ClickHouseParser::ExistsTableStmtContext::TEMPORARY() { - return getToken(ClickHouseParser::TEMPORARY, 0); -} - -ClickHouseParser::ExistsTableStmtContext::ExistsTableStmtContext(ExistsStmtContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::ExistsTableStmtContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitExistsTableStmt(this); - else - return visitor->visitChildren(this); -} -//----------------- ExistsDatabaseStmtContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::ExistsDatabaseStmtContext::EXISTS() { - return getToken(ClickHouseParser::EXISTS, 0); -} - -tree::TerminalNode* ClickHouseParser::ExistsDatabaseStmtContext::DATABASE() { - return getToken(ClickHouseParser::DATABASE, 0); -} - -ClickHouseParser::DatabaseIdentifierContext* ClickHouseParser::ExistsDatabaseStmtContext::databaseIdentifier() { - return getRuleContext(0); -} - -ClickHouseParser::ExistsDatabaseStmtContext::ExistsDatabaseStmtContext(ExistsStmtContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::ExistsDatabaseStmtContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitExistsDatabaseStmt(this); - else - return visitor->visitChildren(this); -} -ClickHouseParser::ExistsStmtContext* ClickHouseParser::existsStmt() { - ExistsStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 84, ClickHouseParser::RuleExistsStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1032); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 118, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1019); - match(ClickHouseParser::EXISTS); - setState(1020); - match(ClickHouseParser::DATABASE); - setState(1021); - databaseIdentifier(); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1022); - match(ClickHouseParser::EXISTS); - setState(1029); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 117, _ctx)) { - case 1: { - setState(1023); - match(ClickHouseParser::DICTIONARY); - break; - } - - case 2: { - setState(1025); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TEMPORARY) { - setState(1024); - match(ClickHouseParser::TEMPORARY); - } - setState(1027); - match(ClickHouseParser::TABLE); - break; - } - - case 3: { - setState(1028); - match(ClickHouseParser::VIEW); - break; - } - - } - setState(1031); - tableIdentifier(); - break; - } - - } - - } - 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) { -} - - -size_t ClickHouseParser::ExplainStmtContext::getRuleIndex() const { - return ClickHouseParser::RuleExplainStmt; -} - -void ClickHouseParser::ExplainStmtContext::copyFrom(ExplainStmtContext *ctx) { - ParserRuleContext::copyFrom(ctx); -} - -//----------------- ExplainSyntaxStmtContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::ExplainSyntaxStmtContext::EXPLAIN() { - return getToken(ClickHouseParser::EXPLAIN, 0); -} - -tree::TerminalNode* ClickHouseParser::ExplainSyntaxStmtContext::SYNTAX() { - return getToken(ClickHouseParser::SYNTAX, 0); -} - -ClickHouseParser::QueryContext* ClickHouseParser::ExplainSyntaxStmtContext::query() { - return getRuleContext(0); -} - -ClickHouseParser::ExplainSyntaxStmtContext::ExplainSyntaxStmtContext(ExplainStmtContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::ExplainSyntaxStmtContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitExplainSyntaxStmt(this); - else - return visitor->visitChildren(this); -} -//----------------- ExplainASTStmtContext ------------------------------------------------------------------ - -tree::TerminalNode* ClickHouseParser::ExplainASTStmtContext::EXPLAIN() { - return getToken(ClickHouseParser::EXPLAIN, 0); -} - -tree::TerminalNode* ClickHouseParser::ExplainASTStmtContext::AST() { - return getToken(ClickHouseParser::AST, 0); -} - -ClickHouseParser::QueryContext* ClickHouseParser::ExplainASTStmtContext::query() { - return getRuleContext(0); -} - -ClickHouseParser::ExplainASTStmtContext::ExplainASTStmtContext(ExplainStmtContext *ctx) { copyFrom(ctx); } - -antlrcpp::Any ClickHouseParser::ExplainASTStmtContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitExplainASTStmt(this); - else - return visitor->visitChildren(this); -} -ClickHouseParser::ExplainStmtContext* ClickHouseParser::explainStmt() { - ExplainStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 86, ClickHouseParser::RuleExplainStmt); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1040); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 119, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1034); - match(ClickHouseParser::EXPLAIN); - setState(1035); - match(ClickHouseParser::AST); - setState(1036); - query(); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1037); - match(ClickHouseParser::EXPLAIN); - setState(1038); - match(ClickHouseParser::SYNTAX); - setState(1039); - query(); - break; - } - - } - - } - 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, 88, ClickHouseParser::RuleInsertStmt); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1042); - match(ClickHouseParser::INSERT); - setState(1043); - match(ClickHouseParser::INTO); - setState(1045); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 120, _ctx)) { - case 1: { - setState(1044); - match(ClickHouseParser::TABLE); - break; - } - - } - setState(1050); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 121, _ctx)) { - case 1: { - setState(1047); - tableIdentifier(); - break; - } - - case 2: { - setState(1048); - match(ClickHouseParser::FUNCTION); - setState(1049); - tableFunctionExpr(); - break; - } - - } - setState(1053); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 122, _ctx)) { - case 1: { - setState(1052); - columnsClause(); - break; - } - - } - setState(1055); - 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, 90, ClickHouseParser::RuleColumnsClause); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1057); - match(ClickHouseParser::LPAREN); - setState(1058); - nestedIdentifier(); - setState(1063); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1059); - match(ClickHouseParser::COMMA); - setState(1060); - nestedIdentifier(); - setState(1065); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1066); - 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, 92, ClickHouseParser::RuleDataClause); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1077); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::FORMAT: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1068); - match(ClickHouseParser::FORMAT); - setState(1069); - identifier(); - break; - } - - case ClickHouseParser::VALUES: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1070); - match(ClickHouseParser::VALUES); - break; - } - - case ClickHouseParser::SELECT: - case ClickHouseParser::WITH: - case ClickHouseParser::LPAREN: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(1071); - selectUnionStmt(); - setState(1073); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::SEMICOLON) { - setState(1072); - match(ClickHouseParser::SEMICOLON); - } - setState(1075); - 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, 94, ClickHouseParser::RuleKillStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1079); - match(ClickHouseParser::KILL); - setState(1080); - match(ClickHouseParser::MUTATION); - setState(1082); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(1081); - clusterClause(); - } - setState(1084); - whereClause(); - setState(1086); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ASYNC || _la == ClickHouseParser::SYNC - - || _la == ClickHouseParser::TEST) { - setState(1085); - _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, 96, ClickHouseParser::RuleOptimizeStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1088); - match(ClickHouseParser::OPTIMIZE); - setState(1089); - match(ClickHouseParser::TABLE); - setState(1090); - tableIdentifier(); - setState(1092); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(1091); - clusterClause(); - } - setState(1095); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::PARTITION) { - setState(1094); - partitionClause(); - } - setState(1098); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FINAL) { - setState(1097); - match(ClickHouseParser::FINAL); - } - setState(1101); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::DEDUPLICATE) { - setState(1100); - 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, 98, ClickHouseParser::RuleRenameStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1103); - match(ClickHouseParser::RENAME); - setState(1104); - match(ClickHouseParser::TABLE); - setState(1105); - tableIdentifier(); - setState(1106); - match(ClickHouseParser::TO); - setState(1107); - tableIdentifier(); - setState(1115); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1108); - match(ClickHouseParser::COMMA); - setState(1109); - tableIdentifier(); - setState(1110); - match(ClickHouseParser::TO); - setState(1111); - tableIdentifier(); - setState(1117); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1119); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(1118); - clusterClause(); - } - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ProjectionSelectStmtContext ------------------------------------------------------------------ - -ClickHouseParser::ProjectionSelectStmtContext::ProjectionSelectStmtContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* ClickHouseParser::ProjectionSelectStmtContext::LPAREN() { - return getToken(ClickHouseParser::LPAREN, 0); -} - -tree::TerminalNode* ClickHouseParser::ProjectionSelectStmtContext::SELECT() { - return getToken(ClickHouseParser::SELECT, 0); -} - -ClickHouseParser::ColumnExprListContext* ClickHouseParser::ProjectionSelectStmtContext::columnExprList() { - return getRuleContext(0); -} - -tree::TerminalNode* ClickHouseParser::ProjectionSelectStmtContext::RPAREN() { - return getToken(ClickHouseParser::RPAREN, 0); -} - -ClickHouseParser::WithClauseContext* ClickHouseParser::ProjectionSelectStmtContext::withClause() { - return getRuleContext(0); -} - -ClickHouseParser::GroupByClauseContext* ClickHouseParser::ProjectionSelectStmtContext::groupByClause() { - return getRuleContext(0); -} - -ClickHouseParser::ProjectionOrderByClauseContext* ClickHouseParser::ProjectionSelectStmtContext::projectionOrderByClause() { - return getRuleContext(0); -} - - -size_t ClickHouseParser::ProjectionSelectStmtContext::getRuleIndex() const { - return ClickHouseParser::RuleProjectionSelectStmt; -} - -antlrcpp::Any ClickHouseParser::ProjectionSelectStmtContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitProjectionSelectStmt(this); - else - return visitor->visitChildren(this); -} - -ClickHouseParser::ProjectionSelectStmtContext* ClickHouseParser::projectionSelectStmt() { - ProjectionSelectStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 100, ClickHouseParser::RuleProjectionSelectStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1121); - match(ClickHouseParser::LPAREN); - setState(1123); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WITH) { - setState(1122); - withClause(); - } - setState(1125); - match(ClickHouseParser::SELECT); - setState(1126); - columnExprList(); - setState(1128); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::GROUP) { - setState(1127); - groupByClause(); - } - setState(1131); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ORDER) { - setState(1130); - projectionOrderByClause(); - } - setState(1133); - match(ClickHouseParser::RPAREN); - - } - 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, 102, ClickHouseParser::RuleSelectUnionStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1135); - selectStmtWithParens(); - setState(1141); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::UNION) { - setState(1136); - match(ClickHouseParser::UNION); - setState(1137); - match(ClickHouseParser::ALL); - setState(1138); - selectStmtWithParens(); - setState(1143); - _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, 104, ClickHouseParser::RuleSelectStmtWithParens); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1149); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::SELECT: - case ClickHouseParser::WITH: { - enterOuterAlt(_localctx, 1); - setState(1144); - selectStmt(); - break; - } - - case ClickHouseParser::LPAREN: { - enterOuterAlt(_localctx, 2); - setState(1145); - match(ClickHouseParser::LPAREN); - setState(1146); - selectUnionStmt(); - setState(1147); - 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, 106, ClickHouseParser::RuleSelectStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1152); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WITH) { - setState(1151); - withClause(); - } - setState(1154); - match(ClickHouseParser::SELECT); - setState(1156); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 140, _ctx)) { - case 1: { - setState(1155); - match(ClickHouseParser::DISTINCT); - break; - } - - } - setState(1159); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 141, _ctx)) { - case 1: { - setState(1158); - topClause(); - break; - } - - } - setState(1161); - columnExprList(); - setState(1163); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FROM) { - setState(1162); - fromClause(); - } - setState(1166); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ARRAY || _la == ClickHouseParser::INNER - - || _la == ClickHouseParser::LEFT) { - setState(1165); - arrayJoinClause(); - } - setState(1169); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::PREWHERE) { - setState(1168); - prewhereClause(); - } - setState(1172); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WHERE) { - setState(1171); - whereClause(); - } - setState(1175); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::GROUP) { - setState(1174); - groupByClause(); - } - setState(1179); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 147, _ctx)) { - case 1: { - setState(1177); - match(ClickHouseParser::WITH); - setState(1178); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::CUBE || _la == ClickHouseParser::ROLLUP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - break; - } - - } - setState(1183); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WITH) { - setState(1181); - match(ClickHouseParser::WITH); - setState(1182); - match(ClickHouseParser::TOTALS); - } - setState(1186); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::HAVING) { - setState(1185); - havingClause(); - } - setState(1189); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ORDER) { - setState(1188); - orderByClause(); - } - setState(1192); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 151, _ctx)) { - case 1: { - setState(1191); - limitByClause(); - break; - } - - } - setState(1195); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::LIMIT) { - setState(1194); - limitClause(); - } - setState(1198); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::SETTINGS) { - setState(1197); - 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, 108, ClickHouseParser::RuleWithClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1200); - match(ClickHouseParser::WITH); - setState(1201); - 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, 110, ClickHouseParser::RuleTopClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1203); - match(ClickHouseParser::TOP); - setState(1204); - match(ClickHouseParser::DECIMAL_LITERAL); - setState(1207); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 154, _ctx)) { - case 1: { - setState(1205); - match(ClickHouseParser::WITH); - setState(1206); - 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, 112, ClickHouseParser::RuleFromClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1209); - match(ClickHouseParser::FROM); - setState(1210); - 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, 114, ClickHouseParser::RuleArrayJoinClause); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1213); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::INNER - - || _la == ClickHouseParser::LEFT) { - setState(1212); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::INNER - - || _la == ClickHouseParser::LEFT)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - setState(1215); - match(ClickHouseParser::ARRAY); - setState(1216); - match(ClickHouseParser::JOIN); - setState(1217); - 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, 116, ClickHouseParser::RulePrewhereClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1219); - match(ClickHouseParser::PREWHERE); - setState(1220); - 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, 118, ClickHouseParser::RuleWhereClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1222); - match(ClickHouseParser::WHERE); - setState(1223); - 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, 120, ClickHouseParser::RuleGroupByClause); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1225); - match(ClickHouseParser::GROUP); - setState(1226); - match(ClickHouseParser::BY); - setState(1233); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 156, _ctx)) { - case 1: { - setState(1227); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::CUBE || _la == ClickHouseParser::ROLLUP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1228); - match(ClickHouseParser::LPAREN); - setState(1229); - columnExprList(); - setState(1230); - match(ClickHouseParser::RPAREN); - break; - } - - case 2: { - setState(1232); - 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, 122, ClickHouseParser::RuleHavingClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1235); - match(ClickHouseParser::HAVING); - setState(1236); - 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, 124, ClickHouseParser::RuleOrderByClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1238); - match(ClickHouseParser::ORDER); - setState(1239); - match(ClickHouseParser::BY); - setState(1240); - orderExprList(); - - } - catch (RecognitionException &e) { - _errHandler->reportError(this, e); - _localctx->exception = std::current_exception(); - _errHandler->recover(this, _localctx->exception); - } - - return _localctx; -} - -//----------------- ProjectionOrderByClauseContext ------------------------------------------------------------------ - -ClickHouseParser::ProjectionOrderByClauseContext::ProjectionOrderByClauseContext(ParserRuleContext *parent, size_t invokingState) - : ParserRuleContext(parent, invokingState) { -} - -tree::TerminalNode* ClickHouseParser::ProjectionOrderByClauseContext::ORDER() { - return getToken(ClickHouseParser::ORDER, 0); -} - -tree::TerminalNode* ClickHouseParser::ProjectionOrderByClauseContext::BY() { - return getToken(ClickHouseParser::BY, 0); -} - -ClickHouseParser::ColumnExprListContext* ClickHouseParser::ProjectionOrderByClauseContext::columnExprList() { - return getRuleContext(0); -} - - -size_t ClickHouseParser::ProjectionOrderByClauseContext::getRuleIndex() const { - return ClickHouseParser::RuleProjectionOrderByClause; -} - -antlrcpp::Any ClickHouseParser::ProjectionOrderByClauseContext::accept(tree::ParseTreeVisitor *visitor) { - if (auto parserVisitor = dynamic_cast(visitor)) - return parserVisitor->visitProjectionOrderByClause(this); - else - return visitor->visitChildren(this); -} - -ClickHouseParser::ProjectionOrderByClauseContext* ClickHouseParser::projectionOrderByClause() { - ProjectionOrderByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 126, ClickHouseParser::RuleProjectionOrderByClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1242); - match(ClickHouseParser::ORDER); - setState(1243); - match(ClickHouseParser::BY); - setState(1244); - columnExprList(); - - } - 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, 128, ClickHouseParser::RuleLimitByClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1246); - match(ClickHouseParser::LIMIT); - setState(1247); - limitExpr(); - setState(1248); - match(ClickHouseParser::BY); - setState(1249); - 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, 130, ClickHouseParser::RuleLimitClause); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1251); - match(ClickHouseParser::LIMIT); - setState(1252); - limitExpr(); - setState(1255); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::WITH) { - setState(1253); - match(ClickHouseParser::WITH); - setState(1254); - 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, 132, ClickHouseParser::RuleSettingsClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1257); - match(ClickHouseParser::SETTINGS); - setState(1258); - 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 = 134; - enterRecursionRule(_localctx, 134, ClickHouseParser::RuleJoinExpr, precedence); - - size_t _la = 0; - - auto onExit = finally([=] { - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1272); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 160, _ctx)) { - case 1: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - - setState(1261); - tableExpr(0); - setState(1263); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 158, _ctx)) { - case 1: { - setState(1262); - match(ClickHouseParser::FINAL); - break; - } - - } - setState(1266); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 159, _ctx)) { - case 1: { - setState(1265); - sampleClause(); - break; - } - - } - break; - } - - case 2: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1268); - match(ClickHouseParser::LPAREN); - setState(1269); - joinExpr(0); - setState(1270); - match(ClickHouseParser::RPAREN); - break; - } - - } - _ctx->stop = _input->LT(-1); - setState(1291); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 164, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - setState(1289); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 163, _ctx)) { - case 1: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleJoinExpr); - setState(1274); - - if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)"); - setState(1275); - joinOpCross(); - setState(1276); - joinExpr(4); - break; - } - - case 2: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleJoinExpr); - setState(1278); - - if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); - setState(1280); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::GLOBAL - - || _la == ClickHouseParser::LOCAL) { - setState(1279); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::GLOBAL - - || _la == ClickHouseParser::LOCAL)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - setState(1283); - _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 - 81) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 81)) & ((1ULL << (ClickHouseParser::INNER - 81)) - | (1ULL << (ClickHouseParser::LEFT - 81)) - | (1ULL << (ClickHouseParser::RIGHT - 81)) - | (1ULL << (ClickHouseParser::SEMI - 81)))) != 0)) { - setState(1282); - joinOp(); - } - setState(1285); - match(ClickHouseParser::JOIN); - setState(1286); - joinExpr(0); - setState(1287); - joinConstraintClause(); - break; - } - - } - } - setState(1293); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 164, _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, 136, ClickHouseParser::RuleJoinOp); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1337); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 178, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1303); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 167, _ctx)) { - case 1: { - setState(1295); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) - | (1ULL << ClickHouseParser::ANY) - | (1ULL << ClickHouseParser::ASOF))) != 0)) { - setState(1294); - _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(1297); - match(ClickHouseParser::INNER); - break; - } - - case 2: { - setState(1298); - match(ClickHouseParser::INNER); - setState(1300); - _errHandler->sync(this); - - _la = _input->LA(1); - if ((((_la & ~ 0x3fULL) == 0) && - ((1ULL << _la) & ((1ULL << ClickHouseParser::ALL) - | (1ULL << ClickHouseParser::ANY) - | (1ULL << ClickHouseParser::ASOF))) != 0)) { - setState(1299); - _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(1302); - _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(1319); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 172, _ctx)) { - case 1: { - setState(1306); - _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(1305); - _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(1308); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::LEFT - - || _la == ClickHouseParser::RIGHT)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1310); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OUTER) { - setState(1309); - match(ClickHouseParser::OUTER); - } - break; - } - - case 2: { - setState(1312); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::LEFT - - || _la == ClickHouseParser::RIGHT)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1314); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OUTER) { - setState(1313); - match(ClickHouseParser::OUTER); - } - setState(1317); - _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(1316); - _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(1335); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 177, _ctx)) { - case 1: { - setState(1322); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ALL - - || _la == ClickHouseParser::ANY) { - setState(1321); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ALL - - || _la == ClickHouseParser::ANY)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - setState(1324); - match(ClickHouseParser::FULL); - setState(1326); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OUTER) { - setState(1325); - match(ClickHouseParser::OUTER); - } - break; - } - - case 2: { - setState(1328); - match(ClickHouseParser::FULL); - setState(1330); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OUTER) { - setState(1329); - match(ClickHouseParser::OUTER); - } - setState(1333); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ALL - - || _la == ClickHouseParser::ANY) { - setState(1332); - _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, 138, ClickHouseParser::RuleJoinOpCross); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1345); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::CROSS: - case ClickHouseParser::GLOBAL: - case ClickHouseParser::LOCAL: { - enterOuterAlt(_localctx, 1); - setState(1340); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::GLOBAL - - || _la == ClickHouseParser::LOCAL) { - setState(1339); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::GLOBAL - - || _la == ClickHouseParser::LOCAL)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - setState(1342); - match(ClickHouseParser::CROSS); - setState(1343); - match(ClickHouseParser::JOIN); - break; - } - - case ClickHouseParser::COMMA: { - enterOuterAlt(_localctx, 2); - setState(1344); - 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, 140, ClickHouseParser::RuleJoinConstraintClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1356); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 181, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1347); - match(ClickHouseParser::ON); - setState(1348); - columnExprList(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1349); - match(ClickHouseParser::USING); - setState(1350); - match(ClickHouseParser::LPAREN); - setState(1351); - columnExprList(); - setState(1352); - match(ClickHouseParser::RPAREN); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1354); - match(ClickHouseParser::USING); - setState(1355); - 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, 142, ClickHouseParser::RuleSampleClause); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1358); - match(ClickHouseParser::SAMPLE); - setState(1359); - ratioExpr(); - setState(1362); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 182, _ctx)) { - case 1: { - setState(1360); - match(ClickHouseParser::OFFSET); - setState(1361); - 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, 144, ClickHouseParser::RuleLimitExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1364); - columnExpr(0); - setState(1367); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::OFFSET || _la == ClickHouseParser::COMMA) { - setState(1365); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::OFFSET || _la == ClickHouseParser::COMMA)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1366); - 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, 146, ClickHouseParser::RuleOrderExprList); - - auto onExit = finally([=] { - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1369); - orderExpr(); - setState(1374); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 184, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1370); - match(ClickHouseParser::COMMA); - setState(1371); - orderExpr(); - } - setState(1376); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 184, _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, 148, ClickHouseParser::RuleOrderExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1377); - columnExpr(0); - setState(1379); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 185, _ctx)) { - case 1: { - setState(1378); - _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(1383); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 186, _ctx)) { - case 1: { - setState(1381); - match(ClickHouseParser::NULLS); - setState(1382); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::FIRST - - || _la == ClickHouseParser::LAST)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - break; - } - - } - setState(1387); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 187, _ctx)) { - case 1: { - setState(1385); - match(ClickHouseParser::COLLATE); - setState(1386); - 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, 150, ClickHouseParser::RuleRatioExpr); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1389); - numberLiteral(); - setState(1392); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 188, _ctx)) { - case 1: { - setState(1390); - match(ClickHouseParser::SLASH); - setState(1391); - 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, 152, ClickHouseParser::RuleSettingExprList); - - auto onExit = finally([=] { - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1394); - settingExpr(); - setState(1399); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 189, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1395); - match(ClickHouseParser::COMMA); - setState(1396); - settingExpr(); - } - setState(1401); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 189, _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, 154, ClickHouseParser::RuleSettingExpr); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1402); - identifier(); - setState(1403); - match(ClickHouseParser::EQ_SINGLE); - setState(1404); - 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, 156, ClickHouseParser::RuleSetStmt); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1406); - match(ClickHouseParser::SET); - setState(1407); - 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, 158, ClickHouseParser::RuleShowStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1451); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 197, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1409); - match(ClickHouseParser::SHOW); - setState(1410); - match(ClickHouseParser::CREATE); - setState(1411); - match(ClickHouseParser::DATABASE); - setState(1412); - databaseIdentifier(); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1413); - match(ClickHouseParser::SHOW); - setState(1414); - match(ClickHouseParser::CREATE); - setState(1415); - match(ClickHouseParser::DICTIONARY); - setState(1416); - tableIdentifier(); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(1417); - match(ClickHouseParser::SHOW); - setState(1418); - match(ClickHouseParser::CREATE); - setState(1420); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 190, _ctx)) { - case 1: { - setState(1419); - match(ClickHouseParser::TEMPORARY); - break; - } - - } - setState(1423); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 191, _ctx)) { - case 1: { - setState(1422); - match(ClickHouseParser::TABLE); - break; - } - - } - setState(1425); - tableIdentifier(); - break; - } - - case 4: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 4); - setState(1426); - match(ClickHouseParser::SHOW); - setState(1427); - match(ClickHouseParser::DATABASES); - break; - } - - case 5: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 5); - setState(1428); - match(ClickHouseParser::SHOW); - setState(1429); - match(ClickHouseParser::DICTIONARIES); - setState(1432); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FROM) { - setState(1430); - match(ClickHouseParser::FROM); - setState(1431); - databaseIdentifier(); - } - break; - } - - case 6: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 6); - setState(1434); - match(ClickHouseParser::SHOW); - setState(1436); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TEMPORARY) { - setState(1435); - match(ClickHouseParser::TEMPORARY); - } - setState(1438); - match(ClickHouseParser::TABLES); - setState(1441); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FROM - - || _la == ClickHouseParser::IN) { - setState(1439); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::FROM - - || _la == ClickHouseParser::IN)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1440); - databaseIdentifier(); - } - setState(1446); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::LIKE: { - setState(1443); - match(ClickHouseParser::LIKE); - setState(1444); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case ClickHouseParser::WHERE: { - setState(1445); - whereClause(); - break; - } - - case ClickHouseParser::EOF: - case ClickHouseParser::FORMAT: - case ClickHouseParser::INTO: - case ClickHouseParser::LIMIT: - case ClickHouseParser::SEMICOLON: { - break; - } - - default: - break; - } - setState(1449); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::LIMIT) { - setState(1448); - 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, 160, ClickHouseParser::RuleSystemStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1487); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 200, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1453); - match(ClickHouseParser::SYSTEM); - setState(1454); - match(ClickHouseParser::FLUSH); - setState(1455); - match(ClickHouseParser::DISTRIBUTED); - setState(1456); - tableIdentifier(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1457); - match(ClickHouseParser::SYSTEM); - setState(1458); - match(ClickHouseParser::FLUSH); - setState(1459); - match(ClickHouseParser::LOGS); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1460); - match(ClickHouseParser::SYSTEM); - setState(1461); - match(ClickHouseParser::RELOAD); - setState(1462); - match(ClickHouseParser::DICTIONARIES); - break; - } - - case 4: { - enterOuterAlt(_localctx, 4); - setState(1463); - match(ClickHouseParser::SYSTEM); - setState(1464); - match(ClickHouseParser::RELOAD); - setState(1465); - match(ClickHouseParser::DICTIONARY); - setState(1466); - tableIdentifier(); - break; - } - - case 5: { - enterOuterAlt(_localctx, 5); - setState(1467); - match(ClickHouseParser::SYSTEM); - setState(1468); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::START - - || _la == ClickHouseParser::STOP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1476); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::DISTRIBUTED: { - setState(1469); - match(ClickHouseParser::DISTRIBUTED); - setState(1470); - match(ClickHouseParser::SENDS); - break; - } - - case ClickHouseParser::FETCHES: { - setState(1471); - match(ClickHouseParser::FETCHES); - break; - } - - case ClickHouseParser::MERGES: - case ClickHouseParser::TTL: { - setState(1473); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::TTL) { - setState(1472); - match(ClickHouseParser::TTL); - } - setState(1475); - match(ClickHouseParser::MERGES); - break; - } - - default: - throw NoViableAltException(this); - } - setState(1478); - tableIdentifier(); - break; - } - - case 6: { - enterOuterAlt(_localctx, 6); - setState(1479); - match(ClickHouseParser::SYSTEM); - setState(1480); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::START - - || _la == ClickHouseParser::STOP)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1481); - match(ClickHouseParser::REPLICATED); - setState(1482); - match(ClickHouseParser::SENDS); - break; - } - - case 7: { - enterOuterAlt(_localctx, 7); - setState(1483); - match(ClickHouseParser::SYSTEM); - setState(1484); - match(ClickHouseParser::SYNC); - setState(1485); - match(ClickHouseParser::REPLICA); - setState(1486); - 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, 162, ClickHouseParser::RuleTruncateStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1489); - match(ClickHouseParser::TRUNCATE); - setState(1491); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 201, _ctx)) { - case 1: { - setState(1490); - match(ClickHouseParser::TEMPORARY); - break; - } - - } - setState(1494); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 202, _ctx)) { - case 1: { - setState(1493); - match(ClickHouseParser::TABLE); - break; - } - - } - setState(1498); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 203, _ctx)) { - case 1: { - setState(1496); - match(ClickHouseParser::IF); - setState(1497); - match(ClickHouseParser::EXISTS); - break; - } - - } - setState(1500); - tableIdentifier(); - setState(1502); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ON) { - setState(1501); - 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, 164, ClickHouseParser::RuleUseStmt); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1504); - match(ClickHouseParser::USE); - setState(1505); - 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, 166, ClickHouseParser::RuleWatchStmt); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1507); - match(ClickHouseParser::WATCH); - setState(1508); - tableIdentifier(); - setState(1510); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::EVENTS) { - setState(1509); - match(ClickHouseParser::EVENTS); - } - setState(1514); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::LIMIT) { - setState(1512); - match(ClickHouseParser::LIMIT); - setState(1513); - 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, 168, ClickHouseParser::RuleColumnTypeExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1563); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 211, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1516); - identifier(); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1517); - identifier(); - setState(1518); - match(ClickHouseParser::LPAREN); - setState(1519); - identifier(); - setState(1520); - columnTypeExpr(); - setState(1527); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1521); - match(ClickHouseParser::COMMA); - setState(1522); - identifier(); - setState(1523); - columnTypeExpr(); - setState(1529); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1530); - match(ClickHouseParser::RPAREN); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(1532); - identifier(); - setState(1533); - match(ClickHouseParser::LPAREN); - setState(1534); - enumValue(); - setState(1539); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1535); - match(ClickHouseParser::COMMA); - setState(1536); - enumValue(); - setState(1541); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1542); - match(ClickHouseParser::RPAREN); - break; - } - - case 4: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 4); - setState(1544); - identifier(); - setState(1545); - match(ClickHouseParser::LPAREN); - setState(1546); - columnTypeExpr(); - setState(1551); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1547); - match(ClickHouseParser::COMMA); - setState(1548); - columnTypeExpr(); - setState(1553); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1554); - match(ClickHouseParser::RPAREN); - break; - } - - case 5: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 5); - setState(1556); - identifier(); - setState(1557); - match(ClickHouseParser::LPAREN); - setState(1559); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(1558); - columnExprList(); - } - setState(1561); - 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, 170, ClickHouseParser::RuleColumnExprList); - - auto onExit = finally([=] { - exitRule(); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1565); - columnsExpr(); - setState(1570); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 212, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - setState(1566); - match(ClickHouseParser::COMMA); - setState(1567); - columnsExpr(); - } - setState(1572); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 212, _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, 172, ClickHouseParser::RuleColumnsExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1584); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 214, _ctx)) { - case 1: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 1); - setState(1576); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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(1573); - tableIdentifier(); - setState(1574); - match(ClickHouseParser::DOT); - } - setState(1578); - match(ClickHouseParser::ASTERISK); - break; - } - - case 2: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 2); - setState(1579); - match(ClickHouseParser::LPAREN); - setState(1580); - selectUnionStmt(); - setState(1581); - match(ClickHouseParser::RPAREN); - break; - } - - case 3: { - _localctx = dynamic_cast(_tracker.createInstance(_localctx)); - enterOuterAlt(_localctx, 3); - setState(1583); - 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 = 174; - enterRecursionRule(_localctx, 174, ClickHouseParser::RuleColumnExpr, precedence); - - size_t _la = 0; - - auto onExit = finally([=] { - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1693); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 225, _ctx)) { - case 1: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - - setState(1587); - match(ClickHouseParser::CASE); - setState(1589); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 215, _ctx)) { - case 1: { - setState(1588); - columnExpr(0); - break; - } - - } - setState(1596); - _errHandler->sync(this); - _la = _input->LA(1); - do { - setState(1591); - match(ClickHouseParser::WHEN); - setState(1592); - columnExpr(0); - setState(1593); - match(ClickHouseParser::THEN); - setState(1594); - columnExpr(0); - setState(1598); - _errHandler->sync(this); - _la = _input->LA(1); - } while (_la == ClickHouseParser::WHEN); - setState(1602); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::ELSE) { - setState(1600); - match(ClickHouseParser::ELSE); - setState(1601); - columnExpr(0); - } - setState(1604); - match(ClickHouseParser::END); - break; - } - - case 2: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1606); - match(ClickHouseParser::CAST); - setState(1607); - match(ClickHouseParser::LPAREN); - setState(1608); - columnExpr(0); - setState(1609); - match(ClickHouseParser::AS); - setState(1610); - columnTypeExpr(); - setState(1611); - match(ClickHouseParser::RPAREN); - break; - } - - case 3: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1613); - match(ClickHouseParser::DATE); - setState(1614); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 4: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1615); - match(ClickHouseParser::EXTRACT); - setState(1616); - match(ClickHouseParser::LPAREN); - setState(1617); - interval(); - setState(1618); - match(ClickHouseParser::FROM); - setState(1619); - columnExpr(0); - setState(1620); - match(ClickHouseParser::RPAREN); - break; - } - - case 5: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1622); - match(ClickHouseParser::INTERVAL); - setState(1623); - columnExpr(0); - setState(1624); - interval(); - break; - } - - case 6: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1626); - match(ClickHouseParser::SUBSTRING); - setState(1627); - match(ClickHouseParser::LPAREN); - setState(1628); - columnExpr(0); - setState(1629); - match(ClickHouseParser::FROM); - setState(1630); - columnExpr(0); - setState(1633); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::FOR) { - setState(1631); - match(ClickHouseParser::FOR); - setState(1632); - columnExpr(0); - } - setState(1635); - match(ClickHouseParser::RPAREN); - break; - } - - case 7: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1637); - match(ClickHouseParser::TIMESTAMP); - setState(1638); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case 8: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1639); - match(ClickHouseParser::TRIM); - setState(1640); - match(ClickHouseParser::LPAREN); - setState(1641); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::BOTH || _la == ClickHouseParser::LEADING || _la == ClickHouseParser::TRAILING)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1642); - match(ClickHouseParser::STRING_LITERAL); - setState(1643); - match(ClickHouseParser::FROM); - setState(1644); - columnExpr(0); - setState(1645); - match(ClickHouseParser::RPAREN); - break; - } - - case 9: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1647); - identifier(); - setState(1653); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 220, _ctx)) { - case 1: { - setState(1648); - match(ClickHouseParser::LPAREN); - setState(1650); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(1649); - columnExprList(); - } - setState(1652); - match(ClickHouseParser::RPAREN); - break; - } - - } - setState(1655); - match(ClickHouseParser::LPAREN); - setState(1657); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 221, _ctx)) { - case 1: { - setState(1656); - match(ClickHouseParser::DISTINCT); - break; - } - - } - setState(1660); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(1659); - columnArgList(); - } - setState(1662); - match(ClickHouseParser::RPAREN); - break; - } - - case 10: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1664); - literal(); - break; - } - - case 11: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1665); - match(ClickHouseParser::DASH); - setState(1666); - columnExpr(17); - break; - } - - case 12: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1667); - match(ClickHouseParser::NOT); - setState(1668); - columnExpr(12); - break; - } - - case 13: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1672); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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(1669); - tableIdentifier(); - setState(1670); - match(ClickHouseParser::DOT); - } - setState(1674); - match(ClickHouseParser::ASTERISK); - break; - } - - case 14: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1675); - match(ClickHouseParser::LPAREN); - setState(1676); - selectUnionStmt(); - setState(1677); - match(ClickHouseParser::RPAREN); - break; - } - - case 15: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1679); - match(ClickHouseParser::LPAREN); - setState(1680); - columnExpr(0); - setState(1681); - match(ClickHouseParser::RPAREN); - break; - } - - case 16: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1683); - match(ClickHouseParser::LPAREN); - setState(1684); - columnExprList(); - setState(1685); - match(ClickHouseParser::RPAREN); - break; - } - - case 17: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1687); - match(ClickHouseParser::LBRACKET); - setState(1689); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::LBRACKET - 197)) - | (1ULL << (ClickHouseParser::LPAREN - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(1688); - columnExprList(); - } - setState(1691); - match(ClickHouseParser::RBRACKET); - break; - } - - case 18: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1692); - columnIdentifier(); - break; - } - - } - _ctx->stop = _input->LT(-1); - setState(1766); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 234, _ctx); - while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { - if (alt == 1) { - if (!_parseListeners.empty()) - triggerExitRuleEvent(); - previousContext = _localctx; - setState(1764); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 233, _ctx)) { - case 1: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1695); - - if (!(precpred(_ctx, 16))) throw FailedPredicateException(this, "precpred(_ctx, 16)"); - setState(1696); - _la = _input->LA(1); - if (!(((((_la - 191) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 191)) & ((1ULL << (ClickHouseParser::ASTERISK - 191)) - | (1ULL << (ClickHouseParser::PERCENT - 191)) - | (1ULL << (ClickHouseParser::SLASH - 191)))) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1697); - columnExpr(17); - break; - } - - case 2: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1698); - - if (!(precpred(_ctx, 15))) throw FailedPredicateException(this, "precpred(_ctx, 15)"); - setState(1699); - _la = _input->LA(1); - if (!(((((_la - 196) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 196)) & ((1ULL << (ClickHouseParser::CONCAT - 196)) - | (1ULL << (ClickHouseParser::DASH - 196)) - | (1ULL << (ClickHouseParser::PLUS - 196)))) != 0))) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - setState(1700); - columnExpr(16); - break; - } - - case 3: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1701); - - if (!(precpred(_ctx, 14))) throw FailedPredicateException(this, "precpred(_ctx, 14)"); - setState(1720); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 229, _ctx)) { - case 1: { - setState(1702); - match(ClickHouseParser::EQ_DOUBLE); - break; - } - - case 2: { - setState(1703); - match(ClickHouseParser::EQ_SINGLE); - break; - } - - case 3: { - setState(1704); - match(ClickHouseParser::NOT_EQ); - break; - } - - case 4: { - setState(1705); - match(ClickHouseParser::LE); - break; - } - - case 5: { - setState(1706); - match(ClickHouseParser::GE); - break; - } - - case 6: { - setState(1707); - match(ClickHouseParser::LT); - break; - } - - case 7: { - setState(1708); - match(ClickHouseParser::GT); - break; - } - - case 8: { - setState(1710); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::GLOBAL) { - setState(1709); - match(ClickHouseParser::GLOBAL); - } - setState(1713); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::NOT) { - setState(1712); - match(ClickHouseParser::NOT); - } - setState(1715); - match(ClickHouseParser::IN); - break; - } - - case 9: { - setState(1717); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::NOT) { - setState(1716); - match(ClickHouseParser::NOT); - } - setState(1719); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::ILIKE - - || _la == ClickHouseParser::LIKE)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - break; - } - - } - setState(1722); - columnExpr(15); - break; - } - - case 4: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1723); - - if (!(precpred(_ctx, 11))) throw FailedPredicateException(this, "precpred(_ctx, 11)"); - setState(1724); - match(ClickHouseParser::AND); - setState(1725); - columnExpr(12); - break; - } - - case 5: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1726); - - if (!(precpred(_ctx, 10))) throw FailedPredicateException(this, "precpred(_ctx, 10)"); - setState(1727); - match(ClickHouseParser::OR); - setState(1728); - columnExpr(11); - break; - } - - case 6: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1729); - - if (!(precpred(_ctx, 9))) throw FailedPredicateException(this, "precpred(_ctx, 9)"); - setState(1731); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::NOT) { - setState(1730); - match(ClickHouseParser::NOT); - } - setState(1733); - match(ClickHouseParser::BETWEEN); - setState(1734); - columnExpr(0); - setState(1735); - match(ClickHouseParser::AND); - setState(1736); - columnExpr(10); - break; - } - - case 7: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1738); - - if (!(precpred(_ctx, 8))) throw FailedPredicateException(this, "precpred(_ctx, 8)"); - setState(1739); - match(ClickHouseParser::QUERY); - setState(1740); - columnExpr(0); - setState(1741); - match(ClickHouseParser::COLON); - setState(1742); - columnExpr(8); - break; - } - - case 8: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1744); - - if (!(precpred(_ctx, 19))) throw FailedPredicateException(this, "precpred(_ctx, 19)"); - setState(1745); - match(ClickHouseParser::LBRACKET); - setState(1746); - columnExpr(0); - setState(1747); - match(ClickHouseParser::RBRACKET); - break; - } - - case 9: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1749); - - if (!(precpred(_ctx, 18))) throw FailedPredicateException(this, "precpred(_ctx, 18)"); - setState(1750); - match(ClickHouseParser::DOT); - setState(1751); - match(ClickHouseParser::DECIMAL_LITERAL); - break; - } - - case 10: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1752); - - if (!(precpred(_ctx, 13))) throw FailedPredicateException(this, "precpred(_ctx, 13)"); - setState(1753); - match(ClickHouseParser::IS); - setState(1755); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::NOT) { - setState(1754); - match(ClickHouseParser::NOT); - } - setState(1757); - match(ClickHouseParser::NULL_SQL); - break; - } - - case 11: { - auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); - _localctx = newContext; - pushNewRecursionContext(newContext, startState, RuleColumnExpr); - setState(1758); - - if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(1762); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::DATE: - case ClickHouseParser::FIRST: - case ClickHouseParser::ID: - case ClickHouseParser::KEY: - case ClickHouseParser::IDENTIFIER: { - setState(1759); - alias(); - break; - } - - case ClickHouseParser::AS: { - setState(1760); - match(ClickHouseParser::AS); - setState(1761); - identifier(); - break; - } - - default: - throw NoViableAltException(this); - } - break; - } - - } - } - setState(1768); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 234, _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, 176, ClickHouseParser::RuleColumnArgList); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1769); - columnArgExpr(); - setState(1774); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1770); - match(ClickHouseParser::COMMA); - setState(1771); - columnArgExpr(); - setState(1776); - _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, 178, ClickHouseParser::RuleColumnArgExpr); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1779); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 236, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1777); - columnLambdaExpr(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1778); - 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, 180, ClickHouseParser::RuleColumnLambdaExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1800); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::LPAREN: { - setState(1781); - match(ClickHouseParser::LPAREN); - setState(1782); - identifier(); - setState(1787); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1783); - match(ClickHouseParser::COMMA); - setState(1784); - identifier(); - setState(1789); - _errHandler->sync(this); - _la = _input->LA(1); - } - setState(1790); - 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::AST: - 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::MATERIALIZE: - 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(1792); - identifier(); - setState(1797); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1793); - match(ClickHouseParser::COMMA); - setState(1794); - identifier(); - setState(1799); - _errHandler->sync(this); - _la = _input->LA(1); - } - break; - } - - default: - throw NoViableAltException(this); - } - setState(1802); - match(ClickHouseParser::ARROW); - setState(1803); - 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, 182, ClickHouseParser::RuleColumnIdentifier); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1808); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 240, _ctx)) { - case 1: { - setState(1805); - tableIdentifier(); - setState(1806); - match(ClickHouseParser::DOT); - break; - } - - } - setState(1810); - 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, 184, ClickHouseParser::RuleNestedIdentifier); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1812); - identifier(); - setState(1815); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 241, _ctx)) { - case 1: { - setState(1813); - match(ClickHouseParser::DOT); - setState(1814); - 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 = 186; - enterRecursionRule(_localctx, 186, ClickHouseParser::RuleTableExpr, precedence); - - - - auto onExit = finally([=] { - unrollRecursionContexts(parentContext); - }); - try { - size_t alt; - enterOuterAlt(_localctx, 1); - setState(1824); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 242, _ctx)) { - case 1: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - - setState(1818); - tableIdentifier(); - break; - } - - case 2: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1819); - tableFunctionExpr(); - break; - } - - case 3: { - _localctx = _tracker.createInstance(_localctx); - _ctx = _localctx; - previousContext = _localctx; - setState(1820); - match(ClickHouseParser::LPAREN); - setState(1821); - selectUnionStmt(); - setState(1822); - match(ClickHouseParser::RPAREN); - break; - } - - } - _ctx->stop = _input->LT(-1); - setState(1834); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 244, _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(1826); - - if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(1830); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::DATE: - case ClickHouseParser::FIRST: - case ClickHouseParser::ID: - case ClickHouseParser::KEY: - case ClickHouseParser::IDENTIFIER: { - setState(1827); - alias(); - break; - } - - case ClickHouseParser::AS: { - setState(1828); - match(ClickHouseParser::AS); - setState(1829); - identifier(); - break; - } - - default: - throw NoViableAltException(this); - } - } - setState(1836); - _errHandler->sync(this); - alt = getInterpreter()->adaptivePredict(_input, 244, _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, 188, ClickHouseParser::RuleTableFunctionExpr); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1837); - identifier(); - setState(1838); - match(ClickHouseParser::LPAREN); - setState(1840); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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 - 197) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 197)) & ((1ULL << (ClickHouseParser::DASH - 197)) - | (1ULL << (ClickHouseParser::DOT - 197)) - | (1ULL << (ClickHouseParser::PLUS - 197)))) != 0)) { - setState(1839); - tableArgList(); - } - setState(1842); - 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, 190, ClickHouseParser::RuleTableIdentifier); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1847); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 246, _ctx)) { - case 1: { - setState(1844); - databaseIdentifier(); - setState(1845); - match(ClickHouseParser::DOT); - break; - } - - } - setState(1849); - 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, 192, ClickHouseParser::RuleTableArgList); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1851); - tableArgExpr(); - setState(1856); - _errHandler->sync(this); - _la = _input->LA(1); - while (_la == ClickHouseParser::COMMA) { - setState(1852); - match(ClickHouseParser::COMMA); - setState(1853); - tableArgExpr(); - setState(1858); - _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::NestedIdentifierContext* ClickHouseParser::TableArgExprContext::nestedIdentifier() { - 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, 194, ClickHouseParser::RuleTableArgExpr); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1862); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 248, _ctx)) { - case 1: { - enterOuterAlt(_localctx, 1); - setState(1859); - nestedIdentifier(); - break; - } - - case 2: { - enterOuterAlt(_localctx, 2); - setState(1860); - tableFunctionExpr(); - break; - } - - case 3: { - enterOuterAlt(_localctx, 3); - setState(1861); - 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, 196, ClickHouseParser::RuleDatabaseIdentifier); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1864); - 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, 198, ClickHouseParser::RuleFloatingLiteral); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1874); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::FLOATING_LITERAL: { - enterOuterAlt(_localctx, 1); - setState(1866); - match(ClickHouseParser::FLOATING_LITERAL); - break; - } - - case ClickHouseParser::DOT: { - enterOuterAlt(_localctx, 2); - setState(1867); - match(ClickHouseParser::DOT); - setState(1868); - _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(1869); - match(ClickHouseParser::DECIMAL_LITERAL); - setState(1870); - match(ClickHouseParser::DOT); - setState(1872); - _errHandler->sync(this); - - switch (getInterpreter()->adaptivePredict(_input, 249, _ctx)) { - case 1: { - setState(1871); - _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, 200, ClickHouseParser::RuleNumberLiteral); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1877); - _errHandler->sync(this); - - _la = _input->LA(1); - if (_la == ClickHouseParser::DASH - - || _la == ClickHouseParser::PLUS) { - setState(1876); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::DASH - - || _la == ClickHouseParser::PLUS)) { - _errHandler->recoverInline(this); - } - else { - _errHandler->reportMatch(this); - consume(); - } - } - setState(1885); - _errHandler->sync(this); - switch (getInterpreter()->adaptivePredict(_input, 252, _ctx)) { - case 1: { - setState(1879); - floatingLiteral(); - break; - } - - case 2: { - setState(1880); - match(ClickHouseParser::OCTAL_LITERAL); - break; - } - - case 3: { - setState(1881); - match(ClickHouseParser::DECIMAL_LITERAL); - break; - } - - case 4: { - setState(1882); - match(ClickHouseParser::HEXADECIMAL_LITERAL); - break; - } - - case 5: { - setState(1883); - match(ClickHouseParser::INF); - break; - } - - case 6: { - setState(1884); - 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, 202, ClickHouseParser::RuleLiteral); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1890); - _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(1887); - numberLiteral(); - break; - } - - case ClickHouseParser::STRING_LITERAL: { - enterOuterAlt(_localctx, 2); - setState(1888); - match(ClickHouseParser::STRING_LITERAL); - break; - } - - case ClickHouseParser::NULL_SQL: { - enterOuterAlt(_localctx, 3); - setState(1889); - 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, 204, ClickHouseParser::RuleInterval); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1892); - _la = _input->LA(1); - if (!(_la == ClickHouseParser::DAY || ((((_la - 73) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 73)) & ((1ULL << (ClickHouseParser::HOUR - 73)) - | (1ULL << (ClickHouseParser::MINUTE - 73)) - | (1ULL << (ClickHouseParser::MONTH - 73)) - | (1ULL << (ClickHouseParser::QUARTER - 73)))) != 0) || ((((_la - 138) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 138)) & ((1ULL << (ClickHouseParser::SECOND - 138)) - | (1ULL << (ClickHouseParser::WEEK - 138)) - | (1ULL << (ClickHouseParser::YEAR - 138)))) != 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; -} - -//----------------- 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::AST() { - return getToken(ClickHouseParser::AST, 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::MATERIALIZE() { - return getToken(ClickHouseParser::MATERIALIZE, 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, 206, ClickHouseParser::RuleKeyword); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1894); - _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::AST) - | (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))) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 64)) & ((1ULL << (ClickHouseParser::FREEZE - 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::MATERIALIZE - 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)))) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 128)) & ((1ULL << (ClickHouseParser::RANGE - 128)) - | (1ULL << (ClickHouseParser::RELOAD - 128)) - | (1ULL << (ClickHouseParser::REMOVE - 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, 208, ClickHouseParser::RuleKeywordForAlias); - size_t _la = 0; - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1896); - _la = _input->LA(1); - if (!(((((_la - 34) & ~ 0x3fULL) == 0) && - ((1ULL << (_la - 34)) & ((1ULL << (ClickHouseParser::DATE - 34)) - | (1ULL << (ClickHouseParser::FIRST - 34)) - | (1ULL << (ClickHouseParser::ID - 34)) - | (1ULL << (ClickHouseParser::KEY - 34)))) != 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, 210, ClickHouseParser::RuleAlias); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1900); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::IDENTIFIER: { - enterOuterAlt(_localctx, 1); - setState(1898); - match(ClickHouseParser::IDENTIFIER); - break; - } - - case ClickHouseParser::DATE: - case ClickHouseParser::FIRST: - case ClickHouseParser::ID: - case ClickHouseParser::KEY: { - enterOuterAlt(_localctx, 2); - setState(1899); - 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, 212, ClickHouseParser::RuleIdentifier); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1905); - _errHandler->sync(this); - switch (_input->LA(1)) { - case ClickHouseParser::IDENTIFIER: { - enterOuterAlt(_localctx, 1); - setState(1902); - 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(1903); - 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::AST: - 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::MATERIALIZE: - 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(1904); - 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, 214, ClickHouseParser::RuleIdentifierOrNull); - - auto onExit = finally([=] { - exitRule(); - }); - try { - setState(1909); - _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::AST: - 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::MATERIALIZE: - 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(1907); - identifier(); - break; - } - - case ClickHouseParser::NULL_SQL: { - enterOuterAlt(_localctx, 2); - setState(1908); - 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, 216, ClickHouseParser::RuleEnumValue); - - auto onExit = finally([=] { - exitRule(); - }); - try { - enterOuterAlt(_localctx, 1); - setState(1911); - match(ClickHouseParser::STRING_LITERAL); - setState(1912); - match(ClickHouseParser::EQ_SINGLE); - setState(1913); - 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 67: return joinExprSempred(dynamic_cast(context), predicateIndex); - case 87: return columnExprSempred(dynamic_cast(context), predicateIndex); - case 93: 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", "tableProjectionDfnt", "codecExpr", - "codecArgExpr", "ttlExpr", "describeStmt", "dropStmt", "existsStmt", "explainStmt", - "insertStmt", "columnsClause", "dataClause", "killStmt", "optimizeStmt", - "renameStmt", "projectionSelectStmt", "selectUnionStmt", "selectStmtWithParens", - "selectStmt", "withClause", "topClause", "fromClause", "arrayJoinClause", - "prewhereClause", "whereClause", "groupByClause", "havingClause", "orderByClause", - "projectionOrderByClause", "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", "AST", "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", - "MATERIALIZE", "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", "PROJECTION", "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, 0xe0, 0x77e, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4, 0x4, - 0x9, 0x4, 0x4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3, 0x1c, 0x3, 0x1c, 0x3, 0x1c, 0x7, 0x1c, 0x358, - 0xa, 0x1c, 0xc, 0x1c, 0xe, 0x1c, 0x35b, 0xb, 0x1c, 0x3, 0x1d, 0x3, 0x1d, - 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1e, 0x3, 0x1e, 0x3, 0x1e, 0x3, 0x1e, 0x3, - 0x1f, 0x3, 0x1f, 0x3, 0x1f, 0x3, 0x1f, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, - 0x3, 0x20, 0x7, 0x20, 0x36d, 0xa, 0x20, 0xc, 0x20, 0xe, 0x20, 0x370, - 0xb, 0x20, 0x3, 0x21, 0x3, 0x21, 0x5, 0x21, 0x374, 0xa, 0x21, 0x3, 0x21, - 0x3, 0x21, 0x3, 0x21, 0x5, 0x21, 0x379, 0xa, 0x21, 0x3, 0x21, 0x5, 0x21, - 0x37c, 0xa, 0x21, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, - 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x5, 0x22, 0x388, - 0xa, 0x22, 0x3, 0x23, 0x3, 0x23, 0x3, 0x23, 0x5, 0x23, 0x38d, 0xa, 0x23, - 0x3, 0x23, 0x3, 0x23, 0x5, 0x23, 0x391, 0xa, 0x23, 0x3, 0x23, 0x5, 0x23, - 0x394, 0xa, 0x23, 0x3, 0x23, 0x3, 0x23, 0x5, 0x23, 0x398, 0xa, 0x23, - 0x3, 0x23, 0x3, 0x23, 0x5, 0x23, 0x39c, 0xa, 0x23, 0x3, 0x23, 0x3, 0x23, - 0x3, 0x23, 0x5, 0x23, 0x3a1, 0xa, 0x23, 0x3, 0x23, 0x5, 0x23, 0x3a4, - 0xa, 0x23, 0x3, 0x23, 0x3, 0x23, 0x5, 0x23, 0x3a8, 0xa, 0x23, 0x5, 0x23, - 0x3aa, 0xa, 0x23, 0x3, 0x24, 0x3, 0x24, 0x3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0x33, 0x45c, 0xa, 0x33, 0xc, 0x33, 0xe, 0x33, - 0x45f, 0xb, 0x33, 0x3, 0x33, 0x5, 0x33, 0x462, 0xa, 0x33, 0x3, 0x34, - 0x3, 0x34, 0x5, 0x34, 0x466, 0xa, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, - 0x5, 0x34, 0x46b, 0xa, 0x34, 0x3, 0x34, 0x5, 0x34, 0x46e, 0xa, 0x34, - 0x3, 0x34, 0x3, 0x34, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x7, - 0x35, 0x476, 0xa, 0x35, 0xc, 0x35, 0xe, 0x35, 0x479, 0xb, 0x35, 0x3, - 0x36, 0x3, 0x36, 0x3, 0x36, 0x3, 0x36, 0x3, 0x36, 0x5, 0x36, 0x480, - 0xa, 0x36, 0x3, 0x37, 0x5, 0x37, 0x483, 0xa, 0x37, 0x3, 0x37, 0x3, 0x37, - 0x5, 0x37, 0x487, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x48a, 0xa, 0x37, - 0x3, 0x37, 0x3, 0x37, 0x5, 0x37, 0x48e, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, - 0x491, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x494, 0xa, 0x37, 0x3, 0x37, - 0x5, 0x37, 0x497, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x49a, 0xa, 0x37, - 0x3, 0x37, 0x3, 0x37, 0x5, 0x37, 0x49e, 0xa, 0x37, 0x3, 0x37, 0x3, 0x37, - 0x5, 0x37, 0x4a2, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x4a5, 0xa, 0x37, - 0x3, 0x37, 0x5, 0x37, 0x4a8, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x4ab, - 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, 0x4ae, 0xa, 0x37, 0x3, 0x37, 0x5, 0x37, - 0x4b1, 0xa, 0x37, 0x3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, 0xe, 0x45, 0x50f, 0xb, 0x45, 0x3, 0x46, 0x5, 0x46, - 0x512, 0xa, 0x46, 0x3, 0x46, 0x3, 0x46, 0x3, 0x46, 0x5, 0x46, 0x517, - 0xa, 0x46, 0x3, 0x46, 0x5, 0x46, 0x51a, 0xa, 0x46, 0x3, 0x46, 0x5, 0x46, - 0x51d, 0xa, 0x46, 0x3, 0x46, 0x3, 0x46, 0x5, 0x46, 0x521, 0xa, 0x46, - 0x3, 0x46, 0x3, 0x46, 0x5, 0x46, 0x525, 0xa, 0x46, 0x3, 0x46, 0x5, 0x46, - 0x528, 0xa, 0x46, 0x5, 0x46, 0x52a, 0xa, 0x46, 0x3, 0x46, 0x5, 0x46, - 0x52d, 0xa, 0x46, 0x3, 0x46, 0x3, 0x46, 0x5, 0x46, 0x531, 0xa, 0x46, - 0x3, 0x46, 0x3, 0x46, 0x5, 0x46, 0x535, 0xa, 0x46, 0x3, 0x46, 0x5, 0x46, - 0x538, 0xa, 0x46, 0x5, 0x46, 0x53a, 0xa, 0x46, 0x5, 0x46, 0x53c, 0xa, - 0x46, 0x3, 0x47, 0x5, 0x47, 0x53f, 0xa, 0x47, 0x3, 0x47, 0x3, 0x47, - 0x3, 0x47, 0x5, 0x47, 0x544, 0xa, 0x47, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, - 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x5, - 0x48, 0x54f, 0xa, 0x48, 0x3, 0x49, 0x3, 0x49, 0x3, 0x49, 0x3, 0x49, - 0x5, 0x49, 0x555, 0xa, 0x49, 0x3, 0x4a, 0x3, 0x4a, 0x3, 0x4a, 0x5, 0x4a, - 0x55a, 0xa, 0x4a, 0x3, 0x4b, 0x3, 0x4b, 0x3, 0x4b, 0x7, 0x4b, 0x55f, - 0xa, 0x4b, 0xc, 0x4b, 0xe, 0x4b, 0x562, 0xb, 0x4b, 0x3, 0x4c, 0x3, 0x4c, - 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, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x5, - 0x52, 0x5c4, 0xa, 0x52, 0x3, 0x52, 0x5, 0x52, 0x5c7, 0xa, 0x52, 0x3, - 0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, - 0x3, 0x52, 0x3, 0x52, 0x5, 0x52, 0x5d2, 0xa, 0x52, 0x3, 0x53, 0x3, 0x53, - 0x5, 0x53, 0x5d6, 0xa, 0x53, 0x3, 0x53, 0x5, 0x53, 0x5d9, 0xa, 0x53, - 0x3, 0x53, 0x3, 0x53, 0x5, 0x53, 0x5dd, 0xa, 0x53, 0x3, 0x53, 0x3, 0x53, - 0x5, 0x53, 0x5e1, 0xa, 0x53, 0x3, 0x54, 0x3, 0x54, 0x3, 0x54, 0x3, 0x55, - 0x3, 0x55, 0x3, 0x55, 0x5, 0x55, 0x5e9, 0xa, 0x55, 0x3, 0x55, 0x3, 0x55, - 0x5, 0x55, 0x5ed, 0xa, 0x55, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, - 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x7, 0x56, 0x5f8, - 0xa, 0x56, 0xc, 0x56, 0xe, 0x56, 0x5fb, 0xb, 0x56, 0x3, 0x56, 0x3, 0x56, - 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x7, 0x56, 0x604, - 0xa, 0x56, 0xc, 0x56, 0xe, 0x56, 0x607, 0xb, 0x56, 0x3, 0x56, 0x3, 0x56, - 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x7, 0x56, 0x610, - 0xa, 0x56, 0xc, 0x56, 0xe, 0x56, 0x613, 0xb, 0x56, 0x3, 0x56, 0x3, 0x56, - 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56, 0x61a, 0xa, 0x56, 0x3, 0x56, - 0x3, 0x56, 0x5, 0x56, 0x61e, 0xa, 0x56, 0x3, 0x57, 0x3, 0x57, 0x3, 0x57, - 0x7, 0x57, 0x623, 0xa, 0x57, 0xc, 0x57, 0xe, 0x57, 0x626, 0xb, 0x57, - 0x3, 0x58, 0x3, 0x58, 0x3, 0x58, 0x5, 0x58, 0x62b, 0xa, 0x58, 0x3, 0x58, - 0x3, 0x58, 0x3, 0x58, 0x3, 0x58, 0x3, 0x58, 0x3, 0x58, 0x5, 0x58, 0x633, - 0xa, 0x58, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x638, 0xa, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x6, 0x59, 0x63f, - 0xa, 0x59, 0xd, 0x59, 0xe, 0x59, 0x640, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, - 0x645, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x664, - 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x675, 0xa, 0x59, 0x3, 0x59, - 0x5, 0x59, 0x678, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x67c, - 0xa, 0x59, 0x3, 0x59, 0x5, 0x59, 0x67f, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x5, 0x59, 0x68b, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x5, 0x59, 0x69c, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x6a0, - 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x6b1, 0xa, 0x59, 0x3, 0x59, - 0x5, 0x59, 0x6b4, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x5, 0x59, 0x6b8, - 0xa, 0x59, 0x3, 0x59, 0x5, 0x59, 0x6bb, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x5, 0x59, 0x6c6, 0xa, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, - 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, - 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x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, 0x72b, 0xa, 0x5f, 0xc, 0x5f, - 0xe, 0x5f, 0x72e, 0xb, 0x5f, 0x3, 0x60, 0x3, 0x60, 0x3, 0x60, 0x5, 0x60, - 0x733, 0xa, 0x60, 0x3, 0x60, 0x3, 0x60, 0x3, 0x61, 0x3, 0x61, 0x3, 0x61, - 0x5, 0x61, 0x73a, 0xa, 0x61, 0x3, 0x61, 0x3, 0x61, 0x3, 0x62, 0x3, 0x62, - 0x3, 0x62, 0x7, 0x62, 0x741, 0xa, 0x62, 0xc, 0x62, 0xe, 0x62, 0x744, - 0xb, 0x62, 0x3, 0x63, 0x3, 0x63, 0x3, 0x63, 0x5, 0x63, 0x749, 0xa, 0x63, - 0x3, 0x64, 0x3, 0x64, 0x3, 0x65, 0x3, 0x65, 0x3, 0x65, 0x3, 0x65, 0x3, - 0x65, 0x3, 0x65, 0x5, 0x65, 0x753, 0xa, 0x65, 0x5, 0x65, 0x755, 0xa, - 0x65, 0x3, 0x66, 0x5, 0x66, 0x758, 0xa, 0x66, 0x3, 0x66, 0x3, 0x66, - 0x3, 0x66, 0x3, 0x66, 0x3, 0x66, 0x3, 0x66, 0x5, 0x66, 0x760, 0xa, 0x66, - 0x3, 0x67, 0x3, 0x67, 0x3, 0x67, 0x5, 0x67, 0x765, 0xa, 0x67, 0x3, 0x68, - 0x3, 0x68, 0x3, 0x69, 0x3, 0x69, 0x3, 0x6a, 0x3, 0x6a, 0x3, 0x6b, 0x3, - 0x6b, 0x5, 0x6b, 0x76f, 0xa, 0x6b, 0x3, 0x6c, 0x3, 0x6c, 0x3, 0x6c, - 0x5, 0x6c, 0x774, 0xa, 0x6c, 0x3, 0x6d, 0x3, 0x6d, 0x5, 0x6d, 0x778, - 0xa, 0x6d, 0x3, 0x6e, 0x3, 0x6e, 0x3, 0x6e, 0x3, 0x6e, 0x3, 0x6e, 0x2, - 0x5, 0x88, 0xb0, 0xbc, 0x6f, 0x2, 0x4, 0x6, 0x8, 0xa, 0xc, 0xe, 0x10, - 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 0x61, 0x2, 0x103, 0x105, - 0x5, 0x2c, 0x17, 0x2, 0x104, 0x103, 0x3, 0x2, 0x2, 0x2, 0x104, 0x105, - 0x3, 0x2, 0x2, 0x2, 0x105, 0x106, 0x3, 0x2, 0x2, 0x2, 0x106, 0x10b, - 0x5, 0x8, 0x5, 0x2, 0x107, 0x108, 0x7, 0xc5, 0x2, 0x2, 0x108, 0x10a, - 0x5, 0x8, 0x5, 0x2, 0x109, 0x107, 0x3, 0x2, 0x2, 0x2, 0x10a, 0x10d, - 0x3, 0x2, 0x2, 0x2, 0x10b, 0x109, 0x3, 0x2, 0x2, 0x2, 0x10b, 0x10c, - 0x3, 0x2, 0x2, 0x2, 0x10c, 0x7, 0x3, 0x2, 0x2, 0x2, 0x10d, 0x10b, 0x3, - 0x2, 0x2, 0x2, 0x10e, 0x10f, 0x7, 0x3, 0x2, 0x2, 0x10f, 0x113, 0x7, - 0x1c, 0x2, 0x2, 0x110, 0x111, 0x7, 0x4d, 0x2, 0x2, 0x111, 0x112, 0x7, - 0x72, 0x2, 0x2, 0x112, 0x114, 0x7, 0x38, 0x2, 0x2, 0x113, 0x110, 0x3, - 0x2, 0x2, 0x2, 0x113, 0x114, 0x3, 0x2, 0x2, 0x2, 0x114, 0x115, 0x3, - 0x2, 0x2, 0x2, 0x115, 0x118, 0x5, 0x44, 0x23, 0x2, 0x116, 0x117, 0x7, - 0x4, 0x2, 0x2, 0x117, 0x119, 0x5, 0xba, 0x5e, 0x2, 0x118, 0x116, 0x3, - 0x2, 0x2, 0x2, 0x118, 0x119, 0x3, 0x2, 0x2, 0x2, 0x119, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x11a, 0x11b, 0x7, 0x3, 0x2, 0x2, 0x11b, 0x11f, 0x7, - 0x50, 0x2, 0x2, 0x11c, 0x11d, 0x7, 0x4d, 0x2, 0x2, 0x11d, 0x11e, 0x7, - 0x72, 0x2, 0x2, 0x11e, 0x120, 0x7, 0x38, 0x2, 0x2, 0x11f, 0x11c, 0x3, - 0x2, 0x2, 0x2, 0x11f, 0x120, 0x3, 0x2, 0x2, 0x2, 0x120, 0x121, 0x3, - 0x2, 0x2, 0x2, 0x121, 0x124, 0x5, 0x48, 0x25, 0x2, 0x122, 0x123, 0x7, - 0x4, 0x2, 0x2, 0x123, 0x125, 0x5, 0xba, 0x5e, 0x2, 0x124, 0x122, 0x3, - 0x2, 0x2, 0x2, 0x124, 0x125, 0x3, 0x2, 0x2, 0x2, 0x125, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x126, 0x127, 0x7, 0x3, 0x2, 0x2, 0x127, 0x12b, 0x7, - 0x80, 0x2, 0x2, 0x128, 0x129, 0x7, 0x4d, 0x2, 0x2, 0x129, 0x12a, 0x7, - 0x72, 0x2, 0x2, 0x12a, 0x12c, 0x7, 0x38, 0x2, 0x2, 0x12b, 0x128, 0x3, - 0x2, 0x2, 0x2, 0x12b, 0x12c, 0x3, 0x2, 0x2, 0x2, 0x12c, 0x12d, 0x3, - 0x2, 0x2, 0x2, 0x12d, 0x130, 0x5, 0x4a, 0x26, 0x2, 0x12e, 0x12f, 0x7, - 0x4, 0x2, 0x2, 0x12f, 0x131, 0x5, 0xba, 0x5e, 0x2, 0x130, 0x12e, 0x3, - 0x2, 0x2, 0x2, 0x130, 0x131, 0x3, 0x2, 0x2, 0x2, 0x131, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x132, 0x133, 0x7, 0x11, 0x2, 0x2, 0x133, 0x136, 0x5, - 0x10, 0x9, 0x2, 0x134, 0x135, 0x7, 0x43, 0x2, 0x2, 0x135, 0x137, 0x5, - 0xc0, 0x61, 0x2, 0x136, 0x134, 0x3, 0x2, 0x2, 0x2, 0x136, 0x137, 0x3, - 0x2, 0x2, 0x2, 0x137, 0x1e5, 0x3, 0x2, 0x2, 0x2, 0x138, 0x139, 0x7, - 0x18, 0x2, 0x2, 0x139, 0x13c, 0x7, 0x1c, 0x2, 0x2, 0x13a, 0x13b, 0x7, - 0x4d, 0x2, 0x2, 0x13b, 0x13d, 0x7, 0x38, 0x2, 0x2, 0x13c, 0x13a, 0x3, - 0x2, 0x2, 0x2, 0x13c, 0x13d, 0x3, 0x2, 0x2, 0x2, 0x13d, 0x13e, 0x3, - 0x2, 0x2, 0x2, 0x13e, 0x141, 0x5, 0xba, 0x5e, 0x2, 0x13f, 0x140, 0x7, - 0x4f, 0x2, 0x2, 0x140, 0x142, 0x5, 0x10, 0x9, 0x2, 0x141, 0x13f, 0x3, - 0x2, 0x2, 0x2, 0x141, 0x142, 0x3, 0x2, 0x2, 0x2, 0x142, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x143, 0x144, 0x7, 0x18, 0x2, 0x2, 0x144, 0x147, 0x7, - 0x50, 0x2, 0x2, 0x145, 0x146, 0x7, 0x4d, 0x2, 0x2, 0x146, 0x148, 0x7, - 0x38, 0x2, 0x2, 0x147, 0x145, 0x3, 0x2, 0x2, 0x2, 0x147, 0x148, 0x3, - 0x2, 0x2, 0x2, 0x148, 0x149, 0x3, 0x2, 0x2, 0x2, 0x149, 0x14c, 0x5, - 0xba, 0x5e, 0x2, 0x14a, 0x14b, 0x7, 0x4f, 0x2, 0x2, 0x14b, 0x14d, 0x5, - 0x10, 0x9, 0x2, 0x14c, 0x14a, 0x3, 0x2, 0x2, 0x2, 0x14c, 0x14d, 0x3, - 0x2, 0x2, 0x2, 0x14d, 0x1e5, 0x3, 0x2, 0x2, 0x2, 0x14e, 0x14f, 0x7, - 0x18, 0x2, 0x2, 0x14f, 0x152, 0x7, 0x80, 0x2, 0x2, 0x150, 0x151, 0x7, - 0x4d, 0x2, 0x2, 0x151, 0x153, 0x7, 0x38, 0x2, 0x2, 0x152, 0x150, 0x3, - 0x2, 0x2, 0x2, 0x152, 0x153, 0x3, 0x2, 0x2, 0x2, 0x153, 0x154, 0x3, - 0x2, 0x2, 0x2, 0x154, 0x157, 0x5, 0xba, 0x5e, 0x2, 0x155, 0x156, 0x7, - 0x4f, 0x2, 0x2, 0x156, 0x158, 0x5, 0x10, 0x9, 0x2, 0x157, 0x155, 0x3, - 0x2, 0x2, 0x2, 0x157, 0x158, 0x3, 0x2, 0x2, 0x2, 0x158, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x159, 0x15a, 0x7, 0x1d, 0x2, 0x2, 0x15a, 0x15d, 0x7, - 0x1c, 0x2, 0x2, 0x15b, 0x15c, 0x7, 0x4d, 0x2, 0x2, 0x15c, 0x15e, 0x7, - 0x38, 0x2, 0x2, 0x15d, 0x15b, 0x3, 0x2, 0x2, 0x2, 0x15d, 0x15e, 0x3, - 0x2, 0x2, 0x2, 0x15e, 0x15f, 0x3, 0x2, 0x2, 0x2, 0x15f, 0x160, 0x5, - 0xba, 0x5e, 0x2, 0x160, 0x161, 0x7, 0xbf, 0x2, 0x2, 0x161, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x162, 0x163, 0x7, 0x29, 0x2, 0x2, 0x163, 0x164, 0x7, - 0xb5, 0x2, 0x2, 0x164, 0x1e5, 0x5, 0xb0, 0x59, 0x2, 0x165, 0x166, 0x7, - 0x2d, 0x2, 0x2, 0x166, 0x1e5, 0x5, 0x10, 0x9, 0x2, 0x167, 0x168, 0x7, - 0x33, 0x2, 0x2, 0x168, 0x16b, 0x7, 0x1c, 0x2, 0x2, 0x169, 0x16a, 0x7, - 0x4d, 0x2, 0x2, 0x16a, 0x16c, 0x7, 0x38, 0x2, 0x2, 0x16b, 0x169, 0x3, - 0x2, 0x2, 0x2, 0x16b, 0x16c, 0x3, 0x2, 0x2, 0x2, 0x16c, 0x16d, 0x3, - 0x2, 0x2, 0x2, 0x16d, 0x1e5, 0x5, 0xba, 0x5e, 0x2, 0x16e, 0x16f, 0x7, - 0x33, 0x2, 0x2, 0x16f, 0x172, 0x7, 0x50, 0x2, 0x2, 0x170, 0x171, 0x7, - 0x4d, 0x2, 0x2, 0x171, 0x173, 0x7, 0x38, 0x2, 0x2, 0x172, 0x170, 0x3, - 0x2, 0x2, 0x2, 0x172, 0x173, 0x3, 0x2, 0x2, 0x2, 0x173, 0x174, 0x3, - 0x2, 0x2, 0x2, 0x174, 0x1e5, 0x5, 0xba, 0x5e, 0x2, 0x175, 0x176, 0x7, - 0x33, 0x2, 0x2, 0x176, 0x179, 0x7, 0x80, 0x2, 0x2, 0x177, 0x178, 0x7, - 0x4d, 0x2, 0x2, 0x178, 0x17a, 0x7, 0x38, 0x2, 0x2, 0x179, 0x177, 0x3, - 0x2, 0x2, 0x2, 0x179, 0x17a, 0x3, 0x2, 0x2, 0x2, 0x17a, 0x17b, 0x3, - 0x2, 0x2, 0x2, 0x17b, 0x1e5, 0x5, 0xba, 0x5e, 0x2, 0x17c, 0x17d, 0x7, - 0x33, 0x2, 0x2, 0x17d, 0x1e5, 0x5, 0x10, 0x9, 0x2, 0x17e, 0x180, 0x7, - 0x42, 0x2, 0x2, 0x17f, 0x181, 0x5, 0x10, 0x9, 0x2, 0x180, 0x17f, 0x3, - 0x2, 0x2, 0x2, 0x180, 0x181, 0x3, 0x2, 0x2, 0x2, 0x181, 0x1e5, 0x3, - 0x2, 0x2, 0x2, 0x182, 0x183, 0x7, 0x66, 0x2, 0x2, 0x183, 0x186, 0x7, - 0x50, 0x2, 0x2, 0x184, 0x185, 0x7, 0x4d, 0x2, 0x2, 0x185, 0x187, 0x7, - 0x38, 0x2, 0x2, 0x186, 0x184, 0x3, 0x2, 0x2, 0x2, 0x186, 0x187, 0x3, - 0x2, 0x2, 0x2, 0x187, 0x188, 0x3, 0x2, 0x2, 0x2, 0x188, 0x18b, 0x5, - 0xba, 0x5e, 0x2, 0x189, 0x18a, 0x7, 0x4f, 0x2, 0x2, 0x18a, 0x18c, 0x5, - 0x10, 0x9, 0x2, 0x18b, 0x189, 0x3, 0x2, 0x2, 0x2, 0x18b, 0x18c, 0x3, - 0x2, 0x2, 0x2, 0x18c, 0x1e5, 0x3, 0x2, 0x2, 0x2, 0x18d, 0x18e, 0x7, - 0x66, 0x2, 0x2, 0x18e, 0x191, 0x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, 0x17, 0x2, 0x1ff, 0x1fe, 0x3, 0x2, 0x2, 0x2, 0x1ff, - 0x200, 0x3, 0x2, 0x2, 0x2, 0x200, 0x13, 0x3, 0x2, 0x2, 0x2, 0x201, 0x202, - 0x7, 0x17, 0x2, 0x2, 0x202, 0x203, 0x7, 0x9a, 0x2, 0x2, 0x203, 0x205, - 0x5, 0xc0, 0x61, 0x2, 0x204, 0x206, 0x5, 0x10, 0x9, 0x2, 0x205, 0x204, - 0x3, 0x2, 0x2, 0x2, 0x205, 0x206, 0x3, 0x2, 0x2, 0x2, 0x206, 0x15, 0x3, - 0x2, 0x2, 0x2, 0x207, 0x208, 0x9, 0x3, 0x2, 0x2, 0x208, 0x20c, 0x7, - 0x22, 0x2, 0x2, 0x209, 0x20a, 0x7, 0x4d, 0x2, 0x2, 0x20a, 0x20b, 0x7, - 0x72, 0x2, 0x2, 0x20b, 0x20d, 0x7, 0x38, 0x2, 0x2, 0x20c, 0x209, 0x3, - 0x2, 0x2, 0x2, 0x20c, 0x20d, 0x3, 0x2, 0x2, 0x2, 0x20d, 0x20e, 0x3, - 0x2, 0x2, 0x2, 0x20e, 0x210, 0x5, 0xc6, 0x64, 0x2, 0x20f, 0x211, 0x5, - 0x2c, 0x17, 0x2, 0x210, 0x20f, 0x3, 0x2, 0x2, 0x2, 0x210, 0x211, 0x3, - 0x2, 0x2, 0x2, 0x211, 0x213, 0x3, 0x2, 0x2, 0x2, 0x212, 0x214, 0x5, - 0x40, 0x21, 0x2, 0x213, 0x212, 0x3, 0x2, 0x2, 0x2, 0x213, 0x214, 0x3, - 0x2, 0x2, 0x2, 0x214, 0x291, 0x3, 0x2, 0x2, 0x2, 0x215, 0x216, 0x9, - 0x3, 0x2, 0x2, 0x216, 0x21a, 0x7, 0x2f, 0x2, 0x2, 0x217, 0x218, 0x7, - 0x4d, 0x2, 0x2, 0x218, 0x219, 0x7, 0x72, 0x2, 0x2, 0x219, 0x21b, 0x7, - 0x38, 0x2, 0x2, 0x21a, 0x217, 0x3, 0x2, 0x2, 0x2, 0x21a, 0x21b, 0x3, - 0x2, 0x2, 0x2, 0x21b, 0x21c, 0x3, 0x2, 0x2, 0x2, 0x21c, 0x21e, 0x5, - 0xc0, 0x61, 0x2, 0x21d, 0x21f, 0x5, 0x2e, 0x18, 0x2, 0x21e, 0x21d, 0x3, - 0x2, 0x2, 0x2, 0x21e, 0x21f, 0x3, 0x2, 0x2, 0x2, 0x21f, 0x221, 0x3, - 0x2, 0x2, 0x2, 0x220, 0x222, 0x5, 0x2c, 0x17, 0x2, 0x221, 0x220, 0x3, - 0x2, 0x2, 0x2, 0x221, 0x222, 0x3, 0x2, 0x2, 0x2, 0x222, 0x223, 0x3, - 0x2, 0x2, 0x2, 0x223, 0x224, 0x5, 0x18, 0xd, 0x2, 0x224, 0x225, 0x5, - 0x1c, 0xf, 0x2, 0x225, 0x291, 0x3, 0x2, 0x2, 0x2, 0x226, 0x227, 0x9, - 0x3, 0x2, 0x2, 0x227, 0x228, 0x7, 0x63, 0x2, 0x2, 0x228, 0x22c, 0x7, - 0xb0, 0x2, 0x2, 0x229, 0x22a, 0x7, 0x4d, 0x2, 0x2, 0x22a, 0x22b, 0x7, - 0x72, 0x2, 0x2, 0x22b, 0x22d, 0x7, 0x38, 0x2, 0x2, 0x22c, 0x229, 0x3, - 0x2, 0x2, 0x2, 0x22c, 0x22d, 0x3, 0x2, 0x2, 0x2, 0x22d, 0x22e, 0x3, - 0x2, 0x2, 0x2, 0x22e, 0x230, 0x5, 0xc0, 0x61, 0x2, 0x22f, 0x231, 0x5, - 0x2e, 0x18, 0x2, 0x230, 0x22f, 0x3, 0x2, 0x2, 0x2, 0x230, 0x231, 0x3, - 0x2, 0x2, 0x2, 0x231, 0x233, 0x3, 0x2, 0x2, 0x2, 0x232, 0x234, 0x5, - 0x2c, 0x17, 0x2, 0x233, 0x232, 0x3, 0x2, 0x2, 0x2, 0x233, 0x234, 0x3, - 0x2, 0x2, 0x2, 0x234, 0x23a, 0x3, 0x2, 0x2, 0x2, 0x235, 0x236, 0x7, - 0xb6, 0x2, 0x2, 0x236, 0x238, 0x7, 0xa0, 0x2, 0x2, 0x237, 0x239, 0x7, - 0xbd, 0x2, 0x2, 0x238, 0x237, 0x3, 0x2, 0x2, 0x2, 0x238, 0x239, 0x3, - 0x2, 0x2, 0x2, 0x239, 0x23b, 0x3, 0x2, 0x2, 0x2, 0x23a, 0x235, 0x3, - 0x2, 0x2, 0x2, 0x23a, 0x23b, 0x3, 0x2, 0x2, 0x2, 0x23b, 0x23d, 0x3, - 0x2, 0x2, 0x2, 0x23c, 0x23e, 0x5, 0x30, 0x19, 0x2, 0x23d, 0x23c, 0x3, - 0x2, 0x2, 0x2, 0x23d, 0x23e, 0x3, 0x2, 0x2, 0x2, 0x23e, 0x240, 0x3, - 0x2, 0x2, 0x2, 0x23f, 0x241, 0x5, 0x34, 0x1b, 0x2, 0x240, 0x23f, 0x3, - 0x2, 0x2, 0x2, 0x240, 0x241, 0x3, 0x2, 0x2, 0x2, 0x241, 0x242, 0x3, - 0x2, 0x2, 0x2, 0x242, 0x243, 0x5, 0x32, 0x1a, 0x2, 0x243, 0x291, 0x3, - 0x2, 0x2, 0x2, 0x244, 0x245, 0x9, 0x3, 0x2, 0x2, 0x245, 0x246, 0x7, - 0x67, 0x2, 0x2, 0x246, 0x24a, 0x7, 0xb0, 0x2, 0x2, 0x247, 0x248, 0x7, - 0x4d, 0x2, 0x2, 0x248, 0x249, 0x7, 0x72, 0x2, 0x2, 0x249, 0x24b, 0x7, - 0x38, 0x2, 0x2, 0x24a, 0x247, 0x3, 0x2, 0x2, 0x2, 0x24a, 0x24b, 0x3, - 0x2, 0x2, 0x2, 0x24b, 0x24c, 0x3, 0x2, 0x2, 0x2, 0x24c, 0x24e, 0x5, - 0xc0, 0x61, 0x2, 0x24d, 0x24f, 0x5, 0x2e, 0x18, 0x2, 0x24e, 0x24d, 0x3, - 0x2, 0x2, 0x2, 0x24e, 0x24f, 0x3, 0x2, 0x2, 0x2, 0x24f, 0x251, 0x3, - 0x2, 0x2, 0x2, 0x250, 0x252, 0x5, 0x2c, 0x17, 0x2, 0x251, 0x250, 0x3, - 0x2, 0x2, 0x2, 0x251, 0x252, 0x3, 0x2, 0x2, 0x2, 0x252, 0x254, 0x3, - 0x2, 0x2, 0x2, 0x253, 0x255, 0x5, 0x34, 0x1b, 0x2, 0x254, 0x253, 0x3, - 0x2, 0x2, 0x2, 0x254, 0x255, 0x3, 0x2, 0x2, 0x2, 0x255, 0x25b, 0x3, - 0x2, 0x2, 0x2, 0x256, 0x25c, 0x5, 0x30, 0x19, 0x2, 0x257, 0x259, 0x5, - 0x36, 0x1c, 0x2, 0x258, 0x25a, 0x7, 0x7d, 0x2, 0x2, 0x259, 0x258, 0x3, - 0x2, 0x2, 0x2, 0x259, 0x25a, 0x3, 0x2, 0x2, 0x2, 0x25a, 0x25c, 0x3, - 0x2, 0x2, 0x2, 0x25b, 0x256, 0x3, 0x2, 0x2, 0x2, 0x25b, 0x257, 0x3, - 0x2, 0x2, 0x2, 0x25c, 0x25d, 0x3, 0x2, 0x2, 0x2, 0x25d, 0x25e, 0x5, - 0x32, 0x1a, 0x2, 0x25e, 0x291, 0x3, 0x2, 0x2, 0x2, 0x25f, 0x261, 0x9, - 0x3, 0x2, 0x2, 0x260, 0x262, 0x7, 0x9c, 0x2, 0x2, 0x261, 0x260, 0x3, - 0x2, 0x2, 0x2, 0x261, 0x262, 0x3, 0x2, 0x2, 0x2, 0x262, 0x263, 0x3, - 0x2, 0x2, 0x2, 0x263, 0x267, 0x7, 0x9a, 0x2, 0x2, 0x264, 0x265, 0x7, - 0x4d, 0x2, 0x2, 0x265, 0x266, 0x7, 0x72, 0x2, 0x2, 0x266, 0x268, 0x7, - 0x38, 0x2, 0x2, 0x267, 0x264, 0x3, 0x2, 0x2, 0x2, 0x267, 0x268, 0x3, - 0x2, 0x2, 0x2, 0x268, 0x269, 0x3, 0x2, 0x2, 0x2, 0x269, 0x26b, 0x5, - 0xc0, 0x61, 0x2, 0x26a, 0x26c, 0x5, 0x2e, 0x18, 0x2, 0x26b, 0x26a, 0x3, - 0x2, 0x2, 0x2, 0x26b, 0x26c, 0x3, 0x2, 0x2, 0x2, 0x26c, 0x26e, 0x3, - 0x2, 0x2, 0x2, 0x26d, 0x26f, 0x5, 0x2c, 0x17, 0x2, 0x26e, 0x26d, 0x3, - 0x2, 0x2, 0x2, 0x26e, 0x26f, 0x3, 0x2, 0x2, 0x2, 0x26f, 0x271, 0x3, - 0x2, 0x2, 0x2, 0x270, 0x272, 0x5, 0x34, 0x1b, 0x2, 0x271, 0x270, 0x3, - 0x2, 0x2, 0x2, 0x271, 0x272, 0x3, 0x2, 0x2, 0x2, 0x272, 0x274, 0x3, - 0x2, 0x2, 0x2, 0x273, 0x275, 0x5, 0x36, 0x1c, 0x2, 0x274, 0x273, 0x3, - 0x2, 0x2, 0x2, 0x274, 0x275, 0x3, 0x2, 0x2, 0x2, 0x275, 0x277, 0x3, - 0x2, 0x2, 0x2, 0x276, 0x278, 0x5, 0x32, 0x1a, 0x2, 0x277, 0x276, 0x3, - 0x2, 0x2, 0x2, 0x277, 0x278, 0x3, 0x2, 0x2, 0x2, 0x278, 0x291, 0x3, - 0x2, 0x2, 0x2, 0x279, 0x27c, 0x9, 0x3, 0x2, 0x2, 0x27a, 0x27b, 0x7, - 0x78, 0x2, 0x2, 0x27b, 0x27d, 0x7, 0x86, 0x2, 0x2, 0x27c, 0x27a, 0x3, - 0x2, 0x2, 0x2, 0x27c, 0x27d, 0x3, 0x2, 0x2, 0x2, 0x27d, 0x27e, 0x3, - 0x2, 0x2, 0x2, 0x27e, 0x282, 0x7, 0xb0, 0x2, 0x2, 0x27f, 0x280, 0x7, - 0x4d, 0x2, 0x2, 0x280, 0x281, 0x7, 0x72, 0x2, 0x2, 0x281, 0x283, 0x7, - 0x38, 0x2, 0x2, 0x282, 0x27f, 0x3, 0x2, 0x2, 0x2, 0x282, 0x283, 0x3, - 0x2, 0x2, 0x2, 0x283, 0x284, 0x3, 0x2, 0x2, 0x2, 0x284, 0x286, 0x5, - 0xc0, 0x61, 0x2, 0x285, 0x287, 0x5, 0x2e, 0x18, 0x2, 0x286, 0x285, 0x3, - 0x2, 0x2, 0x2, 0x286, 0x287, 0x3, 0x2, 0x2, 0x2, 0x287, 0x289, 0x3, - 0x2, 0x2, 0x2, 0x288, 0x28a, 0x5, 0x2c, 0x17, 0x2, 0x289, 0x288, 0x3, - 0x2, 0x2, 0x2, 0x289, 0x28a, 0x3, 0x2, 0x2, 0x2, 0x28a, 0x28c, 0x3, - 0x2, 0x2, 0x2, 0x28b, 0x28d, 0x5, 0x34, 0x1b, 0x2, 0x28c, 0x28b, 0x3, - 0x2, 0x2, 0x2, 0x28c, 0x28d, 0x3, 0x2, 0x2, 0x2, 0x28d, 0x28e, 0x3, - 0x2, 0x2, 0x2, 0x28e, 0x28f, 0x5, 0x32, 0x1a, 0x2, 0x28f, 0x291, 0x3, - 0x2, 0x2, 0x2, 0x290, 0x207, 0x3, 0x2, 0x2, 0x2, 0x290, 0x215, 0x3, - 0x2, 0x2, 0x2, 0x290, 0x226, 0x3, 0x2, 0x2, 0x2, 0x290, 0x244, 0x3, - 0x2, 0x2, 0x2, 0x290, 0x25f, 0x3, 0x2, 0x2, 0x2, 0x290, 0x279, 0x3, - 0x2, 0x2, 0x2, 0x291, 0x17, 0x3, 0x2, 0x2, 0x2, 0x292, 0x293, 0x7, 0xd0, - 0x2, 0x2, 0x293, 0x298, 0x5, 0x1a, 0xe, 0x2, 0x294, 0x295, 0x7, 0xc5, - 0x2, 0x2, 0x295, 0x297, 0x5, 0x1a, 0xe, 0x2, 0x296, 0x294, 0x3, 0x2, - 0x2, 0x2, 0x297, 0x29a, 0x3, 0x2, 0x2, 0x2, 0x298, 0x296, 0x3, 0x2, - 0x2, 0x2, 0x298, 0x299, 0x3, 0x2, 0x2, 0x2, 0x299, 0x29b, 0x3, 0x2, - 0x2, 0x2, 0x29a, 0x298, 0x3, 0x2, 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x2, 0x2, - 0x302, 0x305, 0x3, 0x2, 0x2, 0x2, 0x303, 0x301, 0x3, 0x2, 0x2, 0x2, - 0x303, 0x304, 0x3, 0x2, 0x2, 0x2, 0x304, 0x306, 0x3, 0x2, 0x2, 0x2, - 0x305, 0x303, 0x3, 0x2, 0x2, 0x2, 0x306, 0x307, 0x7, 0xda, 0x2, 0x2, - 0x307, 0x308, 0x7, 0xda, 0x2, 0x2, 0x308, 0x27, 0x3, 0x2, 0x2, 0x2, - 0x309, 0x30a, 0x7, 0x82, 0x2, 0x2, 0x30a, 0x315, 0x7, 0xd0, 0x2, 0x2, - 0x30b, 0x30c, 0x7, 0x6a, 0x2, 0x2, 0x30c, 0x30d, 0x5, 0xd6, 0x6c, 0x2, - 0x30d, 0x30e, 0x7, 0x68, 0x2, 0x2, 0x30e, 0x30f, 0x5, 0xd6, 0x6c, 0x2, - 0x30f, 0x316, 0x3, 0x2, 0x2, 0x2, 0x310, 0x311, 0x7, 0x68, 0x2, 0x2, - 0x311, 0x312, 0x5, 0xd6, 0x6c, 0x2, 0x312, 0x313, 0x7, 0x6a, 0x2, 0x2, - 0x313, 0x314, 0x5, 0xd6, 0x6c, 0x2, 0x314, 0x316, 0x3, 0x2, 0x2, 0x2, - 0x315, 0x30b, 0x3, 0x2, 0x2, 0x2, 0x315, 0x310, 0x3, 0x2, 0x2, 0x2, - 0x316, 0x317, 0x3, 0x2, 0x2, 0x2, 0x317, 0x318, 0x7, 0xda, 0x2, 0x2, - 0x318, 0x29, 0x3, 0x2, 0x2, 0x2, 0x319, 0x31a, 0x7, 0x91, 0x2, 0x2, - 0x31a, 0x31b, 0x7, 0xd0, 0x2, 0x2, 0x31b, 0x31c, 0x5, 0x9a, 0x4e, 0x2, - 0x31c, 0x31d, 0x7, 0xda, 0x2, 0x2, 0x31d, 0x2b, 0x3, 0x2, 0x2, 0x2, - 0x31e, 0x31f, 0x7, 0x76, 0x2, 0x2, 0x31f, 0x322, 0x7, 0x19, 0x2, 0x2, - 0x320, 0x323, 0x5, 0xd6, 0x6c, 0x2, 0x321, 0x323, 0x7, 0xbf, 0x2, 0x2, - 0x322, 0x320, 0x3, 0x2, 0x2, 0x2, 0x322, 0x321, 0x3, 0x2, 0x2, 0x2, - 0x323, 0x2d, 0x3, 0x2, 0x2, 0x2, 0x324, 0x325, 0x7, 0xae, 0x2, 0x2, - 0x325, 0x326, 0x7, 0xbf, 0x2, 0x2, 0x326, 0x2f, 0x3, 0x2, 0x2, 0x2, - 0x327, 0x328, 0x7, 0xa2, 0x2, 0x2, 0x328, 0x329, 0x5, 0xc0, 0x61, 0x2, - 0x329, 0x31, 0x3, 0x2, 0x2, 0x2, 0x32a, 0x32b, 0x7, 0xc, 0x2, 0x2, 0x32b, - 0x32c, 0x5, 0x68, 0x35, 0x2, 0x32c, 0x33, 0x3, 0x2, 0x2, 0x2, 0x32d, - 0x32e, 0x7, 0xd0, 0x2, 0x2, 0x32e, 0x333, 0x5, 0x42, 0x22, 0x2, 0x32f, - 0x330, 0x7, 0xc5, 0x2, 0x2, 0x330, 0x332, 0x5, 0x42, 0x22, 0x2, 0x331, - 0x32f, 0x3, 0x2, 0x2, 0x2, 0x332, 0x335, 0x3, 0x2, 0x2, 0x2, 0x333, - 0x331, 0x3, 0x2, 0x2, 0x2, 0x333, 0x334, 0x3, 0x2, 0x2, 0x2, 0x334, - 0x336, 0x3, 0x2, 0x2, 0x2, 0x335, 0x333, 0x3, 0x2, 0x2, 0x2, 0x336, - 0x337, 0x7, 0xda, 0x2, 0x2, 0x337, 0x33d, 0x3, 0x2, 0x2, 0x2, 0x338, - 0x339, 0x7, 0xc, 0x2, 0x2, 0x339, 0x33d, 0x5, 0xc0, 0x61, 0x2, 0x33a, - 0x33b, 0x7, 0xc, 0x2, 0x2, 0x33b, 0x33d, 0x5, 0xbe, 0x60, 0x2, 0x33c, - 0x32d, 0x3, 0x2, 0x2, 0x2, 0x33c, 0x338, 0x3, 0x2, 0x2, 0x2, 0x33c, - 0x33a, 0x3, 0x2, 0x2, 0x2, 0x33d, 0x35, 0x3, 0x2, 0x2, 0x2, 0x33e, 0x359, - 0x5, 0x40, 0x21, 0x2, 0x33f, 0x340, 0x6, 0x1c, 0xc, 0x3, 0x340, 0x341, - 0x5, 0x7e, 0x40, 0x2, 0x341, 0x342, 0x8, 0x1c, 0x1, 0x2, 0x342, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x343, 0x344, 0x6, 0x1c, 0xd, 0x3, 0x344, 0x345, - 0x5, 0x38, 0x1d, 0x2, 0x345, 0x346, 0x8, 0x1c, 0x1, 0x2, 0x346, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x347, 0x348, 0x6, 0x1c, 0xe, 0x3, 0x348, 0x349, - 0x5, 0x3a, 0x1e, 0x2, 0x349, 0x34a, 0x8, 0x1c, 0x1, 0x2, 0x34a, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x34b, 0x34c, 0x6, 0x1c, 0xf, 0x3, 0x34c, 0x34d, - 0x5, 0x3c, 0x1f, 0x2, 0x34d, 0x34e, 0x8, 0x1c, 0x1, 0x2, 0x34e, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x34f, 0x350, 0x6, 0x1c, 0x10, 0x3, 0x350, 0x351, - 0x5, 0x3e, 0x20, 0x2, 0x351, 0x352, 0x8, 0x1c, 0x1, 0x2, 0x352, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x353, 0x354, 0x6, 0x1c, 0x11, 0x3, 0x354, 0x355, - 0x5, 0x86, 0x44, 0x2, 0x355, 0x356, 0x8, 0x1c, 0x1, 0x2, 0x356, 0x358, - 0x3, 0x2, 0x2, 0x2, 0x357, 0x33f, 0x3, 0x2, 0x2, 0x2, 0x357, 0x343, - 0x3, 0x2, 0x2, 0x2, 0x357, 0x347, 0x3, 0x2, 0x2, 0x2, 0x357, 0x34b, - 0x3, 0x2, 0x2, 0x2, 0x357, 0x34f, 0x3, 0x2, 0x2, 0x2, 0x357, 0x353, - 0x3, 0x2, 0x2, 0x2, 0x358, 0x35b, 0x3, 0x2, 0x2, 0x2, 0x359, 0x357, - 0x3, 0x2, 0x2, 0x2, 0x359, 0x35a, 0x3, 0x2, 0x2, 0x2, 0x35a, 0x37, 0x3, - 0x2, 0x2, 0x2, 0x35b, 0x359, 0x3, 0x2, 0x2, 0x2, 0x35c, 0x35d, 0x7, - 0x7c, 0x2, 0x2, 0x35d, 0x35e, 0x7, 0x14, 0x2, 0x2, 0x35e, 0x35f, 0x5, - 0xb0, 0x59, 0x2, 0x35f, 0x39, 0x3, 0x2, 0x2, 0x2, 0x360, 0x361, 0x7, - 0x7f, 0x2, 0x2, 0x361, 0x362, 0x7, 0x5a, 0x2, 0x2, 0x362, 0x363, 0x5, - 0xb0, 0x59, 0x2, 0x363, 0x3b, 0x3, 0x2, 0x2, 0x2, 0x364, 0x365, 0x7, - 0x8b, 0x2, 0x2, 0x365, 0x366, 0x7, 0x14, 0x2, 0x2, 0x366, 0x367, 0x5, - 0xb0, 0x59, 0x2, 0x367, 0x3d, 0x3, 0x2, 0x2, 0x2, 0x368, 0x369, 0x7, - 0xa8, 0x2, 0x2, 0x369, 0x36e, 0x5, 0x50, 0x29, 0x2, 0x36a, 0x36b, 0x7, - 0xc5, 0x2, 0x2, 0x36b, 0x36d, 0x5, 0x50, 0x29, 0x2, 0x36c, 0x36a, 0x3, - 0x2, 0x2, 0x2, 0x36d, 0x370, 0x3, 0x2, 0x2, 0x2, 0x36e, 0x36c, 0x3, - 0x2, 0x2, 0x2, 0x36e, 0x36f, 0x3, 0x2, 0x2, 0x2, 0x36f, 0x3f, 0x3, 0x2, - 0x2, 0x2, 0x370, 0x36e, 0x3, 0x2, 0x2, 0x2, 0x371, 0x373, 0x7, 0x36, - 0x2, 0x2, 0x372, 0x374, 0x7, 0xca, 0x2, 0x2, 0x373, 0x372, 0x3, 0x2, - 0x2, 0x2, 0x373, 0x374, 0x3, 0x2, 0x2, 0x2, 0x374, 0x375, 0x3, 0x2, - 0x2, 0x2, 0x375, 0x37b, 0x5, 0xd8, 0x6d, 0x2, 0x376, 0x378, 0x7, 0xd0, - 0x2, 0x2, 0x377, 0x379, 0x5, 0xac, 0x57, 0x2, 0x378, 0x377, 0x3, 0x2, - 0x2, 0x2, 0x378, 0x379, 0x3, 0x2, 0x2, 0x2, 0x379, 0x37a, 0x3, 0x2, - 0x2, 0x2, 0x37a, 0x37c, 0x7, 0xda, 0x2, 0x2, 0x37b, 0x376, 0x3, 0x2, - 0x2, 0x2, 0x37b, 0x37c, 0x3, 0x2, 0x2, 0x2, 0x37c, 0x41, 0x3, 0x2, 0x2, - 0x2, 0x37d, 0x388, 0x5, 0x44, 0x23, 0x2, 0x37e, 0x37f, 0x7, 0x1e, 0x2, - 0x2, 0x37f, 0x380, 0x5, 0xd6, 0x6c, 0x2, 0x380, 0x381, 0x7, 0x17, 0x2, - 0x2, 0x381, 0x382, 0x5, 0xb0, 0x59, 0x2, 0x382, 0x388, 0x3, 0x2, 0x2, - 0x2, 0x383, 0x384, 0x7, 0x50, 0x2, 0x2, 0x384, 0x388, 0x5, 0x48, 0x25, - 0x2, 0x385, 0x386, 0x7, 0x80, 0x2, 0x2, 0x386, 0x388, 0x5, 0x4a, 0x26, - 0x2, 0x387, 0x37d, 0x3, 0x2, 0x2, 0x2, 0x387, 0x37e, 0x3, 0x2, 0x2, - 0x2, 0x387, 0x383, 0x3, 0x2, 0x2, 0x2, 0x387, 0x385, 0x3, 0x2, 0x2, - 0x2, 0x388, 0x43, 0x3, 0x2, 0x2, 0x2, 0x389, 0x38a, 0x5, 0xba, 0x5e, - 0x2, 0x38a, 0x38c, 0x5, 0xaa, 0x56, 0x2, 0x38b, 0x38d, 0x5, 0x46, 0x24, - 0x2, 0x38c, 0x38b, 0x3, 0x2, 0x2, 0x2, 0x38c, 0x38d, 0x3, 0x2, 0x2, - 0x2, 0x38d, 0x390, 0x3, 0x2, 0x2, 0x2, 0x38e, 0x38f, 0x7, 0x1d, 0x2, - 0x2, 0x38f, 0x391, 0x7, 0xbf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, 0x40a, 0x400, 0x3, - 0x2, 0x2, 0x2, 0x40b, 0x57, 0x3, 0x2, 0x2, 0x2, 0x40c, 0x40d, 0x7, 0x39, - 0x2, 0x2, 0x40d, 0x40e, 0x7, 0xf, 0x2, 0x2, 0x40e, 0x413, 0x5, 0x4, - 0x3, 0x2, 0x40f, 0x410, 0x7, 0x39, 0x2, 0x2, 0x410, 0x411, 0x7, 0x98, - 0x2, 0x2, 0x411, 0x413, 0x5, 0x4, 0x3, 0x2, 0x412, 0x40c, 0x3, 0x2, - 0x2, 0x2, 0x412, 0x40f, 0x3, 0x2, 0x2, 0x2, 0x413, 0x59, 0x3, 0x2, 0x2, - 0x2, 0x414, 0x415, 0x7, 0x54, 0x2, 0x2, 0x415, 0x417, 0x7, 0x56, 0x2, - 0x2, 0x416, 0x418, 0x7, 0x9a, 0x2, 0x2, 0x417, 0x416, 0x3, 0x2, 0x2, - 0x2, 0x417, 0x418, 0x3, 0x2, 0x2, 0x2, 0x418, 0x41c, 0x3, 0x2, 0x2, - 0x2, 0x419, 0x41d, 0x5, 0xc0, 0x61, 0x2, 0x41a, 0x41b, 0x7, 0x45, 0x2, - 0x2, 0x41b, 0x41d, 0x5, 0xbe, 0x60, 0x2, 0x41c, 0x419, 0x3, 0x2, 0x2, - 0x2, 0x41c, 0x41a, 0x3, 0x2, 0x2, 0x2, 0x41d, 0x41f, 0x3, 0x2, 0x2, - 0x2, 0x41e, 0x420, 0x5, 0x5c, 0x2f, 0x2, 0x41f, 0x41e, 0x3, 0x2, 0x2, - 0x2, 0x41f, 0x420, 0x3, 0x2, 0x2, 0x2, 0x420, 0x421, 0x3, 0x2, 0x2, - 0x2, 0x421, 0x422, 0x5, 0x5e, 0x30, 0x2, 0x422, 0x5b, 0x3, 0x2, 0x2, - 0x2, 0x423, 0x424, 0x7, 0xd0, 0x2, 0x2, 0x424, 0x429, 0x5, 0xba, 0x5e, - 0x2, 0x425, 0x426, 0x7, 0xc5, 0x2, 0x2, 0x426, 0x428, 0x5, 0xba, 0x5e, - 0x2, 0x427, 0x425, 0x3, 0x2, 0x2, 0x2, 0x428, 0x42b, 0x3, 0x2, 0x2, - 0x2, 0x429, 0x427, 0x3, 0x2, 0x2, 0x2, 0x429, 0x42a, 0x3, 0x2, 0x2, - 0x2, 0x42a, 0x42c, 0x3, 0x2, 0x2, 0x2, 0x42b, 0x429, 0x3, 0x2, 0x2, - 0x2, 0x42c, 0x42d, 0x7, 0xda, 0x2, 0x2, 0x42d, 0x5d, 0x3, 0x2, 0x2, - 0x2, 0x42e, 0x42f, 0x7, 0x41, 0x2, 0x2, 0x42f, 0x438, 0x5, 0xd6, 0x6c, - 0x2, 0x430, 0x438, 0x7, 0xaf, 0x2, 0x2, 0x431, 0x433, 0x5, 0x68, 0x35, - 0x2, 0x432, 0x434, 0x7, 0xdb, 0x2, 0x2, 0x433, 0x432, 0x3, 0x2, 0x2, - 0x2, 0x433, 0x434, 0x3, 0x2, 0x2, 0x2, 0x434, 0x435, 0x3, 0x2, 0x2, - 0x2, 0x435, 0x436, 0x7, 0x2, 0x2, 0x3, 0x436, 0x438, 0x3, 0x2, 0x2, - 0x2, 0x437, 0x42e, 0x3, 0x2, 0x2, 0x2, 0x437, 0x430, 0x3, 0x2, 0x2, - 0x2, 0x437, 0x431, 0x3, 0x2, 0x2, 0x2, 0x438, 0x5f, 0x3, 0x2, 0x2, 0x2, - 0x439, 0x43a, 0x7, 0x5b, 0x2, 0x2, 0x43a, 0x43c, 0x7, 0x6f, 0x2, 0x2, - 0x43b, 0x43d, 0x5, 0x2c, 0x17, 0x2, 0x43c, 0x43b, 0x3, 0x2, 0x2, 0x2, - 0x43c, 0x43d, 0x3, 0x2, 0x2, 0x2, 0x43d, 0x43e, 0x3, 0x2, 0x2, 0x2, - 0x43e, 0x440, 0x5, 0x78, 0x3d, 0x2, 0x43f, 0x441, 0x9, 0x7, 0x2, 0x2, - 0x440, 0x43f, 0x3, 0x2, 0x2, 0x2, 0x440, 0x441, 0x3, 0x2, 0x2, 0x2, - 0x441, 0x61, 0x3, 0x2, 0x2, 0x2, 0x442, 0x443, 0x7, 0x77, 0x2, 0x2, - 0x443, 0x444, 0x7, 0x9a, 0x2, 0x2, 0x444, 0x446, 0x5, 0xc0, 0x61, 0x2, - 0x445, 0x447, 0x5, 0x2c, 0x17, 0x2, 0x446, 0x445, 0x3, 0x2, 0x2, 0x2, - 0x446, 0x447, 0x3, 0x2, 0x2, 0x2, 0x447, 0x449, 0x3, 0x2, 0x2, 0x2, - 0x448, 0x44a, 0x5, 0x10, 0x9, 0x2, 0x449, 0x448, 0x3, 0x2, 0x2, 0x2, - 0x449, 0x44a, 0x3, 0x2, 0x2, 0x2, 0x44a, 0x44c, 0x3, 0x2, 0x2, 0x2, - 0x44b, 0x44d, 0x7, 0x3d, 0x2, 0x2, 0x44c, 0x44b, 0x3, 0x2, 0x2, 0x2, - 0x44c, 0x44d, 0x3, 0x2, 0x2, 0x2, 0x44d, 0x44f, 0x3, 0x2, 0x2, 0x2, - 0x44e, 0x450, 0x7, 0x26, 0x2, 0x2, 0x44f, 0x44e, 0x3, 0x2, 0x2, 0x2, - 0x44f, 0x450, 0x3, 0x2, 0x2, 0x2, 0x450, 0x63, 0x3, 0x2, 0x2, 0x2, 0x451, - 0x452, 0x7, 0x85, 0x2, 0x2, 0x452, 0x453, 0x7, 0x9a, 0x2, 0x2, 0x453, - 0x454, 0x5, 0xc0, 0x61, 0x2, 0x454, 0x455, 0x7, 0xa2, 0x2, 0x2, 0x455, - 0x45d, 0x5, 0xc0, 0x61, 0x2, 0x456, 0x457, 0x7, 0xc5, 0x2, 0x2, 0x457, - 0x458, 0x5, 0xc0, 0x61, 0x2, 0x458, 0x459, 0x7, 0xa2, 0x2, 0x2, 0x459, - 0x45a, 0x5, 0xc0, 0x61, 0x2, 0x45a, 0x45c, 0x3, 0x2, 0x2, 0x2, 0x45b, - 0x456, 0x3, 0x2, 0x2, 0x2, 0x45c, 0x45f, 0x3, 0x2, 0x2, 0x2, 0x45d, - 0x45b, 0x3, 0x2, 0x2, 0x2, 0x45d, 0x45e, 0x3, 0x2, 0x2, 0x2, 0x45e, - 0x461, 0x3, 0x2, 0x2, 0x2, 0x45f, 0x45d, 0x3, 0x2, 0x2, 0x2, 0x460, - 0x462, 0x5, 0x2c, 0x17, 0x2, 0x461, 0x460, 0x3, 0x2, 0x2, 0x2, 0x461, - 0x462, 0x3, 0x2, 0x2, 0x2, 0x462, 0x65, 0x3, 0x2, 0x2, 0x2, 0x463, 0x465, - 0x7, 0xd0, 0x2, 0x2, 0x464, 0x466, 0x5, 0x6e, 0x38, 0x2, 0x465, 0x464, - 0x3, 0x2, 0x2, 0x2, 0x465, 0x466, 0x3, 0x2, 0x2, 0x2, 0x466, 0x467, - 0x3, 0x2, 0x2, 0x2, 0x467, 0x468, 0x7, 0x8d, 0x2, 0x2, 0x468, 0x46a, - 0x5, 0xac, 0x57, 0x2, 0x469, 0x46b, 0x5, 0x7a, 0x3e, 0x2, 0x46a, 0x469, - 0x3, 0x2, 0x2, 0x2, 0x46a, 0x46b, 0x3, 0x2, 0x2, 0x2, 0x46b, 0x46d, - 0x3, 0x2, 0x2, 0x2, 0x46c, 0x46e, 0x5, 0x80, 0x41, 0x2, 0x46d, 0x46c, - 0x3, 0x2, 0x2, 0x2, 0x46d, 0x46e, 0x3, 0x2, 0x2, 0x2, 0x46e, 0x46f, - 0x3, 0x2, 0x2, 0x2, 0x46f, 0x470, 0x7, 0xda, 0x2, 0x2, 0x470, 0x67, - 0x3, 0x2, 0x2, 0x2, 0x471, 0x477, 0x5, 0x6a, 0x36, 0x2, 0x472, 0x473, - 0x7, 0xaa, 0x2, 0x2, 0x473, 0x474, 0x7, 0x6, 0x2, 0x2, 0x474, 0x476, - 0x5, 0x6a, 0x36, 0x2, 0x475, 0x472, 0x3, 0x2, 0x2, 0x2, 0x476, 0x479, - 0x3, 0x2, 0x2, 0x2, 0x477, 0x475, 0x3, 0x2, 0x2, 0x2, 0x477, 0x478, - 0x3, 0x2, 0x2, 0x2, 0x478, 0x69, 0x3, 0x2, 0x2, 0x2, 0x479, 0x477, 0x3, - 0x2, 0x2, 0x2, 0x47a, 0x480, 0x5, 0x6c, 0x37, 0x2, 0x47b, 0x47c, 0x7, - 0xd0, 0x2, 0x2, 0x47c, 0x47d, 0x5, 0x68, 0x35, 0x2, 0x47d, 0x47e, 0x7, - 0xda, 0x2, 0x2, 0x47e, 0x480, 0x3, 0x2, 0x2, 0x2, 0x47f, 0x47a, 0x3, - 0x2, 0x2, 0x2, 0x47f, 0x47b, 0x3, 0x2, 0x2, 0x2, 0x480, 0x6b, 0x3, 0x2, - 0x2, 0x2, 0x481, 0x483, 0x5, 0x6e, 0x38, 0x2, 0x482, 0x481, 0x3, 0x2, - 0x2, 0x2, 0x482, 0x483, 0x3, 0x2, 0x2, 0x2, 0x483, 0x484, 0x3, 0x2, - 0x2, 0x2, 0x484, 0x486, 0x7, 0x8d, 0x2, 0x2, 0x485, 0x487, 0x7, 0x31, - 0x2, 0x2, 0x486, 0x485, 0x3, 0x2, 0x2, 0x2, 0x486, 0x487, 0x3, 0x2, - 0x2, 0x2, 0x487, 0x489, 0x3, 0x2, 0x2, 0x2, 0x488, 0x48a, 0x5, 0x70, - 0x39, 0x2, 0x489, 0x488, 0x3, 0x2, 0x2, 0x2, 0x489, 0x48a, 0x3, 0x2, - 0x2, 0x2, 0x48a, 0x48b, 0x3, 0x2, 0x2, 0x2, 0x48b, 0x48d, 0x5, 0xac, - 0x57, 0x2, 0x48c, 0x48e, 0x5, 0x72, 0x3a, 0x2, 0x48d, 0x48c, 0x3, 0x2, - 0x2, 0x2, 0x48d, 0x48e, 0x3, 0x2, 0x2, 0x2, 0x48e, 0x490, 0x3, 0x2, - 0x2, 0x2, 0x48f, 0x491, 0x5, 0x74, 0x3b, 0x2, 0x490, 0x48f, 0x3, 0x2, - 0x2, 0x2, 0x490, 0x491, 0x3, 0x2, 0x2, 0x2, 0x491, 0x493, 0x3, 0x2, - 0x2, 0x2, 0x492,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 0x2, 0x2, 0x2, 0x4fa, 0x4f6, 0x3, 0x2, 0x2, 0x2, 0x4fb, 0x50d, 0x3, - 0x2, 0x2, 0x2, 0x4fc, 0x4fd, 0xc, 0x5, 0x2, 0x2, 0x4fd, 0x4fe, 0x5, - 0x8c, 0x47, 0x2, 0x4fe, 0x4ff, 0x5, 0x88, 0x45, 0x6, 0x4ff, 0x50c, 0x3, - 0x2, 0x2, 0x2, 0x500, 0x502, 0xc, 0x6, 0x2, 0x2, 0x501, 0x503, 0x9, - 0xa, 0x2, 0x2, 0x502, 0x501, 0x3, 0x2, 0x2, 0x2, 0x502, 0x503, 0x3, - 0x2, 0x2, 0x2, 0x503, 0x505, 0x3, 0x2, 0x2, 0x2, 0x504, 0x506, 0x5, - 0x8a, 0x46, 0x2, 0x505, 0x504, 0x3, 0x2, 0x2, 0x2, 0x505, 0x506, 0x3, - 0x2, 0x2, 0x2, 0x506, 0x507, 0x3, 0x2, 0x2, 0x2, 0x507, 0x508, 0x7, - 0x59, 0x2, 0x2, 0x508, 0x509, 0x5, 0x88, 0x45, 0x2, 0x509, 0x50a, 0x5, - 0x8e, 0x48, 0x2, 0x50a, 0x50c, 0x3, 0x2, 0x2, 0x2, 0x50b, 0x4fc, 0x3, - 0x2, 0x2, 0x2, 0x50b, 0x500, 0x3, 0x2, 0x2, 0x2, 0x50c, 0x50f, 0x3, - 0x2, 0x2, 0x2, 0x50d, 0x50b, 0x3, 0x2, 0x2, 0x2, 0x50d, 0x50e, 0x3, - 0x2, 0x2, 0x2, 0x50e, 0x89, 0x3, 0x2, 0x2, 0x2, 0x50f, 0x50d, 0x3, 0x2, - 0x2, 0x2, 0x510, 0x512, 0x9, 0xb, 0x2, 0x2, 0x511, 0x510, 0x3, 0x2, - 0x2, 0x2, 0x511, 0x512, 0x3, 0x2, 0x2, 0x2, 0x512, 0x513, 0x3, 0x2, - 0x2, 0x2, 0x513, 0x51a, 0x7, 0x53, 0x2, 0x2, 0x514, 0x516, 0x7, 0x53, - 0x2, 0x2, 0x515, 0x517, 0x9, 0xb, 0x2, 0x2, 0x516, 0x515, 0x3, 0x2, - 0x2, 0x2, 0x516, 0x517, 0x3, 0x2, 0x2, 0x2, 0x517, 0x51a, 0x3, 0x2, - 0x2, 0x2, 0x518, 0x51a, 0x9, 0xb, 0x2, 0x2, 0x519, 0x511, 0x3, 0x2, - 0x2, 0x2, 0x519, 0x514, 0x3, 0x2, 0x2, 0x2, 0x519, 0x518, 0x3, 0x2, - 0x2, 0x2, 0x51a, 0x53c, 0x3, 0x2, 0x2, 0x2, 0x51b, 0x51d, 0x9, 0xc, - 0x2, 0x2, 0x51c, 0x51b, 0x3, 0x2, 0x2, 0x2, 0x51c, 0x51d, 0x3, 0x2, - 0x2, 0x2, 0x51d, 0x51e, 0x3, 0x2, 0x2, 0x2, 0x51e, 0x520, 0x9, 0xd, - 0x2, 0x2, 0x51f, 0x521, 0x7, 0x7a, 0x2, 0x2, 0x520, 0x51f, 0x3, 0x2, - 0x2, 0x2, 0x520, 0x521, 0x3, 0x2, 0x2, 0x2, 0x521, 0x52a, 0x3, 0x2, - 0x2, 0x2, 0x522, 0x524, 0x9, 0xd, 0x2, 0x2, 0x523, 0x525, 0x7, 0x7a, - 0x2, 0x2, 0x524, 0x523, 0x3, 0x2, 0x2, 0x2, 0x524, 0x525, 0x3, 0x2, - 0x2, 0x2, 0x525, 0x527, 0x3, 0x2, 0x2, 0x2, 0x526, 0x528, 0x9, 0xc, - 0x2, 0x2, 0x527, 0x526, 0x3, 0x2, 0x2, 0x2, 0x527, 0x528, 0x3, 0x2, - 0x2, 0x2, 0x528, 0x52a, 0x3, 0x2, 0x2, 0x2, 0x529, 0x51c, 0x3, 0x2, - 0x2, 0x2, 0x529, 0x522, 0x3, 0x2, 0x2, 0x2, 0x52a, 0x53c, 0x3, 0x2, - 0x2, 0x2, 0x52b, 0x52d, 0x9, 0xe, 0x2, 0x2, 0x52c, 0x52b, 0x3, 0x2, - 0x2, 0x2, 0x52c, 0x52d, 0x3, 0x2, 0x2, 0x2, 0x52d, 0x52e, 0x3, 0x2, - 0x2, 0x2, 0x52e, 0x530, 0x7, 0x44, 0x2, 0x2, 0x52f, 0x531, 0x7, 0x7a, - 0x2, 0x2, 0x530, 0x52f, 0x3, 0x2, 0x2, 0x2, 0x530, 0x531, 0x3, 0x2, - 0x2, 0x2, 0x531, 0x53a, 0x3, 0x2, 0x2, 0x2, 0x532, 0x534, 0x7, 0x44, - 0x2, 0x2, 0x533, 0x535, 0x7, 0x7a, 0x2, 0x2, 0x534, 0x533, 0x3, 0x2, - 0x2, 0x2, 0x534, 0x535, 0x3, 0x2, 0x2, 0x2, 0x535, 0x537, 0x3, 0x2, - 0x2, 0x2, 0x536, 0x538, 0x9, 0xe, 0x2, 0x2, 0x537, 0x536, 0x3, 0x2, - 0x2, 0x2, 0x537, 0x538, 0x3, 0x2, 0x2, 0x2, 0x538, 0x53a, 0x3, 0x2, - 0x2, 0x2, 0x539, 0x52c, 0x3, 0x2, 0x2, 0x2, 0x539, 0x532, 0x3, 0x2, - 0x2, 0x2, 0x53a, 0x53c, 0x3, 0x2, 0x2, 0x2, 0x53b, 0x519, 0x3, 0x2, - 0x2, 0x2, 0x53b, 0x529, 0x3, 0x2, 0x2, 0x2, 0x53b, 0x539, 0x3, 0x2, - 0x2, 0x2, 0x53c, 0x8b, 0x3, 0x2, 0x2, 0x2, 0x53d, 0x53f, 0x9, 0xa, 0x2, - 0x2, 0x53e, 0x53d, 0x3, 0x2, 0x2, 0x2, 0x53e, 0x53f, 0x3, 0x2, 0x2, - 0x2, 0x53f, 0x540, 0x3, 0x2, 0x2, 0x2, 0x540, 0x541, 0x7, 0x20, 0x2, - 0x2, 0x541, 0x544, 0x7, 0x59, 0x2, 0x2, 0x542, 0x544, 0x7, 0xc5, 0x2, - 0x2, 0x543, 0x53e, 0x3, 0x2, 0x2, 0x2, 0x543, 0x542, 0x3, 0x2, 0x2, - 0x2, 0x544, 0x8d, 0x3, 0x2, 0x2, 0x2, 0x545, 0x546, 0x7, 0x76, 0x2, - 0x2, 0x546, 0x54f, 0x5, 0xac, 0x57, 0x2, 0x547, 0x548, 0x7, 0xad, 0x2, - 0x2, 0x548, 0x549, 0x7, 0xd0, 0x2, 0x2, 0x549, 0x54a, 0x5, 0xac, 0x57, - 0x2, 0x54a, 0x54b, 0x7, 0xda, 0x2, 0x2, 0x54b, 0x54f, 0x3, 0x2, 0x2, - 0x2, 0x54c, 0x54d, 0x7, 0xad, 0x2, 0x2, 0x54d, 0x54f, 0x5, 0xac, 0x57, - 0x2, 0x54e, 0x545, 0x3, 0x2, 0x2, 0x2, 0x54e, 0x547, 0x3, 0x2, 0x2, - 0x2, 0x54e, 0x54c, 0x3, 0x2, 0x2, 0x2, 0x54f, 0x8f, 0x3, 0x2, 0x2, 0x2, - 0x550, 0x551, 0x7, 0x8b, 0x2, 0x2, 0x551, 0x554, 0x5, 0x98, 0x4d, 0x2, - 0x552, 0x553, 0x7, 0x75, 0x2, 0x2, 0x553, 0x555, 0x5, 0x98, 0x4d, 0x2, - 0x554, 0x552, 0x3, 0x2, 0x2, 0x2, 0x554, 0x555, 0x3, 0x2, 0x2, 0x2, - 0x555, 0x91, 0x3, 0x2, 0x2, 0x2, 0x556, 0x559, 0x5, 0xb0, 0x59, 0x2, - 0x557, 0x558, 0x9, 0xf, 0x2, 0x2, 0x558, 0x55a, 0x5, 0xb0, 0x59, 0x2, - 0x559, 0x557, 0x3, 0x2, 0x2, 0x2, 0x559, 0x55a, 0x3, 0x2, 0x2, 0x2, - 0x55a, 0x93, 0x3, 0x2, 0x2, 0x2, 0x55b, 0x560, 0x5, 0x96, 0x4c, 0x2, - 0x55c, 0x55d, 0x7, 0xc5, 0x2, 0x2, 0x55d, 0x55f, 0x5, 0x96, 0x4c, 0x2, - 0x55e, 0x55c, 0x3, 0x2, 0x2, 0x2, 0x55f, 0x562, 0x3, 0x2, 0x2, 0x2, - 0x560, 0x55e, 0x3, 0x2, 0x2, 0x2, 0x560, 0x561, 0x3, 0x2, 0x2, 0x2, - 0x561, 0x95, 0x3, 0x2, 0x2, 0x2, 0x562, 0x560, 0x3, 0x2, 0x2, 0x2, 0x563, - 0x565, 0x5, 0xb0, 0x59, 0x2, 0x564, 0x566, 0x9, 0x10, 0x2, 0x2, 0x565, - 0x564, 0x3, 0x2, 0x2, 0x2, 0x565, 0x566, 0x3, 0x2, 0x2, 0x2, 0x566, - 0x569, 0x3, 0x2, 0x2, 0x2, 0x567, 0x568, 0x7, 0x74, 0x2, 0x2, 0x568, - 0x56a, 0x9, 0x11, 0x2, 0x2, 0x569, 0x567, 0x3, 0x2, 0x2, 0x2, 0x569, - 0x56a, 0x3, 0x2, 0x2, 0x2, 0x56a, 0x56d, 0x3, 0x2, 0x2, 0x2, 0x56b, - 0x56c, 0x7, 0x1b, 0x2, 0x2, 0x56c, 0x56e, 0x7, 0xbf, 0x2, 0x2, 0x56d, - 0x56b, 0x3, 0x2, 0x2, 0x2, 0x56d, 0x56e, 0x3, 0x2, 0x2, 0x2, 0x56e, - 0x97, 0x3, 0x2, 0x2, 0x2, 0x56f, 0x572, 0x5, 0xca, 0x66, 0x2, 0x570, - 0x571, 0x7, 0xdc, 0x2, 0x2, 0x571, 0x573, 0x5, 0xca, 0x66, 0x2, 0x572, - 0x570, 0x3, 0x2, 0x2, 0x2, 0x572, 0x573, 0x3, 0x2, 0x2, 0x2, 0x573, - 0x99, 0x3, 0x2, 0x2, 0x2, 0x574, 0x579, 0x5, 0x9c, 0x4f, 0x2, 0x575, - 0x576, 0x7, 0xc5, 0x2, 0x2, 0x576, 0x578, 0x5, 0x9c, 0x4f, 0x2, 0x577, - 0x575, 0x3, 0x2, 0x2, 0x2, 0x578, 0x57b, 0x3, 0x2, 0x2, 0x2, 0x579, - 0x577, 0x3, 0x2, 0x2, 0x2, 0x579, 0x57a, 0x3, 0x2, 0x2, 0x2, 0x57a, - 0x9b, 0x3, 0x2, 0x2, 0x2, 0x57b, 0x579, 0x3, 0x2, 0x2, 0x2, 0x57c, 0x57d, - 0x5, 0xd6, 0x6c, 0x2, 0x57d, 0x57e, 0x7, 0xca, 0x2, 0x2, 0x57e, 0x57f, - 0x5, 0xcc, 0x67, 0x2, 0x57f, 0x9d, 0x3, 0x2, 0x2, 0x2, 0x580, 0x581, - 0x7, 0x90, 0x2, 0x2, 0x581, 0x582, 0x5, 0x9a, 0x4e, 0x2, 0x582, 0x9f, - 0x3, 0x2, 0x2, 0x2, 0x583, 0x584, 0x7, 0x92, 0x2, 0x2, 0x584, 0x585, - 0x7, 0x1f, 0x2, 0x2, 0x585, 0x586, 0x7, 0x22, 0x2, 0x2, 0x586, 0x5ae, - 0x5, 0xc6, 0x64, 0x2, 0x587, 0x588, 0x7, 0x92, 0x2, 0x2, 0x588, 0x589, - 0x7, 0x1f, 0x2, 0x2, 0x589, 0x58a, 0x7, 0x2f, 0x2, 0x2, 0x58a, 0x5ae, - 0x5, 0xc0, 0x61, 0x2, 0x58b, 0x58c, 0x7, 0x92, 0x2, 0x2, 0x58c, 0x58e, - 0x7, 0x1f, 0x2, 0x2, 0x58d, 0x58f, 0x7, 0x9c, 0x2, 0x2, 0x58e, 0x58d, - 0x3, 0x2, 0x2, 0x2, 0x58e, 0x58f, 0x3, 0x2, 0x2, 0x2, 0x58f, 0x591, - 0x3, 0x2, 0x2, 0x2, 0x590, 0x592, 0x7, 0x9a, 0x2, 0x2, 0x591, 0x590, - 0x3, 0x2, 0x2, 0x2, 0x591, 0x592, 0x3, 0x2, 0x2, 0x2, 0x592, 0x593, - 0x3, 0x2, 0x2, 0x2, 0x593, 0x5ae, 0x5, 0xc0, 0x61, 0x2, 0x594, 0x595, - 0x7, 0x92, 0x2, 0x2, 0x595, 0x5ae, 0x7, 0x23, 0x2, 0x2, 0x596, 0x597, - 0x7, 0x92, 0x2, 0x2, 0x597, 0x59a, 0x7, 0x2e, 0x2, 0x2, 0x598, 0x599, - 0x7, 0x43, 0x2, 0x2, 0x599, 0x59b, 0x5, 0xc6, 0x64, 0x2, 0x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 0x2, - 0x2, 0x2, 0x614, 0x615, 0x7, 0xda, 0x2, 0x2, 0x615, 0x61e, 0x3, 0x2, - 0x2, 0x2, 0x616, 0x617, 0x5, 0xd6, 0x6c, 0x2, 0x617, 0x619, 0x7, 0xd0, - 0x2, 0x2, 0x618, 0x61a, 0x5, 0xac, 0x57, 0x2, 0x619, 0x618, 0x3, 0x2, - 0x2, 0x2, 0x619, 0x61a, 0x3, 0x2, 0x2, 0x2, 0x61a, 0x61b, 0x3, 0x2, - 0x2, 0x2, 0x61b, 0x61c, 0x7, 0xda, 0x2, 0x2, 0x61c, 0x61e, 0x3, 0x2, - 0x2, 0x2, 0x61d, 0x5ee, 0x3, 0x2, 0x2, 0x2, 0x61d, 0x5ef, 0x3, 0x2, - 0x2, 0x2, 0x61d, 0x5fe, 0x3, 0x2, 0x2, 0x2, 0x61d, 0x60a, 0x3, 0x2, - 0x2, 0x2, 0x61d, 0x616, 0x3, 0x2, 0x2, 0x2, 0x61e, 0xab, 0x3, 0x2, 0x2, - 0x2, 0x61f, 0x624, 0x5, 0xae, 0x58, 0x2, 0x620, 0x621, 0x7, 0xc5, 0x2, - 0x2, 0x621, 0x623, 0x5, 0xae, 0x58, 0x2, 0x622, 0x620, 0x3, 0x2, 0x2, - 0x2, 0x623, 0x626, 0x3, 0x2, 0x2, 0x2, 0x624, 0x622, 0x3, 0x2, 0x2, - 0x2, 0x624, 0x625, 0x3, 0x2, 0x2, 0x2, 0x625, 0xad, 0x3, 0x2, 0x2, 0x2, - 0x626, 0x624, 0x3, 0x2, 0x2, 0x2, 0x627, 0x628, 0x5, 0xc0, 0x61, 0x2, - 0x628, 0x629, 0x7, 0xc8, 0x2, 0x2, 0x629, 0x62b, 0x3, 0x2, 0x2, 0x2, - 0x62a, 0x627, 0x3, 0x2, 0x2, 0x2, 0x62a, 0x62b, 0x3, 0x2, 0x2, 0x2, - 0x62b, 0x62c, 0x3, 0x2, 0x2, 0x2, 0x62c, 0x633, 0x7, 0xc1, 0x2, 0x2, - 0x62d, 0x62e, 0x7, 0xd0, 0x2, 0x2, 0x62e, 0x62f, 0x5, 0x68, 0x35, 0x2, - 0x62f, 0x630, 0x7, 0xda, 0x2, 0x2, 0x630, 0x633, 0x3, 0x2, 0x2, 0x2, - 0x631, 0x633, 0x5, 0xb0, 0x59, 0x2, 0x632, 0x62a, 0x3, 0x2, 0x2, 0x2, - 0x632, 0x62d, 0x3, 0x2, 0x2, 0x2, 0x632, 0x631, 0x3, 0x2, 0x2, 0x2, - 0x633, 0xaf, 0x3, 0x2, 0x2, 0x2, 0x634, 0x635, 0x8, 0x59, 0x1, 0x2, - 0x635, 0x637, 0x7, 0x15, 0x2, 0x2, 0x636, 0x638, 0x5, 0xb0, 0x59, 0x2, - 0x637, 0x636, 0x3, 0x2, 0x2, 0x2, 0x637, 0x638, 0x3, 0x2, 0x2, 0x2, - 0x638, 0x63e, 0x3, 0x2, 0x2, 0x2, 0x639, 0x63a, 0x7, 0xb4, 0x2, 0x2, - 0x63a, 0x63b, 0x5, 0xb0, 0x59, 0x2, 0x63b, 0x63c, 0x7, 0x9e, 0x2, 0x2, - 0x63c, 0x63d, 0x5, 0xb0, 0x59, 0x2, 0x63d, 0x63f, 0x3, 0x2, 0x2, 0x2, - 0x63e, 0x639, 0x3, 0x2, 0x2, 0x2, 0x63f, 0x640, 0x3, 0x2, 0x2, 0x2, - 0x640, 0x63e, 0x3, 0x2, 0x2, 0x2, 0x640, 0x641, 0x3, 0x2, 0x2, 0x2, - 0x641, 0x644, 0x3, 0x2, 0x2, 0x2, 0x642, 0x643, 0x7, 0x34, 0x2, 0x2, - 0x643, 0x645, 0x5, 0xb0, 0x59, 0x2, 0x644, 0x642, 0x3, 0x2, 0x2, 0x2, - 0x644, 0x645, 0x3, 0x2, 0x2, 0x2, 0x645, 0x646, 0x3, 0x2, 0x2, 0x2, - 0x646, 0x647, 0x7, 0x35, 0x2, 0x2, 0x647, 0x6a0, 0x3, 0x2, 0x2, 0x2, - 0x648, 0x649, 0x7, 0x16, 0x2, 0x2, 0x649, 0x64a, 0x7, 0xd0, 0x2, 0x2, - 0x64a, 0x64b, 0x5, 0xb0, 0x59, 0x2, 0x64b, 0x64c, 0x7, 0xc, 0x2, 0x2, - 0x64c, 0x64d, 0x5, 0xaa, 0x56, 0x2, 0x64d, 0x64e, 0x7, 0xda, 0x2, 0x2, - 0x64e, 0x6a0, 0x3, 0x2, 0x2, 0x2, 0x64f, 0x650, 0x7, 0x24, 0x2, 0x2, - 0x650, 0x6a0, 0x7, 0xbf, 0x2, 0x2, 0x651, 0x652, 0x7, 0x3b, 0x2, 0x2, - 0x652, 0x653, 0x7, 0xd0, 0x2, 0x2, 0x653, 0x654, 0x5, 0xce, 0x68, 0x2, - 0x654, 0x655, 0x7, 0x43, 0x2, 0x2, 0x655, 0x656, 0x5, 0xb0, 0x59, 0x2, - 0x656, 0x657, 0x7, 0xda, 0x2, 0x2, 0x657, 0x6a0, 0x3, 0x2, 0x2, 0x2, - 0x658, 0x659, 0x7, 0x55, 0x2, 0x2, 0x659, 0x65a, 0x5, 0xb0, 0x59, 0x2, - 0x65a, 0x65b, 0x5, 0xce, 0x68, 0x2, 0x65b, 0x6a0, 0x3, 0x2, 0x2, 0x2, - 0x65c, 0x65d, 0x7, 0x96, 0x2, 0x2, 0x65d, 0x65e, 0x7, 0xd0, 0x2, 0x2, - 0x65e, 0x65f, 0x5, 0xb0, 0x59, 0x2, 0x65f, 0x660, 0x7, 0x43, 0x2, 0x2, - 0x660, 0x663, 0x5, 0xb0, 0x59, 0x2, 0x661, 0x662, 0x7, 0x40, 0x2, 0x2, - 0x662, 0x664, 0x5, 0xb0, 0x59, 0x2, 0x663, 0x661, 0x3, 0x2, 0x2, 0x2, - 0x663, 0x664, 0x3, 0x2, 0x2, 0x2, 0x664, 0x665, 0x3, 0x2, 0x2, 0x2, - 0x665, 0x666, 0x7, 0xda, 0x2, 0x2, 0x666, 0x6a0, 0x3, 0x2, 0x2, 0x2, - 0x667, 0x668, 0x7, 0xa1, 0x2, 0x2, 0x668, 0x6a0, 0x7, 0xbf, 0x2, 0x2, - 0x669, 0x66a, 0x7, 0xa6, 0x2, 0x2, 0x66a, 0x66b, 0x7, 0xd0, 0x2, 0x2, - 0x66b, 0x66c, 0x9, 0x14, 0x2, 0x2, 0x66c, 0x66d, 0x7, 0xbf, 0x2, 0x2, - 0x66d, 0x66e, 0x7, 0x43, 0x2, 0x2, 0x66e, 0x66f, 0x5, 0xb0, 0x59, 0x2, - 0x66f, 0x670, 0x7, 0xda, 0x2, 0x2, 0x670, 0x6a0, 0x3, 0x2, 0x2, 0x2, - 0x671, 0x677, 0x5, 0xd6, 0x6c, 0x2, 0x672, 0x674, 0x7, 0xd0, 0x2, 0x2, - 0x673, 0x675, 0x5, 0xac, 0x57, 0x2, 0x674, 0x673, 0x3, 0x2, 0x2, 0x2, - 0x674, 0x675, 0x3, 0x2, 0x2, 0x2, 0x675, 0x676, 0x3, 0x2, 0x2, 0x2, - 0x676, 0x678, 0x7, 0xda, 0x2, 0x2, 0x677, 0x672, 0x3, 0x2, 0x2, 0x2, - 0x677, 0x678, 0x3, 0x2, 0x2, 0x2, 0x678, 0x679, 0x3, 0x2, 0x2, 0x2, - 0x679, 0x67b, 0x7, 0xd0, 0x2, 0x2, 0x67a, 0x67c, 0x7, 0x31, 0x2, 0x2, - 0x67b, 0x67a, 0x3, 0x2, 0x2, 0x2, 0x67b, 0x67c, 0x3, 0x2, 0x2, 0x2, - 0x67c, 0x67e, 0x3, 0x2, 0x2, 0x2, 0x67d, 0x67f, 0x5, 0xb2, 0x5a, 0x2, - 0x67e, 0x67d, 0x3, 0x2, 0x2, 0x2, 0x67e, 0x67f, 0x3, 0x2, 0x2, 0x2, - 0x67f, 0x680, 0x3, 0x2, 0x2, 0x2, 0x680, 0x681, 0x7, 0xda, 0x2, 0x2, - 0x681, 0x6a0, 0x3, 0x2, 0x2, 0x2, 0x682, 0x6a0, 0x5, 0xcc, 0x67, 0x2, - 0x683, 0x684, 0x7, 0xc7, 0x2, 0x2, 0x684, 0x6a0, 0x5, 0xb0, 0x59, 0x13, - 0x685, 0x686, 0x7, 0x72, 0x2, 0x2, 0x686, 0x6a0, 0x5, 0xb0, 0x59, 0xe, - 0x687, 0x688, 0x5, 0xc0, 0x61, 0x2, 0x688, 0x689, 0x7, 0xc8, 0x2, 0x2, - 0x689, 0x68b, 0x3, 0x2, 0x2, 0x2, 0x68a, 0x687, 0x3, 0x2, 0x2, 0x2, - 0x68a, 0x68b, 0x3, 0x2, 0x2, 0x2, 0x68b, 0x68c, 0x3, 0x2, 0x2, 0x2, - 0x68c, 0x6a0, 0x7, 0xc1, 0x2, 0x2, 0x68d, 0x68e, 0x7, 0xd0, 0x2, 0x2, - 0x68e, 0x68f, 0x5, 0x68, 0x35, 0x2, 0x68f, 0x690, 0x7, 0xda, 0x2, 0x2, - 0x690, 0x6a0, 0x3, 0x2, 0x2, 0x2, 0x691, 0x692, 0x7, 0xd0, 0x2, 0x2, - 0x692, 0x693, 0x5, 0xb0, 0x59, 0x2, 0x693, 0x694, 0x7, 0xda, 0x2, 0x2, - 0x694, 0x6a0, 0x3, 0x2, 0x2, 0x2, 0x695, 0x696, 0x7, 0xd0, 0x2, 0x2, - 0x696, 0x697, 0x5, 0xac, 0x57, 0x2, 0x697, 0x698, 0x7, 0xda, 0x2, 0x2, - 0x698, 0x6a0, 0x3, 0x2, 0x2, 0x2, 0x699, 0x69b, 0x7, 0xce, 0x2, 0x2, - 0x69a, 0x69c, 0x5, 0xac, 0x57, 0x2, 0x69b, 0x69a, 0x3, 0x2, 0x2, 0x2, - 0x69b, 0x69c, 0x3, 0x2, 0x2, 0x2, 0x69c, 0x69d, 0x3, 0x2, 0x2, 0x2, - 0x69d, 0x6a0, 0x7, 0xd9, 0x2, 0x2, 0x69e, 0x6a0, 0x5, 0xb8, 0x5d, 0x2, - 0x69f, 0x634, 0x3, 0x2, 0x2, 0x2, 0x69f, 0x648, 0x3, 0x2, 0x2, 0x2, - 0x69f, 0x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, 0x3, - 0x2, 0x2, 0x2, 0x70a, 0x6f7, 0x3, 0x2, 0x2, 0x2, 0x70a, 0x702, 0x3, - 0x2, 0x2, 0x2, 0x70b, 0x70c, 0x3, 0x2, 0x2, 0x2, 0x70c, 0x70d, 0x7, - 0xc0, 0x2, 0x2, 0x70d, 0x70e, 0x5, 0xb0, 0x59, 0x2, 0x70e, 0xb7, 0x3, - 0x2, 0x2, 0x2, 0x70f, 0x710, 0x5, 0xc0, 0x61, 0x2, 0x710, 0x711, 0x7, - 0xc8, 0x2, 0x2, 0x711, 0x713, 0x3, 0x2, 0x2, 0x2, 0x712, 0x70f, 0x3, - 0x2, 0x2, 0x2, 0x712, 0x713, 0x3, 0x2, 0x2, 0x2, 0x713, 0x714, 0x3, - 0x2, 0x2, 0x2, 0x714, 0x715, 0x5, 0xba, 0x5e, 0x2, 0x715, 0xb9, 0x3, - 0x2, 0x2, 0x2, 0x716, 0x719, 0x5, 0xd6, 0x6c, 0x2, 0x717, 0x718, 0x7, - 0xc8, 0x2, 0x2, 0x718, 0x71a, 0x5, 0xd6, 0x6c, 0x2, 0x719, 0x717, 0x3, - 0x2, 0x2, 0x2, 0x719, 0x71a, 0x3, 0x2, 0x2, 0x2, 0x71a, 0xbb, 0x3, 0x2, - 0x2, 0x2, 0x71b, 0x71c, 0x8, 0x5f, 0x1, 0x2, 0x71c, 0x723, 0x5, 0xc0, - 0x61, 0x2, 0x71d, 0x723, 0x5, 0xbe, 0x60, 0x2, 0x71e, 0x71f, 0x7, 0xd0, - 0x2, 0x2, 0x71f, 0x720, 0x5, 0x68, 0x35, 0x2, 0x720, 0x721, 0x7, 0xda, - 0x2, 0x2, 0x721, 0x723, 0x3, 0x2, 0x2, 0x2, 0x722, 0x71b, 0x3, 0x2, - 0x2, 0x2, 0x722, 0x71d, 0x3, 0x2, 0x2, 0x2, 0x722, 0x71e, 0x3, 0x2, - 0x2, 0x2, 0x723, 0x72c, 0x3, 0x2, 0x2, 0x2, 0x724, 0x728, 0xc, 0x3, - 0x2, 0x2, 0x725, 0x729, 0x5, 0xd4, 0x6b, 0x2, 0x726, 0x727, 0x7, 0xc, - 0x2, 0x2, 0x727, 0x729, 0x5, 0xd6, 0x6c, 0x2, 0x728, 0x725, 0x3, 0x2, - 0x2, 0x2, 0x728, 0x726, 0x3, 0x2, 0x2, 0x2, 0x729, 0x72b, 0x3, 0x2, - 0x2, 0x2, 0x72a, 0x724, 0x3, 0x2, 0x2, 0x2, 0x72b, 0x72e, 0x3, 0x2, - 0x2, 0x2, 0x72c, 0x72a, 0x3, 0x2, 0x2, 0x2, 0x72c, 0x72d, 0x3, 0x2, - 0x2, 0x2, 0x72d, 0xbd, 0x3, 0x2, 0x2, 0x2, 0x72e, 0x72c, 0x3, 0x2, 0x2, - 0x2, 0x72f, 0x730, 0x5, 0xd6, 0x6c, 0x2, 0x730, 0x732, 0x7, 0xd0, 0x2, - 0x2, 0x731, 0x733, 0x5, 0xc2, 0x62, 0x2, 0x732, 0x731, 0x3, 0x2, 0x2, - 0x2, 0x732, 0x733, 0x3, 0x2, 0x2, 0x2, 0x733, 0x734, 0x3, 0x2, 0x2, - 0x2, 0x734, 0x735, 0x7, 0xda, 0x2, 0x2, 0x735, 0xbf, 0x3, 0x2, 0x2, - 0x2, 0x736, 0x737, 0x5, 0xc6, 0x64, 0x2, 0x737, 0x738, 0x7, 0xc8, 0x2, - 0x2, 0x738, 0x73a, 0x3, 0x2, 0x2, 0x2, 0x739, 0x736, 0x3, 0x2, 0x2, - 0x2, 0x739, 0x73a, 0x3, 0x2, 0x2, 0x2, 0x73a, 0x73b, 0x3, 0x2, 0x2, - 0x2, 0x73b, 0x73c, 0x5, 0xd6, 0x6c, 0x2, 0x73c, 0xc1, 0x3, 0x2, 0x2, - 0x2, 0x73d, 0x742, 0x5, 0xc4, 0x63, 0x2, 0x73e, 0x73f, 0x7, 0xc5, 0x2, - 0x2, 0x73f, 0x741, 0x5, 0xc4, 0x63, 0x2, 0x740, 0x73e, 0x3, 0x2, 0x2, - 0x2, 0x741, 0x744, 0x3, 0x2, 0x2, 0x2, 0x742, 0x740, 0x3, 0x2, 0x2, - 0x2, 0x742, 0x743, 0x3, 0x2, 0x2, 0x2, 0x743, 0xc3, 0x3, 0x2, 0x2, 0x2, - 0x744, 0x742, 0x3, 0x2, 0x2, 0x2, 0x745, 0x749, 0x5, 0xba, 0x5e, 0x2, - 0x746, 0x749, 0x5, 0xbe, 0x60, 0x2, 0x747, 0x749, 0x5, 0xcc, 0x67, 0x2, - 0x748, 0x745, 0x3, 0x2, 0x2, 0x2, 0x748, 0x746, 0x3, 0x2, 0x2, 0x2, - 0x748, 0x747, 0x3, 0x2, 0x2, 0x2, 0x749, 0xc5, 0x3, 0x2, 0x2, 0x2, 0x74a, - 0x74b, 0x5, 0xd6, 0x6c, 0x2, 0x74b, 0xc7, 0x3, 0x2, 0x2, 0x2, 0x74c, - 0x755, 0x7, 0xbb, 0x2, 0x2, 0x74d, 0x74e, 0x7, 0xc8, 0x2, 0x2, 0x74e, - 0x755, 0x9, 0x18, 0x2, 0x2, 0x74f, 0x750, 0x7, 0xbd, 0x2, 0x2, 0x750, - 0x752, 0x7, 0xc8, 0x2, 0x2, 0x751, 0x753, 0x9, 0x18, 0x2, 0x2, 0x752, - 0x751, 0x3, 0x2, 0x2, 0x2, 0x752, 0x753, 0x3, 0x2, 0x2, 0x2, 0x753, - 0x755, 0x3, 0x2, 0x2, 0x2, 0x754, 0x74c, 0x3, 0x2, 0x2, 0x2, 0x754, - 0x74d, 0x3, 0x2, 0x2, 0x2, 0x754, 0x74f, 0x3, 0x2, 0x2, 0x2, 0x755, - 0xc9, 0x3, 0x2, 0x2, 0x2, 0x756, 0x758, 0x9, 0x19, 0x2, 0x2, 0x757, - 0x756, 0x3, 0x2, 0x2, 0x2, 0x757, 0x758, 0x3, 0x2, 0x2, 0x2, 0x758, - 0x75f, 0x3, 0x2, 0x2, 0x2, 0x759, 0x760, 0x5, 0xc8, 0x65, 0x2, 0x75a, - 0x760, 0x7, 0xbc, 0x2, 0x2, 0x75b, 0x760, 0x7, 0xbd, 0x2, 0x2, 0x75c, - 0x760, 0x7, 0xbe, 0x2, 0x2, 0x75d, 0x760, 0x7, 0x51, 0x2, 0x2, 0x75e, - 0x760, 0x7, 0x70, 0x2, 0x2, 0x75f, 0x759, 0x3, 0x2, 0x2, 0x2, 0x75f, - 0x75a, 0x3, 0x2, 0x2, 0x2, 0x75f, 0x75b, 0x3, 0x2, 0x2, 0x2, 0x75f, - 0x75c, 0x3, 0x2, 0x2, 0x2, 0x75f, 0x75d, 0x3, 0x2, 0x2, 0x2, 0x75f, - 0x75e, 0x3, 0x2, 0x2, 0x2, 0x760, 0xcb, 0x3, 0x2, 0x2, 0x2, 0x761, 0x765, - 0x5, 0xca, 0x66, 0x2, 0x762, 0x765, 0x7, 0xbf, 0x2, 0x2, 0x763, 0x765, - 0x7, 0x73, 0x2, 0x2, 0x764, 0x761, 0x3, 0x2, 0x2, 0x2, 0x764, 0x762, - 0x3, 0x2, 0x2, 0x2, 0x764, 0x763, 0x3, 0x2, 0x2, 0x2, 0x765, 0xcd, 0x3, - 0x2, 0x2, 0x2, 0x766, 0x767, 0x9, 0x1a, 0x2, 0x2, 0x767, 0xcf, 0x3, - 0x2, 0x2, 0x2, 0x768, 0x769, 0x9, 0x1b, 0x2, 0x2, 0x769, 0xd1, 0x3, - 0x2, 0x2, 0x2, 0x76a, 0x76b, 0x9, 0x1c, 0x2, 0x2, 0x76b, 0xd3, 0x3, - 0x2, 0x2, 0x2, 0x76c, 0x76f, 0x7, 0xba, 0x2, 0x2, 0x76d, 0x76f, 0x5, - 0xd2, 0x6a, 0x2, 0x76e, 0x76c, 0x3, 0x2, 0x2, 0x2, 0x76e, 0x76d, 0x3, - 0x2, 0x2, 0x2, 0x76f, 0xd5, 0x3, 0x2, 0x2, 0x2, 0x770, 0x774, 0x7, 0xba, - 0x2, 0x2, 0x771, 0x774, 0x5, 0xce, 0x68, 0x2, 0x772, 0x774, 0x5, 0xd0, - 0x69, 0x2, 0x773, 0x770, 0x3, 0x2, 0x2, 0x2, 0x773, 0x771, 0x3, 0x2, - 0x2, 0x2, 0x773, 0x772, 0x3, 0x2, 0x2, 0x2, 0x774, 0xd7, 0x3, 0x2, 0x2, - 0x2, 0x775, 0x778, 0x5, 0xd6, 0x6c, 0x2, 0x776, 0x778, 0x7, 0x73, 0x2, - 0x2, 0x777, 0x775, 0x3, 0x2, 0x2, 0x2, 0x777, 0x776, 0x3, 0x2, 0x2, - 0x2, 0x778, 0xd9, 0x3, 0x2, 0x2, 0x2, 0x779, 0x77a, 0x7, 0xbf, 0x2, - 0x2, 0x77a, 0x77b, 0x7, 0xca, 0x2, 0x2, 0x77b, 0x77c, 0x5, 0xca, 0x66, - 0x2, 0x77c, 0xdb, 0x3, 0x2, 0x2, 0x2, 0x103, 0xe0, 0xe4, 0xe7, 0xea, - 0xfe, 0x104, 0x10b, 0x113, 0x118, 0x11f, 0x124, 0x12b, 0x130, 0x136, - 0x13c, 0x141, 0x147, 0x14c, 0x152, 0x157, 0x15d, 0x16b, 0x172, 0x179, - 0x180, 0x186, 0x18b, 0x191, 0x196, 0x19c, 0x1a5, 0x1af, 0x1b9, 0x1cd, - 0x1d5, 0x1e4, 0x1eb, 0x1f9, 0x1ff, 0x205, 0x20c, 0x210, 0x213, 0x21a, - 0x21e, 0x221, 0x22c, 0x230, 0x233, 0x238, 0x23a, 0x23d, 0x240, 0x24a, - 0x24e, 0x251, 0x254, 0x259, 0x25b, 0x261, 0x267, 0x26b, 0x26e, 0x271, - 0x274, 0x277, 0x27c, 0x282, 0x286, 0x289, 0x28c, 0x290, 0x298, 0x2b2, - 0x2b4, 0x2b8, 0x2ce, 0x2d0, 0x2db, 0x2de, 0x2e7, 0x2f8, 0x303, 0x315, - 0x322, 0x333, 0x33c, 0x357, 0x359, 0x36e, 0x373, 0x378, 0x37b, 0x387, - 0x38c, 0x390, 0x393, 0x397, 0x39b, 0x3a0, 0x3a3, 0x3a7, 0x3a9, 0x3bf, - 0x3c7, 0x3ca, 0x3d4, 0x3d8, 0x3e0, 0x3e4, 0x3e9, 0x3ed, 0x3f1, 0x3f5, - 0x3f9, 0x3fb, 0x403, 0x407, 0x40a, 0x412, 0x417, 0x41c, 0x41f, 0x429, - 0x433, 0x437, 0x43c, 0x440, 0x446, 0x449, 0x44c, 0x44f, 0x45d, 0x461, - 0x465, 0x46a, 0x46d, 0x477, 0x47f, 0x482, 0x486, 0x489, 0x48d, 0x490, - 0x493, 0x496, 0x499, 0x49d, 0x4a1, 0x4a4, 0x4a7, 0x4aa, 0x4ad, 0x4b0, - 0x4b9, 0x4bf, 0x4d3, 0x4e9, 0x4f1, 0x4f4, 0x4fa, 0x502, 0x505, 0x50b, - 0x50d, 0x511, 0x516, 0x519, 0x51c, 0x520, 0x524, 0x527, 0x529, 0x52c, - 0x530, 0x534, 0x537, 0x539, 0x53b, 0x53e, 0x543, 0x54e, 0x554, 0x559, - 0x560, 0x565, 0x569, 0x56d, 0x572, 0x579, 0x58e, 0x591, 0x59a, 0x59e, - 0x5a3, 0x5a8, 0x5ab, 0x5ad, 0x5c3, 0x5c6, 0x5d1, 0x5d5, 0x5d8, 0x5dc, - 0x5e0, 0x5e8, 0x5ec, 0x5f9, 0x605, 0x611, 0x619, 0x61d, 0x624, 0x62a, - 0x632, 0x637, 0x640, 0x644, 0x663, 0x674, 0x677, 0x67b, 0x67e, 0x68a, - 0x69b, 0x69f, 0x6b0, 0x6b3, 0x6b7, 0x6ba, 0x6c5, 0x6dd, 0x6e4, 0x6e6, - 0x6e8, 0x6f0, 0x6f5, 0x6fd, 0x707, 0x70a, 0x712, 0x719, 0x722, 0x728, - 0x72c, 0x732, 0x739, 0x742, 0x748, 0x752, 0x754, 0x757, 0x75f, 0x764, - 0x76e, 0x773, 0x777, - }; - - 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.h b/src/Parsers/New/ClickHouseParser.h deleted file mode 100644 index c860932ba1c..00000000000 --- a/src/Parsers/New/ClickHouseParser.h +++ /dev/null @@ -1,3435 +0,0 @@ - -// 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, AST = 13, ASYNC = 14, - ATTACH = 15, BETWEEN = 16, BOTH = 17, BY = 18, CASE = 19, CAST = 20, - CHECK = 21, CLEAR = 22, CLUSTER = 23, CODEC = 24, COLLATE = 25, COLUMN = 26, - COMMENT = 27, CONSTRAINT = 28, CREATE = 29, CROSS = 30, CUBE = 31, DATABASE = 32, - DATABASES = 33, DATE = 34, DAY = 35, DEDUPLICATE = 36, DEFAULT = 37, - DELAY = 38, DELETE = 39, DESC = 40, DESCENDING = 41, DESCRIBE = 42, - DETACH = 43, DICTIONARIES = 44, DICTIONARY = 45, DISK = 46, DISTINCT = 47, - DISTRIBUTED = 48, DROP = 49, ELSE = 50, END = 51, ENGINE = 52, EVENTS = 53, - EXISTS = 54, EXPLAIN = 55, EXPRESSION = 56, EXTRACT = 57, FETCHES = 58, - FINAL = 59, FIRST = 60, FLUSH = 61, FOR = 62, FORMAT = 63, FREEZE = 64, - FROM = 65, FULL = 66, FUNCTION = 67, GLOBAL = 68, GRANULARITY = 69, - GROUP = 70, HAVING = 71, HIERARCHICAL = 72, HOUR = 73, ID = 74, IF = 75, - ILIKE = 76, IN = 77, INDEX = 78, INF = 79, INJECTIVE = 80, INNER = 81, - INSERT = 82, INTERVAL = 83, INTO = 84, IS = 85, IS_OBJECT_ID = 86, JOIN = 87, - KEY = 88, KILL = 89, LAST = 90, LAYOUT = 91, LEADING = 92, LEFT = 93, - LIFETIME = 94, LIKE = 95, LIMIT = 96, LIVE = 97, LOCAL = 98, LOGS = 99, - MATERIALIZE = 100, MATERIALIZED = 101, MAX = 102, MERGES = 103, MIN = 104, - MINUTE = 105, MODIFY = 106, MONTH = 107, MOVE = 108, MUTATION = 109, - NAN_SQL = 110, NO = 111, NOT = 112, NULL_SQL = 113, NULLS = 114, OFFSET = 115, - ON = 116, OPTIMIZE = 117, OR = 118, ORDER = 119, OUTER = 120, OUTFILE = 121, - PARTITION = 122, POPULATE = 123, PREWHERE = 124, PRIMARY = 125, PROJECTION = 126, - QUARTER = 127, RANGE = 128, RELOAD = 129, REMOVE = 130, RENAME = 131, - REPLACE = 132, REPLICA = 133, REPLICATED = 134, RIGHT = 135, ROLLUP = 136, - SAMPLE = 137, SECOND = 138, SELECT = 139, SEMI = 140, SENDS = 141, SET = 142, - SETTINGS = 143, SHOW = 144, SOURCE = 145, START = 146, STOP = 147, SUBSTRING = 148, - SYNC = 149, SYNTAX = 150, SYSTEM = 151, TABLE = 152, TABLES = 153, TEMPORARY = 154, - TEST = 155, THEN = 156, TIES = 157, TIMEOUT = 158, TIMESTAMP = 159, - TO = 160, TOP = 161, TOTALS = 162, TRAILING = 163, TRIM = 164, TRUNCATE = 165, - TTL = 166, TYPE = 167, UNION = 168, UPDATE = 169, USE = 170, USING = 171, - UUID = 172, VALUES = 173, VIEW = 174, VOLUME = 175, WATCH = 176, WEEK = 177, - WHEN = 178, WHERE = 179, WITH = 180, YEAR = 181, JSON_FALSE = 182, JSON_TRUE = 183, - IDENTIFIER = 184, FLOATING_LITERAL = 185, OCTAL_LITERAL = 186, DECIMAL_LITERAL = 187, - HEXADECIMAL_LITERAL = 188, STRING_LITERAL = 189, ARROW = 190, ASTERISK = 191, - BACKQUOTE = 192, BACKSLASH = 193, COLON = 194, COMMA = 195, CONCAT = 196, - DASH = 197, DOT = 198, EQ_DOUBLE = 199, EQ_SINGLE = 200, GE = 201, GT = 202, - LBRACE = 203, LBRACKET = 204, LE = 205, LPAREN = 206, LT = 207, NOT_EQ = 208, - PERCENT = 209, PLUS = 210, QUERY = 211, QUOTE_DOUBLE = 212, QUOTE_SINGLE = 213, - RBRACE = 214, RBRACKET = 215, RPAREN = 216, SEMICOLON = 217, SLASH = 218, - UNDERSCORE = 219, MULTI_LINE_COMMENT = 220, SINGLE_LINE_COMMENT = 221, - WHITESPACE = 222 - }; - - 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, - RuleTableProjectionDfnt = 36, RuleCodecExpr = 37, RuleCodecArgExpr = 38, - RuleTtlExpr = 39, RuleDescribeStmt = 40, RuleDropStmt = 41, RuleExistsStmt = 42, - RuleExplainStmt = 43, RuleInsertStmt = 44, RuleColumnsClause = 45, RuleDataClause = 46, - RuleKillStmt = 47, RuleOptimizeStmt = 48, RuleRenameStmt = 49, RuleProjectionSelectStmt = 50, - RuleSelectUnionStmt = 51, RuleSelectStmtWithParens = 52, RuleSelectStmt = 53, - RuleWithClause = 54, RuleTopClause = 55, RuleFromClause = 56, RuleArrayJoinClause = 57, - RulePrewhereClause = 58, RuleWhereClause = 59, RuleGroupByClause = 60, - RuleHavingClause = 61, RuleOrderByClause = 62, RuleProjectionOrderByClause = 63, - RuleLimitByClause = 64, RuleLimitClause = 65, RuleSettingsClause = 66, - RuleJoinExpr = 67, RuleJoinOp = 68, RuleJoinOpCross = 69, RuleJoinConstraintClause = 70, - RuleSampleClause = 71, RuleLimitExpr = 72, RuleOrderExprList = 73, RuleOrderExpr = 74, - RuleRatioExpr = 75, RuleSettingExprList = 76, RuleSettingExpr = 77, - RuleSetStmt = 78, RuleShowStmt = 79, RuleSystemStmt = 80, RuleTruncateStmt = 81, - RuleUseStmt = 82, RuleWatchStmt = 83, RuleColumnTypeExpr = 84, RuleColumnExprList = 85, - RuleColumnsExpr = 86, RuleColumnExpr = 87, RuleColumnArgList = 88, RuleColumnArgExpr = 89, - RuleColumnLambdaExpr = 90, RuleColumnIdentifier = 91, RuleNestedIdentifier = 92, - RuleTableExpr = 93, RuleTableFunctionExpr = 94, RuleTableIdentifier = 95, - RuleTableArgList = 96, RuleTableArgExpr = 97, RuleDatabaseIdentifier = 98, - RuleFloatingLiteral = 99, RuleNumberLiteral = 100, RuleLiteral = 101, - RuleInterval = 102, RuleKeyword = 103, RuleKeywordForAlias = 104, RuleAlias = 105, - RuleIdentifier = 106, RuleIdentifierOrNull = 107, RuleEnumValue = 108 - }; - - 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 TableProjectionDfntContext; - 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 ProjectionSelectStmtContext; - 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 ProjectionOrderByClauseContext; - 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 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 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 AlterTableClauseClearProjectionContext : public AlterTableClauseContext { - public: - AlterTableClauseClearProjectionContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *CLEAR(); - antlr4::tree::TerminalNode *PROJECTION(); - 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 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 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 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 AlterTableClauseDetachContext : public AlterTableClauseContext { - public: - AlterTableClauseDetachContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *DETACH(); - PartitionClauseContext *partitionClause(); - 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 AlterTableClauseMaterializeIndexContext : public AlterTableClauseContext { - public: - AlterTableClauseMaterializeIndexContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *MATERIALIZE(); - antlr4::tree::TerminalNode *INDEX(); - 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 AlterTableClauseMaterializeProjectionContext : public AlterTableClauseContext { - public: - AlterTableClauseMaterializeProjectionContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *MATERIALIZE(); - antlr4::tree::TerminalNode *PROJECTION(); - 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 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 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 AlterTableClauseClearColumnContext : public AlterTableClauseContext { - public: - AlterTableClauseClearColumnContext(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 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 AlterTableClauseClearIndexContext : public AlterTableClauseContext { - public: - AlterTableClauseClearIndexContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *CLEAR(); - antlr4::tree::TerminalNode *INDEX(); - 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 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 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 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 AlterTableClauseDropProjectionContext : public AlterTableClauseContext { - public: - AlterTableClauseDropProjectionContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *DROP(); - antlr4::tree::TerminalNode *PROJECTION(); - NestedIdentifierContext *nestedIdentifier(); - antlr4::tree::TerminalNode *IF(); - antlr4::tree::TerminalNode *EXISTS(); - 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 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 AlterTableClauseAddProjectionContext : public AlterTableClauseContext { - public: - AlterTableClauseAddProjectionContext(AlterTableClauseContext *ctx); - - antlr4::tree::TerminalNode *ADD(); - antlr4::tree::TerminalNode *PROJECTION(); - TableProjectionDfntContext *tableProjectionDfnt(); - 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 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 TableElementExprProjectionContext : public TableElementExprContext { - public: - TableElementExprProjectionContext(TableElementExprContext *ctx); - - antlr4::tree::TerminalNode *PROJECTION(); - TableProjectionDfntContext *tableProjectionDfnt(); - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) 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 TableProjectionDfntContext : public antlr4::ParserRuleContext { - public: - TableProjectionDfntContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - NestedIdentifierContext *nestedIdentifier(); - ProjectionSelectStmtContext *projectionSelectStmt(); - - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - - }; - - TableProjectionDfntContext* tableProjectionDfnt(); - - 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 *VIEW(); - 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); - - ExistsStmtContext() = default; - void copyFrom(ExistsStmtContext *context); - using antlr4::ParserRuleContext::copyFrom; - - virtual size_t getRuleIndex() const override; - - - }; - - class ExistsTableStmtContext : public ExistsStmtContext { - public: - ExistsTableStmtContext(ExistsStmtContext *ctx); - - antlr4::tree::TerminalNode *EXISTS(); - TableIdentifierContext *tableIdentifier(); - antlr4::tree::TerminalNode *DICTIONARY(); - antlr4::tree::TerminalNode *TABLE(); - antlr4::tree::TerminalNode *VIEW(); - antlr4::tree::TerminalNode *TEMPORARY(); - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - }; - - class ExistsDatabaseStmtContext : public ExistsStmtContext { - public: - ExistsDatabaseStmtContext(ExistsStmtContext *ctx); - - antlr4::tree::TerminalNode *EXISTS(); - antlr4::tree::TerminalNode *DATABASE(); - DatabaseIdentifierContext *databaseIdentifier(); - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - }; - - ExistsStmtContext* existsStmt(); - - class ExplainStmtContext : public antlr4::ParserRuleContext { - public: - ExplainStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); - - ExplainStmtContext() = default; - void copyFrom(ExplainStmtContext *context); - using antlr4::ParserRuleContext::copyFrom; - - virtual size_t getRuleIndex() const override; - - - }; - - class ExplainSyntaxStmtContext : public ExplainStmtContext { - public: - ExplainSyntaxStmtContext(ExplainStmtContext *ctx); - - antlr4::tree::TerminalNode *EXPLAIN(); - antlr4::tree::TerminalNode *SYNTAX(); - QueryContext *query(); - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - }; - - class ExplainASTStmtContext : public ExplainStmtContext { - public: - ExplainASTStmtContext(ExplainStmtContext *ctx); - - antlr4::tree::TerminalNode *EXPLAIN(); - antlr4::tree::TerminalNode *AST(); - 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 ProjectionSelectStmtContext : public antlr4::ParserRuleContext { - public: - ProjectionSelectStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *LPAREN(); - antlr4::tree::TerminalNode *SELECT(); - ColumnExprListContext *columnExprList(); - antlr4::tree::TerminalNode *RPAREN(); - WithClauseContext *withClause(); - GroupByClauseContext *groupByClause(); - ProjectionOrderByClauseContext *projectionOrderByClause(); - - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - - }; - - ProjectionSelectStmtContext* projectionSelectStmt(); - - 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 ProjectionOrderByClauseContext : public antlr4::ParserRuleContext { - public: - ProjectionOrderByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); - virtual size_t getRuleIndex() const override; - antlr4::tree::TerminalNode *ORDER(); - antlr4::tree::TerminalNode *BY(); - ColumnExprListContext *columnExprList(); - - virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override; - - }; - - ProjectionOrderByClauseContext* projectionOrderByClause(); - - 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; - NestedIdentifierContext *nestedIdentifier(); - 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 *AST(); - 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 *MATERIALIZE(); - 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 deleted file mode 100644 index ad0990faef9..00000000000 --- a/src/Parsers/New/ClickHouseParserVisitor.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -// 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 deleted file mode 100644 index 088fdd7f0ca..00000000000 --- a/src/Parsers/New/ClickHouseParserVisitor.h +++ /dev/null @@ -1,422 +0,0 @@ - -// 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 visitAlterTableClauseAddProjection(ClickHouseParser::AlterTableClauseAddProjectionContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseAttach(ClickHouseParser::AlterTableClauseAttachContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseClearColumn(ClickHouseParser::AlterTableClauseClearColumnContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseClearIndex(ClickHouseParser::AlterTableClauseClearIndexContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseClearProjection(ClickHouseParser::AlterTableClauseClearProjectionContext *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 visitAlterTableClauseDropProjection(ClickHouseParser::AlterTableClauseDropProjectionContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseDropPartition(ClickHouseParser::AlterTableClauseDropPartitionContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseFreezePartition(ClickHouseParser::AlterTableClauseFreezePartitionContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseMaterializeIndex(ClickHouseParser::AlterTableClauseMaterializeIndexContext *context) = 0; - - virtual antlrcpp::Any visitAlterTableClauseMaterializeProjection(ClickHouseParser::AlterTableClauseMaterializeProjectionContext *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 visitTableElementExprProjection(ClickHouseParser::TableElementExprProjectionContext *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 visitTableProjectionDfnt(ClickHouseParser::TableProjectionDfntContext *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 visitExistsDatabaseStmt(ClickHouseParser::ExistsDatabaseStmtContext *context) = 0; - - virtual antlrcpp::Any visitExistsTableStmt(ClickHouseParser::ExistsTableStmtContext *context) = 0; - - virtual antlrcpp::Any visitExplainASTStmt(ClickHouseParser::ExplainASTStmtContext *context) = 0; - - virtual antlrcpp::Any visitExplainSyntaxStmt(ClickHouseParser::ExplainSyntaxStmtContext *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 visitProjectionSelectStmt(ClickHouseParser::ProjectionSelectStmtContext *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 visitProjectionOrderByClause(ClickHouseParser::ProjectionOrderByClauseContext *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 deleted file mode 100644 index ed6dc358c52..00000000000 --- a/src/Parsers/New/LexerErrorListener.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#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) -{ - LOG_ERROR(&Poco::Logger::get("ClickHouseLexer"), "Lexer error: {}", message); - - 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 deleted file mode 100644 index 62445ffb166..00000000000 --- a/src/Parsers/New/LexerErrorListener.h +++ /dev/null @@ -1,21 +0,0 @@ -#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 deleted file mode 100644 index a7c7a2758eb..00000000000 --- a/src/Parsers/New/ParseTreeVisitor.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#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"))}); - - auto current_database = ColumnExpr::createLiteral(Literal::createString(current_database_name)); - if (ctx->databaseIdentifier()) - { - current_database = ColumnExpr::createLiteral(Literal::createString(visit(ctx->databaseIdentifier()).as>()->getName())); - } - auto database = std::make_shared(nullptr, std::make_shared("database")); - auto equals_args = PtrTo(new ColumnExprList{ - ColumnExpr::createIdentifier(database), - current_database - }); - and_args->push(ColumnExpr::createFunction(std::make_shared("equals"), nullptr, equals_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 deleted file mode 100644 index 35d5ae9b12e..00000000000 --- a/src/Parsers/New/ParseTreeVisitor.h +++ /dev/null @@ -1,304 +0,0 @@ -#pragma once - -#include - - -namespace DB { - -class ParseTreeVisitor : public ClickHouseParserVisitor -{ - const String & current_database_name; -public: - explicit ParseTreeVisitor(const String & database_name) : ClickHouseParserVisitor(), current_database_name(database_name) {} - 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 visitAlterTableClauseAddProjection(ClickHouseParser::AlterTableClauseAddProjectionContext * ctx) override; - antlrcpp::Any visitAlterTableClauseAttach(ClickHouseParser::AlterTableClauseAttachContext * ctx) override; - antlrcpp::Any visitAlterTableClauseClearColumn(ClickHouseParser::AlterTableClauseClearColumnContext * ctx) override; - antlrcpp::Any visitAlterTableClauseClearIndex(ClickHouseParser::AlterTableClauseClearIndexContext * ctx) override; - antlrcpp::Any visitAlterTableClauseClearProjection(ClickHouseParser::AlterTableClauseClearProjectionContext * 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 visitAlterTableClauseDropProjection(ClickHouseParser::AlterTableClauseDropProjectionContext * ctx) override; - antlrcpp::Any visitAlterTableClauseDropPartition(ClickHouseParser::AlterTableClauseDropPartitionContext * ctx) override; - antlrcpp::Any visitAlterTableClauseFreezePartition(ClickHouseParser::AlterTableClauseFreezePartitionContext * ctx) override; - antlrcpp::Any visitAlterTableClauseMaterializeIndex(ClickHouseParser::AlterTableClauseMaterializeIndexContext * ctx) override; - antlrcpp::Any visitAlterTableClauseMaterializeProjection(ClickHouseParser::AlterTableClauseMaterializeProjectionContext * 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 visitExistsTableStmt(ClickHouseParser::ExistsTableStmtContext * ctx) override; - antlrcpp::Any visitExistsDatabaseStmt(ClickHouseParser::ExistsDatabaseStmtContext * ctx) override; - - // ExplainQuery - antlrcpp::Any visitExplainASTStmt(ClickHouseParser::ExplainASTStmtContext * ctx) override; - antlrcpp::Any visitExplainSyntaxStmt(ClickHouseParser::ExplainSyntaxStmtContext * 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 visitProjectionSelectStmt(ClickHouseParser::ProjectionSelectStmtContext * ctx) override; - 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 visitTableElementExprProjection(ClickHouseParser::TableElementExprProjectionContext * ctx) override; - antlrcpp::Any visitTableIndexDfnt(ClickHouseParser::TableIndexDfntContext * ctx) override; - antlrcpp::Any visitTableProjectionDfnt(ClickHouseParser::TableProjectionDfntContext * 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 visitProjectionOrderByClause(ClickHouseParser::ProjectionOrderByClauseContext *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 deleted file mode 100644 index f6ac0f0c451..00000000000 --- a/src/Parsers/New/ParserErrorListener.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#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); - assert(parser); - - LOG_ERROR(&Poco::Logger::get("ClickHouseParser"), //-V522 - "Last element parsed so far:\n" - "{}\n" - "Parser error: (pos {}) {}", parser->getRuleContext()->toStringTree(parser, true), token->getStartIndex(), message); - - 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 deleted file mode 100644 index 1a02ff01abe..00000000000 --- a/src/Parsers/New/ParserErrorListener.h +++ /dev/null @@ -1,21 +0,0 @@ -#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 deleted file mode 100644 index c66772385ca..00000000000 --- a/src/Parsers/New/parseQuery.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#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, const String & current_database) -{ - 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 { current_database }; - - return visitor.visit(parser.queryStmt()); -} - -ASTPtr parseQuery(const char * begin, const char * end, size_t, size_t, const String & current_database) -{ - // 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 { current_database }; - - 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 deleted file mode 100644 index 8d9c8efd337..00000000000 --- a/src/Parsers/New/parseQuery.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace DB -{ - -// Compatibility interface -AST::PtrTo parseQuery(const std::string & query, const String & current_database); -ASTPtr parseQuery(const char * begin, const char * end, size_t max_query_size, size_t max_parser_depth, const String & current_database); - -} diff --git a/src/Server/MySQLHandler.cpp b/src/Server/MySQLHandler.cpp index f06ae2cb8f1..beace5dd576 100644 --- a/src/Server/MySQLHandler.cpp +++ b/src/Server/MySQLHandler.cpp @@ -66,6 +66,7 @@ static const size_t SSL_REQUEST_PAYLOAD_SIZE = 32; static String selectEmptyReplacementQuery(const String & query); static String showTableStatusReplacementQuery(const String & query); static String killConnectionIdReplacementQuery(const String & query); +static String selectLimitReplacementQuery(const String & query); MySQLHandler::MySQLHandler(IServer & server_, const Poco::Net::StreamSocket & socket_, bool ssl_enabled, size_t connection_id_) @@ -83,6 +84,7 @@ MySQLHandler::MySQLHandler(IServer & server_, const Poco::Net::StreamSocket & so replacements.emplace("KILL QUERY", killConnectionIdReplacementQuery); replacements.emplace("SHOW TABLE STATUS LIKE", showTableStatusReplacementQuery); replacements.emplace("SHOW VARIABLES", selectEmptyReplacementQuery); + replacements.emplace("SET SQL_SELECT_LIMIT", selectLimitReplacementQuery); } void MySQLHandler::run() @@ -461,6 +463,14 @@ static String showTableStatusReplacementQuery(const String & query) return query; } +static String selectLimitReplacementQuery(const String & query) +{ + const String prefix = "SET SQL_SELECT_LIMIT"; + if (query.starts_with(prefix)) + return "SET limit" + std::string(query.data() + prefix.length()); + return query; +} + /// Replace "KILL QUERY [connection_id]" into "KILL QUERY WHERE query_id = 'mysql:[connection_id]'". static String killConnectionIdReplacementQuery(const String & query) { diff --git a/src/Storages/IStorage.cpp b/src/Storages/IStorage.cpp index c73eb62d039..0e9f82a9802 100644 --- a/src/Storages/IStorage.cpp +++ b/src/Storages/IStorage.cpp @@ -51,7 +51,10 @@ TableLockHolder IStorage::lockForShare(const String & query_id, const std::chron TableLockHolder result = tryLockTimed(drop_lock, RWLockImpl::Read, query_id, acquire_timeout); if (is_dropped) - throw Exception("Table is dropped", ErrorCodes::TABLE_IS_DROPPED); + { + auto table_id = getStorageID(); + throw Exception(ErrorCodes::TABLE_IS_DROPPED, "Table {}.{} is dropped", table_id.database_name, table_id.table_name); + } return result; } diff --git a/src/Storages/IStorage.h b/src/Storages/IStorage.h index 0e8c7e0a263..2d6109bd7af 100644 --- a/src/Storages/IStorage.h +++ b/src/Storages/IStorage.h @@ -351,6 +351,8 @@ public: */ virtual void drop() {} + virtual void dropInnerTableIfAny(bool /* no_delay */, ContextPtr /* context */) {} + /** Clear the table data and leave it empty. * Must be called under exclusive lock (lockExclusively). */ diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index c2ba01deed6..40b37f5afc4 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -1013,7 +1013,7 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks) ErrorCodes::TOO_MANY_UNEXPECTED_DATA_PARTS); for (auto & part : broken_parts_to_detach) - part->renameToDetached("broken_on_start"); + part->renameToDetached("broken-on-start"); /// detached parts must not have '_' in prefixes /// Delete from the set of current parts those parts that are covered by another part (those parts that diff --git a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index ae3b533918d..cffedf44823 100644 --- a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -301,6 +301,8 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read( context->getTemporaryVolume(), settings.max_threads, settings.min_free_disk_space_for_temporary_data, + settings.compile_expressions, + settings.min_count_to_compile_aggregate_expression, header_before_aggregation); // The source header is also an intermediate header transform_params = std::make_shared(std::move(params), query_info.projection->aggregate_final); @@ -329,7 +331,9 @@ QueryPlanPtr MergeTreeDataSelectExecutor::read( settings.empty_result_for_aggregation_by_empty_set, context->getTemporaryVolume(), settings.max_threads, - settings.min_free_disk_space_for_temporary_data); + settings.min_free_disk_space_for_temporary_data, + settings.compile_aggregate_expressions, + settings.min_count_to_compile_aggregate_expression); transform_params = std::make_shared(std::move(params), query_info.projection->aggregate_final); } diff --git a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp index d170ba835cb..35a011a4a58 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreePartCheckThread.cpp @@ -190,18 +190,36 @@ void ReplicatedMergeTreePartCheckThread::searchForMissingPartAndFetchIfPossible( if (missing_part_search_result == MissingPartSearchResult::LostForever) { - /// Is it in the replication queue? If there is - delete, because the task can not be processed. - if (!storage.queue.remove(zookeeper, part_name)) + auto lost_part_info = MergeTreePartInfo::fromPartName(part_name, storage.format_version); + if (lost_part_info.level != 0) { - /// The part was not in our queue. - LOG_WARNING(log, "Missing part {} is not in our queue, this can happen rarely.", part_name); + Strings source_parts; + bool part_in_queue = storage.queue.checkPartInQueueAndGetSourceParts(part_name, source_parts); + + /// If it's MERGE/MUTATION etc. we shouldn't replace result part with empty part + /// because some source parts can be lost, but some of them can exist. + if (part_in_queue && !source_parts.empty()) + { + LOG_ERROR(log, "Part {} found in queue and some source parts for it was lost. Will check all source parts.", part_name); + for (const String & source_part_name : source_parts) + enqueuePart(source_part_name); + + return; + } } - /** This situation is possible if on all the replicas where the part was, it deteriorated. - * For example, a replica that has just written it has power turned off and the data has not been written from cache to disk. - */ - LOG_ERROR(log, "Part {} is lost forever.", part_name); - ProfileEvents::increment(ProfileEvents::ReplicatedDataLoss); + if (storage.createEmptyPartInsteadOfLost(zookeeper, part_name)) + { + /** This situation is possible if on all the replicas where the part was, it deteriorated. + * For example, a replica that has just written it has power turned off and the data has not been written from cache to disk. + */ + LOG_ERROR(log, "Part {} is lost forever.", part_name); + ProfileEvents::increment(ProfileEvents::ReplicatedDataLoss); + } + else + { + LOG_WARNING(log, "Cannot create empty part {} instead of lost. Will retry later", part_name); + } } } @@ -307,11 +325,12 @@ CheckResult ReplicatedMergeTreePartCheckThread::checkPart(const String & part_na String message = "Part " + part_name + " looks broken. Removing it and will try to fetch."; LOG_ERROR(log, message); + /// Delete part locally. + storage.forgetPartAndMoveToDetached(part, "broken"); + /// Part is broken, let's try to find it and fetch. searchForMissingPartAndFetchIfPossible(part_name, exists_in_zookeeper); - /// Delete part locally. - storage.forgetPartAndMoveToDetached(part, "broken"); return {part_name, false, message}; } } diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp b/src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp index a14b6119f38..bb4d0888c56 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp @@ -64,6 +64,24 @@ bool ReplicatedMergeTreeQueue::isVirtualPart(const MergeTreeData::DataPartPtr & return !virtual_part_name.empty() && virtual_part_name != data_part->name; } +bool ReplicatedMergeTreeQueue::checkPartInQueueAndGetSourceParts(const String & part_name, Strings & source_parts) const +{ + std::lock_guard lock(state_mutex); + + bool found = false; + for (const auto & entry : queue) + { + if (entry->new_part_name == part_name && entry->source_parts.size() > source_parts.size()) + { + source_parts.clear(); + source_parts.insert(source_parts.end(), entry->source_parts.begin(), entry->source_parts.end()); + found = true; + } + } + + return found; +} + bool ReplicatedMergeTreeQueue::load(zkutil::ZooKeeperPtr zookeeper) { @@ -410,62 +428,6 @@ void ReplicatedMergeTreeQueue::removeProcessedEntry(zkutil::ZooKeeperPtr zookeep updateTimesInZooKeeper(zookeeper, min_unprocessed_insert_time_changed, max_processed_insert_time_changed); } - -bool ReplicatedMergeTreeQueue::remove(zkutil::ZooKeeperPtr zookeeper, const String & part_name) -{ - LogEntryPtr found; - size_t queue_size = 0; - - std::optional min_unprocessed_insert_time_changed; - std::optional max_processed_insert_time_changed; - - { - std::unique_lock lock(state_mutex); - - bool removed = virtual_parts.remove(part_name); - - for (Queue::iterator it = queue.begin(); it != queue.end();) - { - if ((*it)->new_part_name == part_name) - { - found = *it; - if (removed) - { - /// Preserve invariant `virtual_parts` = `current_parts` + `queue`. - /// We remove new_part from virtual parts and add all source parts - /// which present in current_parts. - for (const auto & source_part : found->source_parts) - { - auto part_in_current_parts = current_parts.getContainingPart(source_part); - if (part_in_current_parts == source_part) - virtual_parts.add(source_part, nullptr, log); - } - } - - updateStateOnQueueEntryRemoval( - found, /* is_successful = */ false, - min_unprocessed_insert_time_changed, max_processed_insert_time_changed, lock); - queue.erase(it++); - queue_size = queue.size(); - break; - } - else - ++it; - } - } - - if (!found) - return false; - - notifySubscribers(queue_size); - - zookeeper->tryRemove(fs::path(replica_path) / "queue" / found->znode_name); - updateTimesInZooKeeper(zookeeper, min_unprocessed_insert_time_changed, max_processed_insert_time_changed); - - return true; -} - - bool ReplicatedMergeTreeQueue::removeFailedQuorumPart(const MergeTreePartInfo & part_info) { assert(part_info.level == 0); diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeQueue.h b/src/Storages/MergeTree/ReplicatedMergeTreeQueue.h index 078795472bf..820d2794a31 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeQueue.h +++ b/src/Storages/MergeTree/ReplicatedMergeTreeQueue.h @@ -281,11 +281,6 @@ public: */ void insert(zkutil::ZooKeeperPtr zookeeper, LogEntryPtr & entry); - /** Delete the action with the specified part (as new_part_name) from the queue. - * Called for unreachable actions in the queue - old lost parts. - */ - bool remove(zkutil::ZooKeeperPtr zookeeper, const String & part_name); - /** Load (initialize) a queue from ZooKeeper (/replicas/me/queue/). * If queue was not empty load() would not load duplicate records. * return true, if we update queue. @@ -378,6 +373,11 @@ public: /// Checks that part is already in virtual parts bool isVirtualPart(const MergeTreeData::DataPartPtr & data_part) const; + /// Check that part produced by some entry in queue and get source parts for it. + /// If there are several entries return largest source_parts set. This rarely possible + /// for example after replica clone. + bool checkPartInQueueAndGetSourceParts(const String & part_name, Strings & source_parts) const; + /// Check that part isn't in currently generating parts and isn't covered by them and add it to future_parts. /// Locks queue's mutex. bool addFuturePartIfNotCoveredByThem(const String & part_name, LogEntry & entry, String & reject_reason); diff --git a/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.cpp b/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.cpp new file mode 100644 index 00000000000..b43e7656084 --- /dev/null +++ b/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.cpp @@ -0,0 +1,720 @@ +#include "MaterializedPostgreSQLConsumer.h" + +#include "StorageMaterializedPostgreSQL.h" +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int LOGICAL_ERROR; +} + +MaterializedPostgreSQLConsumer::MaterializedPostgreSQLConsumer( + ContextPtr context_, + std::shared_ptr connection_, + const std::string & replication_slot_name_, + const std::string & publication_name_, + const std::string & start_lsn, + const size_t max_block_size_, + bool allow_automatic_update_, + Storages storages_) + : log(&Poco::Logger::get("PostgreSQLReaplicaConsumer")) + , context(context_) + , replication_slot_name(replication_slot_name_) + , publication_name(publication_name_) + , connection(connection_) + , current_lsn(start_lsn) + , lsn_value(getLSNValue(start_lsn)) + , max_block_size(max_block_size_) + , allow_automatic_update(allow_automatic_update_) + , storages(storages_) +{ + final_lsn = start_lsn; + auto tx = std::make_shared(connection->getRef()); + current_lsn = advanceLSN(tx); + LOG_TRACE(log, "Starting replication. LSN: {} (last: {})", getLSNValue(current_lsn), getLSNValue(final_lsn)); + tx->commit(); + + for (const auto & [table_name, storage] : storages) + { + buffers.emplace(table_name, Buffer(storage)); + } +} + + +void MaterializedPostgreSQLConsumer::Buffer::createEmptyBuffer(StoragePtr storage) +{ + const auto storage_metadata = storage->getInMemoryMetadataPtr(); + const Block sample_block = storage_metadata->getSampleBlock(); + + /// Need to clear type, because in description.init() the types are appended (emplace_back) + description.types.clear(); + description.init(sample_block); + + columns = description.sample_block.cloneEmptyColumns(); + const auto & storage_columns = storage_metadata->getColumns().getAllPhysical(); + auto insert_columns = std::make_shared(); + + auto table_id = storage->getStorageID(); + LOG_TRACE(&Poco::Logger::get("MaterializedPostgreSQLBuffer"), "New buffer for table {}.{} ({}), structure: {}", + table_id.database_name, table_id.table_name, toString(table_id.uuid), sample_block.dumpStructure()); + + assert(description.sample_block.columns() == storage_columns.size()); + size_t idx = 0; + + for (const auto & column : storage_columns) + { + if (description.types[idx].first == ExternalResultDescription::ValueType::vtArray) + preparePostgreSQLArrayInfo(array_info, idx, description.sample_block.getByPosition(idx).type); + idx++; + + insert_columns->children.emplace_back(std::make_shared(column.name)); + } + + columnsAST = std::move(insert_columns); +} + + +void MaterializedPostgreSQLConsumer::insertValue(Buffer & buffer, const std::string & value, size_t column_idx) +{ + const auto & sample = buffer.description.sample_block.getByPosition(column_idx); + bool is_nullable = buffer.description.types[column_idx].second; + + if (is_nullable) + { + ColumnNullable & column_nullable = assert_cast(*buffer.columns[column_idx]); + const auto & data_type = assert_cast(*sample.type); + + insertPostgreSQLValue( + column_nullable.getNestedColumn(), value, + buffer.description.types[column_idx].first, data_type.getNestedType(), buffer.array_info, column_idx); + + column_nullable.getNullMapData().emplace_back(0); + } + else + { + insertPostgreSQLValue( + *buffer.columns[column_idx], value, + buffer.description.types[column_idx].first, sample.type, + buffer.array_info, column_idx); + } +} + + +void MaterializedPostgreSQLConsumer::insertDefaultValue(Buffer & buffer, size_t column_idx) +{ + const auto & sample = buffer.description.sample_block.getByPosition(column_idx); + insertDefaultPostgreSQLValue(*buffer.columns[column_idx], *sample.column); +} + + +void MaterializedPostgreSQLConsumer::readString(const char * message, size_t & pos, size_t size, String & result) +{ + assert(size > pos + 2); + char current = unhex2(message + pos); + pos += 2; + while (pos < size && current != '\0') + { + result += current; + current = unhex2(message + pos); + pos += 2; + } +} + + +template +T MaterializedPostgreSQLConsumer::unhexN(const char * message, size_t pos, size_t n) +{ + T result = 0; + for (size_t i = 0; i < n; ++i) + { + if (i) result <<= 8; + result |= UInt32(unhex2(message + pos + 2 * i)); + } + return result; +} + + +Int64 MaterializedPostgreSQLConsumer::readInt64(const char * message, size_t & pos, [[maybe_unused]] size_t size) +{ + assert(size >= pos + 16); + Int64 result = unhexN(message, pos, 8); + pos += 16; + return result; +} + + +Int32 MaterializedPostgreSQLConsumer::readInt32(const char * message, size_t & pos, [[maybe_unused]] size_t size) +{ + assert(size >= pos + 8); + Int32 result = unhexN(message, pos, 4); + pos += 8; + return result; +} + + +Int16 MaterializedPostgreSQLConsumer::readInt16(const char * message, size_t & pos, [[maybe_unused]] size_t size) +{ + assert(size >= pos + 4); + Int16 result = unhexN(message, pos, 2); + pos += 4; + return result; +} + + +Int8 MaterializedPostgreSQLConsumer::readInt8(const char * message, size_t & pos, [[maybe_unused]] size_t size) +{ + assert(size >= pos + 2); + Int8 result = unhex2(message + pos); + pos += 2; + return result; +} + + +void MaterializedPostgreSQLConsumer::readTupleData( + Buffer & buffer, const char * message, size_t & pos, [[maybe_unused]] size_t size, PostgreSQLQuery type, bool old_value) +{ + Int16 num_columns = readInt16(message, pos, size); + + auto proccess_column_value = [&](Int8 identifier, Int16 column_idx) + { + switch (identifier) + { + case 'n': /// NULL + { + insertDefaultValue(buffer, column_idx); + break; + } + case 't': /// Text formatted value + { + Int32 col_len = readInt32(message, pos, size); + String value; + + for (Int32 i = 0; i < col_len; ++i) + value += readInt8(message, pos, size); + + insertValue(buffer, value, column_idx); + break; + } + case 'u': /// TOAST value && unchanged at the same time. Actual value is not sent. + { + /// TOAST values are not supported. (TOAST values are values that are considered in postgres + /// to be too large to be stored directly) + LOG_WARNING(log, "Got TOAST value, which is not supported, default value will be used instead."); + insertDefaultValue(buffer, column_idx); + break; + } + } + }; + + for (int column_idx = 0; column_idx < num_columns; ++column_idx) + proccess_column_value(readInt8(message, pos, size), column_idx); + + switch (type) + { + case PostgreSQLQuery::INSERT: + { + buffer.columns[num_columns]->insert(Int8(1)); + buffer.columns[num_columns + 1]->insert(lsn_value); + + break; + } + case PostgreSQLQuery::DELETE: + { + buffer.columns[num_columns]->insert(Int8(-1)); + buffer.columns[num_columns + 1]->insert(lsn_value); + + break; + } + case PostgreSQLQuery::UPDATE: + { + /// Process old value in case changed value is a primary key. + if (old_value) + buffer.columns[num_columns]->insert(Int8(-1)); + else + buffer.columns[num_columns]->insert(Int8(1)); + + buffer.columns[num_columns + 1]->insert(lsn_value); + + break; + } + } +} + + +/// https://www.postgresql.org/docs/13/protocol-logicalrep-message-formats.html +void MaterializedPostgreSQLConsumer::processReplicationMessage(const char * replication_message, size_t size) +{ + /// Skip '\x' + size_t pos = 2; + char type = readInt8(replication_message, pos, size); + // LOG_DEBUG(log, "Message type: {}, lsn string: {}, lsn value {}", type, current_lsn, lsn_value); + + switch (type) + { + case 'B': // Begin + { + readInt64(replication_message, pos, size); /// Int64 transaction end lsn + readInt64(replication_message, pos, size); /// Int64 transaction commit timestamp + break; + } + case 'I': // Insert + { + Int32 relation_id = readInt32(replication_message, pos, size); + + if (!isSyncAllowed(relation_id)) + return; + + Int8 new_tuple = readInt8(replication_message, pos, size); + const auto & table_name = relation_id_to_name[relation_id]; + auto buffer = buffers.find(table_name); + assert(buffer != buffers.end()); + + if (new_tuple) + readTupleData(buffer->second, replication_message, pos, size, PostgreSQLQuery::INSERT); + + break; + } + case 'U': // Update + { + Int32 relation_id = readInt32(replication_message, pos, size); + + if (!isSyncAllowed(relation_id)) + return; + + const auto & table_name = relation_id_to_name[relation_id]; + auto buffer = buffers.find(table_name); + assert(buffer != buffers.end()); + + auto proccess_identifier = [&](Int8 identifier) -> bool + { + bool read_next = true; + switch (identifier) + { + /// Only if changed column(s) are part of replica identity index (or primary keys if they are used instead). + /// In this case, first comes a tuple with old replica identity indexes and all other values will come as + /// nulls. Then comes a full new row. + case 'K': [[fallthrough]]; + /// Old row. Only if replica identity is set to full. Does not really make sense to use it as + /// it is much more efficient to use replica identity index, but support all possible cases. + case 'O': + { + readTupleData(buffer->second, replication_message, pos, size, PostgreSQLQuery::UPDATE, true); + break; + } + case 'N': + { + /// New row. + readTupleData(buffer->second, replication_message, pos, size, PostgreSQLQuery::UPDATE); + read_next = false; + break; + } + } + + return read_next; + }; + + /// Read either 'K' or 'O'. Never both of them. Also possible not to get both of them. + bool read_next = proccess_identifier(readInt8(replication_message, pos, size)); + + /// 'N'. Always present, but could come in place of 'K' and 'O'. + if (read_next) + proccess_identifier(readInt8(replication_message, pos, size)); + + break; + } + case 'D': // Delete + { + Int32 relation_id = readInt32(replication_message, pos, size); + + if (!isSyncAllowed(relation_id)) + return; + + /// 0 or 1 if replica identity is set to full. For now only default replica identity is supported (with primary keys). + readInt8(replication_message, pos, size); + + const auto & table_name = relation_id_to_name[relation_id]; + auto buffer = buffers.find(table_name); + assert(buffer != buffers.end()); + readTupleData(buffer->second, replication_message, pos, size, PostgreSQLQuery::DELETE); + + break; + } + case 'C': // Commit + { + constexpr size_t unused_flags_len = 1; + constexpr size_t commit_lsn_len = 8; + constexpr size_t transaction_end_lsn_len = 8; + constexpr size_t transaction_commit_timestamp_len = 8; + pos += unused_flags_len + commit_lsn_len + transaction_end_lsn_len + transaction_commit_timestamp_len; + + LOG_DEBUG(log, "Current lsn: {} = {}", current_lsn, getLSNValue(current_lsn)); /// Will be removed + + final_lsn = current_lsn; + break; + } + case 'R': // Relation + { + Int32 relation_id = readInt32(replication_message, pos, size); + + String relation_namespace, relation_name; + + readString(replication_message, pos, size, relation_namespace); + readString(replication_message, pos, size, relation_name); + + if (!isSyncAllowed(relation_id)) + return; + + if (storages.find(relation_name) == storages.end()) + { + markTableAsSkipped(relation_id, relation_name); + LOG_ERROR(log, + "Storage for table {} does not exist, but is included in replication stream. (Storages number: {})", + relation_name, storages.size()); + return; + } + + assert(buffers.count(relation_name)); + + + /// 'd' - default (primary key if any) + /// 'n' - nothing + /// 'f' - all columns (set replica identity full) + /// 'i' - user defined index with indisreplident set + /// Only 'd' and 'i' - are supported. + char replica_identity = readInt8(replication_message, pos, size); + + if (replica_identity != 'd' && replica_identity != 'i') + { + LOG_WARNING(log, + "Table has replica identity {} - not supported. A table must have a primary key or a replica identity index"); + markTableAsSkipped(relation_id, relation_name); + return; + } + + Int16 num_columns = readInt16(replication_message, pos, size); + + Int32 data_type_id; + Int32 type_modifier; /// For example, n in varchar(n) + + bool new_relation_definition = false; + if (schema_data.find(relation_id) == schema_data.end()) + { + relation_id_to_name[relation_id] = relation_name; + schema_data.emplace(relation_id, SchemaData(num_columns)); + new_relation_definition = true; + } + + auto & current_schema_data = schema_data.find(relation_id)->second; + + if (current_schema_data.number_of_columns != num_columns) + { + markTableAsSkipped(relation_id, relation_name); + return; + } + + for (uint16_t i = 0; i < num_columns; ++i) + { + String column_name; + readInt8(replication_message, pos, size); /// Marks column as part of replica identity index + readString(replication_message, pos, size, column_name); + + data_type_id = readInt32(replication_message, pos, size); + type_modifier = readInt32(replication_message, pos, size); + + if (new_relation_definition) + { + current_schema_data.column_identifiers.emplace_back(std::make_tuple(data_type_id, type_modifier)); + } + else + { + if (current_schema_data.column_identifiers[i].first != data_type_id + || current_schema_data.column_identifiers[i].second != type_modifier) + { + markTableAsSkipped(relation_id, relation_name); + return; + } + } + } + + tables_to_sync.insert(relation_name); + + break; + } + case 'O': // Origin + break; + case 'Y': // Type + break; + case 'T': // Truncate + break; + default: + throw Exception(ErrorCodes::LOGICAL_ERROR, + "Unexpected byte1 value {} while parsing replication message", type); + } +} + + +void MaterializedPostgreSQLConsumer::syncTables() +{ + try + { + for (const auto & table_name : tables_to_sync) + { + auto & buffer = buffers.find(table_name)->second; + Block result_rows = buffer.description.sample_block.cloneWithColumns(std::move(buffer.columns)); + + if (result_rows.rows()) + { + auto storage = storages[table_name]; + + auto insert_context = Context::createCopy(context); + insert_context->setInternalQuery(true); + + auto insert = std::make_shared(); + insert->table_id = storage->getStorageID(); + insert->columns = buffer.columnsAST; + + InterpreterInsertQuery interpreter(insert, insert_context, true); + auto block_io = interpreter.execute(); + OneBlockInputStream input(result_rows); + + assertBlocksHaveEqualStructure(input.getHeader(), block_io.out->getHeader(), "postgresql replica table sync"); + copyData(input, *block_io.out); + + buffer.columns = buffer.description.sample_block.cloneEmptyColumns(); + } + } + + LOG_DEBUG(log, "Table sync end for {} tables, last lsn: {} = {}, (attempted lsn {})", tables_to_sync.size(), current_lsn, getLSNValue(current_lsn), getLSNValue(final_lsn)); + + auto tx = std::make_shared(connection->getRef()); + current_lsn = advanceLSN(tx); + tables_to_sync.clear(); + tx->commit(); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } +} + + +String MaterializedPostgreSQLConsumer::advanceLSN(std::shared_ptr tx) +{ + std::string query_str = fmt::format("SELECT end_lsn FROM pg_replication_slot_advance('{}', '{}')", replication_slot_name, final_lsn); + pqxx::result result{tx->exec(query_str)}; + + final_lsn = result[0][0].as(); + LOG_TRACE(log, "Advanced LSN up to: {}", getLSNValue(final_lsn)); + return final_lsn; +} + + +/// Sync for some table might not be allowed if: +/// 1. Table schema changed and might break synchronization. +/// 2. There is no storage for this table. (As a result of some exception or incorrect pg_publication) +bool MaterializedPostgreSQLConsumer::isSyncAllowed(Int32 relation_id) +{ + auto table_with_lsn = skip_list.find(relation_id); + + /// Table is not present in a skip list - allow synchronization. + if (table_with_lsn == skip_list.end()) + return true; + + const auto & table_start_lsn = table_with_lsn->second; + + /// Table is in a skip list and has not yet received a valid lsn == it has not been reloaded. + if (table_start_lsn.empty()) + return false; + + /// Table has received a valid lsn, but it is not yet at a position, from which synchronization is + /// allowed. It is allowed only after lsn position, returned with snapshot, from which + /// table was reloaded. + if (getLSNValue(current_lsn) >= getLSNValue(table_start_lsn)) + { + LOG_TRACE(log, "Synchronization is resumed for table: {} (start_lsn: {})", + relation_id_to_name[relation_id], table_start_lsn); + + skip_list.erase(table_with_lsn); + + return true; + } + + return false; +} + + +void MaterializedPostgreSQLConsumer::markTableAsSkipped(Int32 relation_id, const String & relation_name) +{ + /// Empty lsn string means - continue waiting for valid lsn. + skip_list.insert({relation_id, ""}); + + if (storages.count(relation_name)) + { + /// Erase cached schema identifiers. It will be updated again once table is allowed back into replication stream + /// and it receives first data after update. + schema_data.erase(relation_id); + + /// Clear table buffer. + auto & buffer = buffers.find(relation_name)->second; + buffer.columns = buffer.description.sample_block.cloneEmptyColumns(); + + if (allow_automatic_update) + LOG_TRACE(log, "Table {} (relation_id: {}) is skipped temporarily. It will be reloaded in the background", relation_name, relation_id); + else + LOG_WARNING(log, "Table {} (relation_id: {}) is skipped, because table schema has changed", relation_name, relation_id); + } +} + + +/// Read binary changes from replication slot via COPY command (starting from current lsn in a slot). +bool MaterializedPostgreSQLConsumer::readFromReplicationSlot() +{ + bool slot_empty = true; + + try + { + auto tx = std::make_shared(connection->getRef()); + + /// Read up to max_block_size rows changes (upto_n_changes parameter). It might return larger number as the limit + /// is checked only after each transaction block. + /// Returns less than max_block_changes, if reached end of wal. Sync to table in this case. + + std::string query_str = fmt::format( + "select lsn, data FROM pg_logical_slot_peek_binary_changes(" + "'{}', NULL, {}, 'publication_names', '{}', 'proto_version', '1')", + replication_slot_name, max_block_size, publication_name); + + auto stream{pqxx::stream_from::query(*tx, query_str)}; + + while (true) + { + const std::vector * row{stream.read_row()}; + + if (!row) + { + stream.complete(); + + if (slot_empty) + { + tx->commit(); + return false; + } + + break; + } + + slot_empty = false; + current_lsn = (*row)[0]; + lsn_value = getLSNValue(current_lsn); + + processReplicationMessage((*row)[1].c_str(), (*row)[1].size()); + } + } + catch (const Exception &) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + return false; + } + catch (const pqxx::broken_connection & e) + { + LOG_ERROR(log, "Connection error: {}", e.what()); + connection->tryUpdateConnection(); + return false; + } + catch (const pqxx::sql_error & e) + { + /// For now sql replication interface is used and it has the problem that it registers relcache + /// callbacks on each pg_logical_slot_get_changes and there is no way to invalidate them: + /// https://github.com/postgres/postgres/blob/master/src/backend/replication/pgoutput/pgoutput.c#L1128 + /// So at some point will get out of limit and then they will be cleaned. + std::string error_message = e.what(); + if (error_message.find("out of relcache_callback_list slots") == std::string::npos) + tryLogCurrentException(__PRETTY_FUNCTION__); + + return false; + } + catch (const pqxx::conversion_error & e) + { + LOG_ERROR(log, "Conversion error: {}", e.what()); + return false; + } + catch (const pqxx::in_doubt_error & e) + { + LOG_ERROR(log, "PostgreSQL library has some doubts: {}", e.what()); + return false; + } + catch (const pqxx::internal_error & e) + { + LOG_ERROR(log, "PostgreSQL library internal error: {}", e.what()); + return false; + } + catch (...) + { + /// Since reading is done from a background task, it is important to catch any possible error + /// in order to understand why something does not work. + try + { + std::rethrow_exception(std::current_exception()); + } + catch (const std::exception& e) + { + LOG_ERROR(log, "Unexpected error: {}", e.what()); + } + } + + if (!tables_to_sync.empty()) + syncTables(); + + return true; +} + + +bool MaterializedPostgreSQLConsumer::consume(std::vector> & skipped_tables) +{ + /// Check if there are tables, which are skipped from being updated by changes from replication stream, + /// because schema changes were detected. Update them, if it is allowed. + if (allow_automatic_update && !skip_list.empty()) + { + for (const auto & [relation_id, lsn] : skip_list) + { + /// Non-empty lsn in this place means that table was already updated, but no changes for that table were + /// received in a previous stream. A table is removed from skip list only when there came + /// changes for table with lsn higher than lsn of snapshot, from which table was reloaded. Since table + /// reaload and reading from replication stream are done in the same thread, no lsn will be skipped + /// between these two events. + if (lsn.empty()) + skipped_tables.emplace_back(std::make_pair(relation_id, relation_id_to_name[relation_id])); + } + } + + /// Read up to max_block_size changed (approximately - in same cases might be more). + /// false: no data was read, reschedule. + /// true: some data was read, schedule as soon as possible. + return readFromReplicationSlot(); +} + + +void MaterializedPostgreSQLConsumer::updateNested(const String & table_name, StoragePtr nested_storage, Int32 table_id, const String & table_start_lsn) +{ + /// Cache new pointer to replacingMergeTree table. + storages[table_name] = nested_storage; + + /// Create a new empty buffer (with updated metadata), where data is first loaded before syncing into actual table. + auto & buffer = buffers.find(table_name)->second; + buffer.createEmptyBuffer(nested_storage); + + /// Set start position to valid lsn. Before it was an empty string. Further read for table allowed, if it has a valid lsn. + skip_list[table_id] = table_start_lsn; +} + +} diff --git a/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.h b/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.h new file mode 100644 index 00000000000..8f3224784f1 --- /dev/null +++ b/src/Storages/PostgreSQL/MaterializedPostgreSQLConsumer.h @@ -0,0 +1,146 @@ +#pragma once + +#include +#include + +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +class MaterializedPostgreSQLConsumer +{ +public: + using Storages = std::unordered_map; + + MaterializedPostgreSQLConsumer( + ContextPtr context_, + std::shared_ptr connection_, + const String & replication_slot_name_, + const String & publication_name_, + const String & start_lsn, + const size_t max_block_size_, + bool allow_automatic_update_, + Storages storages_); + + bool consume(std::vector> & skipped_tables); + + /// Called from reloadFromSnapshot by replication handler. This method is needed to move a table back into synchronization + /// process if it was skipped due to schema changes. + void updateNested(const String & table_name, StoragePtr nested_storage, Int32 table_id, const String & table_start_lsn); + +private: + /// Read approximarely up to max_block_size changes from WAL. + bool readFromReplicationSlot(); + + void syncTables(); + + String advanceLSN(std::shared_ptr ntx); + + void processReplicationMessage(const char * replication_message, size_t size); + + bool isSyncAllowed(Int32 relation_id); + + struct Buffer + { + ExternalResultDescription description; + MutableColumns columns; + + /// Needed to pass to insert query columns list in syncTables(). + std::shared_ptr columnsAST; + + /// Needed for insertPostgreSQLValue() method to parse array + std::unordered_map array_info; + + Buffer(StoragePtr storage) { createEmptyBuffer(storage); } + void createEmptyBuffer(StoragePtr storage); + }; + + using Buffers = std::unordered_map; + + static void insertDefaultValue(Buffer & buffer, size_t column_idx); + static void insertValue(Buffer & buffer, const std::string & value, size_t column_idx); + + enum class PostgreSQLQuery + { + INSERT, + UPDATE, + DELETE + }; + + void readTupleData(Buffer & buffer, const char * message, size_t & pos, size_t size, PostgreSQLQuery type, bool old_value = false); + + template + static T unhexN(const char * message, size_t pos, size_t n); + static void readString(const char * message, size_t & pos, size_t size, String & result); + static Int64 readInt64(const char * message, size_t & pos, size_t size); + static Int32 readInt32(const char * message, size_t & pos, size_t size); + static Int16 readInt16(const char * message, size_t & pos, size_t size); + static Int8 readInt8(const char * message, size_t & pos, size_t size); + + void markTableAsSkipped(Int32 relation_id, const String & relation_name); + + /// lsn - log sequnce nuumber, like wal offset (64 bit). + Int64 getLSNValue(const std::string & lsn) + { + UInt32 upper_half, lower_half; + std::sscanf(lsn.data(), "%X/%X", &upper_half, &lower_half); + return (static_cast(upper_half) << 32) + lower_half; + } + + Poco::Logger * log; + ContextPtr context; + const std::string replication_slot_name, publication_name; + + std::shared_ptr connection; + + std::string current_lsn, final_lsn; + + /// current_lsn converted from String to Int64 via getLSNValue(). + UInt64 lsn_value; + + const size_t max_block_size; + bool allow_automatic_update; + + String table_to_insert; + + /// List of tables which need to be synced after last replication stream. + std::unordered_set tables_to_sync; + + Storages storages; + Buffers buffers; + + std::unordered_map relation_id_to_name; + + struct SchemaData + { + Int16 number_of_columns; + /// data_type_id and type_modifier + std::vector> column_identifiers; + + SchemaData(Int16 number_of_columns_) : number_of_columns(number_of_columns_) {} + }; + + /// Cache for table schema data to be able to detect schema changes, because ddl is not + /// replicated with postgresql logical replication protocol, but some table schema info + /// is received if it is the first time we received dml message for given relation in current session or + /// if relation definition has changed since the last relation definition message. + std::unordered_map schema_data; + + /// skip_list contains relation ids for tables on which ddl was performed, which can break synchronization. + /// This breaking changes are detected in replication stream in according replication message and table is added to skip list. + /// After it is finished, a temporary replication slot is created with 'export snapshot' option, and start_lsn is returned. + /// Skipped tables are reloaded from snapshot (nested tables are also updated). Afterwards, if a replication message is + /// related to a table in a skip_list, we compare current lsn with start_lsn, which was returned with according snapshot. + /// If current_lsn >= table_start_lsn, we can safely remove table from skip list and continue its synchronization. + /// No needed message, related to reloaded table will be missed, because messages are not consumed in the meantime, + /// i.e. we will not miss the first start_lsn position for reloaded table. + std::unordered_map skip_list; +}; +} diff --git a/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.cpp b/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.cpp new file mode 100644 index 00000000000..ef9ca78d984 --- /dev/null +++ b/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.cpp @@ -0,0 +1,45 @@ +#include "MaterializedPostgreSQLSettings.h" + +#if USE_LIBPQXX +#include +#include +#include +#include + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int UNKNOWN_SETTING; +} + +IMPLEMENT_SETTINGS_TRAITS(MaterializedPostgreSQLSettingsTraits, LIST_OF_MATERIALIZED_POSTGRESQL_SETTINGS) + +void MaterializedPostgreSQLSettings::loadFromQuery(ASTStorage & storage_def) +{ + if (storage_def.settings) + { + try + { + applyChanges(storage_def.settings->changes); + } + catch (Exception & e) + { + if (e.code() == ErrorCodes::UNKNOWN_SETTING) + e.addMessage("for storage " + storage_def.engine->name); + throw; + } + } + else + { + auto settings_ast = std::make_shared(); + settings_ast->is_standalone = false; + storage_def.set(storage_def.settings, settings_ast); + } +} + +} + +#endif diff --git a/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.h b/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.h new file mode 100644 index 00000000000..3bc32a21876 --- /dev/null +++ b/src/Storages/PostgreSQL/MaterializedPostgreSQLSettings.h @@ -0,0 +1,30 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +#include "config_core.h" +#endif + +#if USE_LIBPQXX +#include + + +namespace DB +{ + class ASTStorage; + + +#define LIST_OF_MATERIALIZED_POSTGRESQL_SETTINGS(M) \ + M(UInt64, materialized_postgresql_max_block_size, 65536, "Number of row collected before flushing data into table.", 0) \ + M(String, materialized_postgresql_tables_list, "", "List of tables for MaterializedPostgreSQL database engine", 0) \ + M(Bool, materialized_postgresql_allow_automatic_update, 0, "Allow to reload table in the background, when schema changes are detected", 0) \ + +DECLARE_SETTINGS_TRAITS(MaterializedPostgreSQLSettingsTraits, LIST_OF_MATERIALIZED_POSTGRESQL_SETTINGS) + +struct MaterializedPostgreSQLSettings : public BaseSettings +{ + void loadFromQuery(ASTStorage & storage_def); +}; + +} + +#endif diff --git a/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.cpp b/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.cpp new file mode 100644 index 00000000000..4c614d8fd5a --- /dev/null +++ b/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.cpp @@ -0,0 +1,648 @@ +#include "PostgreSQLReplicationHandler.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +static const auto RESCHEDULE_MS = 500; +static const auto BACKOFF_TRESHOLD_MS = 10000; + +namespace ErrorCodes +{ + extern const int LOGICAL_ERROR; + extern const int BAD_ARGUMENTS; +} + +PostgreSQLReplicationHandler::PostgreSQLReplicationHandler( + const String & replication_identifier, + const String & remote_database_name_, + const String & current_database_name_, + const postgres::ConnectionInfo & connection_info_, + ContextPtr context_, + bool is_attach_, + const size_t max_block_size_, + bool allow_automatic_update_, + bool is_materialized_postgresql_database_, + const String tables_list_) + : log(&Poco::Logger::get("PostgreSQLReplicationHandler")) + , context(context_) + , is_attach(is_attach_) + , remote_database_name(remote_database_name_) + , current_database_name(current_database_name_) + , connection_info(connection_info_) + , max_block_size(max_block_size_) + , allow_automatic_update(allow_automatic_update_) + , is_materialized_postgresql_database(is_materialized_postgresql_database_) + , tables_list(tables_list_) + , connection(std::make_shared(connection_info_)) + , milliseconds_to_wait(RESCHEDULE_MS) +{ + replication_slot = fmt::format("{}_ch_replication_slot", replication_identifier); + publication_name = fmt::format("{}_ch_publication", replication_identifier); + + startup_task = context->getSchedulePool().createTask("PostgreSQLReplicaStartup", [this]{ waitConnectionAndStart(); }); + consumer_task = context->getSchedulePool().createTask("PostgreSQLReplicaStartup", [this]{ consumerFunc(); }); +} + + +void PostgreSQLReplicationHandler::addStorage(const std::string & table_name, StorageMaterializedPostgreSQL * storage) +{ + materialized_storages[table_name] = storage; +} + + +void PostgreSQLReplicationHandler::startup() +{ + startup_task->activateAndSchedule(); +} + + +void PostgreSQLReplicationHandler::waitConnectionAndStart() +{ + try + { + connection->connect(); /// Will throw pqxx::broken_connection if no connection at the moment + startSynchronization(false); + } + catch (const pqxx::broken_connection & pqxx_error) + { + LOG_ERROR(log, "Unable to set up connection. Reconnection attempt will continue. Error message: {}", pqxx_error.what()); + startup_task->scheduleAfter(RESCHEDULE_MS); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } +} + + +void PostgreSQLReplicationHandler::shutdown() +{ + stop_synchronization.store(true); + startup_task->deactivate(); + consumer_task->deactivate(); +} + + +void PostgreSQLReplicationHandler::startSynchronization(bool throw_on_error) +{ + { + pqxx::work tx(connection->getRef()); + createPublicationIfNeeded(tx); + tx.commit(); + } + + postgres::Connection replication_connection(connection_info, /* replication */true); + pqxx::nontransaction tx(replication_connection.getRef()); + + /// List of nested tables (table_name -> nested_storage), which is passed to replication consumer. + std::unordered_map nested_storages; + + /// snapshot_name is initialized only if a new replication slot is created. + /// start_lsn is initialized in two places: + /// 1. if replication slot does not exist, start_lsn will be returned with its creation return parameters; + /// 2. if replication slot already exist, start_lsn is read from pg_replication_slots as + /// `confirmed_flush_lsn` - the address (LSN) up to which the logical slot's consumer has confirmed receiving data. + /// Data older than this is not available anymore. + /// TODO: more tests + String snapshot_name, start_lsn; + + auto initial_sync = [&]() + { + createReplicationSlot(tx, start_lsn, snapshot_name); + + for (const auto & [table_name, storage] : materialized_storages) + { + try + { + nested_storages[table_name] = loadFromSnapshot(snapshot_name, table_name, storage->as ()); + } + catch (Exception & e) + { + e.addMessage("while loading table {}.{}", remote_database_name, table_name); + tryLogCurrentException(__PRETTY_FUNCTION__); + + /// Throw in case of single MaterializedPostgreSQL storage, because initial setup is done immediately + /// (unlike database engine where it is done in a separate thread). + if (throw_on_error) + throw; + } + } + }; + + /// There is one replication slot for each replication handler. In case of MaterializedPostgreSQL database engine, + /// there is one replication slot per database. Its lifetime must be equal to the lifetime of replication handler. + /// Recreation of a replication slot imposes reloading of all tables. + if (!isReplicationSlotExist(tx, start_lsn, /* temporary */false)) + { + initial_sync(); + } + /// Always drop replication slot if it is CREATE query and not ATTACH. + else if (!is_attach || new_publication) + { + dropReplicationSlot(tx); + initial_sync(); + } + /// Synchronization and initial load already took place - do not create any new tables, just fetch StoragePtr's + /// and pass them to replication consumer. + else + { + for (const auto & [table_name, storage] : materialized_storages) + { + auto * materialized_storage = storage->as (); + try + { + /// Try load nested table, set materialized table metadata. + nested_storages[table_name] = materialized_storage->prepare(); + } + catch (Exception & e) + { + e.addMessage("while loading table {}.{}", remote_database_name, table_name); + tryLogCurrentException(__PRETTY_FUNCTION__); + + if (throw_on_error) + throw; + } + } + LOG_TRACE(log, "Loaded {} tables", nested_storages.size()); + } + + tx.commit(); + + /// Pass current connection to consumer. It is not std::moved implicitly, but a shared_ptr is passed. + /// Consumer and replication handler are always executed one after another (not concurrently) and share the same connection. + /// (Apart from the case, when shutdownFinal is called). + /// Handler uses it only for loadFromSnapshot and shutdown methods. + consumer = std::make_shared( + context, + connection, + replication_slot, + publication_name, + start_lsn, + max_block_size, + allow_automatic_update, + nested_storages); + + consumer_task->activateAndSchedule(); + + /// Do not rely anymore on saved storage pointers. + materialized_storages.clear(); +} + + +StoragePtr PostgreSQLReplicationHandler::loadFromSnapshot(String & snapshot_name, const String & table_name, + StorageMaterializedPostgreSQL * materialized_storage) +{ + auto tx = std::make_shared(connection->getRef()); + + std::string query_str = fmt::format("SET TRANSACTION SNAPSHOT '{}'", snapshot_name); + tx->exec(query_str); + + /// Load from snapshot, which will show table state before creation of replication slot. + /// Already connected to needed database, no need to add it to query. + query_str = fmt::format("SELECT * FROM {}", table_name); + + materialized_storage->createNestedIfNeeded(fetchTableStructure(*tx, table_name)); + auto nested_storage = materialized_storage->getNested(); + + auto insert = std::make_shared(); + insert->table_id = nested_storage->getStorageID(); + + auto insert_context = materialized_storage->getNestedTableContext(); + + InterpreterInsertQuery interpreter(insert, insert_context); + auto block_io = interpreter.execute(); + + const StorageInMemoryMetadata & storage_metadata = nested_storage->getInMemoryMetadata(); + auto sample_block = storage_metadata.getSampleBlockNonMaterialized(); + + PostgreSQLTransactionBlockInputStream input(tx, query_str, sample_block, DEFAULT_BLOCK_SIZE); + assertBlocksHaveEqualStructure(input.getHeader(), block_io.out->getHeader(), "postgresql replica load from snapshot"); + copyData(input, *block_io.out); + + nested_storage = materialized_storage->prepare(); + auto nested_table_id = nested_storage->getStorageID(); + LOG_TRACE(log, "Loaded table {}.{} (uuid: {})", nested_table_id.database_name, nested_table_id.table_name, toString(nested_table_id.uuid)); + + return nested_storage; +} + + +void PostgreSQLReplicationHandler::consumerFunc() +{ + std::vector> skipped_tables; + + bool schedule_now = consumer->consume(skipped_tables); + + if (!skipped_tables.empty()) + { + try + { + reloadFromSnapshot(skipped_tables); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } + } + + if (stop_synchronization) + { + LOG_TRACE(log, "Replication thread is stopped"); + return; + } + + if (schedule_now) + { + milliseconds_to_wait = RESCHEDULE_MS; + consumer_task->schedule(); + + LOG_DEBUG(log, "Scheduling replication thread: now"); + } + else + { + consumer_task->scheduleAfter(milliseconds_to_wait); + if (milliseconds_to_wait < BACKOFF_TRESHOLD_MS) + milliseconds_to_wait *= 2; + + LOG_TRACE(log, "Scheduling replication thread: after {} ms", milliseconds_to_wait); + } +} + + +bool PostgreSQLReplicationHandler::isPublicationExist(pqxx::work & tx) +{ + std::string query_str = fmt::format("SELECT exists (SELECT 1 FROM pg_publication WHERE pubname = '{}')", publication_name); + pqxx::result result{tx.exec(query_str)}; + assert(!result.empty()); + return result[0][0].as() == "t"; +} + + +void PostgreSQLReplicationHandler::createPublicationIfNeeded(pqxx::work & tx) +{ + auto publication_exists = isPublicationExist(tx); + + if (!is_attach && publication_exists) + { + /// This is a case for single Materialized storage. In case of database engine this check is done in advance. + LOG_WARNING(log, + "Publication {} already exists, but it is a CREATE query, not ATTACH. Publication will be dropped", + publication_name); + + connection->execWithRetry([&](pqxx::nontransaction & tx_){ dropPublication(tx_); }); + } + + if (!is_attach || !publication_exists) + { + if (tables_list.empty()) + { + for (const auto & storage_data : materialized_storages) + { + if (!tables_list.empty()) + tables_list += ", "; + tables_list += storage_data.first; + } + } + + if (tables_list.empty()) + throw Exception(ErrorCodes::LOGICAL_ERROR, "No table found to be replicated"); + + /// 'ONLY' means just a table, without descendants. + std::string query_str = fmt::format("CREATE PUBLICATION {} FOR TABLE ONLY {}", publication_name, tables_list); + try + { + tx.exec(query_str); + LOG_TRACE(log, "Created publication {} with tables list: {}", publication_name, tables_list); + new_publication = true; + } + catch (Exception & e) + { + e.addMessage("while creating pg_publication"); + throw; + } + } + else + { + LOG_TRACE(log, "Using existing publication ({}) version", publication_name); + } +} + + +bool PostgreSQLReplicationHandler::isReplicationSlotExist(pqxx::nontransaction & tx, String & start_lsn, bool temporary) +{ + String slot_name; + if (temporary) + slot_name = replication_slot + "_tmp"; + else + slot_name = replication_slot; + + String query_str = fmt::format("SELECT active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots WHERE slot_name = '{}'", slot_name); + pqxx::result result{tx.exec(query_str)}; + + /// Replication slot does not exist + if (result.empty()) + return false; + + start_lsn = result[0][2].as(); + + LOG_TRACE(log, "Replication slot {} already exists (active: {}). Restart lsn position: {}, confirmed flush lsn: {}", + slot_name, result[0][0].as(), result[0][1].as(), start_lsn); + + return true; +} + + +void PostgreSQLReplicationHandler::createReplicationSlot( + pqxx::nontransaction & tx, String & start_lsn, String & snapshot_name, bool temporary) +{ + String query_str, slot_name; + if (temporary) + slot_name = replication_slot + "_tmp"; + else + slot_name = replication_slot; + + query_str = fmt::format("CREATE_REPLICATION_SLOT {} LOGICAL pgoutput EXPORT_SNAPSHOT", slot_name); + + try + { + pqxx::result result{tx.exec(query_str)}; + start_lsn = result[0][1].as(); + snapshot_name = result[0][2].as(); + LOG_TRACE(log, "Created replication slot: {}, start lsn: {}", replication_slot, start_lsn); + } + catch (Exception & e) + { + e.addMessage("while creating PostgreSQL replication slot {}", slot_name); + throw; + } +} + + +void PostgreSQLReplicationHandler::dropReplicationSlot(pqxx::nontransaction & tx, bool temporary) +{ + std::string slot_name; + if (temporary) + slot_name = replication_slot + "_tmp"; + else + slot_name = replication_slot; + + std::string query_str = fmt::format("SELECT pg_drop_replication_slot('{}')", slot_name); + + tx.exec(query_str); + LOG_TRACE(log, "Dropped replication slot: {}", slot_name); +} + + +void PostgreSQLReplicationHandler::dropPublication(pqxx::nontransaction & tx) +{ + std::string query_str = fmt::format("DROP PUBLICATION IF EXISTS {}", publication_name); + tx.exec(query_str); + LOG_TRACE(log, "Dropped publication: {}", publication_name); +} + + +void PostgreSQLReplicationHandler::shutdownFinal() +{ + try + { + shutdown(); + + connection->execWithRetry([&](pqxx::nontransaction & tx){ dropPublication(tx); }); + String last_committed_lsn; + + connection->execWithRetry([&](pqxx::nontransaction & tx) + { + if (isReplicationSlotExist(tx, last_committed_lsn, /* temporary */false)) + dropReplicationSlot(tx, /* temporary */false); + }); + + connection->execWithRetry([&](pqxx::nontransaction & tx) + { + if (isReplicationSlotExist(tx, last_committed_lsn, /* temporary */true)) + dropReplicationSlot(tx, /* temporary */true); + }); + } + catch (Exception & e) + { + e.addMessage("while dropping replication slot: {}", replication_slot); + LOG_ERROR(log, "Failed to drop replication slot: {}. It must be dropped manually.", replication_slot); + throw; + } +} + + +/// Used by MaterializedPostgreSQL database engine. +NameSet PostgreSQLReplicationHandler::fetchRequiredTables(postgres::Connection & connection_) +{ + pqxx::work tx(connection_.getRef()); + NameSet result_tables; + + bool publication_exists_before_startup = isPublicationExist(tx); + LOG_DEBUG(log, "Publication exists: {}, is attach: {}", publication_exists_before_startup, is_attach); + + Strings expected_tables; + if (!tables_list.empty()) + { + splitInto<','>(expected_tables, tables_list); + if (expected_tables.empty()) + throw Exception(ErrorCodes::BAD_ARGUMENTS, "Cannot parse tables list: {}", tables_list); + for (auto & table_name : expected_tables) + boost::trim(table_name); + } + + if (publication_exists_before_startup) + { + if (!is_attach) + { + LOG_WARNING(log, + "Publication {} already exists, but it is a CREATE query, not ATTACH. Publication will be dropped", + publication_name); + + connection->execWithRetry([&](pqxx::nontransaction & tx_){ dropPublication(tx_); }); + } + else + { + if (tables_list.empty()) + { + LOG_WARNING(log, + "Publication {} already exists and tables list is empty. Assuming publication is correct.", + publication_name); + + result_tables = fetchPostgreSQLTablesList(tx); + } + /// Check tables list from publication is the same as expected tables list. + /// If not - drop publication and return expected tables list. + else + { + result_tables = fetchTablesFromPublication(tx); + NameSet diff; + std::set_symmetric_difference(expected_tables.begin(), expected_tables.end(), + result_tables.begin(), result_tables.end(), + std::inserter(diff, diff.begin())); + if (!diff.empty()) + { + String diff_tables; + for (const auto & table_name : diff) + { + if (!diff_tables.empty()) + diff_tables += ", "; + diff_tables += table_name; + } + + LOG_WARNING(log, + "Publication {} already exists, but specified tables list differs from publication tables list in tables: {}.", + publication_name, diff_tables); + + connection->execWithRetry([&](pqxx::nontransaction & tx_){ dropPublication(tx_); }); + } + } + } + } + + if (result_tables.empty()) + { + if (!tables_list.empty()) + { + result_tables = NameSet(expected_tables.begin(), expected_tables.end()); + } + else + { + /// Fetch all tables list from database. Publication does not exist yet, which means + /// that no replication took place. Publication will be created in + /// startSynchronization method. + result_tables = fetchPostgreSQLTablesList(tx); + } + } + + tx.commit(); + return result_tables; +} + + +NameSet PostgreSQLReplicationHandler::fetchTablesFromPublication(pqxx::work & tx) +{ + std::string query = fmt::format("SELECT tablename FROM pg_publication_tables WHERE pubname = '{}'", publication_name); + std::unordered_set tables; + + for (auto table_name : tx.stream(query)) + tables.insert(std::get<0>(table_name)); + + return tables; +} + + +PostgreSQLTableStructurePtr PostgreSQLReplicationHandler::fetchTableStructure( + pqxx::ReplicationTransaction & tx, const std::string & table_name) const +{ + if (!is_materialized_postgresql_database) + return nullptr; + + return std::make_unique(fetchPostgreSQLTableStructure(tx, table_name, true, true, true)); +} + + +void PostgreSQLReplicationHandler::reloadFromSnapshot(const std::vector> & relation_data) +{ + /// If table schema has changed, the table stops consuming changes from replication stream. + /// If `allow_automatic_update` is true, create a new table in the background, load new table schema + /// and all data from scratch. Then execute REPLACE query. + /// This is only allowed for MaterializedPostgreSQL database engine. + try + { + postgres::Connection replication_connection(connection_info, /* replication */true); + pqxx::nontransaction tx(replication_connection.getRef()); + + String snapshot_name, start_lsn; + + if (isReplicationSlotExist(tx, start_lsn, /* temporary */true)) + dropReplicationSlot(tx, /* temporary */true); + + createReplicationSlot(tx, start_lsn, snapshot_name, /* temporary */true); + + for (const auto & [relation_id, table_name] : relation_data) + { + auto storage = DatabaseCatalog::instance().getTable(StorageID(current_database_name, table_name), context); + auto * materialized_storage = storage->as (); + + /// If for some reason this temporary table already exists - also drop it. + auto temp_materialized_storage = materialized_storage->createTemporary(); + + /// This snapshot is valid up to the end of the transaction, which exported it. + StoragePtr temp_nested_storage = loadFromSnapshot(snapshot_name, table_name, + temp_materialized_storage->as ()); + + auto table_id = materialized_storage->getNestedStorageID(); + auto temp_table_id = temp_nested_storage->getStorageID(); + + LOG_TRACE(log, "Starting background update of table {} with table {}", + table_id.getNameForLogs(), temp_table_id.getNameForLogs()); + + auto ast_rename = std::make_shared(); + ASTRenameQuery::Element elem + { + ASTRenameQuery::Table{table_id.database_name, table_id.table_name}, + ASTRenameQuery::Table{temp_table_id.database_name, temp_table_id.table_name} + }; + ast_rename->elements.push_back(std::move(elem)); + ast_rename->exchange = true; + + auto nested_context = materialized_storage->getNestedTableContext(); + + try + { + auto materialized_table_lock = materialized_storage->lockForShare(String(), context->getSettingsRef().lock_acquire_timeout); + InterpreterRenameQuery(ast_rename, nested_context).execute(); + + { + auto nested_storage = DatabaseCatalog::instance().getTable(StorageID(table_id.database_name, table_id.table_name), + nested_context); + auto nested_table_lock = nested_storage->lockForShare(String(), context->getSettingsRef().lock_acquire_timeout); + auto nested_table_id = nested_storage->getStorageID(); + + materialized_storage->setNestedStorageID(nested_table_id); + nested_storage = materialized_storage->prepare(); + + auto nested_storage_metadata = nested_storage->getInMemoryMetadataPtr(); + auto nested_sample_block = nested_storage_metadata->getSampleBlock(); + LOG_TRACE(log, "Updated table {}. New structure: {}", + nested_table_id.getNameForLogs(), nested_sample_block.dumpStructure()); + + auto materialized_storage_metadata = nested_storage->getInMemoryMetadataPtr(); + auto materialized_sample_block = materialized_storage_metadata->getSampleBlock(); + + assertBlocksHaveEqualStructure(nested_sample_block, materialized_sample_block, "while reloading table in the background"); + + /// Pass pointer to new nested table into replication consumer, remove current table from skip list and set start lsn position. + consumer->updateNested(table_name, nested_storage, relation_id, start_lsn); + } + + LOG_DEBUG(log, "Dropping table {}", temp_table_id.getNameForLogs()); + InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Drop, nested_context, nested_context, temp_table_id, true); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } + } + + dropReplicationSlot(tx, /* temporary */true); + tx.commit(); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } +} + +} diff --git a/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.h b/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.h new file mode 100644 index 00000000000..95ac12b3786 --- /dev/null +++ b/src/Storages/PostgreSQL/PostgreSQLReplicationHandler.h @@ -0,0 +1,129 @@ +#pragma once + +#include "MaterializedPostgreSQLConsumer.h" +#include +#include + + +namespace DB +{ + +/// IDEA: There is ALTER PUBLICATION command to dynamically add and remove tables for replicating (the command is transactional). +/// (Probably, if in a replication stream comes a relation name, which does not currently +/// exist in CH, it can be loaded via snapshot while stream is stopped and then comparing wal positions with +/// current lsn and table start lsn. + +class StorageMaterializedPostgreSQL; + +class PostgreSQLReplicationHandler +{ +public: + PostgreSQLReplicationHandler( + const String & replication_identifier, + const String & remote_database_name_, + const String & current_database_name_, + const postgres::ConnectionInfo & connection_info_, + ContextPtr context_, + bool is_attach_, + const size_t max_block_size_, + bool allow_automatic_update_, + bool is_materialized_postgresql_database_, + const String tables_list = ""); + + /// Activate task to be run from a separate thread: wait until connection is available and call startReplication(). + void startup(); + + /// Stop replication without cleanup. + void shutdown(); + + /// Clean up replication: remove publication and replication slots. + void shutdownFinal(); + + /// Add storage pointer to let handler know which tables it needs to keep in sync. + void addStorage(const std::string & table_name, StorageMaterializedPostgreSQL * storage); + + /// Fetch list of tables which are going to be replicated. Used for database engine. + NameSet fetchRequiredTables(postgres::Connection & connection_); + + /// Start replication setup immediately. + void startSynchronization(bool throw_on_error); + +private: + using MaterializedStorages = std::unordered_map; + + /// Methods to manage Publication. + + bool isPublicationExist(pqxx::work & tx); + + void createPublicationIfNeeded(pqxx::work & tx); + + NameSet fetchTablesFromPublication(pqxx::work & tx); + + void dropPublication(pqxx::nontransaction & ntx); + + /// Methods to manage Replication Slots. + + bool isReplicationSlotExist(pqxx::nontransaction & tx, String & start_lsn, bool temporary = false); + + void createReplicationSlot(pqxx::nontransaction & tx, String & start_lsn, String & snapshot_name, bool temporary = false); + + void dropReplicationSlot(pqxx::nontransaction & tx, bool temporary = false); + + /// Methods to manage replication. + + void waitConnectionAndStart(); + + void consumerFunc(); + + StoragePtr loadFromSnapshot(std::string & snapshot_name, const String & table_name, StorageMaterializedPostgreSQL * materialized_storage); + + void reloadFromSnapshot(const std::vector> & relation_data); + + PostgreSQLTableStructurePtr fetchTableStructure(pqxx::ReplicationTransaction & tx, const String & table_name) const; + + Poco::Logger * log; + ContextPtr context; + + /// If it is not attach, i.e. a create query, then if publication already exists - always drop it. + bool is_attach; + + /// If new publication is created at start up - always drop replication slot if it exists. + bool new_publication = false; + + const String remote_database_name, current_database_name; + + /// Connection string and address for logs. + postgres::ConnectionInfo connection_info; + + /// max_block_size for replication stream. + const size_t max_block_size; + + /// Table structure changes are always tracked. By default, table with changed schema will get into a skip list. + /// This setting allows to reloas table in the background. + bool allow_automatic_update = false; + + /// To distinguish whether current replication handler belongs to a MaterializedPostgreSQL database engine or single storage. + bool is_materialized_postgresql_database; + + /// A coma-separated list of tables, which are going to be replicated for database engine. By default, a whole database is replicated. + String tables_list; + + String replication_slot, publication_name; + + /// Shared between replication_consumer and replication_handler, but never accessed concurrently. + std::shared_ptr connection; + + /// Replication consumer. Manages decoding of replication stream and syncing into tables. + std::shared_ptr consumer; + + BackgroundSchedulePool::TaskHolder startup_task, consumer_task; + + std::atomic stop_synchronization = false; + + /// MaterializedPostgreSQL tables. Used for managing all operations with its internal nested tables. + MaterializedStorages materialized_storages; + + UInt64 milliseconds_to_wait; +}; + +} diff --git a/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp new file mode 100644 index 00000000000..70251a940cc --- /dev/null +++ b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.cpp @@ -0,0 +1,502 @@ +#include "StorageMaterializedPostgreSQL.h" + +#if USE_LIBPQXX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +namespace ErrorCodes +{ + extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; + extern const int LOGICAL_ERROR; + extern const int BAD_ARGUMENTS; +} + +static const auto NESTED_TABLE_SUFFIX = "_nested"; +static const auto TMP_SUFFIX = "_tmp"; + + +/// For the case of single storage. +StorageMaterializedPostgreSQL::StorageMaterializedPostgreSQL( + const StorageID & table_id_, + bool is_attach_, + const String & remote_database_name, + const String & remote_table_name_, + const postgres::ConnectionInfo & connection_info, + const StorageInMemoryMetadata & storage_metadata, + ContextPtr context_, + std::unique_ptr replication_settings) + : IStorage(table_id_) + , WithContext(context_->getGlobalContext()) + , is_materialized_postgresql_database(false) + , has_nested(false) + , nested_context(makeNestedTableContext(context_->getGlobalContext())) + , nested_table_id(StorageID(table_id_.database_name, getNestedTableName())) + , remote_table_name(remote_table_name_) + , is_attach(is_attach_) +{ + if (table_id_.uuid == UUIDHelpers::Nil) + throw Exception(ErrorCodes::BAD_ARGUMENTS, "Storage MaterializedPostgreSQL is allowed only for Atomic database"); + + setInMemoryMetadata(storage_metadata); + + String replication_identifier = remote_database_name + "_" + remote_table_name_; + replication_handler = std::make_unique( + replication_identifier, + remote_database_name, + table_id_.database_name, + connection_info, + getContext(), + is_attach, + replication_settings->materialized_postgresql_max_block_size.value, + /* allow_automatic_update */ false, /* is_materialized_postgresql_database */false); +} + + +/// For the case of MaterializePosgreSQL database engine. +/// It is used when nested ReplacingMergeeTree table has not yet be created by replication thread. +/// In this case this storage can't be used for read queries. +StorageMaterializedPostgreSQL::StorageMaterializedPostgreSQL(const StorageID & table_id_, ContextPtr context_) + : IStorage(table_id_) + , WithContext(context_->getGlobalContext()) + , is_materialized_postgresql_database(true) + , has_nested(false) + , nested_context(makeNestedTableContext(context_->getGlobalContext())) +{ +} + + +/// Constructor for MaterializedPostgreSQL table engine - for the case of MaterializePosgreSQL database engine. +/// It is used when nested ReplacingMergeeTree table has already been created by replication thread. +/// This storage is ready to handle read queries. +StorageMaterializedPostgreSQL::StorageMaterializedPostgreSQL(StoragePtr nested_storage_, ContextPtr context_) + : IStorage(nested_storage_->getStorageID()) + , WithContext(context_->getGlobalContext()) + , is_materialized_postgresql_database(true) + , has_nested(true) + , nested_context(makeNestedTableContext(context_->getGlobalContext())) + , nested_table_id(nested_storage_->getStorageID()) +{ + setInMemoryMetadata(nested_storage_->getInMemoryMetadata()); +} + + +/// A temporary clone table might be created for current table in order to update its schema and reload +/// all data in the background while current table will still handle read requests. +StoragePtr StorageMaterializedPostgreSQL::createTemporary() const +{ + auto table_id = getStorageID(); + auto tmp_table_id = StorageID(table_id.database_name, table_id.table_name + TMP_SUFFIX); + + /// If for some reason it already exists - drop it. + auto tmp_storage = DatabaseCatalog::instance().tryGetTable(tmp_table_id, nested_context); + if (tmp_storage) + { + LOG_TRACE(&Poco::Logger::get("MaterializedPostgreSQLStorage"), "Temporary table {} already exists, dropping", tmp_table_id.getNameForLogs()); + InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Drop, getContext(), getContext(), tmp_table_id, /* no delay */true); + } + + auto new_context = Context::createCopy(context); + return StorageMaterializedPostgreSQL::create(tmp_table_id, new_context); +} + + +StoragePtr StorageMaterializedPostgreSQL::getNested() const +{ + return DatabaseCatalog::instance().getTable(getNestedStorageID(), nested_context); +} + + +StoragePtr StorageMaterializedPostgreSQL::tryGetNested() const +{ + return DatabaseCatalog::instance().tryGetTable(getNestedStorageID(), nested_context); +} + + +String StorageMaterializedPostgreSQL::getNestedTableName() const +{ + auto table_id = getStorageID(); + + if (is_materialized_postgresql_database) + return table_id.table_name; + + return toString(table_id.uuid) + NESTED_TABLE_SUFFIX; +} + + +StorageID StorageMaterializedPostgreSQL::getNestedStorageID() const +{ + if (nested_table_id.has_value()) + return nested_table_id.value(); + + auto table_id = getStorageID(); + throw Exception(ErrorCodes::LOGICAL_ERROR, + "No storageID found for inner table. ({})", table_id.getNameForLogs()); +} + + +void StorageMaterializedPostgreSQL::createNestedIfNeeded(PostgreSQLTableStructurePtr table_structure) +{ + const auto ast_create = getCreateNestedTableQuery(std::move(table_structure)); + auto table_id = getStorageID(); + auto tmp_nested_table_id = StorageID(table_id.database_name, getNestedTableName()); + + try + { + InterpreterCreateQuery interpreter(ast_create, nested_context); + interpreter.execute(); + + auto nested_storage = DatabaseCatalog::instance().getTable(tmp_nested_table_id, nested_context); + /// Save storage_id with correct uuid. + nested_table_id = nested_storage->getStorageID(); + } + catch (Exception & e) + { + e.addMessage("while creating nested table: {}", tmp_nested_table_id.getNameForLogs()); + tryLogCurrentException(__PRETTY_FUNCTION__); + } +} + + +std::shared_ptr StorageMaterializedPostgreSQL::makeNestedTableContext(ContextPtr from_context) +{ + auto new_context = Context::createCopy(from_context); + new_context->setInternalQuery(true); + return new_context; +} + + +StoragePtr StorageMaterializedPostgreSQL::prepare() +{ + auto nested_table = getNested(); + setInMemoryMetadata(nested_table->getInMemoryMetadata()); + has_nested.store(true); + return nested_table; +} + + +void StorageMaterializedPostgreSQL::startup() +{ + /// replication_handler != nullptr only in case of single table engine MaterializedPostgreSQL. + if (replication_handler) + { + replication_handler->addStorage(remote_table_name, this); + + if (is_attach) + { + /// In case of attach table use background startup in a separate thread. First wait until connection is reachable, + /// then check for nested table -- it should already be created. + replication_handler->startup(); + } + else + { + /// Start synchronization preliminary setup immediately and throw in case of failure. + /// It should be guaranteed that if MaterializedPostgreSQL table was created successfully, then + /// its nested table was also created. + replication_handler->startSynchronization(/* throw_on_error */ true); + } + } +} + + +void StorageMaterializedPostgreSQL::shutdown() +{ + if (replication_handler) + replication_handler->shutdown(); + auto nested = tryGetNested(); + if (nested) + nested->shutdown(); +} + + +void StorageMaterializedPostgreSQL::dropInnerTableIfAny(bool no_delay, ContextPtr local_context) +{ + /// If it is a table with database engine MaterializedPostgreSQL - return, because delition of + /// internal tables is managed there. + if (is_materialized_postgresql_database) + return; + + replication_handler->shutdownFinal(); + + auto nested_table = getNested(); + if (nested_table) + InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Drop, getContext(), local_context, getNestedStorageID(), no_delay); +} + + +NamesAndTypesList StorageMaterializedPostgreSQL::getVirtuals() const +{ + return NamesAndTypesList{ + {"_sign", std::make_shared()}, + {"_version", std::make_shared()} + }; +} + + +Pipe StorageMaterializedPostgreSQL::read( + const Names & column_names, + const StorageMetadataPtr & metadata_snapshot, + SelectQueryInfo & query_info, + ContextPtr context_, + QueryProcessingStage::Enum processed_stage, + size_t max_block_size, + unsigned num_streams) +{ + auto materialized_table_lock = lockForShare(String(), context_->getSettingsRef().lock_acquire_timeout); + auto nested_table = getNested(); + return readFinalFromNestedStorage(nested_table, column_names, metadata_snapshot, + query_info, context_, processed_stage, max_block_size, num_streams); +} + + +std::shared_ptr StorageMaterializedPostgreSQL::getMaterializedColumnsDeclaration( + const String name, const String type, UInt64 default_value) +{ + auto column_declaration = std::make_shared(); + + column_declaration->name = name; + column_declaration->type = makeASTFunction(type); + + column_declaration->default_specifier = "MATERIALIZED"; + column_declaration->default_expression = std::make_shared(default_value); + + column_declaration->children.emplace_back(column_declaration->type); + column_declaration->children.emplace_back(column_declaration->default_expression); + + return column_declaration; +} + + +ASTPtr StorageMaterializedPostgreSQL::getColumnDeclaration(const DataTypePtr & data_type) const +{ + WhichDataType which(data_type); + + if (which.isNullable()) + return makeASTFunction("Nullable", getColumnDeclaration(typeid_cast(data_type.get())->getNestedType())); + + if (which.isArray()) + return makeASTFunction("Array", getColumnDeclaration(typeid_cast(data_type.get())->getNestedType())); + + /// getName() for decimal returns 'Decimal(precision, scale)', will get an error with it + if (which.isDecimal()) + { + auto make_decimal_expression = [&](std::string type_name) + { + auto ast_expression = std::make_shared(); + + ast_expression->name = type_name; + ast_expression->arguments = std::make_shared(); + ast_expression->arguments->children.emplace_back(std::make_shared(getDecimalScale(*data_type))); + + return ast_expression; + }; + + if (which.isDecimal32()) + return make_decimal_expression("Decimal32"); + + if (which.isDecimal64()) + return make_decimal_expression("Decimal64"); + + if (which.isDecimal128()) + return make_decimal_expression("Decimal128"); + + if (which.isDecimal256()) + return make_decimal_expression("Decimal256"); + } + + return std::make_shared(data_type->getName()); +} + + +/// For single storage MaterializedPostgreSQL get columns and primary key columns from storage definition. +/// For database engine MaterializedPostgreSQL get columns and primary key columns by fetching from PostgreSQL, also using the same +/// transaction with snapshot, which is used for initial tables dump. +ASTPtr StorageMaterializedPostgreSQL::getCreateNestedTableQuery(PostgreSQLTableStructurePtr table_structure) +{ + auto create_table_query = std::make_shared(); + + auto table_id = getStorageID(); + create_table_query->table = getNestedTableName(); + create_table_query->database = table_id.database_name; + if (is_materialized_postgresql_database) + create_table_query->uuid = table_id.uuid; + + auto columns_declare_list = std::make_shared(); + auto columns_expression_list = std::make_shared(); + auto order_by_expression = std::make_shared(); + + auto metadata_snapshot = getInMemoryMetadataPtr(); + const auto & columns = metadata_snapshot->getColumns(); + NamesAndTypesList ordinary_columns_and_types; + + if (!is_materialized_postgresql_database) + { + ordinary_columns_and_types = columns.getOrdinary(); + } + else + { + if (!table_structure) + { + throw Exception(ErrorCodes::LOGICAL_ERROR, + "No table structure returned for table {}.{}", table_id.database_name, table_id.table_name); + } + + if (!table_structure->columns) + { + throw Exception(ErrorCodes::LOGICAL_ERROR, + "No columns returned for table {}.{}", table_id.database_name, table_id.table_name); + } + + ordinary_columns_and_types = *table_structure->columns; + + if (!table_structure->primary_key_columns && !table_structure->replica_identity_columns) + { + throw Exception(ErrorCodes::BAD_ARGUMENTS, + "Table {}.{} has no primary key and no replica identity index", table_id.database_name, table_id.table_name); + } + + NamesAndTypesList merging_columns; + if (table_structure->primary_key_columns) + merging_columns = *table_structure->primary_key_columns; + else + merging_columns = *table_structure->replica_identity_columns; + + order_by_expression->name = "tuple"; + order_by_expression->arguments = std::make_shared(); + + for (const auto & column : merging_columns) + order_by_expression->arguments->children.emplace_back(std::make_shared(column.name)); + } + + for (const auto & [name, type] : ordinary_columns_and_types) + { + const auto & column_declaration = std::make_shared(); + + column_declaration->name = name; + column_declaration->type = getColumnDeclaration(type); + + columns_expression_list->children.emplace_back(column_declaration); + } + + columns_declare_list->set(columns_declare_list->columns, columns_expression_list); + + columns_declare_list->columns->children.emplace_back(getMaterializedColumnsDeclaration("_sign", "Int8", 1)); + columns_declare_list->columns->children.emplace_back(getMaterializedColumnsDeclaration("_version", "UInt64", 1)); + + create_table_query->set(create_table_query->columns_list, columns_declare_list); + + /// Not nullptr for single storage (because throws exception if not specified), nullptr otherwise. + auto primary_key_ast = getInMemoryMetadataPtr()->getPrimaryKeyAST(); + + auto storage = std::make_shared(); + storage->set(storage->engine, makeASTFunction("ReplacingMergeTree", std::make_shared("_version"))); + + if (primary_key_ast) + storage->set(storage->order_by, primary_key_ast); + else + storage->set(storage->order_by, order_by_expression); + + create_table_query->set(create_table_query->storage, storage); + + /// Add columns _sign and _version, so that they can be accessed from nested ReplacingMergeTree table if needed. + ordinary_columns_and_types.push_back({"_sign", std::make_shared()}); + ordinary_columns_and_types.push_back({"_version", std::make_shared()}); + + StorageInMemoryMetadata storage_metadata; + storage_metadata.setColumns(ColumnsDescription(ordinary_columns_and_types)); + storage_metadata.setConstraints(metadata_snapshot->getConstraints()); + + setInMemoryMetadata(storage_metadata); + + return create_table_query; +} + + +void registerStorageMaterializedPostgreSQL(StorageFactory & factory) +{ + auto creator_fn = [](const StorageFactory::Arguments & args) + { + ASTs & engine_args = args.engine_args; + bool has_settings = args.storage_def->settings; + auto postgresql_replication_settings = std::make_unique(); + + if (has_settings) + postgresql_replication_settings->loadFromQuery(*args.storage_def); + + if (engine_args.size() != 5) + throw Exception("Storage MaterializedPostgreSQL requires 5 parameters: " + "PostgreSQL('host:port', 'database', 'table', 'username', 'password'", + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + + for (auto & engine_arg : engine_args) + engine_arg = evaluateConstantExpressionOrIdentifierAsLiteral(engine_arg, args.getContext()); + + StorageInMemoryMetadata metadata; + metadata.setColumns(args.columns); + metadata.setConstraints(args.constraints); + + if (!args.storage_def->order_by && args.storage_def->primary_key) + args.storage_def->set(args.storage_def->order_by, args.storage_def->primary_key->clone()); + + if (!args.storage_def->order_by) + throw Exception("Storage MaterializedPostgreSQL needs order by key or primary key", ErrorCodes::BAD_ARGUMENTS); + + if (args.storage_def->primary_key) + metadata.primary_key = KeyDescription::getKeyFromAST(args.storage_def->primary_key->ptr(), metadata.columns, args.getContext()); + else + metadata.primary_key = KeyDescription::getKeyFromAST(args.storage_def->order_by->ptr(), metadata.columns, args.getContext()); + + auto parsed_host_port = parseAddress(engine_args[0]->as().value.safeGet(), 5432); + const String & remote_table = engine_args[2]->as().value.safeGet(); + const String & remote_database = engine_args[1]->as().value.safeGet(); + + /// No connection is made here, see Storages/PostgreSQL/PostgreSQLConnection.cpp + auto connection_info = postgres::formatConnectionString( + remote_database, + parsed_host_port.first, + parsed_host_port.second, + engine_args[3]->as().value.safeGet(), + engine_args[4]->as().value.safeGet()); + + return StorageMaterializedPostgreSQL::create( + args.table_id, args.attach, remote_database, remote_table, connection_info, + metadata, args.getContext(), + std::move(postgresql_replication_settings)); + }; + + factory.registerStorage( + "MaterializedPostgreSQL", + creator_fn, + StorageFactory::StorageFeatures{ + .supports_settings = true, + .supports_sort_order = true, + .source_access_type = AccessType::POSTGRES, + }); +} + +} + +#endif diff --git a/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.h b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.h new file mode 100644 index 00000000000..5d18a0b16b7 --- /dev/null +++ b/src/Storages/PostgreSQL/StorageMaterializedPostgreSQL.h @@ -0,0 +1,180 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +#include "config_core.h" +#endif + +#if USE_LIBPQXX +#include "PostgreSQLReplicationHandler.h" +#include "MaterializedPostgreSQLSettings.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +/** Case of single MaterializedPostgreSQL table engine. + * + * A user creates a table with engine MaterializedPostgreSQL. Order by expression must be specified (needed for + * nested ReplacingMergeTree table). This storage owns its own replication handler, which loads table data + * from PostgreSQL into nested ReplacingMergeTree table. If table is not created, but attached, replication handler + * will not start loading-from-snapshot procedure, instead it will continue from last committed lsn. + * + * Main point: Both tables exist on disk; database engine interacts only with the main table and main table takes + * total ownershot over nested table. Nested table has name `main_table_uuid` + NESTED_SUFFIX. + * +**/ + + +/** Case of MaterializedPostgreSQL database engine. + * + * MaterializedPostgreSQL table exists only in memory and acts as a wrapper for nested table, i.e. only provides an + * interface to work with nested table. Both tables share the same StorageID. + * + * Main table is never created or dropped via database method. The only way database engine interacts with + * MaterializedPostgreSQL table - in tryGetTable() method, a MaterializedPostgreSQL table is returned in order to wrap + * and redirect read requests. Set of such wrapper-tables is cached inside database engine. All other methods in + * regard to materializePostgreSQL table are handled by replication handler. + * + * All database methods, apart from tryGetTable(), are devoted only to nested table. + * NOTE: It makes sense to allow rename method for MaterializedPostgreSQL table via database method. + * TODO: Make sure replication-to-table data channel is done only by relation_id. + * + * Also main table has the same InMemoryMetadata as its nested table, so if metadata of nested table changes - main table also has + * to update its metadata, because all read requests are passed to MaterializedPostgreSQL table and then it redirects read + * into nested table. + * + * When there is a need to update table structure, there will be created a new MaterializedPostgreSQL table with its own nested table, + * it will have updated table schema and all data will be loaded from scratch in the background, while previous table with outadted table + * structure will still serve read requests. When data is loaded, nested tables will be swapped, metadata of metarialzied table will be + * updated according to nested table. + * +**/ + +class StorageMaterializedPostgreSQL final : public shared_ptr_helper, public IStorage, WithContext +{ + friend struct shared_ptr_helper; + +public: + StorageMaterializedPostgreSQL(const StorageID & table_id_, ContextPtr context_); + + StorageMaterializedPostgreSQL(StoragePtr nested_storage_, ContextPtr context_); + + String getName() const override { return "MaterializedPostgreSQL"; } + + void startup() override; + + void shutdown() override; + + /// Used only for single MaterializedPostgreSQL storage. + void dropInnerTableIfAny(bool no_delay, ContextPtr local_context) override; + + NamesAndTypesList getVirtuals() const override; + + Pipe read( + const Names & column_names, + const StorageMetadataPtr & metadata_snapshot, + SelectQueryInfo & query_info, + ContextPtr context_, + QueryProcessingStage::Enum processed_stage, + size_t max_block_size, + unsigned num_streams) override; + + /// This method is called only from MateriaizePostgreSQL database engine, because it needs to maintain + /// an invariant: a table exists only if its nested table exists. This atomic variable is set to _true_ + /// only once - when nested table is successfully created and is never changed afterwards. + bool hasNested() { return has_nested.load(); } + + void createNestedIfNeeded(PostgreSQLTableStructurePtr table_structure); + + StoragePtr getNested() const; + + StoragePtr tryGetNested() const; + + /// Create a temporary MaterializedPostgreSQL table with current_table_name + TMP_SUFFIX. + /// An empty wrapper is returned - it does not have inMemory metadata, just acts as an empty wrapper over + /// temporary nested, which will be created shortly after. + StoragePtr createTemporary() const; + + ContextPtr getNestedTableContext() const { return nested_context; } + + StorageID getNestedStorageID() const; + + void setNestedStorageID(const StorageID & id) { nested_table_id.emplace(id); } + + static std::shared_ptr makeNestedTableContext(ContextPtr from_context); + + /// Get nested table (or throw if it does not exist), set in-memory metadata (taken from nested table) + /// for current table, set has_nested = true. + StoragePtr prepare(); + +protected: + StorageMaterializedPostgreSQL( + const StorageID & table_id_, + bool is_attach_, + const String & remote_database_name, + const String & remote_table_name, + const postgres::ConnectionInfo & connection_info, + const StorageInMemoryMetadata & storage_metadata, + ContextPtr context_, + std::unique_ptr replication_settings); + +private: + static std::shared_ptr getMaterializedColumnsDeclaration( + const String name, const String type, UInt64 default_value); + + ASTPtr getColumnDeclaration(const DataTypePtr & data_type) const; + + ASTPtr getCreateNestedTableQuery(PostgreSQLTableStructurePtr table_structure); + + String getNestedTableName() const; + + /// Not nullptr only for single MaterializedPostgreSQL storage, because for MaterializedPostgreSQL + /// database engine there is one replication handler for all tables. + std::unique_ptr replication_handler; + + /// Distinguish between single MaterilizePostgreSQL table engine and MaterializedPostgreSQL database engine, + /// because table with engine MaterilizePostgreSQL acts differently in each case. + bool is_materialized_postgresql_database = false; + + /// Will be set to `true` only once - when nested table was loaded by replication thread. + /// After that, it will never be changed. Needed for MaterializedPostgreSQL database engine + /// because there is an invariant - table exists only if its nested table exists, but nested + /// table is not loaded immediately. It is made atomic, because it is accessed only by database engine, + /// and updated by replication handler (only once). + std::atomic has_nested = false; + + /// Nested table context is a copy of global context, but modified to answer isInternalQuery() == true. + /// This is needed to let database engine know whether to access nested table or a wrapper over nested (materialized table). + ContextMutablePtr nested_context; + + /// Save nested storageID to be able to fetch it. It is set once nested is created and will be + /// updated only when nested is reloaded or renamed. + std::optional nested_table_id; + + /// Needed only for the case of single MaterializedPostgreSQL storage - in order to make + /// delayed storage forwarding into replication handler. + String remote_table_name; + + /// Needed only for the case of single MaterializedPostgreSQL storage, because in case of create + /// query (not attach) initial setup will be done immediately and error message is thrown at once. + /// It results in the fact: single MaterializedPostgreSQL storage is created only if its nested table is created. + /// In case of attach - this setup will be done in a separate thread in the background. It will also + /// be checked for nested table and attempted to load it if it does not exist for some reason. + bool is_attach = true; +}; + +} + +#endif diff --git a/src/Storages/ReadFinalForExternalReplicaStorage.cpp b/src/Storages/ReadFinalForExternalReplicaStorage.cpp new file mode 100644 index 00000000000..fb96bb01936 --- /dev/null +++ b/src/Storages/ReadFinalForExternalReplicaStorage.cpp @@ -0,0 +1,86 @@ +#include + +#if USE_MYSQL || USE_LIBPQXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB +{ + +Pipe readFinalFromNestedStorage( + StoragePtr nested_storage, + const Names & column_names, + const StorageMetadataPtr & /*metadata_snapshot*/, + SelectQueryInfo & query_info, + ContextPtr context, + QueryProcessingStage::Enum processed_stage, + size_t max_block_size, + unsigned int num_streams) +{ + NameSet column_names_set = NameSet(column_names.begin(), column_names.end()); + auto lock = nested_storage->lockForShare(context->getCurrentQueryId(), context->getSettingsRef().lock_acquire_timeout); + const StorageMetadataPtr & nested_metadata = nested_storage->getInMemoryMetadataPtr(); + + Block nested_header = nested_metadata->getSampleBlock(); + ColumnWithTypeAndName & sign_column = nested_header.getByPosition(nested_header.columns() - 2); + ColumnWithTypeAndName & version_column = nested_header.getByPosition(nested_header.columns() - 1); + + if (ASTSelectQuery * select_query = query_info.query->as(); select_query && !column_names_set.count(version_column.name)) + { + auto & tables_in_select_query = select_query->tables()->as(); + + if (!tables_in_select_query.children.empty()) + { + auto & tables_element = tables_in_select_query.children[0]->as(); + + if (tables_element.table_expression) + tables_element.table_expression->as().final = true; + } + } + + String filter_column_name; + Names require_columns_name = column_names; + ASTPtr expressions = std::make_shared(); + if (column_names_set.empty() || !column_names_set.count(sign_column.name)) + { + require_columns_name.emplace_back(sign_column.name); + + const auto & sign_column_name = std::make_shared(sign_column.name); + const auto & fetch_sign_value = std::make_shared(Field(Int8(1))); + + expressions->children.emplace_back(makeASTFunction("equals", sign_column_name, fetch_sign_value)); + filter_column_name = expressions->children.back()->getColumnName(); + + for (const auto & column_name : column_names) + expressions->children.emplace_back(std::make_shared(column_name)); + } + + Pipe pipe = nested_storage->read(require_columns_name, nested_metadata, query_info, context, processed_stage, max_block_size, num_streams); + pipe.addTableLock(lock); + + if (!expressions->children.empty() && !pipe.empty()) + { + Block pipe_header = pipe.getHeader(); + auto syntax = TreeRewriter(context).analyze(expressions, pipe_header.getNamesAndTypesList()); + ExpressionActionsPtr expression_actions = ExpressionAnalyzer(expressions, syntax, context).getActions(true /* add_aliases */, false /* project_result */); + + pipe.addSimpleTransform([&](const Block & header) + { + return std::make_shared(header, expression_actions, filter_column_name, false); + }); + } + + return pipe; +} +} + +#endif diff --git a/src/Storages/ReadFinalForExternalReplicaStorage.h b/src/Storages/ReadFinalForExternalReplicaStorage.h new file mode 100644 index 00000000000..b54592159ef --- /dev/null +++ b/src/Storages/ReadFinalForExternalReplicaStorage.h @@ -0,0 +1,28 @@ +#pragma once + +#if !defined(ARCADIA_BUILD) +# include "config_core.h" +#endif + +#if USE_MYSQL || USE_LIBPQXX + +#include +#include + + +namespace DB +{ + +Pipe readFinalFromNestedStorage( + StoragePtr nested_storage, + const Names & column_names, + const StorageMetadataPtr & /*metadata_snapshot*/, + SelectQueryInfo & query_info, + ContextPtr context, + QueryProcessingStage::Enum processed_stage, + size_t max_block_size, + unsigned int num_streams); + +} + +#endif diff --git a/src/Storages/StorageMaterializeMySQL.cpp b/src/Storages/StorageMaterializeMySQL.cpp index 8e6f2e1ad63..5b371fe3fb8 100644 --- a/src/Storages/StorageMaterializeMySQL.cpp +++ b/src/Storages/StorageMaterializeMySQL.cpp @@ -22,6 +22,7 @@ #include #include +#include #include namespace DB @@ -37,7 +38,7 @@ StorageMaterializeMySQL::StorageMaterializeMySQL(const StoragePtr & nested_stora Pipe StorageMaterializeMySQL::read( const Names & column_names, - const StorageMetadataPtr & /*metadata_snapshot*/, + const StorageMetadataPtr & metadata_snapshot, SelectQueryInfo & query_info, ContextPtr context, QueryProcessingStage::Enum processed_stage, @@ -46,61 +47,8 @@ Pipe StorageMaterializeMySQL::read( { /// If the background synchronization thread has exception. rethrowSyncExceptionIfNeed(database); - - NameSet column_names_set = NameSet(column_names.begin(), column_names.end()); - auto lock = nested_storage->lockForShare(context->getCurrentQueryId(), context->getSettingsRef().lock_acquire_timeout); - const StorageMetadataPtr & nested_metadata = nested_storage->getInMemoryMetadataPtr(); - - Block nested_header = nested_metadata->getSampleBlock(); - ColumnWithTypeAndName & sign_column = nested_header.getByPosition(nested_header.columns() - 2); - ColumnWithTypeAndName & version_column = nested_header.getByPosition(nested_header.columns() - 1); - - if (ASTSelectQuery * select_query = query_info.query->as(); select_query && !column_names_set.count(version_column.name)) - { - auto & tables_in_select_query = select_query->tables()->as(); - - if (!tables_in_select_query.children.empty()) - { - auto & tables_element = tables_in_select_query.children[0]->as(); - - if (tables_element.table_expression) - tables_element.table_expression->as().final = true; - } - } - - String filter_column_name; - Names require_columns_name = column_names; - ASTPtr expressions = std::make_shared(); - if (column_names_set.empty() || !column_names_set.count(sign_column.name)) - { - require_columns_name.emplace_back(sign_column.name); - - const auto & sign_column_name = std::make_shared(sign_column.name); - const auto & fetch_sign_value = std::make_shared(Field(Int8(1))); - - expressions->children.emplace_back(makeASTFunction("equals", sign_column_name, fetch_sign_value)); - filter_column_name = expressions->children.back()->getColumnName(); - - for (const auto & column_name : column_names) - expressions->children.emplace_back(std::make_shared(column_name)); - } - - Pipe pipe = nested_storage->read(require_columns_name, nested_metadata, query_info, context, processed_stage, max_block_size, num_streams); - pipe.addTableLock(lock); - - if (!expressions->children.empty() && !pipe.empty()) - { - Block pipe_header = pipe.getHeader(); - auto syntax = TreeRewriter(context).analyze(expressions, pipe_header.getNamesAndTypesList()); - ExpressionActionsPtr expression_actions = ExpressionAnalyzer(expressions, syntax, context).getActions(true /* add_aliases */, false /* project_result */); - - pipe.addSimpleTransform([&](const Block & header) - { - return std::make_shared(header, expression_actions, filter_column_name, false); - }); - } - - return pipe; + return readFinalFromNestedStorage(nested_storage, column_names, metadata_snapshot, + query_info, context, processed_stage, max_block_size, num_streams); } NamesAndTypesList StorageMaterializeMySQL::getVirtuals() const diff --git a/src/Storages/StorageMaterializedView.cpp b/src/Storages/StorageMaterializedView.cpp index 927a3c232ab..76fa4b8e20b 100644 --- a/src/Storages/StorageMaterializedView.cpp +++ b/src/Storages/StorageMaterializedView.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -229,36 +228,6 @@ BlockOutputStreamPtr StorageMaterializedView::write(const ASTPtr & query, const } -static void executeDropQuery(ASTDropQuery::Kind kind, ContextPtr global_context, ContextPtr current_context, const StorageID & target_table_id, bool no_delay) -{ - if (DatabaseCatalog::instance().tryGetTable(target_table_id, current_context)) - { - /// We create and execute `drop` query for internal table. - auto drop_query = std::make_shared(); - drop_query->database = target_table_id.database_name; - drop_query->table = target_table_id.table_name; - drop_query->kind = kind; - drop_query->no_delay = no_delay; - drop_query->if_exists = true; - ASTPtr ast_drop_query = drop_query; - /// FIXME We have to use global context to execute DROP query for inner table - /// to avoid "Not enough privileges" error if current user has only DROP VIEW ON mat_view_name privilege - /// and not allowed to drop inner table explicitly. Allowing to drop inner table without explicit grant - /// looks like expected behaviour and we have tests for it. - auto drop_context = Context::createCopy(global_context); - drop_context->getClientInfo().query_kind = ClientInfo::QueryKind::SECONDARY_QUERY; - if (auto txn = current_context->getZooKeeperMetadataTransaction()) - { - /// For Replicated database - drop_context->setQueryContext(std::const_pointer_cast(current_context)); - drop_context->initZooKeeperMetadataTransaction(txn, true); - } - InterpreterDropQuery drop_interpreter(ast_drop_query, drop_context); - drop_interpreter.execute(); - } -} - - void StorageMaterializedView::drop() { auto table_id = getStorageID(); @@ -266,19 +235,19 @@ void StorageMaterializedView::drop() if (!select_query.select_table_id.empty()) DatabaseCatalog::instance().removeDependency(select_query.select_table_id, table_id); - dropInnerTable(true, getContext()); + dropInnerTableIfAny(true, getContext()); } -void StorageMaterializedView::dropInnerTable(bool no_delay, ContextPtr local_context) +void StorageMaterializedView::dropInnerTableIfAny(bool no_delay, ContextPtr local_context) { if (has_inner_table && tryGetTargetTable()) - executeDropQuery(ASTDropQuery::Kind::Drop, getContext(), local_context, target_table_id, no_delay); + InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Drop, getContext(), local_context, target_table_id, no_delay); } void StorageMaterializedView::truncate(const ASTPtr &, const StorageMetadataPtr &, ContextPtr local_context, TableExclusiveLockHolder &) { if (has_inner_table) - executeDropQuery(ASTDropQuery::Kind::Truncate, getContext(), local_context, target_table_id, true); + InterpreterDropQuery::executeDropQuery(ASTDropQuery::Kind::Truncate, getContext(), local_context, target_table_id, true); } void StorageMaterializedView::checkStatementCanBeForwarded() const diff --git a/src/Storages/StorageMaterializedView.h b/src/Storages/StorageMaterializedView.h index 0f5bf724c2f..1f1729b05f7 100644 --- a/src/Storages/StorageMaterializedView.h +++ b/src/Storages/StorageMaterializedView.h @@ -37,7 +37,7 @@ public: BlockOutputStreamPtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override; void drop() override; - void dropInnerTable(bool no_delay, ContextPtr context); + void dropInnerTableIfAny(bool no_delay, ContextPtr local_context) override; void truncate(const ASTPtr &, const StorageMetadataPtr &, ContextPtr, TableExclusiveLockHolder &) override; diff --git a/src/Storages/StorageMerge.cpp b/src/Storages/StorageMerge.cpp index a076393e7e6..2d5bbfc712d 100644 --- a/src/Storages/StorageMerge.cpp +++ b/src/Storages/StorageMerge.cpp @@ -47,13 +47,16 @@ StorageMerge::StorageMerge( const StorageID & table_id_, const ColumnsDescription & columns_, const String & comment, - const String & source_database_, - const Strings & source_tables_, + const String & source_database_name_or_regexp_, + bool database_is_regexp_, + const DbToTableSetMap & source_databases_and_tables_, ContextPtr context_) : IStorage(table_id_) , WithContext(context_->getGlobalContext()) - , source_database(source_database_) - , source_tables(std::in_place, source_tables_.begin(), source_tables_.end()) + , source_database_regexp(source_database_name_or_regexp_) + , source_databases_and_tables(source_databases_and_tables_) + , source_database_name_or_regexp(source_database_name_or_regexp_) + , database_is_regexp(database_is_regexp_) { StorageInMemoryMetadata storage_metadata; storage_metadata.setColumns(columns_); @@ -65,13 +68,16 @@ StorageMerge::StorageMerge( const StorageID & table_id_, const ColumnsDescription & columns_, const String & comment, - const String & source_database_, + const String & source_database_name_or_regexp_, + bool database_is_regexp_, const String & source_table_regexp_, ContextPtr context_) : IStorage(table_id_) , WithContext(context_->getGlobalContext()) - , source_database(source_database_) + , source_database_regexp(source_database_name_or_regexp_) , source_table_regexp(source_table_regexp_) + , source_database_name_or_regexp(source_database_name_or_regexp_) + , database_is_regexp(database_is_regexp_) { StorageInMemoryMetadata storage_metadata; storage_metadata.setColumns(columns_); @@ -82,15 +88,18 @@ StorageMerge::StorageMerge( template StoragePtr StorageMerge::getFirstTable(F && predicate) const { - auto iterator = getDatabaseIterator(getContext()); + auto database_table_iterators = getDatabaseIterators(getContext()); - while (iterator->isValid()) + for (auto & iterator : database_table_iterators) { - const auto & table = iterator->table(); - if (table.get() != this && predicate(table)) - return table; + while (iterator->isValid()) + { + const auto & table = iterator->table(); + if (table.get() != this && predicate(table)) + return table; - iterator->next(); + iterator->next(); + } } return {}; @@ -112,7 +121,7 @@ bool StorageMerge::mayBenefitFromIndexForIn(const ASTPtr & left_in_operand, Cont size_t i = 0; for (const auto & table : selected_tables) { - const auto & storage_ptr = std::get<0>(table); + const auto & storage_ptr = std::get<1>(table); auto metadata_snapshot = storage_ptr->getInMemoryMetadataPtr(); if (storage_ptr->mayBenefitFromIndexForIn(left_in_operand, query_context, metadata_snapshot)) return true; @@ -145,22 +154,25 @@ QueryProcessingStage::Enum StorageMerge::getQueryProcessingStage( auto stage_in_source_tables = QueryProcessingStage::FetchColumns; - DatabaseTablesIteratorPtr iterator = getDatabaseIterator(local_context); + DatabaseTablesIterators database_table_iterators = getDatabaseIterators(local_context); size_t selected_table_size = 0; - while (iterator->isValid()) + for (const auto & iterator : database_table_iterators) { - const auto & table = iterator->table(); - if (table && table.get() != this) + while (iterator->isValid()) { - ++selected_table_size; - stage_in_source_tables = std::max( - stage_in_source_tables, - table->getQueryProcessingStage(local_context, to_stage, table->getInMemoryMetadataPtr(), query_info)); - } + const auto & table = iterator->table(); + if (table && table.get() != this) + { + ++selected_table_size; + stage_in_source_tables = std::max( + stage_in_source_tables, + table->getQueryProcessingStage(local_context, to_stage, table->getInMemoryMetadataPtr(), query_info)); + } - iterator->next(); + iterator->next(); + } } return selected_table_size == 1 ? stage_in_source_tables : std::min(stage_in_source_tables, QueryProcessingStage::WithMergeableState); @@ -178,13 +190,16 @@ Pipe StorageMerge::read( { Pipes pipes; + bool has_database_virtual_column = false; bool has_table_virtual_column = false; Names real_column_names; real_column_names.reserve(column_names.size()); for (const auto & column_name : column_names) { - if (column_name == "_table" && isVirtualColumn(column_name, metadata_snapshot)) + if (column_name == "_database" && isVirtualColumn(column_name, metadata_snapshot)) + has_database_virtual_column = true; + else if (column_name == "_table" && isVirtualColumn(column_name, metadata_snapshot)) has_table_virtual_column = true; else real_column_names.push_back(column_name); @@ -202,12 +217,24 @@ Pipe StorageMerge::read( /** First we make list of selected tables to find out its size. * This is necessary to correctly pass the recommended number of threads to each table. */ - StorageListWithLocks selected_tables = getSelectedTables(local_context, query_info.query, has_table_virtual_column); + StorageListWithLocks selected_tables + = getSelectedTables(local_context, query_info.query, has_database_virtual_column, has_table_virtual_column); if (selected_tables.empty()) /// FIXME: do we support sampling in this case? return createSources( - {}, query_info, processed_stage, max_block_size, header, {}, {}, real_column_names, modified_context, 0, has_table_virtual_column); + {}, + query_info, + processed_stage, + max_block_size, + header, + {}, + {}, + real_column_names, + modified_context, + 0, + has_database_virtual_column, + has_table_virtual_column); size_t tables_count = selected_tables.size(); Float64 num_streams_multiplier @@ -220,7 +247,7 @@ Pipe StorageMerge::read( { for (auto it = selected_tables.begin(); it != selected_tables.end(); ++it) { - auto storage_ptr = std::get<0>(*it); + auto storage_ptr = std::get<1>(*it); auto storage_metadata_snapshot = storage_ptr->getInMemoryMetadataPtr(); auto current_info = query_info.order_optimizer->getInputOrder(storage_metadata_snapshot, local_context); if (it == selected_tables.begin()) @@ -245,7 +272,7 @@ Pipe StorageMerge::read( remaining_streams -= current_streams; current_streams = std::max(size_t(1), current_streams); - const auto & storage = std::get<0>(table); + const auto & storage = std::get<1>(table); /// If sampling requested, then check that table supports it. if (query_info.query->as()->sampleSize() && !storage->supportsSampling()) @@ -293,9 +320,18 @@ Pipe StorageMerge::read( } auto source_pipe = createSources( - storage_metadata_snapshot, query_info, processed_stage, - max_block_size, header, aliases, table, required_columns.empty() ? real_column_names : required_columns, - modified_context, current_streams, has_table_virtual_column); + storage_metadata_snapshot, + query_info, + processed_stage, + max_block_size, + header, + aliases, + table, + required_columns.empty() ? real_column_names : required_columns, + modified_context, + current_streams, + has_database_virtual_column, + has_table_virtual_column); pipes.emplace_back(std::move(source_pipe)); } @@ -321,10 +357,11 @@ Pipe StorageMerge::createSources( Names & real_column_names, ContextMutablePtr modified_context, size_t streams_num, + bool has_database_virtual_column, bool has_table_virtual_column, bool concat_streams) { - const auto & [storage, struct_lock, table_name] = storage_with_lock; + const auto & [database_name, storage, struct_lock, table_name] = storage_with_lock; SelectQueryInfo modified_query_info = query_info; modified_query_info.query = query_info.query->clone(); @@ -336,6 +373,7 @@ Pipe StorageMerge::createSources( modified_query_info.syntax_analyzer_result = std::make_shared(std::move(new_analyzer_res)); VirtualColumnUtils::rewriteEntityInAst(modified_query_info.query, "_table", table_name); + VirtualColumnUtils::rewriteEntityInAst(modified_query_info.query, "_database", database_name); Pipe pipe; @@ -369,7 +407,7 @@ Pipe StorageMerge::createSources( } else if (processed_stage > storage_stage) { - modified_select.replaceDatabaseAndTable(source_database, table_name); + modified_select.replaceDatabaseAndTable(database_name, table_name); /// Maximum permissible parallelism is streams_num modified_context->setSetting("max_threads", streams_num); @@ -394,6 +432,24 @@ Pipe StorageMerge::createSources( // Using concat instead. pipe.addTransform(std::make_shared(pipe.getHeader(), pipe.numOutputPorts())); + if (has_database_virtual_column) + { + ColumnWithTypeAndName column; + column.name = "_database"; + column.type = std::make_shared(); + column.column = column.type->createColumnConst(0, Field(database_name)); + + auto adding_column_dag = ActionsDAG::makeAddingColumnActions(std::move(column)); + auto adding_column_actions = std::make_shared( + std::move(adding_column_dag), + ExpressionActionsSettings::fromContext(modified_context, CompileExpressions::yes)); + + pipe.addSimpleTransform([&](const Block & stream_header) + { + return std::make_shared(stream_header, adding_column_actions); + }); + } + if (has_table_virtual_column) { ColumnWithTypeAndName column; @@ -425,41 +481,67 @@ Pipe StorageMerge::createSources( } StorageMerge::StorageListWithLocks StorageMerge::getSelectedTables( - ContextPtr query_context, - const ASTPtr & query /* = nullptr */, - bool filter_by_virtual_column /* = false */) const + ContextPtr query_context, + const ASTPtr & query /* = nullptr */, + bool filter_by_database_virtual_column /* = false */, + bool filter_by_table_virtual_column /* = false */) const { - assert(!filter_by_virtual_column || query); + assert(!filter_by_database_virtual_column || !filter_by_table_virtual_column || query); const Settings & settings = query_context->getSettingsRef(); StorageListWithLocks selected_tables; - DatabaseTablesIteratorPtr iterator = getDatabaseIterator(getContext()); + DatabaseTablesIterators database_table_iterators = getDatabaseIterators(getContext()); + MutableColumnPtr database_name_virtual_column; MutableColumnPtr table_name_virtual_column; - if (filter_by_virtual_column) - table_name_virtual_column = ColumnString::create(); - - while (iterator->isValid()) + if (filter_by_database_virtual_column) { - StoragePtr storage = iterator->table(); - if (!storage) - continue; - - if (query && query->as()->prewhere() && !storage->supportsPrewhere()) - throw Exception("Storage " + storage->getName() + " doesn't support PREWHERE.", ErrorCodes::ILLEGAL_PREWHERE); - - if (storage.get() != this) - { - auto table_lock = storage->lockForShare(query_context->getCurrentQueryId(), settings.lock_acquire_timeout); - selected_tables.emplace_back(storage, std::move(table_lock), iterator->name()); - if (filter_by_virtual_column) - table_name_virtual_column->insert(iterator->name()); - } - - iterator->next(); + database_name_virtual_column = ColumnString::create(); } - if (filter_by_virtual_column) + if (filter_by_table_virtual_column) + { + table_name_virtual_column = ColumnString::create(); + } + + for (const auto & iterator : database_table_iterators) + { + if (filter_by_database_virtual_column) + database_name_virtual_column->insert(iterator->databaseName()); + while (iterator->isValid()) + { + StoragePtr storage = iterator->table(); + if (!storage) + continue; + + if (query && query->as()->prewhere() && !storage->supportsPrewhere()) + throw Exception("Storage " + storage->getName() + " doesn't support PREWHERE.", ErrorCodes::ILLEGAL_PREWHERE); + + if (storage.get() != this) + { + auto table_lock = storage->lockForShare(query_context->getCurrentQueryId(), settings.lock_acquire_timeout); + selected_tables.emplace_back(iterator->databaseName(), storage, std::move(table_lock), iterator->name()); + if (filter_by_table_virtual_column) + table_name_virtual_column->insert(iterator->name()); + } + + iterator->next(); + } + } + + if (filter_by_database_virtual_column) + { + /// Filter names of selected tables if there is a condition on "_database" virtual column in WHERE clause + Block virtual_columns_block + = Block{ColumnWithTypeAndName(std::move(database_name_virtual_column), std::make_shared(), "_database")}; + VirtualColumnUtils::filterBlockWithQuery(query, virtual_columns_block, query_context); + auto values = VirtualColumnUtils::extractSingleValueFromBlock(virtual_columns_block, "_database"); + + /// Remove unused databases from the list + selected_tables.remove_if([&](const auto & elem) { return values.find(std::get<0>(elem)) == values.end(); }); + } + + if (filter_by_table_virtual_column) { /// Filter names of selected tables if there is a condition on "_table" virtual column in WHERE clause Block virtual_columns_block = Block{ColumnWithTypeAndName(std::move(table_name_virtual_column), std::make_shared(), "_table")}; @@ -467,13 +549,30 @@ StorageMerge::StorageListWithLocks StorageMerge::getSelectedTables( auto values = VirtualColumnUtils::extractSingleValueFromBlock(virtual_columns_block, "_table"); /// Remove unused tables from the list - selected_tables.remove_if([&] (const auto & elem) { return values.find(std::get<2>(elem)) == values.end(); }); + selected_tables.remove_if([&](const auto & elem) { return values.find(std::get<3>(elem)) == values.end(); }); } return selected_tables; } -DatabaseTablesIteratorPtr StorageMerge::getDatabaseIterator(ContextPtr local_context) const +DatabaseTablesIteratorPtr StorageMerge::getDatabaseIterator(const String & database_name, ContextPtr local_context) const +{ + auto database = DatabaseCatalog::instance().getDatabase(database_name); + + auto table_name_match = [this, &database_name](const String & table_name_) -> bool { + if (source_databases_and_tables) + { + const auto & source_tables = (*source_databases_and_tables).at(database_name); + return source_tables.count(table_name_); + } + else + return source_table_regexp->match(table_name_); + }; + + return database->getTablesIterator(local_context, table_name_match); +} + +StorageMerge::DatabaseTablesIterators StorageMerge::getDatabaseIterators(ContextPtr local_context) const { try { @@ -485,17 +584,25 @@ DatabaseTablesIteratorPtr StorageMerge::getDatabaseIterator(ContextPtr local_con throw; } - auto database = DatabaseCatalog::instance().getDatabase(source_database); + DatabaseTablesIterators database_table_iterators; - auto table_name_match = [this](const String & table_name_) -> bool + /// database_name argument is not a regexp + if (!database_is_regexp) + database_table_iterators.emplace_back(getDatabaseIterator(source_database_name_or_regexp, local_context)); + + /// database_name argument is a regexp + else { - if (source_tables) - return source_tables->count(table_name_); - else - return source_table_regexp->match(table_name_); - }; + auto databases = DatabaseCatalog::instance().getDatabases(); - return database->getTablesIterator(local_context, table_name_match); + for (const auto & db : databases) + { + if (source_database_regexp->match(db.first)) + database_table_iterators.emplace_back(getDatabaseIterator(db.first, local_context)); + } + } + + return database_table_iterators; } @@ -632,19 +739,23 @@ void registerStorageMerge(StorageFactory & factory) " - name of source database and regexp for table names.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); - engine_args[0] = evaluateConstantExpressionForDatabaseName(engine_args[0], args.getLocalContext()); - engine_args[1] = evaluateConstantExpressionAsLiteral(engine_args[1], args.getLocalContext()); + auto [is_regexp, database_ast] = evaluateDatabaseNameForMergeEngine(engine_args[0], args.getLocalContext()); - String source_database = engine_args[0]->as().value.safeGet(); + if (!is_regexp) + engine_args[0] = database_ast; + String source_database_name_or_regexp = database_ast->as().value.safeGet(); + + engine_args[1] = evaluateConstantExpressionAsLiteral(engine_args[1], args.getLocalContext()); String table_name_regexp = engine_args[1]->as().value.safeGet(); - return StorageMerge::create(args.table_id, args.columns, args.comment, source_database, table_name_regexp, args.getContext()); + return StorageMerge::create( + args.table_id, args.columns, args.comment, source_database_name_or_regexp, is_regexp, table_name_regexp, args.getContext()); }); } NamesAndTypesList StorageMerge::getVirtuals() const { - NamesAndTypesList virtuals{{"_table", std::make_shared()}}; + NamesAndTypesList virtuals{{"_database", std::make_shared()}, {"_table", std::make_shared()}}; auto first_table = getFirstTable([](auto && table) { return table; }); if (first_table) diff --git a/src/Storages/StorageMerge.h b/src/Storages/StorageMerge.h index 068008170ca..20460e95156 100644 --- a/src/Storages/StorageMerge.h +++ b/src/Storages/StorageMerge.h @@ -49,20 +49,32 @@ public: const ASTPtr & left_in_operand, ContextPtr query_context, const StorageMetadataPtr & metadata_snapshot) const override; private: - String source_database; - std::optional> source_tables; - std::optional source_table_regexp; + using DbToTableSetMap = std::map>; - using StorageWithLockAndName = std::tuple; + std::optional source_database_regexp; + std::optional source_table_regexp; + std::optional source_databases_and_tables; + + String source_database_name_or_regexp; + bool database_is_regexp = false; + + /// (Database, Table, Lock, TableName) + using StorageWithLockAndName = std::tuple; using StorageListWithLocks = std::list; + using DatabaseTablesIterators = std::vector; StorageMerge::StorageListWithLocks getSelectedTables( - ContextPtr query_context, const ASTPtr & query = nullptr, bool filter_by_virtual_column = false) const; + ContextPtr query_context, + const ASTPtr & query = nullptr, + bool filter_by_database_virtual_column = false, + bool filter_by_table_virtual_column = false) const; template StoragePtr getFirstTable(F && predicate) const; - DatabaseTablesIteratorPtr getDatabaseIterator(ContextPtr context) const; + DatabaseTablesIteratorPtr getDatabaseIterator(const String & database_name, ContextPtr context) const; + + DatabaseTablesIterators getDatabaseIterators(ContextPtr context) const; NamesAndTypesList getVirtuals() const override; ColumnSizeByName getColumnSizes() const override; @@ -72,15 +84,17 @@ protected: const StorageID & table_id_, const ColumnsDescription & columns_, const String & comment, - const String & source_database_, - const Strings & source_tables_, + const String & source_database_name_or_regexp_, + bool database_is_regexp_, + const DbToTableSetMap & source_databases_and_tables_, ContextPtr context_); StorageMerge( const StorageID & table_id_, const ColumnsDescription & columns_, const String & comment, - const String & source_database_, + const String & source_database_name_or_regexp_, + bool database_is_regexp_, const String & source_table_regexp_, ContextPtr context_); @@ -104,6 +118,7 @@ protected: Names & real_column_names, ContextMutablePtr modified_context, size_t streams_num, + bool has_database_virtual_column, bool has_table_virtual_column, bool concat_streams = false); diff --git a/src/Storages/StorageMergeTree.cpp b/src/Storages/StorageMergeTree.cpp index 6f8b69ba419..96ccec15e49 100644 --- a/src/Storages/StorageMergeTree.cpp +++ b/src/Storages/StorageMergeTree.cpp @@ -47,6 +47,7 @@ namespace ErrorCodes extern const int TIMEOUT_EXCEEDED; extern const int UNKNOWN_POLICY; extern const int NO_SUCH_DATA_PART; + extern const int ABORTED; } namespace ActionLocks @@ -676,9 +677,16 @@ void StorageMergeTree::loadMutations() } std::shared_ptr StorageMergeTree::selectPartsToMerge( - const StorageMetadataPtr & metadata_snapshot, bool aggressive, const String & partition_id, bool final, String * out_disable_reason, TableLockHolder & /* table_lock_holder */, bool optimize_skip_merged_partitions, SelectPartsDecision * select_decision_out) + const StorageMetadataPtr & metadata_snapshot, + bool aggressive, + const String & partition_id, + bool final, + String * out_disable_reason, + TableLockHolder & /* table_lock_holder */, + std::unique_lock & lock, + bool optimize_skip_merged_partitions, + SelectPartsDecision * select_decision_out) { - std::unique_lock lock(currently_processing_in_background_mutex); auto data_settings = getSettings(); FutureMergedMutatedPart future_part; @@ -795,7 +803,24 @@ bool StorageMergeTree::merge( SelectPartsDecision select_decision; - auto merge_mutate_entry = selectPartsToMerge(metadata_snapshot, aggressive, partition_id, final, out_disable_reason, table_lock_holder, optimize_skip_merged_partitions, &select_decision); + std::shared_ptr merge_mutate_entry; + + { + std::unique_lock lock(currently_processing_in_background_mutex); + if (merger_mutator.merges_blocker.isCancelled()) + throw Exception("Cancelled merging parts", ErrorCodes::ABORTED); + + merge_mutate_entry = selectPartsToMerge( + metadata_snapshot, + aggressive, + partition_id, + final, + out_disable_reason, + table_lock_holder, + lock, + optimize_skip_merged_partitions, + &select_decision); + } /// If there is nothing to merge then we treat this merge as successful (needed for optimize final optimization) if (select_decision == SelectPartsDecision::NOTHING_TO_MERGE) @@ -867,7 +892,6 @@ bool StorageMergeTree::partIsAssignedToBackgroundOperation(const DataPartPtr & p std::shared_ptr StorageMergeTree::selectPartsToMutate( const StorageMetadataPtr & metadata_snapshot, String * /* disable_reason */, TableLockHolder & /* table_lock_holder */) { - std::lock_guard lock(currently_processing_in_background_mutex); size_t max_ast_elements = getContext()->getSettingsRef().max_expanded_ast_elements; FutureMergedMutatedPart future_part; @@ -1006,16 +1030,20 @@ bool StorageMergeTree::scheduleDataProcessingJob(IBackgroundJobExecutor & execut if (shutdown_called) return false; - if (merger_mutator.merges_blocker.isCancelled()) - return false; - auto metadata_snapshot = getInMemoryMetadataPtr(); std::shared_ptr merge_entry, mutate_entry; auto share_lock = lockForShare(RWLockImpl::NO_QUERY, getSettings()->lock_acquire_timeout_for_background_operations); - merge_entry = selectPartsToMerge(metadata_snapshot, false, {}, false, nullptr, share_lock); - if (!merge_entry) - mutate_entry = selectPartsToMutate(metadata_snapshot, nullptr, share_lock); + + { + std::unique_lock lock(currently_processing_in_background_mutex); + if (merger_mutator.merges_blocker.isCancelled()) + return false; + + merge_entry = selectPartsToMerge(metadata_snapshot, false, {}, false, nullptr, share_lock, lock); + if (!merge_entry) + mutate_entry = selectPartsToMutate(metadata_snapshot, nullptr, share_lock); + } if (merge_entry) { @@ -1033,7 +1061,7 @@ bool StorageMergeTree::scheduleDataProcessingJob(IBackgroundJobExecutor & execut }, PoolType::MERGE_MUTATE}); return true; } - else if (auto lock = time_after_previous_cleanup.compareAndRestartDeferred(1)) + else if (auto cmp_lock = time_after_previous_cleanup.compareAndRestartDeferred(1)) { executor.execute({[this, share_lock] () { @@ -1186,22 +1214,21 @@ bool StorageMergeTree::optimize( ActionLock StorageMergeTree::stopMergesAndWait() { + std::unique_lock lock(currently_processing_in_background_mutex); + /// Asks to complete merges and does not allow them to start. /// This protects against "revival" of data for a removed partition after completion of merge. auto merge_blocker = merger_mutator.merges_blocker.cancel(); + while (!currently_merging_mutating_parts.empty()) { - std::unique_lock lock(currently_processing_in_background_mutex); - while (!currently_merging_mutating_parts.empty()) - { - LOG_DEBUG(log, "Waiting for currently running merges ({} parts are merging right now)", - currently_merging_mutating_parts.size()); + LOG_DEBUG(log, "Waiting for currently running merges ({} parts are merging right now)", + currently_merging_mutating_parts.size()); - if (std::cv_status::timeout == currently_processing_in_background_condition.wait_for( - lock, std::chrono::seconds(DBMS_DEFAULT_LOCK_ACQUIRE_TIMEOUT_SEC))) - { - throw Exception("Timeout while waiting for already running merges", ErrorCodes::TIMEOUT_EXCEEDED); - } + if (std::cv_status::timeout == currently_processing_in_background_condition.wait_for( + lock, std::chrono::seconds(DBMS_DEFAULT_LOCK_ACQUIRE_TIMEOUT_SEC))) + { + throw Exception("Timeout while waiting for already running merges", ErrorCodes::TIMEOUT_EXCEEDED); } } diff --git a/src/Storages/StorageMergeTree.h b/src/Storages/StorageMergeTree.h index 6678ae06b53..57635d38008 100644 --- a/src/Storages/StorageMergeTree.h +++ b/src/Storages/StorageMergeTree.h @@ -196,6 +196,7 @@ private: bool final, String * disable_reason, TableLockHolder & table_lock_holder, + std::unique_lock & lock, bool optimize_skip_merged_partitions = false, SelectPartsDecision * select_decision_out = nullptr); diff --git a/src/Storages/StoragePostgreSQL.cpp b/src/Storages/StoragePostgreSQL.cpp index 72f42ec625b..211a626e8d4 100644 --- a/src/Storages/StoragePostgreSQL.cpp +++ b/src/Storages/StoragePostgreSQL.cpp @@ -1,6 +1,7 @@ #include "StoragePostgreSQL.h" #if USE_LIBPQXX +#include #include #include @@ -16,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -90,7 +90,7 @@ Pipe StoragePostgreSQL::read( } return Pipe(std::make_shared( - std::make_shared(pool->get(), query, sample_block, max_block_size_))); + std::make_shared>(pool->get(), query, sample_block, max_block_size_))); } diff --git a/src/Storages/StoragePostgreSQL.h b/src/Storages/StoragePostgreSQL.h index d1f86dd50ef..5a8ecf5598f 100644 --- a/src/Storages/StoragePostgreSQL.h +++ b/src/Storages/StoragePostgreSQL.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include namespace DB diff --git a/src/Storages/StorageReplicatedMergeTree.cpp b/src/Storages/StorageReplicatedMergeTree.cpp index ce2e2bf0774..b51b39f7d68 100644 --- a/src/Storages/StorageReplicatedMergeTree.cpp +++ b/src/Storages/StorageReplicatedMergeTree.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1215,29 +1216,37 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks) for (size_t i = 0; i < parts_to_fetch.size(); ++i) { const String & part_name = parts_to_fetch[i]; - LOG_ERROR(log, "Removing locally missing part from ZooKeeper and queueing a fetch: {}", part_name); Coordination::Requests ops; - time_t part_create_time = 0; - Coordination::ExistsResponse exists_resp = exists_futures[i].get(); - if (exists_resp.error == Coordination::Error::ZOK) + String has_replica = findReplicaHavingPart(part_name, true); + if (!has_replica.empty()) { - part_create_time = exists_resp.stat.ctime / 1000; - removePartFromZooKeeper(part_name, ops, exists_resp.stat.numChildren > 0); + LOG_ERROR(log, "Removing locally missing part from ZooKeeper and queueing a fetch: {}", part_name); + time_t part_create_time = 0; + Coordination::ExistsResponse exists_resp = exists_futures[i].get(); + if (exists_resp.error == Coordination::Error::ZOK) + { + part_create_time = exists_resp.stat.ctime / 1000; + removePartFromZooKeeper(part_name, ops, exists_resp.stat.numChildren > 0); + } + LogEntry log_entry; + log_entry.type = LogEntry::GET_PART; + log_entry.source_replica = ""; + log_entry.new_part_name = part_name; + log_entry.create_time = part_create_time; + + /// We assume that this occurs before the queue is loaded (queue.initialize). + ops.emplace_back(zkutil::makeCreateRequest( + fs::path(replica_path) / "queue/queue-", log_entry.toString(), zkutil::CreateMode::PersistentSequential)); + enqueue_futures.emplace_back(zookeeper->asyncMulti(ops)); + } + else + { + LOG_ERROR(log, "Not found active replica having part {}", part_name); + enqueuePartForCheck(part_name); } - LogEntry log_entry; - log_entry.type = LogEntry::GET_PART; - log_entry.source_replica = ""; - log_entry.new_part_name = part_name; - log_entry.create_time = part_create_time; - - /// We assume that this occurs before the queue is loaded (queue.initialize). - ops.emplace_back(zkutil::makeCreateRequest( - fs::path(replica_path) / "queue/queue-", log_entry.toString(), zkutil::CreateMode::PersistentSequential)); - - enqueue_futures.emplace_back(zookeeper->asyncMulti(ops)); } for (auto & future : enqueue_futures) @@ -1272,7 +1281,6 @@ void StorageReplicatedMergeTree::syncPinnedPartUUIDs() } } - void StorageReplicatedMergeTree::checkPartChecksumsAndAddCommitOps(const zkutil::ZooKeeperPtr & zookeeper, const DataPartPtr & part, Coordination::Requests & ops, String part_name, NameSet * absent_replicas_paths) { @@ -7393,4 +7401,164 @@ bool StorageReplicatedMergeTree::checkIfDetachedPartitionExists(const String & p } return false; } + + +bool StorageReplicatedMergeTree::createEmptyPartInsteadOfLost(zkutil::ZooKeeperPtr zookeeper, const String & lost_part_name) +{ + LOG_INFO(log, "Going to replace lost part {} with empty part", lost_part_name); + auto metadata_snapshot = getInMemoryMetadataPtr(); + auto settings = getSettings(); + + constexpr static auto TMP_PREFIX = "tmp_empty_"; + + auto new_part_info = MergeTreePartInfo::fromPartName(lost_part_name, format_version); + auto block = metadata_snapshot->getSampleBlock(); + + DB::IMergeTreeDataPart::TTLInfos move_ttl_infos; + + NamesAndTypesList columns = metadata_snapshot->getColumns().getAllPhysical().filter(block.getNames()); + ReservationPtr reservation = reserveSpacePreferringTTLRules(metadata_snapshot, 0, move_ttl_infos, time(nullptr), 0, true); + VolumePtr volume = getStoragePolicy()->getVolume(0); + + IMergeTreeDataPart::MinMaxIndex minmax_idx; + minmax_idx.update(block, getMinMaxColumnsNames(metadata_snapshot->getPartitionKey())); + + auto new_data_part = createPart( + lost_part_name, + choosePartType(0, block.rows()), + new_part_info, + createVolumeFromReservation(reservation, volume), + TMP_PREFIX + lost_part_name); + + if (settings->assign_part_uuids) + new_data_part->uuid = UUIDHelpers::generateV4(); + + new_data_part->setColumns(columns); + new_data_part->rows_count = block.rows(); + + { + auto lock = lockParts(); + auto parts_in_partition = getDataPartsPartitionRange(new_part_info.partition_id); + if (parts_in_partition.empty()) + { + LOG_WARNING(log, "Empty part {} is not created instead of lost part because there are no parts in partition {} (it's empty), resolve this manually using DROP PARTITION.", lost_part_name, new_part_info.partition_id); + return false; + } + + new_data_part->partition = (*parts_in_partition.begin())->partition; + } + + new_data_part->minmax_idx = std::move(minmax_idx); + new_data_part->is_temp = true; + + + SyncGuardPtr sync_guard; + if (new_data_part->isStoredOnDisk()) + { + /// The name could be non-unique in case of stale files from previous runs. + String full_path = new_data_part->getFullRelativePath(); + + if (new_data_part->volume->getDisk()->exists(full_path)) + { + LOG_WARNING(log, "Removing old temporary directory {}", fullPath(new_data_part->volume->getDisk(), full_path)); + new_data_part->volume->getDisk()->removeRecursive(full_path); + } + + const auto disk = new_data_part->volume->getDisk(); + disk->createDirectories(full_path); + + if (getSettings()->fsync_part_directory) + sync_guard = disk->getDirectorySyncGuard(full_path); + } + + /// This effectively chooses minimal compression method: + /// either default lz4 or compression method with zero thresholds on absolute and relative part size. + auto compression_codec = getContext()->chooseCompressionCodec(0, 0); + + const auto & index_factory = MergeTreeIndexFactory::instance(); + MergedBlockOutputStream out(new_data_part, metadata_snapshot, columns, index_factory.getMany(metadata_snapshot->getSecondaryIndices()), compression_codec); + bool sync_on_insert = settings->fsync_after_insert; + + out.writePrefix(); + out.write(block); + out.writeSuffixAndFinalizePart(new_data_part, sync_on_insert); + + try + { + MergeTreeData::Transaction transaction(*this); + auto replaced_parts = renameTempPartAndReplace(new_data_part, nullptr, &transaction); + + if (!replaced_parts.empty()) + { + Strings part_names; + for (const auto & part : replaced_parts) + part_names.emplace_back(part->name); + + /// Why this exception is not a LOGICAL_ERROR? Because it's possible + /// to have some source parts for the lost part if replica currently + /// cloning from another replica, but source replica lost covering + /// part and finished MERGE_PARTS before clone. It's an extremely + /// rare case and it's unclear how to resolve it better. Eventually + /// source replica will replace lost part with empty part and we + /// will fetch this empty part instead of our source parts. This + /// will make replicas consistent, but some data will be lost. + throw Exception(ErrorCodes::INCORRECT_DATA, "Tried to create empty part {}, but it replaces existing parts {}.", lost_part_name, fmt::join(part_names, ", ")); + } + + while (true) + { + + Coordination::Requests ops; + Coordination::Stat replicas_stat; + auto replicas_path = fs::path(zookeeper_path) / "replicas"; + Strings replicas = zookeeper->getChildren(replicas_path, &replicas_stat); + + /// In rare cases new replica can appear during check + ops.emplace_back(zkutil::makeCheckRequest(replicas_path, replicas_stat.version)); + + for (const String & replica : replicas) + { + String current_part_path = fs::path(zookeeper_path) / "replicas" / replica / "parts" / lost_part_name; + + /// We must be sure that this part doesn't exist on other replicas + if (!zookeeper->exists(current_part_path)) + { + ops.emplace_back(zkutil::makeCreateRequest(current_part_path, "", zkutil::CreateMode::Persistent)); + ops.emplace_back(zkutil::makeRemoveRequest(current_part_path, -1)); + } + else + { + throw Exception(ErrorCodes::DUPLICATE_DATA_PART, "Part {} already exists on replica {} on path {}", lost_part_name, replica, current_part_path); + } + } + + getCommitPartOps(ops, new_data_part); + + Coordination::Responses responses; + if (auto code = zookeeper->tryMulti(ops, responses); code == Coordination::Error::ZOK) + { + transaction.commit(); + break; + } + else if (code == Coordination::Error::ZBADVERSION) + { + LOG_INFO(log, "Looks like new replica appearead while creating new empty part, will retry"); + } + else + { + zkutil::KeeperMultiException::check(code, ops, responses); + } + } + } + catch (const Exception & ex) + { + LOG_WARNING(log, "Cannot commit empty part {} with error {}", lost_part_name, ex.displayText()); + return false; + } + + LOG_INFO(log, "Created empty part {} instead of lost part", lost_part_name); + + return true; +} + } diff --git a/src/Storages/StorageReplicatedMergeTree.h b/src/Storages/StorageReplicatedMergeTree.h index 205dc9687c7..6f717b7c450 100644 --- a/src/Storages/StorageReplicatedMergeTree.h +++ b/src/Storages/StorageReplicatedMergeTree.h @@ -258,6 +258,8 @@ public: return replicated_sends_throttler; } + bool createEmptyPartInsteadOfLost(zkutil::ZooKeeperPtr zookeeper, const String & lost_part_name); + private: std::atomic_bool are_restoring_replica {false}; diff --git a/src/Storages/registerStorages.cpp b/src/Storages/registerStorages.cpp index 7100afa6909..0b302ee437a 100644 --- a/src/Storages/registerStorages.cpp +++ b/src/Storages/registerStorages.cpp @@ -60,6 +60,7 @@ void registerStorageEmbeddedRocksDB(StorageFactory & factory); #if USE_LIBPQXX void registerStoragePostgreSQL(StorageFactory & factory); +void registerStorageMaterializedPostgreSQL(StorageFactory & factory); #endif #if USE_MYSQL || USE_LIBPQXX @@ -121,6 +122,7 @@ void registerStorages() #if USE_LIBPQXX registerStoragePostgreSQL(factory); + registerStorageMaterializedPostgreSQL(factory); #endif #if USE_MYSQL || USE_LIBPQXX diff --git a/src/TableFunctions/TableFunctionMerge.cpp b/src/TableFunctions/TableFunctionMerge.cpp index 051aa38398f..81dde4a12a4 100644 --- a/src/TableFunctions/TableFunctionMerge.cpp +++ b/src/TableFunctions/TableFunctionMerge.cpp @@ -18,17 +18,20 @@ namespace DB namespace ErrorCodes { extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; - extern const int UNKNOWN_TABLE; + extern const int BAD_ARGUMENTS; } namespace { - [[noreturn]] void throwNoTablesMatchRegexp(const String & source_database, const String & source_table_regexp) + [[noreturn]] void throwNoTablesMatchRegexp(const String & source_database_regexp, const String & source_table_regexp) { throw Exception( - "Error while executing table function merge. In database " + source_database - + " no one matches regular expression: " + source_table_regexp, - ErrorCodes::UNKNOWN_TABLE); + ErrorCodes::BAD_ARGUMENTS, + "Error while executing table function merge. Either there is no database, which matches regular expression `{}`, or there are " + "no tables in database matches `{}`, which fit tables expression: {}", + source_database_regexp, + source_database_regexp, + source_table_regexp); } } @@ -49,58 +52,72 @@ void TableFunctionMerge::parseArguments(const ASTPtr & ast_function, ContextPtr " - name of source database and regexp for table names.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); - args[0] = evaluateConstantExpressionForDatabaseName(args[0], context); - args[1] = evaluateConstantExpressionAsLiteral(args[1], context); + auto [is_regexp, database_ast] = evaluateDatabaseNameForMergeEngine(args[0], context); - source_database = args[0]->as().value.safeGet(); + database_is_regexp = is_regexp; + + if (!is_regexp) + args[0] = database_ast; + source_database_name_or_regexp = database_ast->as().value.safeGet(); + + args[1] = evaluateConstantExpressionAsLiteral(args[1], context); source_table_regexp = args[1]->as().value.safeGet(); } -const Strings & TableFunctionMerge::getSourceTables(ContextPtr context) const +const TableFunctionMerge::DbToTableSetMap & TableFunctionMerge::getSourceDatabasesAndTables(ContextPtr context) const { - if (source_tables) - return *source_tables; + if (source_databases_and_tables) + return *source_databases_and_tables; - auto database = DatabaseCatalog::instance().getDatabase(source_database); + source_databases_and_tables.emplace(); - OptimizedRegularExpression re(source_table_regexp); - auto table_name_match = [&](const String & table_name_) { return re.match(table_name_); }; - - auto access = context->getAccess(); - bool granted_show_on_all_tables = access->isGranted(AccessType::SHOW_TABLES, source_database); - bool granted_select_on_all_tables = access->isGranted(AccessType::SELECT, source_database); - - source_tables.emplace(); - for (auto it = database->getTablesIterator(context, table_name_match); it->isValid(); it->next()) + /// database_name is not a regexp + if (!database_is_regexp) { - if (!it->table()) - continue; - bool granted_show = granted_show_on_all_tables || access->isGranted(AccessType::SHOW_TABLES, source_database, it->name()); - if (!granted_show) - continue; - if (!granted_select_on_all_tables) - access->checkAccess(AccessType::SELECT, source_database, it->name()); - source_tables->emplace_back(it->name()); + auto source_tables = getMatchedTablesWithAccess(source_database_name_or_regexp, source_table_regexp, context); + if (source_tables.empty()) + throwNoTablesMatchRegexp(source_database_name_or_regexp, source_table_regexp); + (*source_databases_and_tables)[source_database_name_or_regexp] = source_tables; } - if (source_tables->empty()) - throwNoTablesMatchRegexp(source_database, source_table_regexp); + /// database_name is a regexp + else + { + OptimizedRegularExpression database_re(source_database_name_or_regexp); + auto databases = DatabaseCatalog::instance().getDatabases(); - return *source_tables; + for (const auto & db : databases) + { + if (database_re.match(db.first)) + { + auto source_tables = getMatchedTablesWithAccess(db.first, source_table_regexp, context); + + if (!source_tables.empty()) + (*source_databases_and_tables)[db.first] = source_tables; + } + } + + if ((*source_databases_and_tables).empty()) + throwNoTablesMatchRegexp(source_database_name_or_regexp, source_table_regexp); + } + + return *source_databases_and_tables; } - ColumnsDescription TableFunctionMerge::getActualTableStructure(ContextPtr context) const { - for (const auto & table_name : getSourceTables(context)) + for (const auto & db_with_tables : getSourceDatabasesAndTables(context)) { - auto storage = DatabaseCatalog::instance().tryGetTable(StorageID{source_database, table_name}, context); - if (storage) - return ColumnsDescription{storage->getInMemoryMetadataPtr()->getColumns().getAllPhysical()}; + for (const auto & table : db_with_tables.second) + { + auto storage = DatabaseCatalog::instance().tryGetTable(StorageID{db_with_tables.first, table}, context); + if (storage) + return ColumnsDescription{storage->getInMemoryMetadataPtr()->getColumns().getAllPhysical()}; + } } - throwNoTablesMatchRegexp(source_database, source_table_regexp); + throwNoTablesMatchRegexp(source_database_name_or_regexp, source_table_regexp); } @@ -110,14 +127,44 @@ StoragePtr TableFunctionMerge::executeImpl(const ASTPtr & /*ast_function*/, Cont StorageID(getDatabaseName(), table_name), getActualTableStructure(context), String{}, - source_database, - getSourceTables(context), + source_database_name_or_regexp, + database_is_regexp, + getSourceDatabasesAndTables(context), context); res->startup(); return res; } +TableFunctionMerge::TableSet +TableFunctionMerge::getMatchedTablesWithAccess(const String & database_name, const String & table_regexp, const ContextPtr & context) +{ + OptimizedRegularExpression table_re(table_regexp); + + auto table_name_match = [&](const String & table_name) { return table_re.match(table_name); }; + + auto access = context->getAccess(); + + auto database = DatabaseCatalog::instance().getDatabase(database_name); + + bool granted_show_on_all_tables = access->isGranted(AccessType::SHOW_TABLES, database_name); + bool granted_select_on_all_tables = access->isGranted(AccessType::SELECT, database_name); + + TableSet tables; + + for (auto it = database->getTablesIterator(context, table_name_match); it->isValid(); it->next()) + { + if (!it->table()) + continue; + bool granted_show = granted_show_on_all_tables || access->isGranted(AccessType::SHOW_TABLES, database_name, it->name()); + if (!granted_show) + continue; + if (!granted_select_on_all_tables) + access->checkAccess(AccessType::SELECT, database_name, it->name()); + tables.emplace(it->name()); + } + return tables; +} void registerTableFunctionMerge(TableFunctionFactory & factory) { diff --git a/src/TableFunctions/TableFunctionMerge.h b/src/TableFunctions/TableFunctionMerge.h index 04027b9d76a..73b61f8eb79 100644 --- a/src/TableFunctions/TableFunctionMerge.h +++ b/src/TableFunctions/TableFunctionMerge.h @@ -15,17 +15,22 @@ class TableFunctionMerge : public ITableFunction public: static constexpr auto name = "merge"; std::string getName() const override { return name; } + private: StoragePtr executeImpl(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name, ColumnsDescription cached_columns) const override; const char * getStorageTypeName() const override { return "Merge"; } - const Strings & getSourceTables(ContextPtr context) const; + using TableSet = std::set; + using DbToTableSetMap = std::map; + const DbToTableSetMap & getSourceDatabasesAndTables(ContextPtr context) const; ColumnsDescription getActualTableStructure(ContextPtr context) const override; void parseArguments(const ASTPtr & ast_function, ContextPtr context) override; + static TableSet getMatchedTablesWithAccess(const String & database_name, const String & table_regexp, const ContextPtr & context); - String source_database; + String source_database_name_or_regexp; String source_table_regexp; - mutable std::optional source_tables; + bool database_is_regexp = false; + mutable std::optional source_databases_and_tables; }; diff --git a/src/TableFunctions/TableFunctionPostgreSQL.cpp b/src/TableFunctions/TableFunctionPostgreSQL.cpp index 6c3d77f226e..ceea29b335b 100644 --- a/src/TableFunctions/TableFunctionPostgreSQL.cpp +++ b/src/TableFunctions/TableFunctionPostgreSQL.cpp @@ -1,6 +1,9 @@ #include #if USE_LIBPQXX +#include +#include + #include #include #include @@ -9,10 +12,8 @@ #include #include #include "registerTableFunctions.h" -#include #include #include -#include namespace DB @@ -47,11 +48,12 @@ StoragePtr TableFunctionPostgreSQL::executeImpl(const ASTPtr & /*ast_function*/, ColumnsDescription TableFunctionPostgreSQL::getActualTableStructure(ContextPtr context) const { const bool use_nulls = context->getSettingsRef().external_table_functions_use_nulls; + auto connection_holder = connection_pool->get(); auto columns = fetchPostgreSQLTableStructure( - connection_pool->get(), + connection_holder->get(), remote_table_schema.empty() ? doubleQuoteString(remote_table_name) : doubleQuoteString(remote_table_schema) + '.' + doubleQuoteString(remote_table_name), - use_nulls); + use_nulls).columns; return ColumnsDescription{*columns}; } diff --git a/src/TableFunctions/TableFunctionPostgreSQL.h b/src/TableFunctions/TableFunctionPostgreSQL.h index a3d024c1a50..c31d02fa955 100644 --- a/src/TableFunctions/TableFunctionPostgreSQL.h +++ b/src/TableFunctions/TableFunctionPostgreSQL.h @@ -5,7 +5,7 @@ #if USE_LIBPQXX #include -#include +#include namespace DB diff --git a/tests/ci/ci_config.json b/tests/ci/ci_config.json index 2efa6ec6fef..52a101728ea 100644 --- a/tests/ci/ci_config.json +++ b/tests/ci/ci_config.json @@ -393,18 +393,6 @@ "with_coverage": false } }, - "Functional stateless tests (ANTLR debug)": { - "required_build_properties": { - "compiler": "clang-11", - "package_type": "deb", - "build_type": "debug", - "sanitizer": "none", - "bundled": "bundled", - "splitted": "unsplitted", - "clang-tidy": "disable", - "with_coverage": false - } - }, "Stress test (address)": { "required_build_properties": { "compiler": "clang-11", diff --git a/tests/clickhouse-test b/tests/clickhouse-test index 924e4017670..63624246190 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -647,7 +647,6 @@ class BuildFlags(): RELEASE = 'release-build' DATABASE_ORDINARY = 'database-ordinary' POLYMORPHIC_PARTS = 'polymorphic-parts' - ANTLR = 'antlr' DATABASE_REPLICATED = 'database-replicated' @@ -770,8 +769,6 @@ def main(args): Note: if you are using split build, you may have to specify -c option.") build_flags = collect_build_flags(args.client) - if args.antlr: - build_flags.append(BuildFlags.ANTLR) if args.replicated_database: build_flags.append(BuildFlags.DATABASE_REPLICATED) @@ -1086,8 +1083,6 @@ if __name__ == '__main__': parser.add_argument('--use-skip-list', action='store_true', default=False, help="Use skip list to skip tests if found") parser.add_argument('--db-engine', help='Database engine name') parser.add_argument('--replicated-database', action='store_true', default=False, help='Run tests with Replicated database engine') - - parser.add_argument('--antlr', action='store_true', default=False, dest='antlr', help='Use new ANTLR parser in tests') parser.add_argument('--no-stateless', action='store_true', help='Disable all stateless tests') parser.add_argument('--no-stateful', action='store_true', help='Disable all stateful tests') parser.add_argument('--skip', nargs='+', help="Skip these tests") @@ -1180,13 +1175,6 @@ if __name__ == '__main__': os.environ['CLICKHOUSE_URL_PARAMS'] += get_additional_client_options_url(args) - if args.antlr: - if 'CLICKHOUSE_CLIENT_OPT' in os.environ: - os.environ['CLICKHOUSE_CLIENT_OPT'] += ' --use_antlr_parser=1' - else: - os.environ['CLICKHOUSE_CLIENT_OPT'] = '--use_antlr_parser=1' - args.client += ' --use_antlr_parser=1' - if args.extract_from_config is None: if os.access(args.binary + '-extract-from-config', os.X_OK): args.extract_from_config = args.binary + '-extract-from-config' diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py index 2617a7ade40..162ffc53e20 100644 --- a/tests/integration/helpers/cluster.py +++ b/tests/integration/helpers/cluster.py @@ -1068,7 +1068,7 @@ class ClickHouseCluster: logging.error("Can't connect to MySQL:{}".format(errors)) raise Exception("Cannot wait MySQL container") - def wait_postgres_to_start(self, timeout=180): + def wait_postgres_to_start(self, timeout=260): self.postgres_ip = self.get_instance_ip(self.postgres_host) start = time.time() while time.time() - start < timeout: diff --git a/tests/integration/test_lost_part/__init__.py b/tests/integration/test_lost_part/__init__.py new file mode 100644 index 00000000000..e5a0d9b4834 --- /dev/null +++ b/tests/integration/test_lost_part/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/tests/integration/test_lost_part/test.py b/tests/integration/test_lost_part/test.py new file mode 100644 index 00000000000..614df52063f --- /dev/null +++ b/tests/integration/test_lost_part/test.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python3 + +import pytest +import time +import ast +import random + +from helpers.cluster import ClickHouseCluster +from helpers.test_tools import assert_eq_with_retry + +cluster = ClickHouseCluster(__file__) + +node1 = cluster.add_instance('node1', with_zookeeper=True) +node2 = cluster.add_instance('node2', with_zookeeper=True) + +@pytest.fixture(scope="module") +def start_cluster(): + try: + cluster.start() + + yield cluster + finally: + cluster.shutdown() + + +def remove_part_from_disk(node, table, part_name): + part_path = node.query( + "SELECT path FROM system.parts WHERE table = '{}' and name = '{}'".format(table, part_name)).strip() + if not part_path: + raise Exception("Part " + part_name + "doesn't exist") + node.exec_in_container(['bash', '-c', 'rm -r {p}/*'.format(p=part_path)], privileged=True) + + +def test_lost_part_same_replica(start_cluster): + for node in [node1, node2]: + node.query( + "CREATE TABLE mt0 (id UInt64, date Date) ENGINE ReplicatedMergeTree('/clickhouse/tables/t', '{}') ORDER BY tuple() PARTITION BY date".format(node.name)) + + node1.query("SYSTEM STOP MERGES mt0") + node2.query("SYSTEM STOP REPLICATION QUEUES") + + for i in range(5): + node1.query("INSERT INTO mt0 VALUES ({}, toDate('2020-10-01'))".format(i)) + + for i in range(20): + parts_to_merge = node1.query("SELECT parts_to_merge FROM system.replication_queue") + if parts_to_merge: + parts_list = list(sorted(ast.literal_eval(parts_to_merge))) + print("Got parts list", parts_list) + if len(parts_list) < 3: + raise Exception("Got too small parts list {}".format(parts_list)) + break + time.sleep(1) + + victim_part_from_the_middle = random.choice(parts_list[1:-1]) + print("Will corrupt part", victim_part_from_the_middle) + + remove_part_from_disk(node1, 'mt0', victim_part_from_the_middle) + + node1.query("DETACH TABLE mt0") + + node1.query("ATTACH TABLE mt0") + + node1.query("SYSTEM START MERGES mt0") + + for i in range(10): + result = node1.query("SELECT count() FROM system.replication_queue") + if int(result) == 0: + break + time.sleep(1) + else: + assert False, "Still have something in replication queue:\n" + node1.query("SELECT count() FROM system.replication_queue FORMAT Vertical") + + assert node1.contains_in_log("Created empty part"), "Seems like empty part {} is not created or log message changed".format(victim_part_from_the_middle) + + assert node1.query("SELECT COUNT() FROM mt0") == "4\n" + + node2.query("SYSTEM START REPLICATION QUEUES") + + assert_eq_with_retry(node2, "SELECT COUNT() FROM mt0", "4") + assert_eq_with_retry(node2, "SELECT COUNT() FROM system.replication_queue", "0") + +def test_lost_part_other_replica(start_cluster): + for node in [node1, node2]: + node.query( + "CREATE TABLE mt1 (id UInt64) ENGINE ReplicatedMergeTree('/clickhouse/tables/t1', '{}') ORDER BY tuple()".format(node.name)) + + node1.query("SYSTEM STOP MERGES mt1") + node2.query("SYSTEM STOP REPLICATION QUEUES") + + for i in range(5): + node1.query("INSERT INTO mt1 VALUES ({})".format(i)) + + for i in range(20): + parts_to_merge = node1.query("SELECT parts_to_merge FROM system.replication_queue") + if parts_to_merge: + parts_list = list(sorted(ast.literal_eval(parts_to_merge))) + print("Got parts list", parts_list) + if len(parts_list) < 3: + raise Exception("Got too small parts list {}".format(parts_list)) + break + time.sleep(1) + + victim_part_from_the_middle = random.choice(parts_list[1:-1]) + print("Will corrupt part", victim_part_from_the_middle) + + remove_part_from_disk(node1, 'mt1', victim_part_from_the_middle) + + # other way to detect broken parts + node1.query("CHECK TABLE mt1") + + node2.query("SYSTEM START REPLICATION QUEUES") + + for i in range(10): + result = node2.query("SELECT count() FROM system.replication_queue") + if int(result) == 0: + break + time.sleep(1) + else: + assert False, "Still have something in replication queue:\n" + node2.query("SELECT * FROM system.replication_queue FORMAT Vertical") + + assert node1.contains_in_log("Created empty part"), "Seems like empty part {} is not created or log message changed".format(victim_part_from_the_middle) + + assert_eq_with_retry(node2, "SELECT COUNT() FROM mt1", "4") + assert_eq_with_retry(node2, "SELECT COUNT() FROM system.replication_queue", "0") + + node1.query("SYSTEM START MERGES mt1") + + assert_eq_with_retry(node1, "SELECT COUNT() FROM mt1", "4") + assert_eq_with_retry(node1, "SELECT COUNT() FROM system.replication_queue", "0") + +def test_lost_part_mutation(start_cluster): + for node in [node1, node2]: + node.query( + "CREATE TABLE mt2 (id UInt64) ENGINE ReplicatedMergeTree('/clickhouse/tables/t2', '{}') ORDER BY tuple()".format(node.name)) + + node1.query("SYSTEM STOP MERGES mt2") + node2.query("SYSTEM STOP REPLICATION QUEUES") + + for i in range(2): + node1.query("INSERT INTO mt2 VALUES ({})".format(i)) + + node1.query("ALTER TABLE mt2 UPDATE id = 777 WHERE 1", settings={"mutations_sync": "0"}) + + for i in range(20): + parts_to_mutate = node1.query("SELECT count() FROM system.replication_queue") + # two mutations for both replicas + if int(parts_to_mutate) == 4: + break + time.sleep(1) + + remove_part_from_disk(node1, 'mt2', 'all_1_1_0') + + # other way to detect broken parts + node1.query("CHECK TABLE mt2") + + node1.query("SYSTEM START MERGES mt2") + + for i in range(10): + result = node1.query("SELECT count() FROM system.replication_queue") + if int(result) == 0: + break + time.sleep(1) + else: + assert False, "Still have something in replication queue:\n" + node1.query("SELECT * FROM system.replication_queue FORMAT Vertical") + + assert_eq_with_retry(node1, "SELECT COUNT() FROM mt2", "1") + assert_eq_with_retry(node1, "SELECT SUM(id) FROM mt2", "777") + assert_eq_with_retry(node1, "SELECT COUNT() FROM system.replication_queue", "0") + + node2.query("SYSTEM START REPLICATION QUEUES") + + assert_eq_with_retry(node2, "SELECT COUNT() FROM mt2", "1") + assert_eq_with_retry(node2, "SELECT SUM(id) FROM mt2", "777") + assert_eq_with_retry(node2, "SELECT COUNT() FROM system.replication_queue", "0") + + +def test_lost_last_part(start_cluster): + for node in [node1, node2]: + node.query( + "CREATE TABLE mt3 (id UInt64) ENGINE ReplicatedMergeTree('/clickhouse/tables/t3', '{}') ORDER BY tuple()".format(node.name)) + + node1.query("SYSTEM STOP MERGES mt3") + node2.query("SYSTEM STOP REPLICATION QUEUES") + + for i in range(1): + node1.query("INSERT INTO mt3 VALUES ({})".format(i)) + + # actually not important + node1.query("ALTER TABLE mt3 UPDATE id = 777 WHERE 1", settings={"mutations_sync": "0"}) + + remove_part_from_disk(node1, 'mt3', 'all_0_0_0') + + # other way to detect broken parts + node1.query("CHECK TABLE mt3") + + node1.query("SYSTEM START MERGES mt3") + + for i in range(10): + result = node1.query("SELECT count() FROM system.replication_queue") + assert int(result) <= 1, "Have a lot of entries in queue {}".format(node1.query("SELECT * FROM system.replication_queue FORMAT Vertical")) + if node1.contains_in_log("Cannot create empty part") and node1.contains_in_log("DROP PARTITION"): + break + time.sleep(1) + else: + assert False, "Don't have required messages in node1 log" + + node1.query("ALTER TABLE mt3 DROP PARTITION ID 'all'") + + assert_eq_with_retry(node1, "SELECT COUNT() FROM mt3", "0") + assert_eq_with_retry(node1, "SELECT COUNT() FROM system.replication_queue", "0") diff --git a/tests/queries/0_stateless/01442_merge_detach_attach.reference b/tests/integration/test_postgresql_replica_database_engine/__init__.py similarity index 100% rename from tests/queries/0_stateless/01442_merge_detach_attach.reference rename to tests/integration/test_postgresql_replica_database_engine/__init__.py diff --git a/tests/integration/test_postgresql_replica_database_engine/configs/log_conf.xml b/tests/integration/test_postgresql_replica_database_engine/configs/log_conf.xml new file mode 100644 index 00000000000..f9d15e572aa --- /dev/null +++ b/tests/integration/test_postgresql_replica_database_engine/configs/log_conf.xml @@ -0,0 +1,11 @@ + + + trace + /var/log/clickhouse-server/log.log + /var/log/clickhouse-server/log.err.log + 1000M + 10 + /var/log/clickhouse-server/stderr.log + /var/log/clickhouse-server/stdout.log + + diff --git a/tests/integration/test_postgresql_replica_database_engine/configs/users.xml b/tests/integration/test_postgresql_replica_database_engine/configs/users.xml new file mode 100644 index 00000000000..1cdece49459 --- /dev/null +++ b/tests/integration/test_postgresql_replica_database_engine/configs/users.xml @@ -0,0 +1,8 @@ + + + + + 1 + + + diff --git a/tests/integration/test_postgresql_replica_database_engine/test.py b/tests/integration/test_postgresql_replica_database_engine/test.py new file mode 100644 index 00000000000..97fd461e640 --- /dev/null +++ b/tests/integration/test_postgresql_replica_database_engine/test.py @@ -0,0 +1,928 @@ +import pytest +import time +import psycopg2 +import os.path as p +import random + +from helpers.cluster import ClickHouseCluster +from helpers.test_tools import assert_eq_with_retry +from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT +from helpers.test_tools import TSV + +from random import randrange +import threading + +cluster = ClickHouseCluster(__file__) +instance = cluster.add_instance('instance', + main_configs = ['configs/log_conf.xml'], + user_configs = ['configs/users.xml'], + with_postgres=True, stay_alive=True) + +postgres_table_template = """ + CREATE TABLE IF NOT EXISTS {} ( + key Integer NOT NULL, value Integer, PRIMARY KEY(key)) + """ +postgres_table_template_2 = """ + CREATE TABLE IF NOT EXISTS {} ( + key Integer NOT NULL, value1 Integer, value2 Integer, value3 Integer, PRIMARY KEY(key)) + """ +postgres_table_template_3 = """ + CREATE TABLE IF NOT EXISTS {} ( + key1 Integer NOT NULL, value1 Integer, key2 Integer NOT NULL, value2 Integer NOT NULL) + """ + +def get_postgres_conn(ip, port, database=False, auto_commit=True, database_name='postgres_database'): + if database == True: + conn_string = "host={} port={} dbname='{}' user='postgres' password='mysecretpassword'".format(ip, port, database_name) + else: + conn_string = "host={} port={} user='postgres' password='mysecretpassword'".format(ip, port) + + conn = psycopg2.connect(conn_string) + if auto_commit: + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + conn.autocommit = True + return conn + + +def create_postgres_db(cursor, name='postgres_database'): + cursor.execute("CREATE DATABASE {}".format(name)) + +def drop_postgres_db(cursor, name='postgres_database'): + cursor.execute("DROP DATABASE IF EXISTS {}".format(name)) + +def create_clickhouse_postgres_db(ip, port, name='postgres_database'): + instance.query(''' + CREATE DATABASE {} + ENGINE = PostgreSQL('{}:{}', '{}', 'postgres', 'mysecretpassword')'''.format(name, ip, port, name)) + +def drop_clickhouse_postgres_db(name='postgres_database'): + instance.query('DROP DATABASE {}'.format(name)) + +def create_materialized_db(ip, port, + materialized_database='test_database', + postgres_database='postgres_database', + settings=[]): + create_query = "CREATE DATABASE {} ENGINE = MaterializedPostgreSQL('{}:{}', '{}', 'postgres', 'mysecretpassword')".format(materialized_database, ip, port, postgres_database) + if len(settings) > 0: + create_query += " SETTINGS " + for i in range(len(settings)): + if i != 0: + create_query += ', ' + create_query += settings[i] + instance.query(create_query) + assert materialized_database in instance.query('SHOW DATABASES') + +def drop_materialized_db(materialized_database='test_database'): + instance.query('DROP DATABASE IF EXISTS {}'.format(materialized_database)) + assert materialized_database not in instance.query('SHOW DATABASES') + +def create_postgres_table(cursor, table_name, replica_identity_full=False, template=postgres_table_template): + cursor.execute("DROP TABLE IF EXISTS {}".format(table_name)) + cursor.execute(template.format(table_name)) + if replica_identity_full: + cursor.execute('ALTER TABLE {} REPLICA IDENTITY FULL;'.format(table_name)) + +queries = [ + 'INSERT INTO postgresql_replica_{} select i, i from generate_series(0, 10000) as t(i);', + 'DELETE FROM postgresql_replica_{} WHERE (value*value) % 3 = 0;', + 'UPDATE postgresql_replica_{} SET value = value - 125 WHERE key % 2 = 0;', + "UPDATE postgresql_replica_{} SET key=key+20000 WHERE key%2=0", + 'INSERT INTO postgresql_replica_{} select i, i from generate_series(40000, 50000) as t(i);', + 'DELETE FROM postgresql_replica_{} WHERE key % 10 = 0;', + 'UPDATE postgresql_replica_{} SET value = value + 101 WHERE key % 2 = 1;', + "UPDATE postgresql_replica_{} SET key=key+80000 WHERE key%2=1", + 'DELETE FROM postgresql_replica_{} WHERE value % 2 = 0;', + 'UPDATE postgresql_replica_{} SET value = value + 2000 WHERE key % 5 = 0;', + 'INSERT INTO postgresql_replica_{} select i, i from generate_series(200000, 250000) as t(i);', + 'DELETE FROM postgresql_replica_{} WHERE value % 3 = 0;', + 'UPDATE postgresql_replica_{} SET value = value * 2 WHERE key % 3 = 0;', + "UPDATE postgresql_replica_{} SET key=key+500000 WHERE key%2=1", + 'INSERT INTO postgresql_replica_{} select i, i from generate_series(1000000, 1050000) as t(i);', + 'DELETE FROM postgresql_replica_{} WHERE value % 9 = 2;', + "UPDATE postgresql_replica_{} SET key=key+10000000", + 'UPDATE postgresql_replica_{} SET value = value + 2 WHERE key % 3 = 1;', + 'DELETE FROM postgresql_replica_{} WHERE value%5 = 0;' + ] + + +def assert_nested_table_is_created(table_name, materialized_database='test_database'): + database_tables = instance.query('SHOW TABLES FROM {}'.format(materialized_database)) + while table_name not in database_tables: + time.sleep(0.2) + database_tables = instance.query('SHOW TABLES FROM {}'.format(materialized_database)) + assert(table_name in database_tables) + + +def check_tables_are_synchronized(table_name, order_by='key', postgres_database='postgres_database', materialized_database='test_database'): + assert_nested_table_is_created(table_name, materialized_database) + + expected = instance.query('select * from {}.{} order by {};'.format(postgres_database, table_name, order_by)) + result = instance.query('select * from {}.{} order by {};'.format(materialized_database, table_name, order_by)) + + while result != expected: + time.sleep(0.5) + result = instance.query('select * from {}.{} order by {};'.format(materialized_database, table_name, order_by)) + + assert(result == expected) + + +@pytest.fixture(scope="module") +def started_cluster(): + try: + cluster.start() + conn = get_postgres_conn(ip=cluster.postgres_ip, + port=cluster.postgres_port) + cursor = conn.cursor() + create_postgres_db(cursor, 'postgres_database') + create_clickhouse_postgres_db(ip=cluster.postgres_ip, + port=cluster.postgres_port) + + instance.query("DROP DATABASE IF EXISTS test_database") + yield cluster + + finally: + cluster.shutdown() + + +def test_load_and_sync_all_database_tables(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + create_postgres_table(cursor, table_name); + instance.query("INSERT INTO postgres_database.{} SELECT number, number from numbers(50)".format(table_name)) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + assert 'test_database' in instance.query('SHOW DATABASES') + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + check_tables_are_synchronized(table_name); + cursor.execute('drop table {};'.format(table_name)) + + result = instance.query('''SELECT count() FROM system.tables WHERE database = 'test_database';''') + assert(int(result) == NUM_TABLES) + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_replicating_dml(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT number, {} from numbers(50)".format(i, i)) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for i in range(NUM_TABLES): + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT 50 + number, {} from numbers(1000)".format(i, i)) + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + check_tables_are_synchronized(table_name); + + for i in range(NUM_TABLES): + cursor.execute('UPDATE postgresql_replica_{} SET value = {} * {} WHERE key < 50;'.format(i, i, i)) + cursor.execute('UPDATE postgresql_replica_{} SET value = {} * {} * {} WHERE key >= 50;'.format(i, i, i, i)) + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + cursor.execute('DELETE FROM postgresql_replica_{} WHERE (value*value + {}) % 2 = 0;'.format(i, i)) + cursor.execute('UPDATE postgresql_replica_{} SET value = value - (value % 7) WHERE key > 128 AND key < 512;'.format(i)) + cursor.execute('DELETE FROM postgresql_replica_{} WHERE key % 7 = 1;'.format(i, i)) + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + drop_materialized_db() + + +def test_different_data_types(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + cursor.execute('drop table if exists test_data_types;') + cursor.execute('drop table if exists test_array_data_type;') + + cursor.execute( + '''CREATE TABLE test_data_types ( + id integer PRIMARY KEY, a smallint, b integer, c bigint, d real, e double precision, f serial, g bigserial, + h timestamp, i date, j decimal(5, 5), k numeric(5, 5))''') + + cursor.execute( + '''CREATE TABLE test_array_data_type + ( + key Integer NOT NULL PRIMARY KEY, + a Date[] NOT NULL, -- Date + b Timestamp[] NOT NULL, -- DateTime + c real[][] NOT NULL, -- Float32 + d double precision[][] NOT NULL, -- Float64 + e decimal(5, 5)[][][] NOT NULL, -- Decimal32 + f integer[][][] NOT NULL, -- Int32 + g Text[][][][][] NOT NULL, -- String + h Integer[][][], -- Nullable(Int32) + i Char(2)[][][][], -- Nullable(String) + k Char(2)[] -- Nullable(String) + )''') + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for i in range(10): + instance.query(''' + INSERT INTO postgres_database.test_data_types VALUES + ({}, -32768, -2147483648, -9223372036854775808, 1.12345, 1.1234567890, 2147483647, 9223372036854775807, '2000-05-12 12:12:12', '2000-05-12', 0.2, 0.2)'''.format(i)) + + check_tables_are_synchronized('test_data_types', 'id'); + result = instance.query('SELECT * FROM test_database.test_data_types ORDER BY id LIMIT 1;') + assert(result == '0\t-32768\t-2147483648\t-9223372036854775808\t1.12345\t1.123456789\t2147483647\t9223372036854775807\t2000-05-12 12:12:12\t2000-05-12\t0.20000\t0.20000\n') + + for i in range(10): + col = random.choice(['a', 'b', 'c']) + cursor.execute('UPDATE test_data_types SET {} = {};'.format(col, i)) + cursor.execute('''UPDATE test_data_types SET i = '2020-12-12';'''.format(col, i)) + + check_tables_are_synchronized('test_data_types', 'id'); + + instance.query("INSERT INTO postgres_database.test_array_data_type " + "VALUES (" + "0, " + "['2000-05-12', '2000-05-12'], " + "['2000-05-12 12:12:12', '2000-05-12 12:12:12'], " + "[[1.12345], [1.12345], [1.12345]], " + "[[1.1234567891], [1.1234567891], [1.1234567891]], " + "[[[0.11111, 0.11111]], [[0.22222, 0.22222]], [[0.33333, 0.33333]]], " + "[[[1, 1], [1, 1]], [[3, 3], [3, 3]], [[4, 4], [5, 5]]], " + "[[[[['winx', 'winx', 'winx']]]]], " + "[[[1, NULL], [NULL, 1]], [[NULL, NULL], [NULL, NULL]], [[4, 4], [5, 5]]], " + "[[[[NULL]]]], " + "[]" + ")") + + expected = ( + "0\t" + + "['2000-05-12','2000-05-12']\t" + + "['2000-05-12 12:12:12','2000-05-12 12:12:12']\t" + + "[[1.12345],[1.12345],[1.12345]]\t" + + "[[1.1234567891],[1.1234567891],[1.1234567891]]\t" + + "[[[0.11111,0.11111]],[[0.22222,0.22222]],[[0.33333,0.33333]]]\t" + "[[[1,1],[1,1]],[[3,3],[3,3]],[[4,4],[5,5]]]\t" + "[[[[['winx','winx','winx']]]]]\t" + "[[[1,NULL],[NULL,1]],[[NULL,NULL],[NULL,NULL]],[[4,4],[5,5]]]\t" + "[[[[NULL]]]]\t" + "[]\n" + ) + + check_tables_are_synchronized('test_array_data_type'); + result = instance.query('SELECT * FROM test_database.test_array_data_type ORDER BY key;') + assert(result == expected) + + drop_materialized_db() + cursor.execute('drop table if exists test_data_types;') + cursor.execute('drop table if exists test_array_data_type;') + + +def test_load_and_sync_subset_of_database_tables(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 10 + + publication_tables = '' + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT number, number from numbers(50)".format(i)) + + if i < int(NUM_TABLES/2): + if publication_tables != '': + publication_tables += ', ' + publication_tables += table_name + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + settings=["materialized_postgresql_tables_list = '{}'".format(publication_tables)]) + assert 'test_database' in instance.query('SHOW DATABASES') + + time.sleep(1) + + for i in range(int(NUM_TABLES/2)): + table_name = 'postgresql_replica_{}'.format(i) + assert_nested_table_is_created(table_name) + + result = instance.query('''SELECT count() FROM system.tables WHERE database = 'test_database';''') + assert(int(result) == int(NUM_TABLES/2)) + + database_tables = instance.query('SHOW TABLES FROM test_database') + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + if i < int(NUM_TABLES/2): + assert table_name in database_tables + else: + assert table_name not in database_tables + instance.query("INSERT INTO postgres_database.{} SELECT 50 + number, {} from numbers(100)".format(table_name, i)) + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + if i < int(NUM_TABLES/2): + check_tables_are_synchronized(table_name); + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_changing_replica_identity_value(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 50 + number, number from numbers(50)") + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 100 + number, number from numbers(50)") + check_tables_are_synchronized('postgresql_replica'); + cursor.execute("UPDATE postgresql_replica SET key=key-25 WHERE key<100 ") + check_tables_are_synchronized('postgresql_replica'); + + drop_materialized_db() + cursor.execute('drop table if exists postgresql_replica;') + + +def test_clickhouse_restart(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT number, {} from numbers(50)".format(i, i)) + + instance.query("CREATE DATABASE test_database ENGINE = MaterializedPostgreSQL('postgres1:5432', 'postgres_database', 'postgres', 'mysecretpassword')") + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + check_tables_are_synchronized(table_name); + + for i in range(NUM_TABLES): + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT 50 + number, {} from numbers(50000)".format(i, i)) + + instance.restart_clickhouse() + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_replica_identity_index(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + + create_postgres_table(cursor, 'postgresql_replica', template=postgres_table_template_3); + cursor.execute("CREATE unique INDEX idx on postgresql_replica(key1, key2);") + cursor.execute("ALTER TABLE postgresql_replica REPLICA IDENTITY USING INDEX idx") + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number, number, number from numbers(50, 10)") + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number, number, number from numbers(100, 10)") + check_tables_are_synchronized('postgresql_replica', order_by='key1'); + + cursor.execute("UPDATE postgresql_replica SET key1=key1-25 WHERE key1<100 ") + cursor.execute("UPDATE postgresql_replica SET key2=key2-25 WHERE key2>100 ") + cursor.execute("UPDATE postgresql_replica SET value1=value1+100 WHERE key1<100 ") + cursor.execute("UPDATE postgresql_replica SET value2=value2+200 WHERE key2>100 ") + check_tables_are_synchronized('postgresql_replica', order_by='key1'); + + cursor.execute('DELETE FROM postgresql_replica WHERE key2<75;') + check_tables_are_synchronized('postgresql_replica', order_by='key1'); + + drop_materialized_db() + cursor.execute('drop table if exists postgresql_replica;') + + +def test_table_schema_changes(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i), template=postgres_table_template_2); + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT number, {}, {}, {} from numbers(25)".format(i, i, i, i)) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + settings=["materialized_postgresql_allow_automatic_update = 1"]) + + for i in range(NUM_TABLES): + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT 25 + number, {}, {}, {} from numbers(25)".format(i, i, i, i)) + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + expected = instance.query("SELECT key, value1, value3 FROM test_database.postgresql_replica_3 ORDER BY key"); + + altered_table = random.randint(0, 4) + cursor.execute("ALTER TABLE postgresql_replica_{} DROP COLUMN value2".format(altered_table)) + + for i in range(NUM_TABLES): + cursor.execute("INSERT INTO postgresql_replica_{} VALUES (50, {}, {})".format(i, i, i)) + cursor.execute("UPDATE postgresql_replica_{} SET value3 = 12 WHERE key%2=0".format(i)) + + assert_nested_table_is_created('postgresql_replica_{}'.format(altered_table)) + check_tables_are_synchronized('postgresql_replica_{}'.format(altered_table)) + print('check1 OK') + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + if i != altered_table: + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT 51 + number, {}, {}, {} from numbers(49)".format(i, i, i, i)) + else: + instance.query("INSERT INTO postgres_database.postgresql_replica_{} SELECT 51 + number, {}, {} from numbers(49)".format(i, i, i)) + + check_tables_are_synchronized('postgresql_replica_{}'.format(altered_table)); + print('check2 OK') + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + cursor.execute('drop table postgresql_replica_{};'.format(i)) + + instance.query("DROP DATABASE test_database") + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_many_concurrent_queries(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + instance.query('INSERT INTO postgres_database.postgresql_replica_{} SELECT number, number from numbers(10000)'.format(i)) + n = [10000] + + query_pool = ['DELETE FROM postgresql_replica_{} WHERE (value*value) % 3 = 0;', + 'UPDATE postgresql_replica_{} SET value = value - 125 WHERE key % 2 = 0;', + 'DELETE FROM postgresql_replica_{} WHERE key % 10 = 0;', + 'UPDATE postgresql_replica_{} SET value = value*5 WHERE key % 2 = 1;', + 'DELETE FROM postgresql_replica_{} WHERE value % 2 = 0;', + 'UPDATE postgresql_replica_{} SET value = value + 2000 WHERE key % 5 = 0;', + 'DELETE FROM postgresql_replica_{} WHERE value % 3 = 0;', + 'UPDATE postgresql_replica_{} SET value = value * 2 WHERE key % 3 = 0;', + 'DELETE FROM postgresql_replica_{} WHERE value % 9 = 2;', + 'UPDATE postgresql_replica_{} SET value = value + 2 WHERE key % 3 = 1;', + 'DELETE FROM postgresql_replica_{} WHERE value%5 = 0;'] + + def attack(thread_id): + print('thread {}'.format(thread_id)) + k = 10000 + for i in range(20): + query_id = random.randrange(0, len(query_pool)-1) + table_id = random.randrange(0, 5) # num tables + + # random update / delete query + cursor.execute(query_pool[query_id].format(table_id)) + print("table {} query {} ok".format(table_id, query_id)) + + # allow some thread to do inserts (not to violate key constraints) + if thread_id < 5: + print("try insert table {}".format(thread_id)) + instance.query('INSERT INTO postgres_database.postgresql_replica_{} SELECT {}*10000*({} + number), number from numbers(1000)'.format(i, thread_id, k)) + k += 1 + print("insert table {} ok".format(thread_id)) + + if i == 5: + # also change primary key value + print("try update primary key {}".format(thread_id)) + cursor.execute("UPDATE postgresql_replica_{} SET key=key%100000+100000*{} WHERE key%{}=0".format(thread_id, i+1, i+1)) + print("update primary key {} ok".format(thread_id)) + + threads = [] + threads_num = 16 + for i in range(threads_num): + threads.append(threading.Thread(target=attack, args=(i,))) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for thread in threads: + time.sleep(random.uniform(0, 1)) + thread.start() + + n[0] = 50000 + for table_id in range(NUM_TABLES): + n[0] += 1 + instance.query('INSERT INTO postgres_database.postgresql_replica_{} SELECT {} + number, number from numbers(5000)'.format(table_id, n[0])) + #cursor.execute("UPDATE postgresql_replica_{} SET key=key%100000+100000*{} WHERE key%{}=0".format(table_id, table_id+1, table_id+1)) + + for thread in threads: + thread.join() + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + count1 = instance.query('SELECT count() FROM postgres_database.postgresql_replica_{}'.format(i)) + count2 = instance.query('SELECT count() FROM (SELECT * FROM test_database.postgresql_replica_{})'.format(i)) + assert(int(count1) == int(count2)) + print(count1, count2) + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_single_transaction(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=False) + cursor = conn.cursor() + + create_postgres_table(cursor, 'postgresql_replica_0'); + conn.commit() + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + assert_nested_table_is_created('postgresql_replica_0') + + for query in queries: + print('query {}'.format(query)) + cursor.execute(query.format(0)) + + time.sleep(5) + result = instance.query("select count() from test_database.postgresql_replica_0") + # no commit yet + assert(int(result) == 0) + + conn.commit() + check_tables_are_synchronized('postgresql_replica_0'); + + drop_materialized_db() + cursor.execute('drop table if exists postgresql_replica_0;') + + +def test_virtual_columns(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica_0'); + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + settings=["materialized_postgresql_allow_automatic_update = 1"]) + assert_nested_table_is_created('postgresql_replica_0') + instance.query("INSERT INTO postgres_database.postgresql_replica_0 SELECT number, number from numbers(10)") + check_tables_are_synchronized('postgresql_replica_0'); + + # just check that it works, no check with `expected` becuase _version is taken as LSN, which will be different each time. + result = instance.query('SELECT key, value, _sign, _version FROM test_database.postgresql_replica_0;') + print(result) + + cursor.execute("ALTER TABLE postgresql_replica_0 ADD COLUMN value2 integer") + instance.query("INSERT INTO postgres_database.postgresql_replica_0 SELECT number, number, number from numbers(10, 10)") + check_tables_are_synchronized('postgresql_replica_0'); + + result = instance.query('SELECT key, value, value2, _sign, _version FROM test_database.postgresql_replica_0;') + print(result) + + instance.query("INSERT INTO postgres_database.postgresql_replica_0 SELECT number, number, number from numbers(20, 10)") + check_tables_are_synchronized('postgresql_replica_0'); + + result = instance.query('SELECT key, value, value2, _sign, _version FROM test_database.postgresql_replica_0;') + print(result) + + drop_materialized_db() + cursor.execute('drop table if exists postgresql_replica_0;') + + +def test_multiple_databases(started_cluster): + drop_materialized_db('test_database_1') + drop_materialized_db('test_database_2') + NUM_TABLES = 5 + + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=False) + cursor = conn.cursor() + create_postgres_db(cursor, 'postgres_database_1') + create_postgres_db(cursor, 'postgres_database_2') + + conn1 = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, database_name='postgres_database_1') + conn2 = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, database_name='postgres_database_2') + + cursor1 = conn1.cursor() + cursor2 = conn2.cursor() + + create_clickhouse_postgres_db(cluster.postgres_ip, cluster.postgres_port, 'postgres_database_1') + create_clickhouse_postgres_db(cluster.postgres_ip, cluster.postgres_port, 'postgres_database_2') + + cursors = [cursor1, cursor2] + for cursor_id in range(len(cursors)): + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + create_postgres_table(cursors[cursor_id], table_name); + instance.query("INSERT INTO postgres_database_{}.{} SELECT number, number from numbers(50)".format(cursor_id + 1, table_name)) + print('database 1 tables: ', instance.query('''SELECT name FROM system.tables WHERE database = 'postgres_database_1';''')) + print('database 2 tables: ', instance.query('''SELECT name FROM system.tables WHERE database = 'postgres_database_2';''')) + + create_materialized_db(started_cluster.postgres_ip, started_cluster.postgres_port, + 'test_database_1', 'postgres_database_1') + create_materialized_db(started_cluster.postgres_ip, started_cluster.postgres_port, + 'test_database_2', 'postgres_database_2') + + cursors = [cursor1, cursor2] + for cursor_id in range(len(cursors)): + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + instance.query("INSERT INTO postgres_database_{}.{} SELECT 50 + number, number from numbers(50)".format(cursor_id + 1, table_name)) + + for cursor_id in range(len(cursors)): + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + check_tables_are_synchronized( + table_name, 'key', 'postgres_database_{}'.format(cursor_id + 1), 'test_database_{}'.format(cursor_id + 1)); + + for i in range(NUM_TABLES): + cursor1.execute('drop table if exists postgresql_replica_{};'.format(i)) + for i in range(NUM_TABLES): + cursor2.execute('drop table if exists postgresql_replica_{};'.format(i)) + + drop_clickhouse_postgres_db('postgres_database_1') + drop_clickhouse_postgres_db('postgres_database_2') + + drop_materialized_db('test_database_1') + drop_materialized_db('test_database_2') + + +def test_concurrent_transactions(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 6 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + + def transaction(thread_id): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=False) + cursor_ = conn.cursor() + for query in queries: + cursor_.execute(query.format(thread_id)) + print('thread {}, query {}'.format(thread_id, query)) + conn.commit() + + threads = [] + threads_num = 6 + for i in range(threads_num): + threads.append(threading.Thread(target=transaction, args=(i,))) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for thread in threads: + time.sleep(random.uniform(0, 0.5)) + thread.start() + for thread in threads: + thread.join() + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + count1 = instance.query('SELECT count() FROM postgres_database.postgresql_replica_{}'.format(i)) + count2 = instance.query('SELECT count() FROM (SELECT * FROM test_database.postgresql_replica_{})'.format(i)) + print(int(count1), int(count2), sep=' ') + assert(int(count1) == int(count2)) + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_abrupt_connection_loss_while_heavy_replication(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 6 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + + def transaction(thread_id): + if thread_id % 2: + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=True) + else: + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=False) + cursor_ = conn.cursor() + for query in queries: + cursor_.execute(query.format(thread_id)) + print('thread {}, query {}'.format(thread_id, query)) + if thread_id % 2 == 0: + conn.commit() + + threads = [] + threads_num = 6 + for i in range(threads_num): + threads.append(threading.Thread(target=transaction, args=(i,))) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for thread in threads: + time.sleep(random.uniform(0, 0.5)) + thread.start() + + # Join here because it takes time for data to reach wal + for thread in threads: + thread.join() + time.sleep(1) + started_cluster.pause_container('postgres1') + + for i in range(NUM_TABLES): + result = instance.query("SELECT count() FROM test_database.postgresql_replica_{}".format(i)) + print(result) # Just debug + + started_cluster.unpause_container('postgres1') + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + result = instance.query("SELECT count() FROM test_database.postgresql_replica_{}".format(i)) + print(result) # Just debug + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_drop_database_while_replication_startup_not_finished(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + create_postgres_table(cursor, table_name); + instance.query("INSERT INTO postgres_database.{} SELECT number, number from numbers(100000)".format(table_name)) + + for i in range(6): + create_materialized_db(ip=started_cluster.postgres_ip, port=started_cluster.postgres_port) + time.sleep(0.5 * i) + drop_materialized_db() + + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +def test_restart_server_while_replication_startup_not_finished(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 5 + + for i in range(NUM_TABLES): + table_name = 'postgresql_replica_{}'.format(i) + create_postgres_table(cursor, table_name); + instance.query("INSERT INTO postgres_database.{} SELECT number, number from numbers(100000)".format(table_name)) + + create_materialized_db(ip=started_cluster.postgres_ip, port=started_cluster.postgres_port) + time.sleep(0.5) + instance.restart_clickhouse() + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table postgresql_replica_{};'.format(i)) + + +def test_abrupt_server_restart_while_heavy_replication(started_cluster): + drop_materialized_db() + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + NUM_TABLES = 6 + + for i in range(NUM_TABLES): + create_postgres_table(cursor, 'postgresql_replica_{}'.format(i)); + + def transaction(thread_id): + if thread_id % 2: + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=True) + else: + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True, auto_commit=False) + cursor_ = conn.cursor() + for query in queries: + cursor_.execute(query.format(thread_id)) + print('thread {}, query {}'.format(thread_id, query)) + if thread_id % 2 == 0: + conn.commit() + + threads = [] + threads_num = 6 + for i in range(threads_num): + threads.append(threading.Thread(target=transaction, args=(i,))) + + create_materialized_db(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for thread in threads: + time.sleep(random.uniform(0, 0.5)) + thread.start() + + # Join here because it takes time for data to reach wal + for thread in threads: + thread.join() + instance.restart_clickhouse() + + for i in range(NUM_TABLES): + result = instance.query("SELECT count() FROM test_database.postgresql_replica_{}".format(i)) + print(result) # Just debug + + for i in range(NUM_TABLES): + check_tables_are_synchronized('postgresql_replica_{}'.format(i)); + + for i in range(NUM_TABLES): + result = instance.query("SELECT count() FROM test_database.postgresql_replica_{}".format(i)) + print(result) # Just debug + + drop_materialized_db() + for i in range(NUM_TABLES): + cursor.execute('drop table if exists postgresql_replica_{};'.format(i)) + + +if __name__ == '__main__': + cluster.start() + input("Cluster created, press any key to destroy...") + cluster.shutdown() diff --git a/tests/integration/test_storage_postgresql_replica/__init__.py b/tests/integration/test_storage_postgresql_replica/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/integration/test_storage_postgresql_replica/configs/log_conf.xml b/tests/integration/test_storage_postgresql_replica/configs/log_conf.xml new file mode 100644 index 00000000000..f9d15e572aa --- /dev/null +++ b/tests/integration/test_storage_postgresql_replica/configs/log_conf.xml @@ -0,0 +1,11 @@ + + + trace + /var/log/clickhouse-server/log.log + /var/log/clickhouse-server/log.err.log + 1000M + 10 + /var/log/clickhouse-server/stderr.log + /var/log/clickhouse-server/stdout.log + + diff --git a/tests/integration/test_storage_postgresql_replica/test.py b/tests/integration/test_storage_postgresql_replica/test.py new file mode 100644 index 00000000000..4602d567b46 --- /dev/null +++ b/tests/integration/test_storage_postgresql_replica/test.py @@ -0,0 +1,600 @@ +import pytest +import time +import psycopg2 +import os.path as p + +from helpers.cluster import ClickHouseCluster +from helpers.test_tools import assert_eq_with_retry +from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT +from helpers.test_tools import TSV + +import threading + +cluster = ClickHouseCluster(__file__) +instance = cluster.add_instance('instance', main_configs=['configs/log_conf.xml'], with_postgres=True, stay_alive=True) + +postgres_table_template = """ + CREATE TABLE IF NOT EXISTS {} ( + key Integer NOT NULL, value Integer, PRIMARY KEY(key)) + """ + +queries = [ + 'INSERT INTO postgresql_replica select i, i from generate_series(0, 10000) as t(i);', + 'DELETE FROM postgresql_replica WHERE (value*value) % 3 = 0;', + 'UPDATE postgresql_replica SET value = value + 125 WHERE key % 2 = 0;', + "UPDATE postgresql_replica SET key=key+20000 WHERE key%2=0", + 'INSERT INTO postgresql_replica select i, i from generate_series(40000, 50000) as t(i);', + 'DELETE FROM postgresql_replica WHERE key % 10 = 0;', + 'UPDATE postgresql_replica SET value = value + 101 WHERE key % 2 = 1;', + "UPDATE postgresql_replica SET key=key+80000 WHERE key%2=1", + 'DELETE FROM postgresql_replica WHERE value % 2 = 0;', + 'UPDATE postgresql_replica SET value = value + 2000 WHERE key % 5 = 0;', + 'INSERT INTO postgresql_replica select i, i from generate_series(200000, 250000) as t(i);', + 'DELETE FROM postgresql_replica WHERE value % 3 = 0;', + 'UPDATE postgresql_replica SET value = value * 2 WHERE key % 3 = 0;', + "UPDATE postgresql_replica SET key=key+500000 WHERE key%2=1", + 'INSERT INTO postgresql_replica select i, i from generate_series(1000000, 1050000) as t(i);', + 'DELETE FROM postgresql_replica WHERE value % 9 = 2;', + "UPDATE postgresql_replica SET key=key+10000000", + 'UPDATE postgresql_replica SET value = value + 2 WHERE key % 3 = 1;', + 'DELETE FROM postgresql_replica WHERE value%5 = 0;' + ] + + +@pytest.mark.timeout(30) +def check_tables_are_synchronized(table_name, order_by='key', postgres_database='postgres_database'): + expected = instance.query('select * from {}.{} order by {};'.format(postgres_database, table_name, order_by)) + result = instance.query('select * from test.{} order by {};'.format(table_name, order_by)) + + while result != expected: + time.sleep(0.5) + result = instance.query('select * from test.{} order by {};'.format(table_name, order_by)) + + assert(result == expected) + +def get_postgres_conn(ip, port, database=False, auto_commit=True, database_name='postgres_database'): + if database == True: + conn_string = "host={} port={} dbname='{}' user='postgres' password='mysecretpassword'".format(ip, port, database_name) + else: + conn_string = "host={} port={} user='postgres' password='mysecretpassword'".format(ip, port) + + conn = psycopg2.connect(conn_string) + if auto_commit: + conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) + conn.autocommit = True + return conn + +def create_postgres_db(cursor, name): + cursor.execute("CREATE DATABASE {}".format(name)) + +def create_clickhouse_postgres_db(ip, port, name='postgres_database'): + instance.query(''' + CREATE DATABASE {} + ENGINE = PostgreSQL('{}:{}', '{}', 'postgres', 'mysecretpassword')'''.format(name, ip, port, name)) + +def create_materialized_table(ip, port): + instance.query(''' + CREATE TABLE test.postgresql_replica (key UInt64, value UInt64) + ENGINE = MaterializedPostgreSQL( + '{}:{}', 'postgres_database', 'postgresql_replica', 'postgres', 'mysecretpassword') + PRIMARY KEY key; '''.format(ip, port)) + +def create_postgres_table(cursor, table_name, replica_identity_full=False): + cursor.execute("DROP TABLE IF EXISTS {}".format(table_name)) + cursor.execute(postgres_table_template.format(table_name)) + if replica_identity_full: + cursor.execute('ALTER TABLE {} REPLICA IDENTITY FULL;'.format(table_name)) + + +def postgresql_replica_check_result(result, check=False, ref_file='test_postgresql_replica.reference'): + fpath = p.join(p.dirname(__file__), ref_file) + with open(fpath) as reference: + if check: + assert TSV(result) == TSV(reference) + else: + return TSV(result) == TSV(reference) + + +@pytest.fixture(scope="module") +def started_cluster(): + try: + cluster.start() + conn = get_postgres_conn(ip=cluster.postgres_ip, + port=cluster.postgres_port) + cursor = conn.cursor() + create_postgres_db(cursor, 'postgres_database') + create_clickhouse_postgres_db(ip=cluster.postgres_ip, + port=cluster.postgres_port) + + instance.query('CREATE DATABASE test') + yield cluster + + finally: + cluster.shutdown() + + +@pytest.mark.timeout(320) +def test_initial_load_from_snapshot(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.2) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_no_connection_at_startup(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + time.sleep(3) + + instance.query('DETACH TABLE test.postgresql_replica') + started_cluster.pause_container('postgres1') + + instance.query('ATTACH TABLE test.postgresql_replica') + time.sleep(3) + started_cluster.unpause_container('postgres1') + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) == 0: + time.sleep(0.5); + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_detach_attach_is_ok(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) == 0): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + postgresql_replica_check_result(result, True) + + instance.query('DETACH TABLE test.postgresql_replica') + instance.query('ATTACH TABLE test.postgresql_replica') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.5) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_replicating_insert_queries(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(10)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 10): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 10 + number, 10 + number from numbers(10)") + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 20 + number, 20 + number from numbers(10)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 30): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 30 + number, 30 + number from numbers(10)") + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 40 + number, 40 + number from numbers(10)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 50): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_replicating_delete_queries(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.2) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 50 + number, 50 + number from numbers(50)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) != 100: + time.sleep(0.5) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + cursor.execute('DELETE FROM postgresql_replica WHERE key > 49;') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.5) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_replicating_update_queries(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number + 10 from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 50): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + cursor.execute('UPDATE postgresql_replica SET value = value - 10;') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.5) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_resume_from_written_version(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number + 10 from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 50): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT 50 + number, 50 + number from numbers(50)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 100): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + instance.query('DETACH TABLE test.postgresql_replica') + + cursor.execute('DELETE FROM postgresql_replica WHERE key > 49;') + cursor.execute('UPDATE postgresql_replica SET value = value - 10;') + + instance.query('ATTACH TABLE test.postgresql_replica') + + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + while postgresql_replica_check_result(result) == False: + time.sleep(0.5) + result = instance.query('SELECT * FROM test.postgresql_replica ORDER BY key;') + + cursor.execute('DROP TABLE postgresql_replica;') + postgresql_replica_check_result(result, True) + + +@pytest.mark.timeout(320) +def test_many_replication_messages(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(100000)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 100000): + time.sleep(0.2) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + print("SYNC OK") + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(100000, 100000)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while (int(result) != 200000): + time.sleep(1) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + print("INSERT OK") + + result = instance.query('SELECT key FROM test.postgresql_replica ORDER BY key;') + expected = instance.query("SELECT number from numbers(200000)") + assert(result == expected) + + cursor.execute('UPDATE postgresql_replica SET value = key + 1 WHERE key < 100000;') + + result = instance.query('SELECT key FROM test.postgresql_replica WHERE value = key + 1 ORDER BY key;') + expected = instance.query("SELECT number from numbers(100000)") + + while (result != expected): + time.sleep(1) + result = instance.query('SELECT key FROM test.postgresql_replica WHERE value = key + 1 ORDER BY key;') + print("UPDATE OK") + + cursor.execute('DELETE FROM postgresql_replica WHERE key % 2 = 1;') + cursor.execute('DELETE FROM postgresql_replica WHERE key != value;') + + result = instance.query('SELECT count() FROM (SELECT * FROM test.postgresql_replica);') + while (int(result) != 50000): + time.sleep(1) + result = instance.query('SELECT count() FROM (SELECT * FROM test.postgresql_replica);') + print("DELETE OK") + + cursor.execute('DROP TABLE postgresql_replica;') + + +@pytest.mark.timeout(320) +def test_connection_loss(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + i = 50 + while i < 100000: + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT {} + number, number from numbers(10000)".format(i)) + i += 10000 + + started_cluster.pause_container('postgres1') + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + print(int(result)) + time.sleep(6) + + started_cluster.unpause_container('postgres1') + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) < 100050: + time.sleep(1) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + cursor.execute('DROP TABLE postgresql_replica;') + assert(int(result) == 100050) + + +@pytest.mark.timeout(320) +def test_clickhouse_restart(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(50)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + i = 50 + while i < 100000: + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT {} + number, number from numbers(10000)".format(i)) + i += 10000 + + instance.restart_clickhouse() + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) < 100050: + time.sleep(1) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + cursor.execute('DROP TABLE postgresql_replica;') + print(result) + assert(int(result) == 100050) + + +def test_rename_table(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(25)") + + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) != 25: + time.sleep(0.5) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + instance.query('RENAME TABLE test.postgresql_replica TO test.postgresql_replica_renamed') + assert(int(instance.query('SELECT count() FROM test.postgresql_replica_renamed;')) == 25) + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(25, 25)") + + result = instance.query('SELECT count() FROM test.postgresql_replica_renamed;') + while int(result) != 50: + time.sleep(0.5) + result = instance.query('SELECT count() FROM test.postgresql_replica_renamed;') + + result = instance.query('SELECT * FROM test.postgresql_replica_renamed ORDER BY key;') + postgresql_replica_check_result(result, True) + cursor.execute('DROP TABLE postgresql_replica;') + instance.query('DROP TABLE IF EXISTS test.postgresql_replica_renamed') + + +def test_virtual_columns(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(10)") + result = instance.query('SELECT count() FROM test.postgresql_replica;') + while int(result) != 10: + time.sleep(0.5) + result = instance.query('SELECT count() FROM test.postgresql_replica;') + + # just check that it works, no check with `expected` becuase _version is taken as LSN, which will be different each time. + result = instance.query('SELECT key, value, _sign, _version FROM test.postgresql_replica;') + print(result) + cursor.execute('DROP TABLE postgresql_replica;') + + +def test_abrupt_connection_loss_while_heavy_replication(started_cluster): + instance.query("DROP DATABASE IF EXISTS test_database") + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for i in range(len(queries)): + query = queries[i] + cursor.execute(query) + print('query {}'.format(query)) + + started_cluster.pause_container('postgres1') + + result = instance.query("SELECT count() FROM test.postgresql_replica") + print(result) # Just debug + + started_cluster.unpause_container('postgres1') + + check_tables_are_synchronized('postgresql_replica'); + + result = instance.query("SELECT count() FROM test.postgresql_replica") + print(result) # Just debug + + +def test_abrupt_server_restart_while_heavy_replication(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port) + + for query in queries: + cursor.execute(query) + print('query {}'.format(query)) + + instance.restart_clickhouse() + + result = instance.query("SELECT count() FROM test.postgresql_replica") + print(result) # Just debug + + check_tables_are_synchronized('postgresql_replica'); + + result = instance.query("SELECT count() FROM test.postgresql_replica") + print(result) # Just debug + + +def test_drop_table_immediately(started_cluster): + conn = get_postgres_conn(ip=started_cluster.postgres_ip, + port=started_cluster.postgres_port, + database=True) + cursor = conn.cursor() + create_postgres_table(cursor, 'postgresql_replica'); + instance.query("INSERT INTO postgres_database.postgresql_replica SELECT number, number from numbers(100000)") + + instance.query('DROP TABLE IF EXISTS test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, port=started_cluster.postgres_port) + instance.query('DROP TABLE test.postgresql_replica') + create_materialized_table(ip=started_cluster.postgres_ip, port=started_cluster.postgres_port) + check_tables_are_synchronized('postgresql_replica'); + instance.query('DROP TABLE test.postgresql_replica') + + +if __name__ == '__main__': + cluster.start() + input("Cluster created, press any key to destroy...") + cluster.shutdown() diff --git a/tests/integration/test_storage_postgresql_replica/test_postgresql_replica.reference b/tests/integration/test_storage_postgresql_replica/test_postgresql_replica.reference new file mode 100644 index 00000000000..959bb2aad74 --- /dev/null +++ b/tests/integration/test_storage_postgresql_replica/test_postgresql_replica.reference @@ -0,0 +1,50 @@ +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 +9 9 +10 10 +11 11 +12 12 +13 13 +14 14 +15 15 +16 16 +17 17 +18 18 +19 19 +20 20 +21 21 +22 22 +23 23 +24 24 +25 25 +26 26 +27 27 +28 28 +29 29 +30 30 +31 31 +32 32 +33 33 +34 34 +35 35 +36 36 +37 37 +38 38 +39 39 +40 40 +41 41 +42 42 +43 43 +44 44 +45 45 +46 46 +47 47 +48 48 +49 49 diff --git a/tests/integration/test_table_functions_access_rights/test.py b/tests/integration/test_table_functions_access_rights/test.py index bd2f767413a..16f18407960 100644 --- a/tests/integration/test_table_functions_access_rights/test.py +++ b/tests/integration/test_table_functions_access_rights/test.py @@ -38,7 +38,7 @@ def test_merge(): assert "it's necessary to have grant CREATE TEMPORARY TABLE ON *.*" in instance.query_and_get_error(select_query, user = 'A') instance.query("GRANT CREATE TEMPORARY TABLE ON *.* TO A") - assert "no one matches regular expression" in instance.query_and_get_error(select_query, user = 'A') + assert "no tables in database matches" in instance.query_and_get_error(select_query, user = 'A') instance.query("GRANT SELECT ON default.table1 TO A") assert instance.query(select_query, user = 'A') == "1\n" diff --git a/tests/performance/jit_aggregate_functions.xml b/tests/performance/jit_aggregate_functions.xml new file mode 100644 index 00000000000..31b621f7258 --- /dev/null +++ b/tests/performance/jit_aggregate_functions.xml @@ -0,0 +1,293 @@ + + + hits_100m_single + + + + CREATE TABLE jit_test_memory ( + key UInt64, + value_1 UInt64, + value_2 UInt64, + value_3 UInt64, + value_4 UInt64, + value_5 UInt64, + predicate UInt8 + ) Engine = Memory + + + + CREATE TABLE jit_test_merge_tree ( + key UInt64, + value_1 UInt64, + value_2 UInt64, + value_3 UInt64, + value_4 UInt64, + value_5 UInt64, + predicate UInt8 + ) Engine = MergeTree + ORDER BY key + + + + CREATE TABLE jit_test_merge_tree_nullable ( + key UInt64, + value_1 Nullable(UInt64), + value_2 Nullable(UInt64), + value_3 Nullable(UInt64), + value_4 Nullable(UInt64), + value_5 Nullable(UInt64), + predicate UInt8 + ) Engine = Memory + + + + CREATE TABLE jit_test_memory_nullable ( + key UInt64, + value_1 Nullable(UInt64), + value_2 Nullable(UInt64), + value_3 Nullable(UInt64), + value_4 Nullable(UInt64), + value_5 Nullable(UInt64), + predicate UInt8 + ) Engine = MergeTree + ORDER BY key + + + + + function + + sum + min + max + avg + any + anyLast + count + + + + + table + + jit_test_memory + jit_test_merge_tree + jit_test_memory_nullable + jit_test_merge_tree_nullable + + + + + group_scale + + 1000000 + + + + + + INSERT INTO {table} + SELECT + number % 1000000, + number, + number, + number, + number, + number, + if (number % 2 == 0, 1, 0) + FROM + system.numbers_mt + LIMIT 10000000 + + + + SELECT + {function}(value_1), + {function}(value_2), + {function}(value_3) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}(value_1), + {function}(value_2), + groupBitAnd(value_3), + {function}(value_3) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}If(value_1, predicate), + {function}If(value_2, predicate), + {function}If(value_3, predicate) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}If(value_1, predicate), + {function}If(value_2, predicate), + groupBitAndIf(value_3, predicate), + {function}If(value_3, predicate) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}(value_1), + {function}(value_2), + {function}(value_3), + {function}(value_4), + {function}(value_5) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}(value_1), + {function}(value_2), + groupBitAnd(value_3), + {function}(value_3), + {function}(value_4), + {function}(value_5) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}If(value_1, predicate), + {function}If(value_2, predicate), + {function}If(value_3, predicate), + {function}If(value_4, predicate), + {function}If(value_5, predicate) + FROM {table} + GROUP BY key + FORMAT Null + + + + SELECT + {function}If(value_1, predicate), + {function}If(value_2, predicate), + groupBitAndIf(value_3, predicate), + {function}If(value_3, predicate), + {function}If(value_4, predicate), + {function}If(value_5, predicate) + FROM {table} + GROUP BY key + FORMAT Null + + + + + SELECT + {function}(WatchID), + {function}(CounterID), + {function}(ClientIP) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + SELECT + {function}(WatchID), + {function}(CounterID), + groupBitAnd(ClientIP), + {function}(ClientIP) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + SELECT + {function}(WatchID), + {function}(CounterID), + {function}(ClientIP), + {function}(GoodEvent), + {function}(CounterClass) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + SELECT + {function}(WatchID), + {function}(CounterID), + groupBitAnd(ClientIP), + {function}(ClientIP), + {function}(GoodEvent), + {function}(CounterClass) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + WITH (WatchID % 2 == 0) AS predicate + SELECT + {function}If(WatchID, predicate), + {function}If(CounterID, predicate), + {function}If(ClientIP, predicate) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + WITH (WatchID % 2 == 0) AS predicate + SELECT + {function}If(WatchID, predicate), + {function}If(CounterID, predicate), + groupBitAndIf(ClientIP, predicate), + {function}If(ClientIP, predicate) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + WITH (WatchID % 2 == 0) AS predicate + SELECT + {function}If(WatchID, predicate), + {function}If(CounterID, predicate), + {function}If(ClientIP, predicate), + {function}If(GoodEvent, predicate), + {function}If(CounterClass, predicate) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + + WITH (WatchID % 2 == 0) AS predicate + SELECT + {function}If(WatchID, predicate), + {function}If(CounterID, predicate), + groupBitAndIf(ClientIP, predicate), + {function}If(ClientIP, predicate), + {function}If(GoodEvent, predicate), + {function}If(CounterClass, predicate) + FROM hits_100m_single + GROUP BY intHash32(UserID) % {group_scale} + FORMAT Null + + + DROP TABLE IF EXISTS {table} + diff --git a/tests/queries/0_stateless/00918_json_functions.reference b/tests/queries/0_stateless/00918_json_functions.reference index a3beb2967d4..d9b34df8bf8 100644 --- a/tests/queries/0_stateless/00918_json_functions.reference +++ b/tests/queries/0_stateless/00918_json_functions.reference @@ -57,11 +57,21 @@ Friday (3,0) (3,5) (3,0) +(123456,3.55) +(1,'417ddc5d-e556-4d27-95dd-a34d84e46a50') +hello +(3333.6,'test') +(3333.6333333333,'test') +123456.1234 Decimal(20, 4) +123456789012345.1136 123456789012345.1136 +1234567890.12345677879616925706 (1234567890.12345677879616925706,'test') +1234567890.123456695758468374595199311875 (1234567890.123456695758468374595199311875,'test') --JSONExtractKeysAndValues-- [('a','hello')] [('b',[-100,200,300])] [('a','hello'),('b','world')] [('a',5),('b',7),('c',11)] +[('a','hello'),('b','world')] --JSONExtractRaw-- {"a":"hello","b":[-100,200,300]} "hello" diff --git a/tests/queries/0_stateless/00918_json_functions.sql b/tests/queries/0_stateless/00918_json_functions.sql index dbaa5b6a80a..f548b9e5e66 100644 --- a/tests/queries/0_stateless/00918_json_functions.sql +++ b/tests/queries/0_stateless/00918_json_functions.sql @@ -66,12 +66,22 @@ SELECT JSONExtract('{"a":3,"b":5,"c":7}', 'Tuple(Int, Int)'); SELECT JSONExtract('{"a":3}', 'Tuple(Int, Int)'); SELECT JSONExtract('[3,5,7]', 'Tuple(Int, Int)'); SELECT JSONExtract('[3]', 'Tuple(Int, Int)'); +SELECT JSONExtract('{"a":123456, "b":3.55}', 'Tuple(a LowCardinality(Int32), b Decimal(5, 2))'); +SELECT JSONExtract('{"a":1, "b":"417ddc5d-e556-4d27-95dd-a34d84e46a50"}', 'Tuple(a Int8, b UUID)'); +SELECT JSONExtract('{"a": "hello", "b": [-100, 200.0, 300]}', 'a', 'LowCardinality(String)'); +SELECT JSONExtract('{"a":3333.6333333333333333333333, "b":"test"}', 'Tuple(a Decimal(10,1), b LowCardinality(String))'); +SELECT JSONExtract('{"a":3333.6333333333333333333333, "b":"test"}', 'Tuple(a Decimal(20,10), b LowCardinality(String))'); +SELECT JSONExtract('{"a":123456.123456}', 'a', 'Decimal(20, 4)') as a, toTypeName(a); +SELECT toDecimal64(123456789012345.12, 4), JSONExtract('{"a":123456789012345.12}', 'a', 'Decimal(30, 4)'); +SELECT toDecimal128(1234567890.12345678901234567890, 20), JSONExtract('{"a":1234567890.12345678901234567890, "b":"test"}', 'Tuple(a Decimal(35,20), b LowCardinality(String))'); +SELECT toDecimal256(1234567890.123456789012345678901234567890, 30), JSONExtract('{"a":1234567890.12345678901234567890, "b":"test"}', 'Tuple(a Decimal(45,30), b LowCardinality(String))'); SELECT '--JSONExtractKeysAndValues--'; SELECT JSONExtractKeysAndValues('{"a": "hello", "b": [-100, 200.0, 300]}', 'String'); SELECT JSONExtractKeysAndValues('{"a": "hello", "b": [-100, 200.0, 300]}', 'Array(Float64)'); SELECT JSONExtractKeysAndValues('{"a": "hello", "b": "world"}', 'String'); SELECT JSONExtractKeysAndValues('{"x": {"a": 5, "b": 7, "c": 11}}', 'x', 'Int8'); +SELECT JSONExtractKeysAndValues('{"a": "hello", "b": "world"}', 'LowCardinality(String)'); SELECT '--JSONExtractRaw--'; SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}'); diff --git a/tests/queries/0_stateless/01414_optimize_any_bug.reference b/tests/queries/0_stateless/01414_optimize_any_bug.reference index 573541ac970..e69de29bb2d 100644 --- a/tests/queries/0_stateless/01414_optimize_any_bug.reference +++ b/tests/queries/0_stateless/01414_optimize_any_bug.reference @@ -1 +0,0 @@ -0 diff --git a/tests/queries/0_stateless/01442_merge_detach_attach_long.reference b/tests/queries/0_stateless/01442_merge_detach_attach_long.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/01442_merge_detach_attach.sh b/tests/queries/0_stateless/01442_merge_detach_attach_long.sh similarity index 100% rename from tests/queries/0_stateless/01442_merge_detach_attach.sh rename to tests/queries/0_stateless/01442_merge_detach_attach_long.sh diff --git a/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.reference b/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.reference index 95479cf37ba..71d10397326 100644 --- a/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.reference +++ b/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.reference @@ -1,9 +1,12 @@ +optimize_move_to_prewhere_if_final = 1 + SELECT x, y, z FROM prewhere_move_select_final PREWHERE y > 100 + SELECT x, y, @@ -11,6 +14,7 @@ SELECT FROM prewhere_move_select_final FINAL PREWHERE y > 100 + SELECT x, y, @@ -18,6 +22,7 @@ SELECT FROM prewhere_move_select_final FINAL WHERE z > 400 + SELECT x, y, @@ -26,3 +31,36 @@ FROM prewhere_move_select_final FINAL PREWHERE y > 100 WHERE (y > 100) AND (z > 400) + +optimize_move_to_prewhere_if_final = 0 + +SELECT + x, + y, + z +FROM prewhere_move_select_final +PREWHERE y > 100 + +SELECT + x, + y, + z +FROM prewhere_move_select_final +FINAL +WHERE y > 100 + +SELECT + x, + y, + z +FROM prewhere_move_select_final +FINAL +WHERE z > 400 + +SELECT + x, + y, + z +FROM prewhere_move_select_final +FINAL +WHERE (y > 100) AND (z > 400) diff --git a/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.sql b/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.sql index a3a882c461a..ecc11c625e3 100644 --- a/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.sql +++ b/tests/queries/0_stateless/01737_move_order_key_to_prewhere_select_final.sql @@ -1,15 +1,36 @@ DROP TABLE IF EXISTS prewhere_move_select_final; + CREATE TABLE prewhere_move_select_final (x Int, y Int, z Int) ENGINE = ReplacingMergeTree() ORDER BY (x, y); INSERT INTO prewhere_move_select_final SELECT number, number * 2, number * 3 FROM numbers(1000); +select 'optimize_move_to_prewhere_if_final = 1'; +SET optimize_move_to_prewhere_if_final = 1; + -- order key can be pushed down with final +select ''; EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final WHERE y > 100; +select ''; EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE y > 100; -- can not be pushed down +select ''; EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE z > 400; -- only y can be pushed down +select ''; +EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE y > 100 and z > 400; + +select ''; +select 'optimize_move_to_prewhere_if_final = 0'; +SET optimize_move_to_prewhere_if_final = 0; + +select ''; +EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final WHERE y > 100; +select ''; +EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE y > 100; +select ''; +EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE z > 400; +select ''; EXPLAIN SYNTAX SELECT * FROM prewhere_move_select_final FINAL WHERE y > 100 and z > 400; DROP TABLE prewhere_move_select_final; diff --git a/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.reference b/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.reference new file mode 100644 index 00000000000..4897a71df3c --- /dev/null +++ b/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 2340 2340 2340 2340 +1 2380 2380 2380 2380 +2 2420 2420 2420 2420 +Test signed integer values +0 2340 2340 2340 2340 +1 2380 2380 2380 2380 +2 2420 2420 2420 2420 +Test float values +0 2340 2340 +1 2380 2380 +2 2420 2420 +Test nullable unsigned integer values +0 2340 2340 2340 2340 +1 2380 2380 2380 2380 +2 2420 2420 2420 2420 +Test nullable signed integer values +0 2340 2340 2340 2340 +1 2380 2380 2380 2380 +2 2420 2420 2420 2420 +Test nullable float values +0 2340 2340 +1 2380 2380 +2 2420 2420 +Test null specifics +0 6 4 \N diff --git a/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.sql b/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.sql new file mode 100644 index 00000000000..0f61ab168f5 --- /dev/null +++ b/tests/queries/0_stateless/01890_jit_aggregation_function_sum_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2), sum(value3), sum(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2), sum(value3), sum(value4)FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2), sum(value3), sum(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2), sum(value3), sum(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, sum(value1), sum(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, sum(value1), sum(value2), sum(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.reference b/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.reference new file mode 100644 index 00000000000..d3ea3d46376 --- /dev/null +++ b/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test signed integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test float values +0 0 0 +1 1 1 +2 2 2 +Test nullable unsigned integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test nullable signed integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test nullable float values +0 0 0 +1 1 1 +2 2 2 +Test null specifics +0 1 1 \N diff --git a/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.sql b/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.sql new file mode 100644 index 00000000000..28e81640993 --- /dev/null +++ b/tests/queries/0_stateless/01891_jit_aggregation_function_any_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2), any(value3), any(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2), any(value3), any(value4) FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2), any(value3), any(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2), any(value3), any(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, any(value1), any(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, any(value1), any(value2), any(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.reference b/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.reference new file mode 100644 index 00000000000..bdf0499e1f3 --- /dev/null +++ b/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test signed integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test float values +0 117 117 +1 118 118 +2 119 119 +Test nullable unsigned integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test nullable signed integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test nullable float values +0 117 117 +1 118 118 +2 119 119 +Test null specifics +0 3 3 \N diff --git a/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.sql b/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.sql new file mode 100644 index 00000000000..c02ed8f18ee --- /dev/null +++ b/tests/queries/0_stateless/01892_jit_aggregation_function_any_last_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2), anyLast(value3), anyLast(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2), anyLast(value3), anyLast(value4) FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2), anyLast(value3), anyLast(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2), anyLast(value3), anyLast(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, anyLast(value1), anyLast(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, anyLast(value1), anyLast(value2), anyLast(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.reference b/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.reference new file mode 100644 index 00000000000..d3ea3d46376 --- /dev/null +++ b/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test signed integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test float values +0 0 0 +1 1 1 +2 2 2 +Test nullable unsigned integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test nullable signed integer values +0 0 0 0 0 +1 1 1 1 1 +2 2 2 2 2 +Test nullable float values +0 0 0 +1 1 1 +2 2 2 +Test null specifics +0 1 1 \N diff --git a/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.sql b/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.sql new file mode 100644 index 00000000000..5e700e537eb --- /dev/null +++ b/tests/queries/0_stateless/01893_jit_aggregation_function_min_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2), min(value3), min(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2), min(value3), min(value4) FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2), min(value3), min(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2), min(value3), min(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, min(value1), min(value2), min(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.reference b/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.reference new file mode 100644 index 00000000000..321d1fa7196 --- /dev/null +++ b/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test signed integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test float values +0 0 0 +1 1 1 +2 2 2 +Test nullable unsigned integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test nullable signed integer values +0 117 117 117 117 +1 118 118 118 118 +2 119 119 119 119 +Test nullable float values +0 117 117 +1 118 118 +2 119 119 +Test null specifics +0 3 3 \N diff --git a/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.sql b/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.sql new file mode 100644 index 00000000000..8ba11f4c643 --- /dev/null +++ b/tests/queries/0_stateless/01894_jit_aggregation_function_max_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, max(value1), max(value2), max(value3), max(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, max(value1), max(value2), max(value3), max(value4) FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, min(value1), min(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, max(value1), max(value2), max(value3), max(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, max(value1), max(value2), max(value3), max(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, max(value1), max(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, max(value1), max(value2), max(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.reference b/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.reference new file mode 100644 index 00000000000..e1eac2fe41b --- /dev/null +++ b/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 58.5 58.5 58.5 58.5 +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test signed integer values +0 58.5 58.5 58.5 58.5 +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test float values +0 58.5 58.5 +1 59.5 59.5 +2 60.5 60.5 +Test nullable unsigned integer values +0 58.5 58.5 58.5 58.5 +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test nullable signed integer values +0 58.5 58.5 58.5 58.5 +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test nullable float values +0 58.5 58.5 +1 59.5 59.5 +2 60.5 60.5 +Test null specifics +0 2 2 \N diff --git a/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.sql b/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.sql new file mode 100644 index 00000000000..903a7c65f21 --- /dev/null +++ b/tests/queries/0_stateless/01895_jit_aggregation_function_avg_long.sql @@ -0,0 +1,119 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2), avg(value3), avg(value4) FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2), avg(value3), avg(value4) FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2), avg(value3), avg(value4) FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2), avg(value3), avg(value4) FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64) +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number FROM system.numbers LIMIT 120; +SELECT id, avg(value1), avg(value2) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL); + +SELECT id, avg(value1), avg(value2), avg(value3) FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.reference b/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.reference new file mode 100644 index 00000000000..153adc0f998 --- /dev/null +++ b/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.reference @@ -0,0 +1,28 @@ +Test unsigned integer values +0 1140 1140 1140 1140 +1 1220 1220 1220 1220 +2 1180 1180 1180 1180 +Test signed integer values +0 1140 1140 1140 1140 +1 1220 1220 1220 1220 +2 1180 1180 1180 1180 +Test float values +0 1140 1140 +1 1220 1220 +2 1180 1180 +Test nullable unsigned integer values +0 1140 1140 1140 1140 +1 1220 1220 1220 1220 +2 1180 1180 1180 1180 +Test nullable signed integer values +0 1140 1140 1140 1140 +1 1220 1220 1220 1220 +2 1180 1180 1180 1180 +Test nullable float values +0 1140 1140 +1 1220 1220 +2 1180 1180 +Test null specifics +0 6 4 \N +Test null variadic +0 2.3333333333333335 2.5 \N diff --git a/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.sql b/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.sql new file mode 100644 index 00000000000..8b5618230f0 --- /dev/null +++ b/tests/queries/0_stateless/01896_jit_aggregation_function_if_long.sql @@ -0,0 +1,197 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64, + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value), + sumIf(value3, predicate_value), + sumIf(value4, predicate_value) +FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64, + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value), + sumIf(value3, predicate_value), + sumIf(value4, predicate_value) +FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64, + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value) +FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64), + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value), + sumIf(value3, predicate_value), + sumIf(value4, predicate_value) +FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64), + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value), + sumIf(value3, predicate_value), + sumIf(value4, predicate_value) +FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64), + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number, if(number % 2 == 0, 1, 0) FROM system.numbers LIMIT 120; +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value) +FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64), + + predicate_value UInt8 +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL, 1); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL, 1); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL, 1); + +SELECT + id, + sumIf(value1, predicate_value), + sumIf(value2, predicate_value), + sumIf(value3, predicate_value) +FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; + +SELECT 'Test null variadic'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64), + + predicate_value UInt8, + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL, 1, 1); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL, 1, 2); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL, 1, 3); + +SELECT + id, + avgWeightedIf(value1, weight, predicate_value), + avgWeightedIf(value2, weight, predicate_value), + avgWeightedIf(value3, weight, predicate_value) +FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.reference b/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.reference new file mode 100644 index 00000000000..fec5cc09859 --- /dev/null +++ b/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.reference @@ -0,0 +1,26 @@ +Test unsigned integer values +0 nan nan nan nan +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test signed integer values +0 nan nan nan nan +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test float values +0 nan nan +1 59.5 59.5 +2 60.5 60.5 +Test nullable unsigned integer values +0 nan nan nan nan +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test nullable signed integer values +0 nan nan nan nan +1 59.5 59.5 59.5 59.5 +2 60.5 60.5 60.5 60.5 +Test nullable float values +0 nan nan +1 59.5 59.5 +2 60.5 60.5 +Test null specifics +0 2.3333333333333335 2.5 \N 2.5 2.5 \N diff --git a/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.sql b/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.sql new file mode 100644 index 00000000000..04b8a818382 --- /dev/null +++ b/tests/queries/0_stateless/01897_jit_aggregation_function_avg_weighted_long.sql @@ -0,0 +1,167 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Test unsigned integer values'; + +DROP TABLE IF EXISTS test_table_unsigned_values; +CREATE TABLE test_table_unsigned_values +( + id UInt64, + + value1 UInt8, + value2 UInt16, + value3 UInt32, + value4 UInt64, + + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_unsigned_values SELECT number % 3, number, number, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT + id, + avgWeighted(value1, weight), + avgWeighted(value2, weight), + avgWeighted(value3, weight), + avgWeighted(value4, weight) +FROM test_table_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_unsigned_values; + +SELECT 'Test signed integer values'; + +DROP TABLE IF EXISTS test_table_signed_values; +CREATE TABLE test_table_signed_values +( + id UInt64, + + value1 Int8, + value2 Int16, + value3 Int32, + value4 Int64, + + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_signed_values SELECT number % 3, number, number, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT + id, + avgWeighted(value1, weight), + avgWeighted(value2, weight), + avgWeighted(value3, weight), + avgWeighted(value4, weight) +FROM test_table_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_signed_values; + +SELECT 'Test float values'; + +DROP TABLE IF EXISTS test_table_float_values; +CREATE TABLE test_table_float_values +( + id UInt64, + + value1 Float32, + value2 Float64, + + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_float_values SELECT number % 3, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT id, avgWeighted(value1, weight), avgWeighted(value2, weight) FROM test_table_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_float_values; + +SELECT 'Test nullable unsigned integer values'; + +DROP TABLE IF EXISTS test_table_nullable_unsigned_values; +CREATE TABLE test_table_nullable_unsigned_values +( + id UInt64, + + value1 Nullable(UInt8), + value2 Nullable(UInt16), + value3 Nullable(UInt32), + value4 Nullable(UInt64), + + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_unsigned_values SELECT number % 3, number, number, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT + id, + avgWeighted(value1, weight), + avgWeighted(value2, weight), + avgWeighted(value3, weight), + avgWeighted(value4, weight) +FROM test_table_nullable_unsigned_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_unsigned_values; + +SELECT 'Test nullable signed integer values'; + +DROP TABLE IF EXISTS test_table_nullable_signed_values; +CREATE TABLE test_table_nullable_signed_values +( + id UInt64, + + value1 Nullable(Int8), + value2 Nullable(Int16), + value3 Nullable(Int32), + value4 Nullable(Int64), + + weight UInt64 +) ENGINE=TinyLog; + + +INSERT INTO test_table_nullable_signed_values SELECT number % 3, number, number, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT + id, + avgWeighted(value1, weight), + avgWeighted(value2, weight), + avgWeighted(value3, weight), + avgWeighted(value4, weight) +FROM test_table_nullable_signed_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_signed_values; + +SELECT 'Test nullable float values'; + +DROP TABLE IF EXISTS test_table_nullable_float_values; +CREATE TABLE test_table_nullable_float_values +( + id UInt64, + + value1 Nullable(Float32), + value2 Nullable(Float64), + + weight UInt64 +) ENGINE=TinyLog; + +INSERT INTO test_table_nullable_float_values SELECT number % 3, number, number, number % 3 FROM system.numbers LIMIT 120; +SELECT id, avgWeighted(value1, weight), avgWeighted(value2, weight) FROM test_table_nullable_float_values GROUP BY id ORDER BY id; +DROP TABLE test_table_nullable_float_values; + +SELECT 'Test null specifics'; + +DROP TABLE IF EXISTS test_table_null_specifics; +CREATE TABLE test_table_null_specifics +( + id UInt64, + + value1 Nullable(UInt64), + value2 Nullable(UInt64), + value3 Nullable(UInt64), + + weight UInt64, + weight_nullable Nullable(UInt64) +) ENGINE=TinyLog; + +INSERT INTO test_table_null_specifics VALUES (0, 1, 1, NULL, 1, 1); +INSERT INTO test_table_null_specifics VALUES (0, 2, NULL, NULL, 2, NULL); +INSERT INTO test_table_null_specifics VALUES (0, 3, 3, NULL, 3, 3); + +SELECT + id, + avgWeighted(value1, weight), + avgWeighted(value2, weight), + avgWeighted(value3, weight), + avgWeighted(value1, weight_nullable), + avgWeighted(value2, weight_nullable), + avgWeighted(value3, weight_nullable) +FROM test_table_null_specifics GROUP BY id ORDER BY id; +DROP TABLE IF EXISTS test_table_null_specifics; diff --git a/tests/queries/0_stateless/01902_table_function_merge_db_repr.reference b/tests/queries/0_stateless/01902_table_function_merge_db_repr.reference new file mode 100644 index 00000000000..4fd27ceec77 --- /dev/null +++ b/tests/queries/0_stateless/01902_table_function_merge_db_repr.reference @@ -0,0 +1,195 @@ +CREATE TABLE t_merge as 01902_db.t ENGINE=Merge(REGEXP(^01902_db), ^t) +SELECT _database, _table, n FROM 01902_db.t_merge ORDER BY _database, _table, n +01902_db t 0 +01902_db t 1 +01902_db t 2 +01902_db t 3 +01902_db t 4 +01902_db t 5 +01902_db t 6 +01902_db t 7 +01902_db t 8 +01902_db t 9 +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 +01902_db2 t2 0 +01902_db2 t2 1 +01902_db2 t2 2 +01902_db2 t2 3 +01902_db2 t2 4 +01902_db2 t2 5 +01902_db2 t2 6 +01902_db2 t2 7 +01902_db2 t2 8 +01902_db2 t2 9 +01902_db3 t3 0 +01902_db3 t3 1 +01902_db3 t3 2 +01902_db3 t3 3 +01902_db3 t3 4 +01902_db3 t3 5 +01902_db3 t3 6 +01902_db3 t3 7 +01902_db3 t3 8 +01902_db3 t3 9 +SHOW CREATE TABLE 01902_db.t_merge +CREATE TABLE `01902_db`.t_merge\n(\n `n` Int8\n)\nENGINE = Merge(REGEXP(\'^01902_db\'), \'^t\') +SELECT _database, _table, n FROM merge(REGEXP(^01902_db), ^t) ORDER BY _database, _table, n +01902_db t 0 +01902_db t 1 +01902_db t 2 +01902_db t 3 +01902_db t 4 +01902_db t 5 +01902_db t 6 +01902_db t 7 +01902_db t 8 +01902_db t 9 +01902_db t_merge 0 +01902_db t_merge 0 +01902_db t_merge 0 +01902_db t_merge 0 +01902_db t_merge 1 +01902_db t_merge 1 +01902_db t_merge 1 +01902_db t_merge 1 +01902_db t_merge 2 +01902_db t_merge 2 +01902_db t_merge 2 +01902_db t_merge 2 +01902_db t_merge 3 +01902_db t_merge 3 +01902_db t_merge 3 +01902_db t_merge 3 +01902_db t_merge 4 +01902_db t_merge 4 +01902_db t_merge 4 +01902_db t_merge 4 +01902_db t_merge 5 +01902_db t_merge 5 +01902_db t_merge 5 +01902_db t_merge 5 +01902_db t_merge 6 +01902_db t_merge 6 +01902_db t_merge 6 +01902_db t_merge 6 +01902_db t_merge 7 +01902_db t_merge 7 +01902_db t_merge 7 +01902_db t_merge 7 +01902_db t_merge 8 +01902_db t_merge 8 +01902_db t_merge 8 +01902_db t_merge 8 +01902_db t_merge 9 +01902_db t_merge 9 +01902_db t_merge 9 +01902_db t_merge 9 +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 +01902_db2 t2 0 +01902_db2 t2 1 +01902_db2 t2 2 +01902_db2 t2 3 +01902_db2 t2 4 +01902_db2 t2 5 +01902_db2 t2 6 +01902_db2 t2 7 +01902_db2 t2 8 +01902_db2 t2 9 +01902_db3 t3 0 +01902_db3 t3 1 +01902_db3 t3 2 +01902_db3 t3 3 +01902_db3 t3 4 +01902_db3 t3 5 +01902_db3 t3 6 +01902_db3 t3 7 +01902_db3 t3 8 +01902_db3 t3 9 +SELECT _database, _table, n FROM 01902_db.t_merge WHERE _database = 01902_db1 ORDER BY _database, _table, n +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 +SELECT _database, _table, n FROM 01902_db.t_merge WHERE _table = t1 ORDER BY _database, _table, n +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 +CREATE TABLE t_merge1 as 01902_db.t ENGINE=Merge(01902_db, ^t$) +SELECT _database, _table, n FROM 01902_db.t_merge1 ORDER BY _database, _table, n +01902_db t 0 +01902_db t 1 +01902_db t 2 +01902_db t 3 +01902_db t 4 +01902_db t 5 +01902_db t 6 +01902_db t 7 +01902_db t 8 +01902_db t 9 +SELECT _database, _table, n FROM merge(01902_db, ^t$) ORDER BY _database, _table, n +01902_db t 0 +01902_db t 1 +01902_db t 2 +01902_db t 3 +01902_db t 4 +01902_db t 5 +01902_db t 6 +01902_db t 7 +01902_db t 8 +01902_db t 9 +CREATE TABLE t_merge_1 as 01902_db.t ENGINE=Merge(currentDatabase(), ^t) +SELECT _database, _table, n FROM 01902_db.t_merge_1 ORDER BY _database, _table, n +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 +SHOW CREATE TABLE 01902_db.t_merge_1 +CREATE TABLE `01902_db`.t_merge_1\n(\n `n` Int8\n)\nENGINE = Merge(\'01902_db1\', \'^t\') +SELECT _database, _table, n FROM merge(currentDatabase(), ^t) ORDER BY _database, _table, n +01902_db1 t1 0 +01902_db1 t1 1 +01902_db1 t1 2 +01902_db1 t1 3 +01902_db1 t1 4 +01902_db1 t1 5 +01902_db1 t1 6 +01902_db1 t1 7 +01902_db1 t1 8 +01902_db1 t1 9 diff --git a/tests/queries/0_stateless/01902_table_function_merge_db_repr.sql b/tests/queries/0_stateless/01902_table_function_merge_db_repr.sql new file mode 100644 index 00000000000..3aabf1a1f36 --- /dev/null +++ b/tests/queries/0_stateless/01902_table_function_merge_db_repr.sql @@ -0,0 +1,66 @@ +DROP DATABASE IF EXISTS 01902_db; +DROP DATABASE IF EXISTS 01902_db1; +DROP DATABASE IF EXISTS 01902_db2; +DROP DATABASE IF EXISTS 01902_db3; + +CREATE DATABASE 01902_db; +CREATE DATABASE 01902_db1; +CREATE DATABASE 01902_db2; +CREATE DATABASE 01902_db3; + +CREATE TABLE 01902_db.t (n Int8) ENGINE=MergeTree ORDER BY n; +CREATE TABLE 01902_db1.t1 (n Int8) ENGINE=MergeTree ORDER BY n; +CREATE TABLE 01902_db2.t2 (n Int8) ENGINE=MergeTree ORDER BY n; +CREATE TABLE 01902_db3.t3 (n Int8) ENGINE=MergeTree ORDER BY n; + +INSERT INTO 01902_db.t SELECT * FROM numbers(10); +INSERT INTO 01902_db1.t1 SELECT * FROM numbers(10); +INSERT INTO 01902_db2.t2 SELECT * FROM numbers(10); +INSERT INTO 01902_db3.t3 SELECT * FROM numbers(10); + +SELECT 'CREATE TABLE t_merge as 01902_db.t ENGINE=Merge(REGEXP(^01902_db), ^t)'; +CREATE TABLE 01902_db.t_merge as 01902_db.t ENGINE=Merge(REGEXP('^01902_db'), '^t'); + +SELECT 'SELECT _database, _table, n FROM 01902_db.t_merge ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM 01902_db.t_merge ORDER BY _database, _table, n; + +SELECT 'SHOW CREATE TABLE 01902_db.t_merge'; +SHOW CREATE TABLE 01902_db.t_merge; + +SELECT 'SELECT _database, _table, n FROM merge(REGEXP(^01902_db), ^t) ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM merge(REGEXP('^01902_db'), '^t') ORDER BY _database, _table, n; + +SELECT 'SELECT _database, _table, n FROM 01902_db.t_merge WHERE _database = 01902_db1 ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM 01902_db.t_merge WHERE _database = '01902_db1' ORDER BY _database, _table, n; + +SELECT 'SELECT _database, _table, n FROM 01902_db.t_merge WHERE _table = t1 ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM 01902_db.t_merge WHERE _table = 't1' ORDER BY _database, _table, n; + +-- not regexp +SELECT 'CREATE TABLE t_merge1 as 01902_db.t ENGINE=Merge(01902_db, ^t$)'; +CREATE TABLE 01902_db.t_merge1 as 01902_db.t ENGINE=Merge('01902_db', '^t$'); + +SELECT 'SELECT _database, _table, n FROM 01902_db.t_merge1 ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM 01902_db.t_merge1 ORDER BY _database, _table, n; + +SELECT 'SELECT _database, _table, n FROM merge(01902_db, ^t$) ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM merge('01902_db', '^t$') ORDER BY _database, _table, n; + +USE 01902_db1; + +SELECT 'CREATE TABLE t_merge_1 as 01902_db.t ENGINE=Merge(currentDatabase(), ^t)'; +CREATE TABLE 01902_db.t_merge_1 as 01902_db.t ENGINE=Merge(currentDatabase(), '^t'); + +SELECT 'SELECT _database, _table, n FROM 01902_db.t_merge_1 ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM 01902_db.t_merge_1 ORDER BY _database, _table, n; + +SELECT 'SHOW CREATE TABLE 01902_db.t_merge_1'; +SHOW CREATE TABLE 01902_db.t_merge_1; + +SELECT 'SELECT _database, _table, n FROM merge(currentDatabase(), ^t) ORDER BY _database, _table, n'; +SELECT _database, _table, n FROM merge(currentDatabase(), '^t') ORDER BY _database, _table, n; + +DROP DATABASE 01902_db; +DROP DATABASE 01902_db1; +DROP DATABASE 01902_db2; +DROP DATABASE 01902_db3; diff --git a/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.reference b/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.reference new file mode 100644 index 00000000000..f3b78aeb71e --- /dev/null +++ b/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.reference @@ -0,0 +1,3 @@ +0 40 20 +1 40 20 +2 40 20 diff --git a/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.sql b/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.sql new file mode 100644 index 00000000000..03a3c4f8b65 --- /dev/null +++ b/tests/queries/0_stateless/01925_jit_aggregation_function_count_long.sql @@ -0,0 +1,15 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +DROP TABLE IF EXISTS test_table; +CREATE TABLE test_table +( + id UInt64, + + value UInt8, + value_nullable Nullable(UInt8) +) ENGINE=TinyLog; + +INSERT INTO test_table SELECT number % 3, number, if (number % 2 == 0, number, NULL) FROM system.numbers LIMIT 120; +SELECT id, count(value), count(value_nullable) FROM test_table GROUP BY id ORDER BY id; +DROP TABLE test_table; diff --git a/tests/queries/0_stateless/01925_test_group_by_const_consistency.reference b/tests/queries/0_stateless/01925_test_group_by_const_consistency.reference new file mode 100644 index 00000000000..573541ac970 --- /dev/null +++ b/tests/queries/0_stateless/01925_test_group_by_const_consistency.reference @@ -0,0 +1 @@ +0 diff --git a/tests/queries/0_stateless/01925_test_group_by_const_consistency.sql b/tests/queries/0_stateless/01925_test_group_by_const_consistency.sql new file mode 100644 index 00000000000..8a5de0e7c4f --- /dev/null +++ b/tests/queries/0_stateless/01925_test_group_by_const_consistency.sql @@ -0,0 +1,2 @@ +SELECT 1 as a, count() FROM numbers(10) WHERE 0 GROUP BY a; +SELECT count() FROM numbers(10) WHERE 0 diff --git a/tests/queries/0_stateless/01936_empty_function_support_uuid.reference b/tests/queries/0_stateless/01936_empty_function_support_uuid.reference new file mode 100644 index 00000000000..30373074c1f --- /dev/null +++ b/tests/queries/0_stateless/01936_empty_function_support_uuid.reference @@ -0,0 +1,4 @@ +1 +0 +1 2 +2 1 diff --git a/tests/queries/0_stateless/01936_empty_function_support_uuid.sql b/tests/queries/0_stateless/01936_empty_function_support_uuid.sql new file mode 100644 index 00000000000..c67f38b776a --- /dev/null +++ b/tests/queries/0_stateless/01936_empty_function_support_uuid.sql @@ -0,0 +1,35 @@ +SELECT empty(toUUID('00000000-0000-0000-0000-000000000000')); +SELECT notEmpty(toUUID('00000000-0000-0000-0000-000000000000')); +SELECT uniqIf(uuid, empty(uuid)), uniqIf(uuid, notEmpty(uuid)) +FROM +( + SELECT toUUID('00000000-0000-0000-0000-000000000002') AS uuid + UNION ALL + SELECT toUUID('00000000-0000-0000-0000-000000000000') AS uuid + UNION ALL + SELECT toUUID('00000000-0000-0000-0000-000000000001') AS uuid +); + +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS orders; + +CREATE TABLE users (user_id UUID) ENGINE = Memory; +CREATE TABLE orders (order_id UUID, user_id UUID) ENGINE = Memory; + +INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000001'); +INSERT INTO users VALUES ('00000000-0000-0000-0000-000000000002'); +INSERT INTO orders VALUES ('00000000-0000-0000-0000-000000000003', '00000000-0000-0000-0000-000000000001'); + +SELECT + uniq(user_id) AS users, + uniqIf(order_id, notEmpty(order_id)) AS orders +FROM +( + SELECT * FROM users +) t1 ALL LEFT JOIN ( + SELECT * FROM orders +) t2 USING (user_id); + +DROP TABLE users; +DROP TABLE orders; + diff --git a/tests/queries/0_stateless/01939_type_map_json.reference b/tests/queries/0_stateless/01939_type_map_json.reference new file mode 100644 index 00000000000..9b831c29608 --- /dev/null +++ b/tests/queries/0_stateless/01939_type_map_json.reference @@ -0,0 +1,8 @@ +{"m":{"1":2,"3":4}} +{1:2,3:4} {"1":2,"3":4} 1 +{"m":{"key1":"1","key2":"2"}} +{'key1':1,'key2':2} {"key1":"1","key2":"2"} 1 +{"m":{"key1":1,"key2":2}} +{'key1':1,'key2':2} {"key1":1,"key2":2} 1 +{"m1":{"k1":"1","k2":"2"},"m2":{"1":2,"2":3}} +{"m1":{"k1":1,"k2":2},"m2":{"1":2,"2":3}} diff --git a/tests/queries/0_stateless/01939_type_map_json.sql b/tests/queries/0_stateless/01939_type_map_json.sql new file mode 100644 index 00000000000..4ad25f3c073 --- /dev/null +++ b/tests/queries/0_stateless/01939_type_map_json.sql @@ -0,0 +1,19 @@ +SELECT map(1, 2, 3, 4) AS m FORMAT JSONEachRow; +SELECT map(1, 2, 3, 4) AS m, toJSONString(m) AS s, isValidJSON(s); + +SELECT map('key1', number, 'key2', number * 2) AS m FROM numbers(1, 1) FORMAT JSONEachRow; +SELECT map('key1', number, 'key2', number * 2) AS m, toJSONString(m) AS s, isValidJSON(s) FROM numbers(1, 1); + +SELECT map('key1', number, 'key2', number * 2) AS m FROM numbers(1, 1) + FORMAT JSONEachRow + SETTINGS output_format_json_quote_64bit_integers = 0; + +SELECT map('key1', number, 'key2', number * 2) AS m, toJSONString(m) AS s, isValidJSON(s) FROM numbers(1, 1) + SETTINGS output_format_json_quote_64bit_integers = 0; + +CREATE TEMPORARY TABLE map_json (m1 Map(String, UInt64), m2 Map(UInt32, UInt32)); + +INSERT INTO map_json FORMAT JSONEachRow {"m1" : {"k1" : 1, "k2" : 2}, "m2" : {"1" : 2, "2" : 3}}; + +SELECT m1, m2 FROM map_json FORMAT JSONEachRow; +SELECT m1, m2 FROM map_json FORMAT JSONEachRow SETTINGS output_format_json_quote_64bit_integers = 0; diff --git a/tests/queries/0_stateless/arcadia_skip_list.txt b/tests/queries/0_stateless/arcadia_skip_list.txt index 8453094cc65..903c72f044a 100644 --- a/tests/queries/0_stateless/arcadia_skip_list.txt +++ b/tests/queries/0_stateless/arcadia_skip_list.txt @@ -252,3 +252,4 @@ 01914_exchange_dictionaries 01923_different_expression_name_alias 01932_null_valid_identifier +00918_json_functions diff --git a/tests/queries/1_stateful/00165_jit_aggregate_functions.reference b/tests/queries/1_stateful/00165_jit_aggregate_functions.reference new file mode 100644 index 00000000000..2d94ad190ca --- /dev/null +++ b/tests/queries/1_stateful/00165_jit_aggregate_functions.reference @@ -0,0 +1,128 @@ +Aggregation using JIT compilation +Simple functions +1704509 4611700827100483880 9223360787015464643 10441337359398154812 19954243669348.844 9648741.579254271 523264 +732797 4611701940806302259 9223355550934604746 977192643464016658 2054229034942.3723 51998323.94457991 475698 +598875 4611701407242345792 9223362250391155632 9312163881623734456 27615161624211.875 12261797.824844675 337212 +792887 4611699550286611812 9223290551912005343 6930300520201292824 27479710385933.586 53095331.60360441 252197 +3807842 4611710821592843606 9223326163906184987 16710274896338005145 85240848090850.69 22373416.533275086 196036 +25703952 4611709443519524003 9223353913449113943 9946868158853570839 67568783303242.086 3154349.826950714 147211 +716829 4611852156092872082 9223361623076951140 15381015774917924786 170693446547158.72 201431892.4773785 90109 +59183 4611730685242027332 9223354909338698162 8078812522502896568 94622946187035.42 1425270865.0901496 85379 +33010362 4611704682869732882 9223268545373999677 2064452191838585926 26532987929602.555 3695122.4062526934 77807 +800784 4611752907938305166 9223340418389788041 18082918611792817587 233352070043266.62 36535786.81446395 77492 +20810645 4611712185532639162 9223218900001937412 4996531385439292694 68246505203164.63 6316535.831023813 73213 +25843850 4611690025407720929 9223346023778617822 12755881190906812868 185015319325648.16 9962165.34831339 68945 +23447120 4611796031755620254 9223329309291309758 17231649548755339966 255019232629204.38 7937191.271698021 67570 +14739804 4611692230555590277 9223313509005166531 2458378896777063244 38308020331864.36 14590240.469105456 64174 +32077710 4611884228437061959 9223352444952988904 12965822147651192908 214467085941034.7 7257521.096258734 60456 +22446879 4611846229717089436 9223124373140579096 13530160492087688838 231724477077663.4 4737362.521046629 58389 +170282 4611833225706935900 9223371583739401906 8076893424988479310 141657635880324.8 1613795518.1065989 57017 +11482817 4611708000353743073 9223337838355779113 14841435427430843458 283531099960470.8 9938452.835998287 52345 +63469 4611695097019173921 9223353530156141191 6296784708578574520 120762239817777.88 579655378.4603049 52142 +29103473 4611744585914335132 9223333530281362537 5908285283932344933 123712996438970.34 867841.595541967 47758 +Simple functions with non compilable function +1704509 4611700827100483880 9223360787015464643 10441337359398154812 4611686018427387904 19954243669348.844 9648741.579254271 523264 +732797 4611701940806302259 9223355550934604746 977192643464016658 4611686018427387904 2054229034942.3723 51998323.94457991 475698 +598875 4611701407242345792 9223362250391155632 9312163881623734456 4611686018427387904 27615161624211.875 12261797.824844675 337212 +792887 4611699550286611812 9223290551912005343 6930300520201292824 4611686018427387904 27479710385933.586 53095331.60360441 252197 +3807842 4611710821592843606 9223326163906184987 16710274896338005145 4611686018427387904 85240848090850.69 22373416.533275086 196036 +25703952 4611709443519524003 9223353913449113943 9946868158853570839 4611686018427387904 67568783303242.086 3154349.826950714 147211 +716829 4611852156092872082 9223361623076951140 15381015774917924786 4611686018427387904 170693446547158.72 201431892.4773785 90109 +59183 4611730685242027332 9223354909338698162 8078812522502896568 4611686018427387904 94622946187035.42 1425270865.0901496 85379 +33010362 4611704682869732882 9223268545373999677 2064452191838585926 4611686018427387904 26532987929602.555 3695122.4062526934 77807 +800784 4611752907938305166 9223340418389788041 18082918611792817587 4611686018427387904 233352070043266.62 36535786.81446395 77492 +20810645 4611712185532639162 9223218900001937412 4996531385439292694 4611686018427387904 68246505203164.63 6316535.831023813 73213 +25843850 4611690025407720929 9223346023778617822 12755881190906812868 4611686018427387904 185015319325648.16 9962165.34831339 68945 +23447120 4611796031755620254 9223329309291309758 17231649548755339966 4611686018427387904 255019232629204.38 7937191.271698021 67570 +14739804 4611692230555590277 9223313509005166531 2458378896777063244 4611686018427387904 38308020331864.36 14590240.469105456 64174 +32077710 4611884228437061959 9223352444952988904 12965822147651192908 4611686018427387904 214467085941034.7 7257521.096258734 60456 +22446879 4611846229717089436 9223124373140579096 13530160492087688838 4611686018427387904 231724477077663.4 4737362.521046629 58389 +170282 4611833225706935900 9223371583739401906 8076893424988479310 4611686018427387904 141657635880324.8 1613795518.1065989 57017 +11482817 4611708000353743073 9223337838355779113 14841435427430843458 4611686018427387904 283531099960470.8 9938452.835998287 52345 +63469 4611695097019173921 9223353530156141191 6296784708578574520 4611686018427387904 120762239817777.88 579655378.4603049 52142 +29103473 4611744585914335132 9223333530281362537 5908285283932344933 4611686018427387904 123712996438970.34 867841.595541967 47758 +Simple functions if combinator +1704509 4611700827100483880 9223310246721229500 16398241567152875142 62618822667209.71 2224726.7626273884 261874 +732797 4611721382223060002 9223355550934604746 16281585268876620522 68472164943295.68 5898616.931652982 237784 +598875 4611701407242345792 9223362250391155632 3577699408183553052 21300140553347.42 53771550.26565126 167966 +792887 4611699550286611812 9223164887726235740 7088177025760385824 56461952267903.89 92835869.96920013 125539 +3807842 4611710821592843606 9223283397553859544 5756765290752687660 58835559208469.4 39794091.419183925 97845 +25703952 4611784761593342388 9223241341744449690 4782279928971192568 65182094768443.91 9276773.708181158 73368 +716829 4611852156092872082 9223361623076951140 8613712481895484190 191445613359755.62 291083243.75407773 44993 +59183 4611730685242027332 9223354909338698162 18369075291092794110 429013599530392 5925109959.715378 42817 +33010362 4611704682869732882 9223092117352620518 9991152681891671022 257099731913529.5 12412830.045471078 38861 +800784 4611752907938305166 9223309994342931384 5251877538869750510 135472890315726.03 53535427.52018088 38767 +20810645 4611712185532639162 9223218900001937412 11803718472901310700 323593455407553 10496765.20741332 36477 +25843850 4611744529689964352 9223346023778617822 127137885677350808 3700925266420.715 18966925.191309396 34353 +23447120 4611796031755620254 9223329309291309758 1841522159325376278 54534534450526.42 6271211.193812284 33768 +14739804 4611762063154116632 9223007205463222212 16302703534054321116 506987919332451.8 6885575.861759452 32156 +32077710 4612033458080771112 9223352444952988904 421072759851674408 13955745719596.793 12220152.393889504 30172 +22446879 4611846229717089436 9223124373140579096 6577134317587565298 224866980668999.47 2482202.163802278 29249 +170282 4611833225706935900 9223371583739401906 15764226366913732386 551447384017691 2515144222.953728 28587 +11482817 4611990575414646848 9223302669582414438 9828522700609834800 378121905921203.2 34845264.2080656 25993 +63469 4612175339998036670 9222961628400798084 17239621485933250238 663164390134376.5 7825349797.6059 25996 +29103473 4611744585914335132 9223035551850347954 12590190375872647672 525927999326314.7 26049107.15514301 23939 +Aggregation without JIT compilation +Simple functions +1704509 4611700827100483880 9223360787015464643 10441337359398154812 19954243669348.844 9648741.579254271 523264 +732797 4611701940806302259 9223355550934604746 977192643464016658 2054229034942.3723 51998323.94457991 475698 +598875 4611701407242345792 9223362250391155632 9312163881623734456 27615161624211.875 12261797.824844675 337212 +792887 4611699550286611812 9223290551912005343 6930300520201292824 27479710385933.586 53095331.60360441 252197 +3807842 4611710821592843606 9223326163906184987 16710274896338005145 85240848090850.69 22373416.533275086 196036 +25703952 4611709443519524003 9223353913449113943 9946868158853570839 67568783303242.086 3154349.826950714 147211 +716829 4611852156092872082 9223361623076951140 15381015774917924786 170693446547158.72 201431892.4773785 90109 +59183 4611730685242027332 9223354909338698162 8078812522502896568 94622946187035.42 1425270865.0901496 85379 +33010362 4611704682869732882 9223268545373999677 2064452191838585926 26532987929602.555 3695122.4062526934 77807 +800784 4611752907938305166 9223340418389788041 18082918611792817587 233352070043266.62 36535786.81446395 77492 +20810645 4611712185532639162 9223218900001937412 4996531385439292694 68246505203164.63 6316535.831023813 73213 +25843850 4611690025407720929 9223346023778617822 12755881190906812868 185015319325648.16 9962165.34831339 68945 +23447120 4611796031755620254 9223329309291309758 17231649548755339966 255019232629204.38 7937191.271698021 67570 +14739804 4611692230555590277 9223313509005166531 2458378896777063244 38308020331864.36 14590240.469105456 64174 +32077710 4611884228437061959 9223352444952988904 12965822147651192908 214467085941034.7 7257521.096258734 60456 +22446879 4611846229717089436 9223124373140579096 13530160492087688838 231724477077663.4 4737362.521046629 58389 +170282 4611833225706935900 9223371583739401906 8076893424988479310 141657635880324.8 1613795518.1065989 57017 +11482817 4611708000353743073 9223337838355779113 14841435427430843458 283531099960470.8 9938452.835998287 52345 +63469 4611695097019173921 9223353530156141191 6296784708578574520 120762239817777.88 579655378.4603049 52142 +29103473 4611744585914335132 9223333530281362537 5908285283932344933 123712996438970.34 867841.595541967 47758 +Simple functions with non compilable function +1704509 4611700827100483880 9223360787015464643 10441337359398154812 4611686018427387904 19954243669348.844 9648741.579254271 523264 +732797 4611701940806302259 9223355550934604746 977192643464016658 4611686018427387904 2054229034942.3723 51998323.94457991 475698 +598875 4611701407242345792 9223362250391155632 9312163881623734456 4611686018427387904 27615161624211.875 12261797.824844675 337212 +792887 4611699550286611812 9223290551912005343 6930300520201292824 4611686018427387904 27479710385933.586 53095331.60360441 252197 +3807842 4611710821592843606 9223326163906184987 16710274896338005145 4611686018427387904 85240848090850.69 22373416.533275086 196036 +25703952 4611709443519524003 9223353913449113943 9946868158853570839 4611686018427387904 67568783303242.086 3154349.826950714 147211 +716829 4611852156092872082 9223361623076951140 15381015774917924786 4611686018427387904 170693446547158.72 201431892.4773785 90109 +59183 4611730685242027332 9223354909338698162 8078812522502896568 4611686018427387904 94622946187035.42 1425270865.0901496 85379 +33010362 4611704682869732882 9223268545373999677 2064452191838585926 4611686018427387904 26532987929602.555 3695122.4062526934 77807 +800784 4611752907938305166 9223340418389788041 18082918611792817587 4611686018427387904 233352070043266.62 36535786.81446395 77492 +20810645 4611712185532639162 9223218900001937412 4996531385439292694 4611686018427387904 68246505203164.63 6316535.831023813 73213 +25843850 4611690025407720929 9223346023778617822 12755881190906812868 4611686018427387904 185015319325648.16 9962165.34831339 68945 +23447120 4611796031755620254 9223329309291309758 17231649548755339966 4611686018427387904 255019232629204.38 7937191.271698021 67570 +14739804 4611692230555590277 9223313509005166531 2458378896777063244 4611686018427387904 38308020331864.36 14590240.469105456 64174 +32077710 4611884228437061959 9223352444952988904 12965822147651192908 4611686018427387904 214467085941034.7 7257521.096258734 60456 +22446879 4611846229717089436 9223124373140579096 13530160492087688838 4611686018427387904 231724477077663.4 4737362.521046629 58389 +170282 4611833225706935900 9223371583739401906 8076893424988479310 4611686018427387904 141657635880324.8 1613795518.1065989 57017 +11482817 4611708000353743073 9223337838355779113 14841435427430843458 4611686018427387904 283531099960470.8 9938452.835998287 52345 +63469 4611695097019173921 9223353530156141191 6296784708578574520 4611686018427387904 120762239817777.88 579655378.4603049 52142 +29103473 4611744585914335132 9223333530281362537 5908285283932344933 4611686018427387904 123712996438970.34 867841.595541967 47758 +Simple functions if combinator +1704509 4611700827100483880 9223310246721229500 16398241567152875142 2224726.7626273884 261874 +732797 4611721382223060002 9223355550934604746 16281585268876620522 5898616.931652982 237784 +598875 4611701407242345792 9223362250391155632 3577699408183553052 53771550.26565126 167966 +792887 4611699550286611812 9223164887726235740 7088177025760385824 92835869.96920013 125539 +3807842 4611710821592843606 9223283397553859544 5756765290752687660 39794091.419183925 97845 +25703952 4611784761593342388 9223241341744449690 4782279928971192568 9276773.708181158 73368 +716829 4611852156092872082 9223361623076951140 8613712481895484190 291083243.75407773 44993 +59183 4611730685242027332 9223354909338698162 18369075291092794110 5925109959.715378 42817 +33010362 4611704682869732882 9223092117352620518 9991152681891671022 12412830.045471078 38861 +800784 4611752907938305166 9223309994342931384 5251877538869750510 53535427.52018088 38767 +20810645 4611712185532639162 9223218900001937412 11803718472901310700 10496765.20741332 36477 +25843850 4611744529689964352 9223346023778617822 127137885677350808 18966925.191309396 34353 +23447120 4611796031755620254 9223329309291309758 1841522159325376278 6271211.193812284 33768 +14739804 4611762063154116632 9223007205463222212 16302703534054321116 6885575.861759452 32156 +32077710 4612033458080771112 9223352444952988904 421072759851674408 12220152.393889504 30172 +22446879 4611846229717089436 9223124373140579096 6577134317587565298 2482202.163802278 29249 +170282 4611833225706935900 9223371583739401906 15764226366913732386 2515144222.953728 28587 +11482817 4611990575414646848 9223302669582414438 9828522700609834800 34845264.2080656 25993 +63469 4612175339998036670 9222961628400798084 17239621485933250238 7825349797.6059 25996 +29103473 4611744585914335132 9223035551850347954 12590190375872647672 26049107.15514301 23939 diff --git a/tests/queries/1_stateful/00165_jit_aggregate_functions.sql b/tests/queries/1_stateful/00165_jit_aggregate_functions.sql new file mode 100644 index 00000000000..90917209d1b --- /dev/null +++ b/tests/queries/1_stateful/00165_jit_aggregate_functions.sql @@ -0,0 +1,39 @@ +SET compile_aggregate_expressions = 1; +SET min_count_to_compile_aggregate_expression = 0; + +SELECT 'Aggregation using JIT compilation'; + +SELECT 'Simple functions'; + +SELECT CounterID, min(WatchID), max(WatchID), sum(WatchID), avg(WatchID), avgWeighted(WatchID, CounterID), count(WatchID) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; + +SELECT 'Simple functions with non compilable function'; + +SELECT CounterID, min(WatchID), max(WatchID), sum(WatchID), groupBitAnd(WatchID), avg(WatchID), avgWeighted(WatchID, CounterID), count(WatchID) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; + +SELECT 'Simple functions if combinator'; + +WITH (WatchID % 2 == 0) AS predicate +SELECT CounterID, minIf(WatchID,predicate), maxIf(WatchID, predicate), sumIf(WatchID, predicate), avgIf(WatchID, predicate), avgWeightedIf(WatchID, CounterID, predicate), countIf(WatchID, predicate) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; + +SET compile_aggregate_expressions = 0; + +SELECT 'Aggregation without JIT compilation'; + +SELECT 'Simple functions'; + +SELECT CounterID, min(WatchID), max(WatchID), sum(WatchID), avg(WatchID), avgWeighted(WatchID, CounterID), count(WatchID) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; + +SELECT 'Simple functions with non compilable function'; +SELECT CounterID, min(WatchID), max(WatchID), sum(WatchID), groupBitAnd(WatchID), avg(WatchID), avgWeighted(WatchID, CounterID), count(WatchID) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; + +SELECT 'Simple functions if combinator'; + +WITH (WatchID % 2 == 0) AS predicate +SELECT CounterID, minIf(WatchID,predicate), maxIf(WatchID, predicate), sumIf(WatchID, predicate), avgWeightedIf(WatchID, CounterID, predicate), countIf(WatchID, predicate) FROM test.hits +GROUP BY CounterID ORDER BY count() DESC LIMIT 20; diff --git a/tests/queries/skip_list.json b/tests/queries/skip_list.json index 8fb95741bab..b2f00dcfb87 100644 --- a/tests/queries/skip_list.json +++ b/tests/queries/skip_list.json @@ -181,351 +181,6 @@ "01508_partition_pruning_long", /// bug, shoud be fixed "01482_move_to_prewhere_and_cast" /// bug, shoud be fixed ], - "antlr": [ - "00011_array_join_alias", - "00186_very_long_arrays", - "00233_position_function_sql_comparibilty", - "00417_kill_query", - "00534_functions_bad_arguments12", - "00534_functions_bad_arguments2", - "00534_functions_bad_arguments4", - "00534_functions_bad_arguments9", - "00564_temporary_table_management", - "00600_replace_running_query", - "00626_replace_partition_from_table_zookeeper", - "00652_replicated_mutations_zookeeper", - "00687_top_and_offset", - "00746_sql_fuzzy", - "00763_create_query_as_table_engine_bug", - "00765_sql_compatibility_aliases", - "00825_protobuf_format_array_3dim", - "00825_protobuf_format_array_of_arrays", - "00825_protobuf_format_enum_mapping", - "00825_protobuf_format_map", - "00825_protobuf_format_nested_in_nested", - "00825_protobuf_format_nested_optional", - "00825_protobuf_format_no_length_delimiter", - "00825_protobuf_format_persons", - "00825_protobuf_format_splitted_nested", - "00825_protobuf_format_squares", - "00825_protobuf_format_table_default", - "00826_cross_to_inner_join", - "00834_not_between", - "00855_join_with_array_join", - "00909_kill_not_initialized_query", - "00938_template_input_format", - "00939_limit_by_offset", - "00943_materialize_index", - "00944_clear_index_in_partition", - "00952_input_function", - "00953_constraints_operations", - "00954_client_prepared_statements", - "00956_sensitive_data_masking", - "00969_columns_clause", - "00975_indices_mutation_replicated_zookeeper_long", - "00975_values_list", - "00976_system_stop_ttl_merges", - "00977_int_div", - "00978_table_function_values_alias", - "00980_merge_alter_settings", - "00980_zookeeper_merge_tree_alter_settings", - "00982_array_enumerate_uniq_ranked", - "00984_materialized_view_to_columns", - "00988_constraints_replication_zookeeper", - "00995_order_by_with_fill", - "01001_enums_in_in_section", - "01011_group_uniq_array_memsan", - "01011_test_create_as_skip_indices", - "01014_format_custom_separated", - "01015_attach_part", - "01015_database_bad_tables", - "01017_uniqCombined_memory_usage", - "01018_ddl_dictionaries_concurrent_requrests", /// Cannot parse ATTACH DICTIONARY IF NOT EXISTS - "01019_alter_materialized_view_atomic", - "01019_alter_materialized_view_consistent", - "01019_alter_materialized_view_query", - "01021_tuple_parser", - "01025_array_compact_generic", - "01030_limit_by_with_ties_error", - "01033_quota_dcl", - "01034_with_fill_and_push_down_predicate", - "01035_avg_weighted_long", - "01039_row_policy_dcl", - "01039_test_setting_parse", - "01042_system_reload_dictionary_reloads_completely", - "01045_dictionaries_restrictions", - "01053_ssd_dictionary", - "01055_compact_parts_1", - "01056_create_table_as", - "01066_bit_count", - "01070_materialize_ttl", - "01070_mutations_with_dependencies", - "01073_grant_and_revoke", - "01073_show_tables_not_like", - "01074_partial_revokes", - "01075_allowed_client_hosts", - "01083_expressions_in_engine_arguments", - "01085_regexp_input_format", - "01086_regexp_input_format_skip_unmatched", - "01089_alter_settings_old_format", - "01095_tpch_like_smoke", - "01107_atomic_db_detach_attach", - "01109_exchange_tables", - "01109_sc0rp10_string_hash_map_zero_bytes", - "01110_dictionary_layout_without_arguments", - "01114_database_atomic", - "01114_materialize_clear_index_compact_parts", - "01115_join_with_dictionary", - "01117_comma_and_others_join_mix", - "01125_dict_ddl_cannot_add_column", - "01130_in_memory_parts", - "01144_multiple_joins_rewriter_v2_and_lambdas", - "01144_multiword_data_types", - "01145_with_fill_const", - "01149_zookeeper_mutation_stuck_after_replace_partition", - "01150_ddl_guard_rwr", - "01153_attach_mv_uuid", - "01155_old_mutation_parts_to_do", - "01155_rename_move_materialized_view", - "01182_materialized_view_different_structure", - "01185_create_or_replace_table", - "01187_set_profile_as_setting", - "01188_attach_table_from_path", - "01190_full_attach_syntax", - "01191_rename_dictionary", - "01192_rename_database_zookeeper", - "01213_alter_rename_column", - "01232_untuple", - "01240_join_get_or_null", - "01244_optimize_distributed_group_by_sharding_key", - "01254_dict_load_after_detach_attach", - "01256_misspell_layout_name_podshumok", - "01257_dictionary_mismatch_types", - "01267_alter_default_key_columns_zookeeper", - "01268_mv_scalars", - "01269_create_with_null", - "01271_show_privileges", - "01272_offset_without_limit", - "01277_alter_rename_column_constraint_zookeeper", - "01278_min_insert_block_size_rows_for_materialized_views", - "01280_min_map_max_map", - "01280_null_in", - "01280_ssd_complex_key_dictionary", - "01280_ttl_where_group_by_negative", - "01280_ttl_where_group_by", - "01280_unicode_whitespaces_lexer", - "01292_create_user", - "01293_create_role", - "01293_pretty_max_value_width", - "01293_show_clusters", - "01293_show_settings", - "01294_create_settings_profile", - "01294_lazy_database_concurrent_recreate_reattach_and_show_tables_long", - "01294_system_distributed_on_cluster", - "01295_create_row_policy", - "01296_create_row_policy_in_current_database", - "01297_create_quota", - "01308_row_policy_and_trivial_count_query", - "01317_no_password_in_command_line", - "01318_map_add_map_subtract", - "01322_any_input_optimize", - "01324_if_transform_strings_to_enum", - "01337_mysql_global_variables", - "01355_alter_column_with_order", - "01355_ilike", - "01373_is_zero_or_null", - "01374_if_nullable_filimonov", - "01378_alter_rename_with_ttl_zookeeper", - "01379_with_fill_several_columns", - "01397_in_bad_arguments", - "01412_mod_float", - "01415_table_function_view", - "01417_freeze_partition_verbose_zookeeper", - "01417_freeze_partition_verbose", - "01418_custom_settings", - "01419_merge_tree_settings_sanity_check", - "01430_modify_sample_by_zookeeper", - "01447_json_strings", - "01449_json_compact_strings", - "01451_detach_drop_part", - "01451_replicated_detach_drop_and_quorum", - "01451_replicated_detach_drop_part", - "01457_create_as_table_function_structure", - "01460_allow_dollar_and_number_in_identifier", - "01463_test_alter_live_view_refresh", - "01465_ttl_recompression", - "01470_columns_transformers", - "01470_columns_transformers2", - "01470_explain", - "01470_show_databases_like", - "01470_test_insert_select_asterisk", - "01475_read_subcolumns_2", - "01475_read_subcolumns_3", - "01475_read_subcolumns_storages", - "01475_read_subcolumns", - "01480_binary_operator_monotonicity", - "01491_nested_multiline_comments", - "01493_table_function_null", - "01495_subqueries_in_with_statement_2", - "01495_subqueries_in_with_statement_3", - "01495_subqueries_in_with_statement", - "01501_clickhouse_client_INSERT_exception", - "01504_compression_multiple_streams", - "01504_rocksdb", - "01506_ttl_same_with_order_by", - "01508_explain_header", - "01508_partition_pruning_long", - "01509_check_parallel_quorum_inserts_long", - "01509_dictionary_preallocate", - "01509_parallel_quorum_and_merge_long", - "01515_mv_and_array_join_optimisation_bag", - "01515_with_global_and_with_propagation", - "01516_create_table_primary_key", - "01517_drop_mv_with_inner_table", - "01523_client_local_queries_file_parameter", - "01523_interval_operator_support_string_literal", - "01525_select_with_offset_fetch_clause", - "01526_client_start_and_exit", - "01527_dist_sharding_key_dictGet_reload", - "01529_union_distinct_and_setting_union_default_mode", - "01530_drop_database_atomic_sync", - "01532_execute_merges_on_single_replica", - "01532_primary_key_without_order_by_zookeeper", - "01533_multiple_nested", - "01541_max_memory_usage_for_user_long", - "01551_mergetree_read_in_order_spread", - "01552_dict_fixedstring", - "01554_bloom_filter_index_big_integer_uuid", - "01556_explain_select_with_union_query", - "01561_aggregate_functions_of_key_with_join", - "01562_optimize_monotonous_functions_in_order_by", - "01568_window_functions_distributed", - "01571_window_functions", - "01576_alias_column_rewrite", - "01581_deduplicate_by_columns_local", - "01581_deduplicate_by_columns_replicated", - "01582_any_join_supertype", - "01582_distinct_optimization", - "01590_countSubstrings", - "01591_window_functions", - "01592_long_window_functions1", - "01592_window_functions", - "01593_insert_settings", - "01594_too_low_memory_limits", - "01596_setting_limit_offset", - "01600_log_queries_with_extensive_info", - "01600_quota_by_forwarded_ip", - "01601_detach_permanently", - "01602_show_create_view", - "01603_read_with_backoff_bug", - "01604_explain_ast_of_nonselect_query", - "01605_drop_settings_profile_while_assigned", - "01605_skip_idx_compact_parts", - "01606_git_import", - "01606_merge_from_wide_to_compact", - "01614_with_fill_with_limit", - "01622_multiple_ttls", - "01630_disallow_floating_point_as_partition_key", - "01632_max_partitions_to_read", - "01632_select_all_syntax", - "01638_div_mod_ambiguities", - "01642_if_nullable_regression", - "01643_system_suspend", - "01646_system_restart_replicas_smoke", - "01650_drop_part_and_deduplication_zookeeper", - "01650_fetch_patition_with_macro_in_zk_path", - "01651_lc_insert_tiny_log", - "01655_plan_optimizations", - "01656_test_query_log_factories_info", - "01658_values_ubsan", - "01663_quantile_weighted_overflow", - "01666_blns", - "01666_merge_tree_max_query_limit", - "01666_merge_tree_max_query_limit", - "01674_clickhouse_client_query_param_cte", - "01674_unicode_asan", - "01676_dictget_in_default_expression", - "01680_predicate_pushdown_union_distinct_subquery", - "01681_cache_dictionary_simple_key", - "01682_cache_dictionary_complex_key", - "01683_flat_dictionary", - "01684_ssd_cache_dictionary_simple_key", - "01685_ssd_cache_dictionary_complex_key", - "01686_rocksdb", - "01699_timezoneOffset", - "01702_bitmap_native_integers", - "01702_system_query_log", - "01710_projections", - "01711_cte_subquery_fix", - "01712_no_adaptive_granularity_vertical_merge", - "01715_table_function_view_fix", - "01720_dictionary_create_source_with_functions", - "01720_union_distinct_with_limit", - "01721_dictionary_decimal_p_s", - "01721_engine_file_truncate_on_insert", - "01730_distributed_group_by_no_merge_order_by_long", - "01732_explain_syntax_union_query", - "01732_union_and_union_all", - "01747_join_view_filter_dictionary", - "01748_dictionary_table_dot", - "01753_direct_dictionary_simple_key", - "01754_direct_dictionary_complex_key", - "01756_optimize_skip_unused_shards_rewrite_in", - "01757_optimize_skip_unused_shards_limit", - "01759_dictionary_unique_attribute_names", - "01760_polygon_dictionaries", - "01760_system_dictionaries", - "01763_long_ttl_group_by", - "01765_hashed_dictionary_simple_key", - "01766_hashed_dictionary_complex_key", - "01774_tuple_null_in", - "01778_hierarchical_dictionaries", - "01778_mmap_cache_infra", - "01780_clickhouse_dictionary_source_loop", - "01781_merge_tree_deduplication", - "01785_dictionary_element_count", - "01786_explain_merge_tree", - "01801_distinct_group_by_shard", - "01802_rank_corr_mann_whitney_over_window", - "01802_test_postgresql_protocol_with_row_policy", /// It cannot parse DROP ROW POLICY - "01818_move_partition_simple", - "01821_table_comment", - "01823_explain_json", - "01837_database_memory_ddl_dictionaries", - "01839_join_to_subqueries_rewriter_columns_matcher", - "01840_tupleElement_formatting_fuzzer", - "01851_fix_row_policy_empty_result", - "01851_hedged_connections_external_tables", - "01852_cast_operator_bad_cases", - "01852_cast_operator", - "01861_explain_pipeline", - "01868_order_by_fill_with_datetime64", - "01870_buffer_flush", - "01871_merge_tree_compile_expressions", - "01872_functions_to_subcolumns", - "01881_union_header_mismatch_bug", - "01883_subcolumns_distributed", - "01889_postgresql_protocol_null_fields", - "01889_check_row_policy_defined_using_user_function", - "01892_setting_limit_offset_distributed", - "01902_dictionary_array_type", - "01903_ssd_cache_dictionary_array_type", - "01905_to_json_string", - "01913_fix_column_transformer_replace_format", - "01913_if_int_decimal", - "01913_join_push_down_bug", - "01921_with_fill_with_totals", - "01924_argmax_bitmap_state", - "01913_replace_dictionary", - "01914_exchange_dictionaries", - "01915_create_or_replace_dictionary", - "01913_names_of_tuple_literal", - "01925_merge_prewhere_table", - "01932_null_valid_identifier", - "01934_constexpr_aggregate_function_parameters", - "01932_alter_index_with_order", - "01936_quantiles_cannot_return_null" - ], "parallel": [ /// Pessimistic list of tests which work badly in parallel. @@ -856,6 +511,7 @@ "01914_exchange_dictionaries", "01915_create_or_replace_dictionary", "01925_test_storage_merge_aliases", - "01933_client_replxx_convert_history" /// Uses non unique history file + "01933_client_replxx_convert_history", /// Uses non unique history file + "01902_table_function_merge_db_repr" ] } diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index bd6453e406b..a6bf2843e9a 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -12,7 +12,6 @@ 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/src/Parsers/New/ClickHouseLexer.g4 b/utils/antlr/ClickHouseLexer.g4 similarity index 100% rename from src/Parsers/New/ClickHouseLexer.g4 rename to utils/antlr/ClickHouseLexer.g4 diff --git a/src/Parsers/New/ClickHouseParser.g4 b/utils/antlr/ClickHouseParser.g4 similarity index 100% rename from src/Parsers/New/ClickHouseParser.g4 rename to utils/antlr/ClickHouseParser.g4 diff --git a/src/Parsers/New/README.md b/utils/antlr/README.md similarity index 100% rename from src/Parsers/New/README.md rename to utils/antlr/README.md diff --git a/utils/list-versions/version_date.tsv b/utils/list-versions/version_date.tsv index 3df6b8e6616..541dea23698 100644 --- a/utils/list-versions/version_date.tsv +++ b/utils/list-versions/version_date.tsv @@ -1,6 +1,8 @@ +v21.6.6.51-stable 2021-07-02 v21.6.5.37-stable 2021-06-19 v21.6.4.26-stable 2021-06-11 v21.6.3.14-stable 2021-06-04 +v21.5.8.21-stable 2021-07-02 v21.5.7.9-stable 2021-06-22 v21.5.6.6-stable 2021-05-29 v21.5.5.12-stable 2021-05-20 @@ -9,6 +11,7 @@ v21.4.6.55-stable 2021-04-30 v21.4.5.46-stable 2021-04-24 v21.4.4.30-stable 2021-04-16 v21.4.3.21-stable 2021-04-12 +v21.3.14.1-lts 2021-07-01 v21.3.13.9-lts 2021-06-22 v21.3.12.2-lts 2021-05-25 v21.3.11.5-lts 2021-05-14 diff --git a/utils/syntax-analyzer/CMakeLists.txt b/utils/syntax-analyzer/CMakeLists.txt deleted file mode 100644 index 77068f528be..00000000000 --- a/utils/syntax-analyzer/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index cf264160407..00000000000 --- a/utils/syntax-analyzer/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#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; - } - } - } -}