diff --git a/.dockerignore b/.dockerignore index 2c26fc9cb0041..79a794a0401f7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -33,4 +33,4 @@ !plugin-server/.prettierrc !share/GeoLite2-City.mmdb !hogvm/python -!unit.json \ No newline at end of file +!unit.json diff --git a/.github/actions/run-backend-tests/action.yml b/.github/actions/run-backend-tests/action.yml index 48812f4caf992..87038a52189ad 100644 --- a/.github/actions/run-backend-tests/action.yml +++ b/.github/actions/run-backend-tests/action.yml @@ -49,11 +49,17 @@ runs: python-version: ${{ inputs.python-version }} token: ${{ inputs.token }} + - name: Determine if hogql-parser has changed compared to master + shell: bash + id: hogql-parser-diff + run: | + changed=$(git diff --quiet HEAD master -- hogql_parser/ && echo "false" || echo "true") + echo "::set-output name=changed::$changed" + - name: Install SAML (python3-saml) dependencies shell: bash run: | - sudo apt-get update - sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl + sudo apt-get update && sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl - uses: syphar/restore-virtualenv@v1 id: cache-backend-tests @@ -63,12 +69,37 @@ runs: - uses: syphar/restore-pip-download-cache@v1 if: steps.cache-backend-tests.outputs.cache-hit != 'true' - - name: Install python dependencies + - name: Install Python dependencies if: steps.cache-backend-tests.outputs.cache-hit != 'true' shell: bash run: | - python -m pip install -r requirements-dev.txt - python -m pip install -r requirements.txt + pip install -r requirements.txt -r requirements-dev.txt + + - name: Install the working version of hogql-parser + if: steps.hogql-parser-diff.outputs.changed == 'true' + shell: bash + # This is not cached currently, as it's important to build the current HEAD version of hogql-parser if it has + # changed (requirements.txt has the already-published version) + run: | + sudo apt-get install libboost-all-dev unzip cmake curl uuid pkg-config + curl https://www.antlr.org/download/antlr4-cpp-runtime-4.13.0-source.zip --output antlr4-source.zip + # Check that the downloaded archive is the expected runtime - a security measure + anltr_known_md5sum="ff214b65fb02e150b4f515d7983bca92" + antlr_found_ms5sum="$(md5sum antlr4-source.zip | cut -d' ' -f1)" + if [[ "$anltr_known_md5sum" != "$antlr_found_ms5sum" ]]; then + echo "Unexpected MD5 sum of antlr4-source.zip!" + echo "Known: $anltr_known_md5sum" + echo "Found: $antlr_found_ms5sum" + exit 64 + fi + unzip antlr4-source.zip -d antlr4-source && cd antlr4-source + cmake . + DESTDIR=out make install + sudo cp -r out/usr/local/include/antlr4-runtime /usr/include/ + sudo cp out/usr/local/lib/libantlr4-runtime.so* /usr/lib/ + sudo ldconfig + cd .. + pip install ./hogql_parser - name: Set up needed files shell: bash diff --git a/.github/workflows/build-hogql-parser.yml b/.github/workflows/build-hogql-parser.yml new file mode 100644 index 0000000000000..97cc24fa59abf --- /dev/null +++ b/.github/workflows/build-hogql-parser.yml @@ -0,0 +1,130 @@ +name: Release hogql-parser + +on: + push: + branches: + - master + paths: + - hogql_parser/** + - .github/workflows/build-hogql-parser.yml + pull_request: + paths: + - hogql_parser/** + - .github/workflows/build-hogql-parser.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + check-version: + name: Check version legitimacy + runs-on: ubuntu-22.04 + outputs: + parser_any_changed: ${{ steps.changed-files-yaml.outputs.parser_any_changed }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetching all for comparison since last push (not just last commit) + + - name: Check if hogql_parser/ has changed + id: changed-files-yaml + uses: tj-actions/changed-files@v39 + with: + since_last_remote_commit: true + files_yaml: | + parser: + - hogql_parser/** + + - name: Notify about release needed + if: steps.changed-files-yaml.outputs.parser_any_changed == 'true' + shell: bash + run: | + published=$(curl -fSsl https://pypi.org/pypi/hogql-parser/json | jq -r '.info.version') + local=$(python hogql_parser/setup.py --version) + # TODO: Only comment if no comment alraedy exists for $local + if [[ "$published" == "$local" ]]; then + MESSAGE_BODY="It looks like the code of `hogql-parser` has changed since last push, but its version stayed the same at $local. πŸ‘€\nMake sure to resolve this in `hogql_parser/setup.py` before merging!" + curl -s -u posthog-bot:${{ secrets.POSTHOG_BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} -X POST -d "{ \"body\": \"$MESSAGE_BODY\" }" "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" + fi + + build-wheels: + name: Build wheels on ${{ matrix.os }} + needs: check-version + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + if: ${{ needs.check-version.outputs.parser_any_changed == 'true' }} + strategy: + matrix: + # As of October 2023, GitHub doesn't have ARM Actions runners… and ARM emulation is insanely slow + # (20x longer) on the Linux runners (while being reasonable on the macOS runners). Hence, we use + # BuildJet as a provider of ARM runners - this solution saves a lot of time and consequently some money. + os: [ubuntu-22.04, buildjet-2vcpu-ubuntu-2204-arm, macos-12] + + steps: + - uses: actions/checkout@v4 + + - if: ${{ !endsWith(matrix.os, '-arm') }} + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - if: ${{ endsWith(matrix.os, '-arm') }} + uses: deadsnakes/action@v3.0.1 # Unfortunately actions/setup-python@v4 just doesn't work on ARM! This does + with: + python-version: '3.11' + + - name: Build sdist + if: matrix.os == 'ubuntu-22.04' # Only build the sdist once + run: cd hogql_parser && python setup.py sdist + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.16.* + + - name: Build wheels + run: cd hogql_parser && python -m cibuildwheel --output-dir dist + env: + MACOSX_DEPLOYMENT_TARGET: '12' # A modern target allows us to use C++20 + + - uses: actions/upload-artifact@v3 + with: + path: | + hogql_parser/dist/*.whl + hogql_parser/dist/*.tar.gz + if-no-files-found: error + + publish: + name: Publish on PyPI + needs: build-wheels + environment: pypi-hogql-parser + permissions: + id-token: write + runs-on: ubuntu-22.04 + steps: + - name: Fetch wheels + uses: actions/download-artifact@v3 + with: + name: artifact + path: dist/ + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - uses: actions/checkout@v4 + with: + token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} + ref: ${{ github.event.pull_request.head.ref }} + + - name: Update hogql-parser in requirements + shell: bash + run: | + local=$(python hogql_parser/setup.py --version) + sed -i "s/hogql-parser==.*/hogql-parser==${local}/g" requirements.in + sed -i "s/hogql-parser==.*/hogql-parser==${local}/g" requirements.txt + + - uses: EndBug/add-and-commit@v9 + with: + add: '["requirements.in", "requirements.txt"]' + message: 'Use new hogql-parser version' + default_author: github_actions + github_token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml index 5a74f81d849d0..198d41c25c117 100644 --- a/.github/workflows/ci-backend.yml +++ b/.github/workflows/ci-backend.yml @@ -98,7 +98,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 1 - path: 'current/' - name: Set up Python uses: actions/setup-python@v4 @@ -119,38 +118,30 @@ jobs: sudo apt-get update sudo apt-get install libxml2-dev libxmlsec1 libxmlsec1-dev libxmlsec1-openssl - - name: Install python dependencies + - name: Install Python dependencies if: steps.cache-backend-tests.outputs.cache-hit != 'true' run: | - cd current python -m pip install -r requirements.txt -r requirements-dev.txt - name: Check for syntax errors, import sort, and code style violations run: | - cd current ruff . - name: Check formatting run: | - cd current black --exclude posthog/hogql/grammar --check . - name: Check static typing run: | - cd current mypy -p posthog --exclude bin/migrate_kafka_data.py --exclude posthog/hogql/grammar/HogQLParser.py --exclude gunicorn.config.py --enable-recursive-aliases - name: Check if "schema.py" is up to date run: | - cd current npm run schema:build:python && git diff --exit-code - - name: Check if antlr definitions are up to date + - name: Check if ANTLR definitions are up to date run: | - # Installing a version of ant compatible with what we use in development from homebrew (4.13) - # "apt-get install antlr" would install 4.7 which is incompatible with our grammar. - export ANTLR_VERSION=4.13.0 - # java version doesn't matter + cd .. sudo apt-get install default-jre mkdir antlr cd antlr @@ -162,9 +153,13 @@ jobs: export CLASSPATH=".:$PWD/antlr.jar:$CLASSPATH" export PATH="$PWD:$PATH" - cd ../current + cd ../posthog antlr | grep "Version" npm run grammar:build && git diff --exit-code + env: + # Installing a version of ANTLR compatible with what's in Homebrew as of October 2023 (version 4.13), + # as apt-get is quite out of date. The same version must be set in hogql_parser/pyproject.toml + ANTLR_VERSION: '4.13.0' check-migrations: needs: changes diff --git a/.vscode/launch.json b/.vscode/launch.json index 1624d13d056dc..9c2023d82e322 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -96,6 +96,31 @@ "console": "integratedTerminal", "python": "${workspaceFolder}/env/bin/python", "cwd": "${workspaceFolder}" + }, + { + "name": "Pytest: Current File", + "type": "python", + "request": "launch", + "module": "pytest", + "args": ["${file}", "-vvv"], + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "(lldb) Attach", + "type": "cppdbg", + "request": "attach", + "program": "/Users/twixes/.pyenv/versions/3.10.10/envs/posthog-3.10/bin/python", + "MIMode": "lldb" + }, + { + "name": "Python C++ Debugger: Current File", + "type": "pythoncpp", + "request": "launch", + "pythonConfig": "custom", + "pythonLaunchName": "Pytest: Current File", + "cppConfig": "custom", + "cppAttachName": "(lldb) Attach" } ], "compounds": [ diff --git a/hogql_parser/.clang-format b/hogql_parser/.clang-format new file mode 100644 index 0000000000000..583a666fe94e5 --- /dev/null +++ b/hogql_parser/.clang-format @@ -0,0 +1,3 @@ +BasedOnStyle: Chromium +ColumnLimit: 120 +AlignAfterOpenBracket: BlockIndent diff --git a/hogql_parser/.gitignore b/hogql_parser/.gitignore new file mode 100644 index 0000000000000..2a5a44e877407 --- /dev/null +++ b/hogql_parser/.gitignore @@ -0,0 +1,5 @@ +# Build +build/ +*.egg-info +*.so +dist/ diff --git a/hogql_parser/CONTRIBUTING.md b/hogql_parser/CONTRIBUTING.md new file mode 100644 index 0000000000000..a8274e06c4732 --- /dev/null +++ b/hogql_parser/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Developing `hogql-parser` + +## Mandatory reading + +If you're new to Python C/C++ extensions, there are some things you must have in your mind. + +### [Objects, Types and Reference Counts in CPython](https://docs.python.org/3/c-api/intro.html#objects-types-and-reference-counts) + + Key takeaways: + + 1. `Py_INCREF()` and `Py_DECREF()` need to be used accurately, or there'll be memory leaks (or, less likely, segfaults). + 1. `Py_None`, `Py_True`, and `Py_False` are singletons, but they still need to be incref'd/decref'd - the best way to do create a new reference to them is wrapping them in `Py_NewRef()`. + 1. Pretty much only `PyList_SET_ITEM()` _steals_ references (i.e. assumes ownership of objects passed into it), if you pass an object into any other function and no longer need it after that - remember to `Py_DECREF` it! + +### [Building Values in CPython](https://docs.python.org/3/c-api/arg.html#building-values) + + Key takeaways: + + 1. Use `Py_BuildValue()` for building tuples, dicts, and lists of static size. Use type-specific functions (e.g. `PyUnicode_FromString()` or `PyList_New()`) otherwise. + 1. `str`-building with `s` involves `strlen`, while `s#` doesn't - it's better to use the latter with C++ strings. + 1. `object`-passing with `O` increments the object's refcount, while doing it with `N` doesn't - we should use `N` pretty much exclusively, because the parse tree converter is about creating new objects (not borrowing). + +## Conventions + +1. Use `snake_case`. ANTLR is `camelCase`-heavy because of its Java heritage, but both the C++ stdlib and CPython are snaky. +2. Use the `auto` type for ANTLR and ANTLR-derived types, since they can be pretty verbose. Otherwise specify the type explictly. +3. Stay out of Python land as long as possible. E.g. avoid using `PyObject*`s` for bools or strings. + Do use Python for parsing numbers though - that way we don't need to consider integer overflow. +4. If any child rule results in an AST node, so must the parent rule - once in Python land, always in Python land. + E.g. it doesn't make sense to create a `vector`, that should just be a `PyObject*` of Python type `list`. + +## How to develop locally on macOS + +1. Install libraries: + + ```bash + brew install boost antlr4-cpp-runtime + ``` + +1. Install `hogql_parser` by building from local sources: + + ```bash + pip install ./hogql_parser + ``` + +1. If you now run tests, the locally-built version of `hogql_parser` will be used: + + ```bash + pytest posthog/hogql/ + ``` diff --git a/hogql_parser/HogQLLexer.cpp b/hogql_parser/HogQLLexer.cpp new file mode 100644 index 0000000000000..d8ba1b07116fa --- /dev/null +++ b/hogql_parser/HogQLLexer.cpp @@ -0,0 +1,1048 @@ + +// Generated from HogQLLexer.g4 by ANTLR 4.13.0 + + +#include "HogQLLexer.h" + + +using namespace antlr4; + + + +using namespace antlr4; + +namespace { + +struct HogQLLexerStaticData final { + HogQLLexerStaticData(std::vector ruleNames, + std::vector channelNames, + std::vector modeNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)), + modeNames(std::move(modeNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + HogQLLexerStaticData(const HogQLLexerStaticData&) = delete; + HogQLLexerStaticData(HogQLLexerStaticData&&) = delete; + HogQLLexerStaticData& operator=(const HogQLLexerStaticData&) = delete; + HogQLLexerStaticData& operator=(HogQLLexerStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector channelNames; + const std::vector modeNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag hogqllexerLexerOnceFlag; +#if ANTLR4_USE_THREAD_LOCAL_CACHE +static thread_local +#endif +HogQLLexerStaticData *hogqllexerLexerStaticData = nullptr; + +void hogqllexerLexerInitialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + if (hogqllexerLexerStaticData != nullptr) { + return; + } +#else + assert(hogqllexerLexerStaticData == nullptr); +#endif + auto staticData = std::make_unique( + std::vector{ + "ADD", "AFTER", "ALIAS", "ALL", "ALTER", "AND", "ANTI", "ANY", "ARRAY", + "AS", "ASCENDING", "ASOF", "AST", "ASYNC", "ATTACH", "BETWEEN", "BOTH", + "BY", "CASE", "CAST", "CHECK", "CLEAR", "CLUSTER", "CODEC", "COHORT", + "COLLATE", "COLUMN", "COMMENT", "CONSTRAINT", "CREATE", "CROSS", "CUBE", + "CURRENT", "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", "FOLLOWING", "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", "OVER", "PARTITION", + "POPULATE", "PRECEDING", "PREWHERE", "PRIMARY", "PROJECTION", "QUARTER", + "RANGE", "RELOAD", "REMOVE", "RENAME", "REPLACE", "REPLICA", "REPLICATED", + "RIGHT", "ROLLUP", "ROW", "ROWS", "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", "UNBOUNDED", "UNION", "UPDATE", + "USE", "USING", "UUID", "VALUES", "VIEW", "VOLUME", "WATCH", "WEEK", + "WHEN", "WHERE", "WINDOW", "WITH", "YEAR", "JSON_FALSE", "JSON_TRUE", + "ESCAPE_CHAR", "IDENTIFIER", "FLOATING_LITERAL", "OCTAL_LITERAL", + "DECIMAL_LITERAL", "HEXADECIMAL_LITERAL", "STRING_LITERAL", "PLACEHOLDER", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "LETTER", + "OCT_DIGIT", "DEC_DIGIT", "HEX_DIGIT", "ARROW", "ASTERISK", "BACKQUOTE", + "BACKSLASH", "COLON", "COMMA", "CONCAT", "DASH", "DOLLAR", "DOT", + "EQ_DOUBLE", "EQ_SINGLE", "GT_EQ", "GT", "HASH", "IREGEX_SINGLE", + "IREGEX_DOUBLE", "LBRACE", "LBRACKET", "LPAREN", "LT_EQ", "LT", "NOT_EQ", + "NOT_IREGEX", "NOT_REGEX", "NULLISH", "PERCENT", "PLUS", "QUERY", + "QUOTE_DOUBLE", "QUOTE_SINGLE", "REGEX_SINGLE", "REGEX_DOUBLE", "RBRACE", + "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "UNDERSCORE", "MULTI_LINE_COMMENT", + "SINGLE_LINE_COMMENT", "WHITESPACE" + }, + std::vector{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }, + std::vector{ + "DEFAULT_MODE" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "'false'", "'true'", "", "", "", "", "", "", "", "", + "'->'", "'*'", "'`'", "'\\'", "':'", "','", "'||'", "'-'", "'$'", + "'.'", "'=='", "'='", "'>='", "'>'", "'#'", "'~*'", "'=~*'", "'{'", + "'['", "'('", "'<='", "'<'", "", "'!~*'", "'!~'", "'\\u003F\\u003F'", + "'%'", "'+'", "'\\u003F'", "'\"'", "'''", "'~'", "'=~'", "'}'", "']'", + "')'", "';'", "'/'", "'_'" + }, + std::vector{ + "", "ADD", "AFTER", "ALIAS", "ALL", "ALTER", "AND", "ANTI", "ANY", + "ARRAY", "AS", "ASCENDING", "ASOF", "AST", "ASYNC", "ATTACH", "BETWEEN", + "BOTH", "BY", "CASE", "CAST", "CHECK", "CLEAR", "CLUSTER", "CODEC", + "COHORT", "COLLATE", "COLUMN", "COMMENT", "CONSTRAINT", "CREATE", + "CROSS", "CUBE", "CURRENT", "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", + "FOLLOWING", "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", "OVER", "PARTITION", "POPULATE", "PRECEDING", + "PREWHERE", "PRIMARY", "PROJECTION", "QUARTER", "RANGE", "RELOAD", + "REMOVE", "RENAME", "REPLACE", "REPLICA", "REPLICATED", "RIGHT", "ROLLUP", + "ROW", "ROWS", "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", "UNBOUNDED", "UNION", "UPDATE", + "USE", "USING", "UUID", "VALUES", "VIEW", "VOLUME", "WATCH", "WEEK", + "WHEN", "WHERE", "WINDOW", "WITH", "YEAR", "JSON_FALSE", "JSON_TRUE", + "ESCAPE_CHAR", "IDENTIFIER", "FLOATING_LITERAL", "OCTAL_LITERAL", + "DECIMAL_LITERAL", "HEXADECIMAL_LITERAL", "STRING_LITERAL", "PLACEHOLDER", + "ARROW", "ASTERISK", "BACKQUOTE", "BACKSLASH", "COLON", "COMMA", "CONCAT", + "DASH", "DOLLAR", "DOT", "EQ_DOUBLE", "EQ_SINGLE", "GT_EQ", "GT", + "HASH", "IREGEX_SINGLE", "IREGEX_DOUBLE", "LBRACE", "LBRACKET", "LPAREN", + "LT_EQ", "LT", "NOT_EQ", "NOT_IREGEX", "NOT_REGEX", "NULLISH", "PERCENT", + "PLUS", "QUERY", "QUOTE_DOUBLE", "QUOTE_SINGLE", "REGEX_SINGLE", "REGEX_DOUBLE", + "RBRACE", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "UNDERSCORE", + "MULTI_LINE_COMMENT", "SINGLE_LINE_COMMENT", "WHITESPACE" + } + ); + static const int32_t serializedATNSegment[] = { + 4,0,242,2222,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6, + 7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2, + 14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2, + 21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2, + 28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2, + 35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2, + 42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2, + 49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2, + 56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2, + 63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2, + 70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2, + 77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2, + 84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, + 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2, + 98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104, + 7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110, + 7,110,2,111,7,111,2,112,7,112,2,113,7,113,2,114,7,114,2,115,7,115,2,116, + 7,116,2,117,7,117,2,118,7,118,2,119,7,119,2,120,7,120,2,121,7,121,2,122, + 7,122,2,123,7,123,2,124,7,124,2,125,7,125,2,126,7,126,2,127,7,127,2,128, + 7,128,2,129,7,129,2,130,7,130,2,131,7,131,2,132,7,132,2,133,7,133,2,134, + 7,134,2,135,7,135,2,136,7,136,2,137,7,137,2,138,7,138,2,139,7,139,2,140, + 7,140,2,141,7,141,2,142,7,142,2,143,7,143,2,144,7,144,2,145,7,145,2,146, + 7,146,2,147,7,147,2,148,7,148,2,149,7,149,2,150,7,150,2,151,7,151,2,152, + 7,152,2,153,7,153,2,154,7,154,2,155,7,155,2,156,7,156,2,157,7,157,2,158, + 7,158,2,159,7,159,2,160,7,160,2,161,7,161,2,162,7,162,2,163,7,163,2,164, + 7,164,2,165,7,165,2,166,7,166,2,167,7,167,2,168,7,168,2,169,7,169,2,170, + 7,170,2,171,7,171,2,172,7,172,2,173,7,173,2,174,7,174,2,175,7,175,2,176, + 7,176,2,177,7,177,2,178,7,178,2,179,7,179,2,180,7,180,2,181,7,181,2,182, + 7,182,2,183,7,183,2,184,7,184,2,185,7,185,2,186,7,186,2,187,7,187,2,188, + 7,188,2,189,7,189,2,190,7,190,2,191,7,191,2,192,7,192,2,193,7,193,2,194, + 7,194,2,195,7,195,2,196,7,196,2,197,7,197,2,198,7,198,2,199,7,199,2,200, + 7,200,2,201,7,201,2,202,7,202,2,203,7,203,2,204,7,204,2,205,7,205,2,206, + 7,206,2,207,7,207,2,208,7,208,2,209,7,209,2,210,7,210,2,211,7,211,2,212, + 7,212,2,213,7,213,2,214,7,214,2,215,7,215,2,216,7,216,2,217,7,217,2,218, + 7,218,2,219,7,219,2,220,7,220,2,221,7,221,2,222,7,222,2,223,7,223,2,224, + 7,224,2,225,7,225,2,226,7,226,2,227,7,227,2,228,7,228,2,229,7,229,2,230, + 7,230,2,231,7,231,2,232,7,232,2,233,7,233,2,234,7,234,2,235,7,235,2,236, + 7,236,2,237,7,237,2,238,7,238,2,239,7,239,2,240,7,240,2,241,7,241,2,242, + 7,242,2,243,7,243,2,244,7,244,2,245,7,245,2,246,7,246,2,247,7,247,2,248, + 7,248,2,249,7,249,2,250,7,250,2,251,7,251,2,252,7,252,2,253,7,253,2,254, + 7,254,2,255,7,255,2,256,7,256,2,257,7,257,2,258,7,258,2,259,7,259,2,260, + 7,260,2,261,7,261,2,262,7,262,2,263,7,263,2,264,7,264,2,265,7,265,2,266, + 7,266,2,267,7,267,2,268,7,268,2,269,7,269,2,270,7,270,2,271,7,271,1,0, + 1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1, + 3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7, + 1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1, + 10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,3,10,608,8,10,1,11,1, + 11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1, + 14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1, + 15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1, + 19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1, + 21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1, + 23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1, + 25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1, + 27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1, + 28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1, + 30,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1, + 33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1, + 34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1, + 37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1, + 38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1, + 40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1, + 42,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1, + 43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1, + 45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,1,46,1, + 46,1,46,1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1, + 48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1, + 49,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1,52,1, + 52,1,52,1,52,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,54,1,54,1,54,1,54,1, + 54,1,54,1,54,1,55,1,55,1,55,1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,56,1, + 56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,57,1, + 57,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,58,1,59,1,59,1,59,1,59,1,59,1, + 59,1,59,1,59,1,60,1,60,1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,61,1,61,1, + 61,1,62,1,62,1,62,1,62,1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1, + 63,1,63,1,63,1,64,1,64,1,64,1,64,1,65,1,65,1,65,1,65,1,65,1,65,1,65,1, + 66,1,66,1,66,1,66,1,66,1,66,1,66,1,67,1,67,1,67,1,67,1,67,1,68,1,68,1, + 68,1,68,1,68,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,69,1,70,1,70,1, + 70,1,70,1,70,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1, + 71,1,71,1,71,1,72,1,72,1,72,1,72,1,72,1,72,1,73,1,73,1,73,1,73,1,73,1, + 73,1,73,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1,74,1, + 74,1,75,1,75,1,75,1,75,1,75,1,76,1,76,1,76,1,77,1,77,1,77,1,78,1,78,1, + 78,1,78,1,78,1,78,1,79,1,79,1,79,1,80,1,80,1,80,1,80,1,80,1,80,1,81,1, + 81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,1,81,3,81,1113,8, + 81,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1, + 83,1,83,1,83,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,85,1,85,1,85,1,85,1, + 85,1,85,1,85,1,85,1,85,1,86,1,86,1,86,1,86,1,86,1,87,1,87,1,87,1,88,1, + 88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,89,1,89,1, + 89,1,89,1,89,1,90,1,90,1,90,1,90,1,91,1,91,1,91,1,91,1,91,1,92,1,92,1, + 92,1,92,1,92,1,93,1,93,1,93,1,93,1,93,1,93,1,93,1,94,1,94,1,94,1,94,1, + 94,1,94,1,94,1,94,1,95,1,95,1,95,1,95,1,95,1,96,1,96,1,96,1,96,1,96,1, + 96,1,96,1,96,1,96,1,97,1,97,1,97,1,97,1,97,1,98,1,98,1,98,1,98,1,98,1, + 98,1,99,1,99,1,99,1,99,1,99,1,100,1,100,1,100,1,100,1,100,1,100,1,101, + 1,101,1,101,1,101,1,101,1,102,1,102,1,102,1,102,1,102,1,102,1,102,1,102, + 1,102,1,102,1,102,1,102,1,103,1,103,1,103,1,103,1,103,1,103,1,103,1,103, + 1,103,1,103,1,103,1,103,1,103,1,104,1,104,1,104,1,104,1,105,1,105,1,105, + 1,105,1,105,1,105,1,105,1,106,1,106,1,106,1,106,1,107,1,107,1,107,1,107, + 1,107,1,107,1,107,1,108,1,108,1,108,1,108,1,108,1,108,1,108,1,109,1,109, + 1,109,1,109,1,109,1,109,1,110,1,110,1,110,1,110,1,110,1,111,1,111,1,111, + 1,111,1,111,1,111,1,111,1,111,1,111,1,112,1,112,1,112,1,112,1,113,1,113, + 1,113,1,114,1,114,1,114,1,114,1,115,1,115,1,115,1,115,1,115,1,116,1,116, + 1,116,1,116,1,116,1,116,1,117,1,117,1,117,1,117,1,117,1,117,1,117,1,118, + 1,118,1,118,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,119,1,120, + 1,120,1,120,1,121,1,121,1,121,1,121,1,121,1,121,1,122,1,122,1,122,1,122, + 1,122,1,122,1,123,1,123,1,123,1,123,1,123,1,123,1,123,1,123,1,124,1,124, + 1,124,1,124,1,124,1,125,1,125,1,125,1,125,1,125,1,125,1,125,1,125,1,125, + 1,125,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,126,1,127,1,127, + 1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,127,1,128,1,128,1,128,1,128, + 1,128,1,128,1,128,1,128,1,128,1,129,1,129,1,129,1,129,1,129,1,129,1,129, + 1,129,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130,1,130, + 1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,131,1,132,1,132,1,132,1,132, + 1,132,1,132,1,133,1,133,1,133,1,133,1,133,1,133,1,133,1,134,1,134,1,134, + 1,134,1,134,1,134,1,134,1,135,1,135,1,135,1,135,1,135,1,135,1,135,1,136, + 1,136,1,136,1,136,1,136,1,136,1,136,1,136,1,137,1,137,1,137,1,137,1,137, + 1,137,1,137,1,137,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138,1,138, + 1,138,1,138,1,139,1,139,1,139,1,139,1,139,1,139,1,140,1,140,1,140,1,140, + 1,140,1,140,1,140,1,141,1,141,1,141,1,141,1,142,1,142,1,142,1,142,1,142, + 1,143,1,143,1,143,1,143,1,143,1,143,1,143,1,144,1,144,1,144,1,144,1,144, + 1,144,1,144,1,145,1,145,1,145,1,145,1,145,1,145,1,145,1,146,1,146,1,146, + 1,146,1,146,1,147,1,147,1,147,1,147,1,147,1,147,1,148,1,148,1,148,1,148, + 1,149,1,149,1,149,1,149,1,149,1,149,1,149,1,149,1,149,1,150,1,150,1,150, + 1,150,1,150,1,151,1,151,1,151,1,151,1,151,1,151,1,151,1,152,1,152,1,152, + 1,152,1,152,1,152,1,153,1,153,1,153,1,153,1,153,1,154,1,154,1,154,1,154, + 1,154,1,154,1,154,1,154,1,154,1,154,1,155,1,155,1,155,1,155,1,155,1,156, + 1,156,1,156,1,156,1,156,1,156,1,156,1,157,1,157,1,157,1,157,1,157,1,157, + 1,157,1,158,1,158,1,158,1,158,1,158,1,158,1,159,1,159,1,159,1,159,1,159, + 1,159,1,159,1,160,1,160,1,160,1,160,1,160,1,160,1,160,1,160,1,160,1,160, + 1,161,1,161,1,161,1,161,1,161,1,162,1,162,1,162,1,162,1,162,1,163,1,163, + 1,163,1,163,1,163,1,164,1,164,1,164,1,164,1,164,1,164,1,164,1,164,1,165, + 1,165,1,165,1,165,1,165,1,165,1,165,1,165,1,165,1,165,1,166,1,166,1,166, + 1,167,1,167,1,167,1,167,1,168,1,168,1,168,1,168,1,168,1,168,1,168,1,169, + 1,169,1,169,1,169,1,169,1,169,1,169,1,169,1,169,1,170,1,170,1,170,1,170, + 1,170,1,171,1,171,1,171,1,171,1,171,1,171,1,171,1,171,1,171,1,172,1,172, + 1,172,1,172,1,173,1,173,1,173,1,173,1,173,1,174,1,174,1,174,1,174,1,174, + 1,174,1,174,1,174,1,174,1,174,1,175,1,175,1,175,1,175,1,175,1,175,1,176, + 1,176,1,176,1,176,1,176,1,176,1,176,1,177,1,177,1,177,1,177,1,178,1,178, + 1,178,1,178,1,178,1,178,1,179,1,179,1,179,1,179,1,179,1,180,1,180,1,180, + 1,180,1,180,1,180,1,180,1,181,1,181,1,181,1,181,1,181,1,182,1,182,1,182, + 1,182,1,182,1,182,1,182,1,183,1,183,1,183,1,183,1,183,1,183,1,184,1,184, + 1,184,1,184,1,184,1,185,1,185,1,185,1,185,1,185,1,186,1,186,1,186,1,186, + 1,186,1,186,1,187,1,187,1,187,1,187,1,187,1,187,1,187,1,188,1,188,1,188, + 1,188,1,188,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189,1,189, + 3,189,1827,8,189,1,190,1,190,1,190,1,190,1,190,1,190,1,191,1,191,1,191, + 1,191,1,191,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192, + 1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192, + 1,192,1,192,1,192,1,192,1,192,1,192,1,192,1,192,3,192,1870,8,192,1,193, + 1,193,1,193,3,193,1875,8,193,1,193,1,193,1,193,1,193,5,193,1881,8,193, + 10,193,12,193,1884,9,193,1,193,1,193,1,193,1,193,1,193,1,193,5,193,1892, + 8,193,10,193,12,193,1895,9,193,1,193,1,193,1,193,1,193,1,193,1,193,1, + 193,1,193,5,193,1905,8,193,10,193,12,193,1908,9,193,1,193,1,193,3,193, + 1912,8,193,1,194,1,194,1,194,5,194,1917,8,194,10,194,12,194,1920,9,194, + 1,194,1,194,3,194,1924,8,194,1,194,1,194,3,194,1928,8,194,1,194,4,194, + 1931,8,194,11,194,12,194,1932,1,194,1,194,1,194,3,194,1938,8,194,1,194, + 1,194,3,194,1942,8,194,1,194,4,194,1945,8,194,11,194,12,194,1946,1,194, + 1,194,1,194,5,194,1952,8,194,10,194,12,194,1955,9,194,1,194,1,194,1,194, + 3,194,1960,8,194,1,194,4,194,1963,8,194,11,194,12,194,1964,1,194,1,194, + 1,194,1,194,1,194,3,194,1972,8,194,1,194,4,194,1975,8,194,11,194,12,194, + 1976,1,194,1,194,1,194,1,194,3,194,1983,8,194,1,194,4,194,1986,8,194, + 11,194,12,194,1987,3,194,1990,8,194,1,195,1,195,4,195,1994,8,195,11,195, + 12,195,1995,1,196,4,196,1999,8,196,11,196,12,196,2000,1,197,1,197,1,197, + 4,197,2006,8,197,11,197,12,197,2007,1,198,1,198,1,198,1,198,1,198,1,198, + 5,198,2016,8,198,10,198,12,198,2019,9,198,1,198,1,198,1,199,1,199,1,199, + 1,199,1,199,1,199,5,199,2029,8,199,10,199,12,199,2032,9,199,1,199,1,199, + 1,200,1,200,1,201,1,201,1,202,1,202,1,203,1,203,1,204,1,204,1,205,1,205, + 1,206,1,206,1,207,1,207,1,208,1,208,1,209,1,209,1,210,1,210,1,211,1,211, + 1,212,1,212,1,213,1,213,1,214,1,214,1,215,1,215,1,216,1,216,1,217,1,217, + 1,218,1,218,1,219,1,219,1,220,1,220,1,221,1,221,1,222,1,222,1,223,1,223, + 1,224,1,224,1,225,1,225,1,226,1,226,1,227,1,227,1,228,1,228,1,229,1,229, + 1,230,1,230,1,230,1,231,1,231,1,232,1,232,1,233,1,233,1,234,1,234,1,235, + 1,235,1,236,1,236,1,236,1,237,1,237,1,238,1,238,1,239,1,239,1,240,1,240, + 1,240,1,241,1,241,1,242,1,242,1,242,1,243,1,243,1,244,1,244,1,245,1,245, + 1,245,1,246,1,246,1,246,1,246,1,247,1,247,1,248,1,248,1,249,1,249,1,250, + 1,250,1,250,1,251,1,251,1,252,1,252,1,252,1,252,3,252,2152,8,252,1,253, + 1,253,1,253,1,253,1,254,1,254,1,254,1,255,1,255,1,255,1,256,1,256,1,257, + 1,257,1,258,1,258,1,259,1,259,1,260,1,260,1,261,1,261,1,262,1,262,1,262, + 1,263,1,263,1,264,1,264,1,265,1,265,1,266,1,266,1,267,1,267,1,268,1,268, + 1,269,1,269,1,269,1,269,5,269,2195,8,269,10,269,12,269,2198,9,269,1,269, + 1,269,1,269,1,269,1,269,1,270,1,270,1,270,1,270,5,270,2209,8,270,10,270, + 12,270,2212,9,270,1,270,3,270,2215,8,270,1,270,1,270,1,271,1,271,1,271, + 1,271,1,2196,0,272,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11, + 23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45, + 23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34, + 69,35,71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91, + 46,93,47,95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56, + 113,57,115,58,117,59,119,60,121,61,123,62,125,63,127,64,129,65,131,66, + 133,67,135,68,137,69,139,70,141,71,143,72,145,73,147,74,149,75,151,76, + 153,77,155,78,157,79,159,80,161,81,163,82,165,83,167,84,169,85,171,86, + 173,87,175,88,177,89,179,90,181,91,183,92,185,93,187,94,189,95,191,96, + 193,97,195,98,197,99,199,100,201,101,203,102,205,103,207,104,209,105, + 211,106,213,107,215,108,217,109,219,110,221,111,223,112,225,113,227,114, + 229,115,231,116,233,117,235,118,237,119,239,120,241,121,243,122,245,123, + 247,124,249,125,251,126,253,127,255,128,257,129,259,130,261,131,263,132, + 265,133,267,134,269,135,271,136,273,137,275,138,277,139,279,140,281,141, + 283,142,285,143,287,144,289,145,291,146,293,147,295,148,297,149,299,150, + 301,151,303,152,305,153,307,154,309,155,311,156,313,157,315,158,317,159, + 319,160,321,161,323,162,325,163,327,164,329,165,331,166,333,167,335,168, + 337,169,339,170,341,171,343,172,345,173,347,174,349,175,351,176,353,177, + 355,178,357,179,359,180,361,181,363,182,365,183,367,184,369,185,371,186, + 373,187,375,188,377,189,379,190,381,191,383,192,385,193,387,194,389,195, + 391,196,393,197,395,198,397,199,399,200,401,0,403,0,405,0,407,0,409,0, + 411,0,413,0,415,0,417,0,419,0,421,0,423,0,425,0,427,0,429,0,431,0,433, + 0,435,0,437,0,439,0,441,0,443,0,445,0,447,0,449,0,451,0,453,0,455,0,457, + 0,459,0,461,201,463,202,465,203,467,204,469,205,471,206,473,207,475,208, + 477,209,479,210,481,211,483,212,485,213,487,214,489,215,491,216,493,217, + 495,218,497,219,499,220,501,221,503,222,505,223,507,224,509,225,511,226, + 513,227,515,228,517,229,519,230,521,231,523,232,525,233,527,234,529,235, + 531,236,533,237,535,238,537,239,539,240,541,241,543,242,1,0,37,2,0,92, + 92,96,96,2,0,34,34,92,92,2,0,39,39,92,92,2,0,92,92,125,125,2,0,65,65, + 97,97,2,0,66,66,98,98,2,0,67,67,99,99,2,0,68,68,100,100,2,0,69,69,101, + 101,2,0,70,70,102,102,2,0,71,71,103,103,2,0,72,72,104,104,2,0,73,73,105, + 105,2,0,74,74,106,106,2,0,75,75,107,107,2,0,76,76,108,108,2,0,77,77,109, + 109,2,0,78,78,110,110,2,0,79,79,111,111,2,0,80,80,112,112,2,0,81,81,113, + 113,2,0,82,82,114,114,2,0,83,83,115,115,2,0,84,84,116,116,2,0,85,85,117, + 117,2,0,86,86,118,118,2,0,87,87,119,119,2,0,88,88,120,120,2,0,89,89,121, + 121,2,0,90,90,122,122,2,0,65,90,97,122,1,0,48,55,1,0,48,57,3,0,48,57, + 65,70,97,102,2,0,10,10,13,13,2,1,10,10,13,13,2,0,9,13,32,32,2252,0,1, + 1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0, + 0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23, + 1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0, + 0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0, + 0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55, + 1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0, + 0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0, + 0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87, + 1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0, + 0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0, + 0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0, + 0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0,0,0,0,127,1,0, + 0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0, + 0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,143,1,0,0,0,0,145,1,0,0,0,0,147,1,0, + 0,0,0,149,1,0,0,0,0,151,1,0,0,0,0,153,1,0,0,0,0,155,1,0,0,0,0,157,1,0, + 0,0,0,159,1,0,0,0,0,161,1,0,0,0,0,163,1,0,0,0,0,165,1,0,0,0,0,167,1,0, + 0,0,0,169,1,0,0,0,0,171,1,0,0,0,0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0, + 0,0,0,179,1,0,0,0,0,181,1,0,0,0,0,183,1,0,0,0,0,185,1,0,0,0,0,187,1,0, + 0,0,0,189,1,0,0,0,0,191,1,0,0,0,0,193,1,0,0,0,0,195,1,0,0,0,0,197,1,0, + 0,0,0,199,1,0,0,0,0,201,1,0,0,0,0,203,1,0,0,0,0,205,1,0,0,0,0,207,1,0, + 0,0,0,209,1,0,0,0,0,211,1,0,0,0,0,213,1,0,0,0,0,215,1,0,0,0,0,217,1,0, + 0,0,0,219,1,0,0,0,0,221,1,0,0,0,0,223,1,0,0,0,0,225,1,0,0,0,0,227,1,0, + 0,0,0,229,1,0,0,0,0,231,1,0,0,0,0,233,1,0,0,0,0,235,1,0,0,0,0,237,1,0, + 0,0,0,239,1,0,0,0,0,241,1,0,0,0,0,243,1,0,0,0,0,245,1,0,0,0,0,247,1,0, + 0,0,0,249,1,0,0,0,0,251,1,0,0,0,0,253,1,0,0,0,0,255,1,0,0,0,0,257,1,0, + 0,0,0,259,1,0,0,0,0,261,1,0,0,0,0,263,1,0,0,0,0,265,1,0,0,0,0,267,1,0, + 0,0,0,269,1,0,0,0,0,271,1,0,0,0,0,273,1,0,0,0,0,275,1,0,0,0,0,277,1,0, + 0,0,0,279,1,0,0,0,0,281,1,0,0,0,0,283,1,0,0,0,0,285,1,0,0,0,0,287,1,0, + 0,0,0,289,1,0,0,0,0,291,1,0,0,0,0,293,1,0,0,0,0,295,1,0,0,0,0,297,1,0, + 0,0,0,299,1,0,0,0,0,301,1,0,0,0,0,303,1,0,0,0,0,305,1,0,0,0,0,307,1,0, + 0,0,0,309,1,0,0,0,0,311,1,0,0,0,0,313,1,0,0,0,0,315,1,0,0,0,0,317,1,0, + 0,0,0,319,1,0,0,0,0,321,1,0,0,0,0,323,1,0,0,0,0,325,1,0,0,0,0,327,1,0, + 0,0,0,329,1,0,0,0,0,331,1,0,0,0,0,333,1,0,0,0,0,335,1,0,0,0,0,337,1,0, + 0,0,0,339,1,0,0,0,0,341,1,0,0,0,0,343,1,0,0,0,0,345,1,0,0,0,0,347,1,0, + 0,0,0,349,1,0,0,0,0,351,1,0,0,0,0,353,1,0,0,0,0,355,1,0,0,0,0,357,1,0, + 0,0,0,359,1,0,0,0,0,361,1,0,0,0,0,363,1,0,0,0,0,365,1,0,0,0,0,367,1,0, + 0,0,0,369,1,0,0,0,0,371,1,0,0,0,0,373,1,0,0,0,0,375,1,0,0,0,0,377,1,0, + 0,0,0,379,1,0,0,0,0,381,1,0,0,0,0,383,1,0,0,0,0,385,1,0,0,0,0,387,1,0, + 0,0,0,389,1,0,0,0,0,391,1,0,0,0,0,393,1,0,0,0,0,395,1,0,0,0,0,397,1,0, + 0,0,0,399,1,0,0,0,0,461,1,0,0,0,0,463,1,0,0,0,0,465,1,0,0,0,0,467,1,0, + 0,0,0,469,1,0,0,0,0,471,1,0,0,0,0,473,1,0,0,0,0,475,1,0,0,0,0,477,1,0, + 0,0,0,479,1,0,0,0,0,481,1,0,0,0,0,483,1,0,0,0,0,485,1,0,0,0,0,487,1,0, + 0,0,0,489,1,0,0,0,0,491,1,0,0,0,0,493,1,0,0,0,0,495,1,0,0,0,0,497,1,0, + 0,0,0,499,1,0,0,0,0,501,1,0,0,0,0,503,1,0,0,0,0,505,1,0,0,0,0,507,1,0, + 0,0,0,509,1,0,0,0,0,511,1,0,0,0,0,513,1,0,0,0,0,515,1,0,0,0,0,517,1,0, + 0,0,0,519,1,0,0,0,0,521,1,0,0,0,0,523,1,0,0,0,0,525,1,0,0,0,0,527,1,0, + 0,0,0,529,1,0,0,0,0,531,1,0,0,0,0,533,1,0,0,0,0,535,1,0,0,0,0,537,1,0, + 0,0,0,539,1,0,0,0,0,541,1,0,0,0,0,543,1,0,0,0,1,545,1,0,0,0,3,549,1,0, + 0,0,5,555,1,0,0,0,7,561,1,0,0,0,9,565,1,0,0,0,11,571,1,0,0,0,13,575,1, + 0,0,0,15,580,1,0,0,0,17,584,1,0,0,0,19,590,1,0,0,0,21,607,1,0,0,0,23, + 609,1,0,0,0,25,614,1,0,0,0,27,618,1,0,0,0,29,624,1,0,0,0,31,631,1,0,0, + 0,33,639,1,0,0,0,35,644,1,0,0,0,37,647,1,0,0,0,39,652,1,0,0,0,41,657, + 1,0,0,0,43,663,1,0,0,0,45,669,1,0,0,0,47,677,1,0,0,0,49,683,1,0,0,0,51, + 690,1,0,0,0,53,698,1,0,0,0,55,705,1,0,0,0,57,713,1,0,0,0,59,724,1,0,0, + 0,61,731,1,0,0,0,63,737,1,0,0,0,65,742,1,0,0,0,67,750,1,0,0,0,69,759, + 1,0,0,0,71,769,1,0,0,0,73,774,1,0,0,0,75,778,1,0,0,0,77,790,1,0,0,0,79, + 798,1,0,0,0,81,804,1,0,0,0,83,811,1,0,0,0,85,816,1,0,0,0,87,827,1,0,0, + 0,89,836,1,0,0,0,91,843,1,0,0,0,93,856,1,0,0,0,95,867,1,0,0,0,97,872, + 1,0,0,0,99,881,1,0,0,0,101,893,1,0,0,0,103,898,1,0,0,0,105,903,1,0,0, + 0,107,907,1,0,0,0,109,914,1,0,0,0,111,921,1,0,0,0,113,928,1,0,0,0,115, + 936,1,0,0,0,117,947,1,0,0,0,119,955,1,0,0,0,121,963,1,0,0,0,123,969,1, + 0,0,0,125,975,1,0,0,0,127,981,1,0,0,0,129,991,1,0,0,0,131,995,1,0,0,0, + 133,1002,1,0,0,0,135,1009,1,0,0,0,137,1014,1,0,0,0,139,1019,1,0,0,0,141, + 1028,1,0,0,0,143,1035,1,0,0,0,145,1047,1,0,0,0,147,1053,1,0,0,0,149,1060, + 1,0,0,0,151,1073,1,0,0,0,153,1078,1,0,0,0,155,1081,1,0,0,0,157,1084,1, + 0,0,0,159,1090,1,0,0,0,161,1093,1,0,0,0,163,1112,1,0,0,0,165,1114,1,0, + 0,0,167,1124,1,0,0,0,169,1130,1,0,0,0,171,1137,1,0,0,0,173,1146,1,0,0, + 0,175,1151,1,0,0,0,177,1154,1,0,0,0,179,1167,1,0,0,0,181,1172,1,0,0,0, + 183,1176,1,0,0,0,185,1181,1,0,0,0,187,1186,1,0,0,0,189,1193,1,0,0,0,191, + 1201,1,0,0,0,193,1206,1,0,0,0,195,1215,1,0,0,0,197,1220,1,0,0,0,199,1226, + 1,0,0,0,201,1231,1,0,0,0,203,1237,1,0,0,0,205,1242,1,0,0,0,207,1254,1, + 0,0,0,209,1267,1,0,0,0,211,1271,1,0,0,0,213,1278,1,0,0,0,215,1282,1,0, + 0,0,217,1289,1,0,0,0,219,1296,1,0,0,0,221,1302,1,0,0,0,223,1307,1,0,0, + 0,225,1316,1,0,0,0,227,1320,1,0,0,0,229,1323,1,0,0,0,231,1327,1,0,0,0, + 233,1332,1,0,0,0,235,1338,1,0,0,0,237,1345,1,0,0,0,239,1348,1,0,0,0,241, + 1357,1,0,0,0,243,1360,1,0,0,0,245,1366,1,0,0,0,247,1372,1,0,0,0,249,1380, + 1,0,0,0,251,1385,1,0,0,0,253,1395,1,0,0,0,255,1404,1,0,0,0,257,1414,1, + 0,0,0,259,1423,1,0,0,0,261,1431,1,0,0,0,263,1442,1,0,0,0,265,1450,1,0, + 0,0,267,1456,1,0,0,0,269,1463,1,0,0,0,271,1470,1,0,0,0,273,1477,1,0,0, + 0,275,1485,1,0,0,0,277,1493,1,0,0,0,279,1504,1,0,0,0,281,1510,1,0,0,0, + 283,1517,1,0,0,0,285,1521,1,0,0,0,287,1526,1,0,0,0,289,1533,1,0,0,0,291, + 1540,1,0,0,0,293,1547,1,0,0,0,295,1552,1,0,0,0,297,1558,1,0,0,0,299,1562, + 1,0,0,0,301,1571,1,0,0,0,303,1576,1,0,0,0,305,1583,1,0,0,0,307,1589,1, + 0,0,0,309,1594,1,0,0,0,311,1604,1,0,0,0,313,1609,1,0,0,0,315,1616,1,0, + 0,0,317,1623,1,0,0,0,319,1629,1,0,0,0,321,1636,1,0,0,0,323,1646,1,0,0, + 0,325,1651,1,0,0,0,327,1656,1,0,0,0,329,1661,1,0,0,0,331,1669,1,0,0,0, + 333,1679,1,0,0,0,335,1682,1,0,0,0,337,1686,1,0,0,0,339,1693,1,0,0,0,341, + 1702,1,0,0,0,343,1707,1,0,0,0,345,1716,1,0,0,0,347,1720,1,0,0,0,349,1725, + 1,0,0,0,351,1735,1,0,0,0,353,1741,1,0,0,0,355,1748,1,0,0,0,357,1752,1, + 0,0,0,359,1758,1,0,0,0,361,1763,1,0,0,0,363,1770,1,0,0,0,365,1775,1,0, + 0,0,367,1782,1,0,0,0,369,1788,1,0,0,0,371,1793,1,0,0,0,373,1798,1,0,0, + 0,375,1804,1,0,0,0,377,1811,1,0,0,0,379,1826,1,0,0,0,381,1828,1,0,0,0, + 383,1834,1,0,0,0,385,1869,1,0,0,0,387,1911,1,0,0,0,389,1989,1,0,0,0,391, + 1991,1,0,0,0,393,1998,1,0,0,0,395,2002,1,0,0,0,397,2009,1,0,0,0,399,2022, + 1,0,0,0,401,2035,1,0,0,0,403,2037,1,0,0,0,405,2039,1,0,0,0,407,2041,1, + 0,0,0,409,2043,1,0,0,0,411,2045,1,0,0,0,413,2047,1,0,0,0,415,2049,1,0, + 0,0,417,2051,1,0,0,0,419,2053,1,0,0,0,421,2055,1,0,0,0,423,2057,1,0,0, + 0,425,2059,1,0,0,0,427,2061,1,0,0,0,429,2063,1,0,0,0,431,2065,1,0,0,0, + 433,2067,1,0,0,0,435,2069,1,0,0,0,437,2071,1,0,0,0,439,2073,1,0,0,0,441, + 2075,1,0,0,0,443,2077,1,0,0,0,445,2079,1,0,0,0,447,2081,1,0,0,0,449,2083, + 1,0,0,0,451,2085,1,0,0,0,453,2087,1,0,0,0,455,2089,1,0,0,0,457,2091,1, + 0,0,0,459,2093,1,0,0,0,461,2095,1,0,0,0,463,2098,1,0,0,0,465,2100,1,0, + 0,0,467,2102,1,0,0,0,469,2104,1,0,0,0,471,2106,1,0,0,0,473,2108,1,0,0, + 0,475,2111,1,0,0,0,477,2113,1,0,0,0,479,2115,1,0,0,0,481,2117,1,0,0,0, + 483,2120,1,0,0,0,485,2122,1,0,0,0,487,2125,1,0,0,0,489,2127,1,0,0,0,491, + 2129,1,0,0,0,493,2132,1,0,0,0,495,2136,1,0,0,0,497,2138,1,0,0,0,499,2140, + 1,0,0,0,501,2142,1,0,0,0,503,2145,1,0,0,0,505,2151,1,0,0,0,507,2153,1, + 0,0,0,509,2157,1,0,0,0,511,2160,1,0,0,0,513,2163,1,0,0,0,515,2165,1,0, + 0,0,517,2167,1,0,0,0,519,2169,1,0,0,0,521,2171,1,0,0,0,523,2173,1,0,0, + 0,525,2175,1,0,0,0,527,2178,1,0,0,0,529,2180,1,0,0,0,531,2182,1,0,0,0, + 533,2184,1,0,0,0,535,2186,1,0,0,0,537,2188,1,0,0,0,539,2190,1,0,0,0,541, + 2204,1,0,0,0,543,2218,1,0,0,0,545,546,3,401,200,0,546,547,3,407,203,0, + 547,548,3,407,203,0,548,2,1,0,0,0,549,550,3,401,200,0,550,551,3,411,205, + 0,551,552,3,439,219,0,552,553,3,409,204,0,553,554,3,435,217,0,554,4,1, + 0,0,0,555,556,3,401,200,0,556,557,3,423,211,0,557,558,3,417,208,0,558, + 559,3,401,200,0,559,560,3,437,218,0,560,6,1,0,0,0,561,562,3,401,200,0, + 562,563,3,423,211,0,563,564,3,423,211,0,564,8,1,0,0,0,565,566,3,401,200, + 0,566,567,3,423,211,0,567,568,3,439,219,0,568,569,3,409,204,0,569,570, + 3,435,217,0,570,10,1,0,0,0,571,572,3,401,200,0,572,573,3,427,213,0,573, + 574,3,407,203,0,574,12,1,0,0,0,575,576,3,401,200,0,576,577,3,427,213, + 0,577,578,3,439,219,0,578,579,3,417,208,0,579,14,1,0,0,0,580,581,3,401, + 200,0,581,582,3,427,213,0,582,583,3,449,224,0,583,16,1,0,0,0,584,585, + 3,401,200,0,585,586,3,435,217,0,586,587,3,435,217,0,587,588,3,401,200, + 0,588,589,3,449,224,0,589,18,1,0,0,0,590,591,3,401,200,0,591,592,3,437, + 218,0,592,20,1,0,0,0,593,594,3,401,200,0,594,595,3,437,218,0,595,596, + 3,405,202,0,596,608,1,0,0,0,597,598,3,401,200,0,598,599,3,437,218,0,599, + 600,3,405,202,0,600,601,3,409,204,0,601,602,3,427,213,0,602,603,3,407, + 203,0,603,604,3,417,208,0,604,605,3,427,213,0,605,606,3,413,206,0,606, + 608,1,0,0,0,607,593,1,0,0,0,607,597,1,0,0,0,608,22,1,0,0,0,609,610,3, + 401,200,0,610,611,3,437,218,0,611,612,3,429,214,0,612,613,3,411,205,0, + 613,24,1,0,0,0,614,615,3,401,200,0,615,616,3,437,218,0,616,617,3,439, + 219,0,617,26,1,0,0,0,618,619,3,401,200,0,619,620,3,437,218,0,620,621, + 3,449,224,0,621,622,3,427,213,0,622,623,3,405,202,0,623,28,1,0,0,0,624, + 625,3,401,200,0,625,626,3,439,219,0,626,627,3,439,219,0,627,628,3,401, + 200,0,628,629,3,405,202,0,629,630,3,415,207,0,630,30,1,0,0,0,631,632, + 3,403,201,0,632,633,3,409,204,0,633,634,3,439,219,0,634,635,3,445,222, + 0,635,636,3,409,204,0,636,637,3,409,204,0,637,638,3,427,213,0,638,32, + 1,0,0,0,639,640,3,403,201,0,640,641,3,429,214,0,641,642,3,439,219,0,642, + 643,3,415,207,0,643,34,1,0,0,0,644,645,3,403,201,0,645,646,3,449,224, + 0,646,36,1,0,0,0,647,648,3,405,202,0,648,649,3,401,200,0,649,650,3,437, + 218,0,650,651,3,409,204,0,651,38,1,0,0,0,652,653,3,405,202,0,653,654, + 3,401,200,0,654,655,3,437,218,0,655,656,3,439,219,0,656,40,1,0,0,0,657, + 658,3,405,202,0,658,659,3,415,207,0,659,660,3,409,204,0,660,661,3,405, + 202,0,661,662,3,421,210,0,662,42,1,0,0,0,663,664,3,405,202,0,664,665, + 3,423,211,0,665,666,3,409,204,0,666,667,3,401,200,0,667,668,3,435,217, + 0,668,44,1,0,0,0,669,670,3,405,202,0,670,671,3,423,211,0,671,672,3,441, + 220,0,672,673,3,437,218,0,673,674,3,439,219,0,674,675,3,409,204,0,675, + 676,3,435,217,0,676,46,1,0,0,0,677,678,3,405,202,0,678,679,3,429,214, + 0,679,680,3,407,203,0,680,681,3,409,204,0,681,682,3,405,202,0,682,48, + 1,0,0,0,683,684,3,405,202,0,684,685,3,429,214,0,685,686,3,415,207,0,686, + 687,3,429,214,0,687,688,3,435,217,0,688,689,3,439,219,0,689,50,1,0,0, + 0,690,691,3,405,202,0,691,692,3,429,214,0,692,693,3,423,211,0,693,694, + 3,423,211,0,694,695,3,401,200,0,695,696,3,439,219,0,696,697,3,409,204, + 0,697,52,1,0,0,0,698,699,3,405,202,0,699,700,3,429,214,0,700,701,3,423, + 211,0,701,702,3,441,220,0,702,703,3,425,212,0,703,704,3,427,213,0,704, + 54,1,0,0,0,705,706,3,405,202,0,706,707,3,429,214,0,707,708,3,425,212, + 0,708,709,3,425,212,0,709,710,3,409,204,0,710,711,3,427,213,0,711,712, + 3,439,219,0,712,56,1,0,0,0,713,714,3,405,202,0,714,715,3,429,214,0,715, + 716,3,427,213,0,716,717,3,437,218,0,717,718,3,439,219,0,718,719,3,435, + 217,0,719,720,3,401,200,0,720,721,3,417,208,0,721,722,3,427,213,0,722, + 723,3,439,219,0,723,58,1,0,0,0,724,725,3,405,202,0,725,726,3,435,217, + 0,726,727,3,409,204,0,727,728,3,401,200,0,728,729,3,439,219,0,729,730, + 3,409,204,0,730,60,1,0,0,0,731,732,3,405,202,0,732,733,3,435,217,0,733, + 734,3,429,214,0,734,735,3,437,218,0,735,736,3,437,218,0,736,62,1,0,0, + 0,737,738,3,405,202,0,738,739,3,441,220,0,739,740,3,403,201,0,740,741, + 3,409,204,0,741,64,1,0,0,0,742,743,3,405,202,0,743,744,3,441,220,0,744, + 745,3,435,217,0,745,746,3,435,217,0,746,747,3,409,204,0,747,748,3,427, + 213,0,748,749,3,439,219,0,749,66,1,0,0,0,750,751,3,407,203,0,751,752, + 3,401,200,0,752,753,3,439,219,0,753,754,3,401,200,0,754,755,3,403,201, + 0,755,756,3,401,200,0,756,757,3,437,218,0,757,758,3,409,204,0,758,68, + 1,0,0,0,759,760,3,407,203,0,760,761,3,401,200,0,761,762,3,439,219,0,762, + 763,3,401,200,0,763,764,3,403,201,0,764,765,3,401,200,0,765,766,3,437, + 218,0,766,767,3,409,204,0,767,768,3,437,218,0,768,70,1,0,0,0,769,770, + 3,407,203,0,770,771,3,401,200,0,771,772,3,439,219,0,772,773,3,409,204, + 0,773,72,1,0,0,0,774,775,3,407,203,0,775,776,3,401,200,0,776,777,3,449, + 224,0,777,74,1,0,0,0,778,779,3,407,203,0,779,780,3,409,204,0,780,781, + 3,407,203,0,781,782,3,441,220,0,782,783,3,431,215,0,783,784,3,423,211, + 0,784,785,3,417,208,0,785,786,3,405,202,0,786,787,3,401,200,0,787,788, + 3,439,219,0,788,789,3,409,204,0,789,76,1,0,0,0,790,791,3,407,203,0,791, + 792,3,409,204,0,792,793,3,411,205,0,793,794,3,401,200,0,794,795,3,441, + 220,0,795,796,3,423,211,0,796,797,3,439,219,0,797,78,1,0,0,0,798,799, + 3,407,203,0,799,800,3,409,204,0,800,801,3,423,211,0,801,802,3,401,200, + 0,802,803,3,449,224,0,803,80,1,0,0,0,804,805,3,407,203,0,805,806,3,409, + 204,0,806,807,3,423,211,0,807,808,3,409,204,0,808,809,3,439,219,0,809, + 810,3,409,204,0,810,82,1,0,0,0,811,812,3,407,203,0,812,813,3,409,204, + 0,813,814,3,437,218,0,814,815,3,405,202,0,815,84,1,0,0,0,816,817,3,407, + 203,0,817,818,3,409,204,0,818,819,3,437,218,0,819,820,3,405,202,0,820, + 821,3,409,204,0,821,822,3,427,213,0,822,823,3,407,203,0,823,824,3,417, + 208,0,824,825,3,427,213,0,825,826,3,413,206,0,826,86,1,0,0,0,827,828, + 3,407,203,0,828,829,3,409,204,0,829,830,3,437,218,0,830,831,3,405,202, + 0,831,832,3,435,217,0,832,833,3,417,208,0,833,834,3,403,201,0,834,835, + 3,409,204,0,835,88,1,0,0,0,836,837,3,407,203,0,837,838,3,409,204,0,838, + 839,3,439,219,0,839,840,3,401,200,0,840,841,3,405,202,0,841,842,3,415, + 207,0,842,90,1,0,0,0,843,844,3,407,203,0,844,845,3,417,208,0,845,846, + 3,405,202,0,846,847,3,439,219,0,847,848,3,417,208,0,848,849,3,429,214, + 0,849,850,3,427,213,0,850,851,3,401,200,0,851,852,3,435,217,0,852,853, + 3,417,208,0,853,854,3,409,204,0,854,855,3,437,218,0,855,92,1,0,0,0,856, + 857,3,407,203,0,857,858,3,417,208,0,858,859,3,405,202,0,859,860,3,439, + 219,0,860,861,3,417,208,0,861,862,3,429,214,0,862,863,3,427,213,0,863, + 864,3,401,200,0,864,865,3,435,217,0,865,866,3,449,224,0,866,94,1,0,0, + 0,867,868,3,407,203,0,868,869,3,417,208,0,869,870,3,437,218,0,870,871, + 3,421,210,0,871,96,1,0,0,0,872,873,3,407,203,0,873,874,3,417,208,0,874, + 875,3,437,218,0,875,876,3,439,219,0,876,877,3,417,208,0,877,878,3,427, + 213,0,878,879,3,405,202,0,879,880,3,439,219,0,880,98,1,0,0,0,881,882, + 3,407,203,0,882,883,3,417,208,0,883,884,3,437,218,0,884,885,3,439,219, + 0,885,886,3,435,217,0,886,887,3,417,208,0,887,888,3,403,201,0,888,889, + 3,441,220,0,889,890,3,439,219,0,890,891,3,409,204,0,891,892,3,407,203, + 0,892,100,1,0,0,0,893,894,3,407,203,0,894,895,3,435,217,0,895,896,3,429, + 214,0,896,897,3,431,215,0,897,102,1,0,0,0,898,899,3,409,204,0,899,900, + 3,423,211,0,900,901,3,437,218,0,901,902,3,409,204,0,902,104,1,0,0,0,903, + 904,3,409,204,0,904,905,3,427,213,0,905,906,3,407,203,0,906,106,1,0,0, + 0,907,908,3,409,204,0,908,909,3,427,213,0,909,910,3,413,206,0,910,911, + 3,417,208,0,911,912,3,427,213,0,912,913,3,409,204,0,913,108,1,0,0,0,914, + 915,3,409,204,0,915,916,3,443,221,0,916,917,3,409,204,0,917,918,3,427, + 213,0,918,919,3,439,219,0,919,920,3,437,218,0,920,110,1,0,0,0,921,922, + 3,409,204,0,922,923,3,447,223,0,923,924,3,417,208,0,924,925,3,437,218, + 0,925,926,3,439,219,0,926,927,3,437,218,0,927,112,1,0,0,0,928,929,3,409, + 204,0,929,930,3,447,223,0,930,931,3,431,215,0,931,932,3,423,211,0,932, + 933,3,401,200,0,933,934,3,417,208,0,934,935,3,427,213,0,935,114,1,0,0, + 0,936,937,3,409,204,0,937,938,3,447,223,0,938,939,3,431,215,0,939,940, + 3,435,217,0,940,941,3,409,204,0,941,942,3,437,218,0,942,943,3,437,218, + 0,943,944,3,417,208,0,944,945,3,429,214,0,945,946,3,427,213,0,946,116, + 1,0,0,0,947,948,3,409,204,0,948,949,3,447,223,0,949,950,3,439,219,0,950, + 951,3,435,217,0,951,952,3,401,200,0,952,953,3,405,202,0,953,954,3,439, + 219,0,954,118,1,0,0,0,955,956,3,411,205,0,956,957,3,409,204,0,957,958, + 3,439,219,0,958,959,3,405,202,0,959,960,3,415,207,0,960,961,3,409,204, + 0,961,962,3,437,218,0,962,120,1,0,0,0,963,964,3,411,205,0,964,965,3,417, + 208,0,965,966,3,427,213,0,966,967,3,401,200,0,967,968,3,423,211,0,968, + 122,1,0,0,0,969,970,3,411,205,0,970,971,3,417,208,0,971,972,3,435,217, + 0,972,973,3,437,218,0,973,974,3,439,219,0,974,124,1,0,0,0,975,976,3,411, + 205,0,976,977,3,423,211,0,977,978,3,441,220,0,978,979,3,437,218,0,979, + 980,3,415,207,0,980,126,1,0,0,0,981,982,3,411,205,0,982,983,3,429,214, + 0,983,984,3,423,211,0,984,985,3,423,211,0,985,986,3,429,214,0,986,987, + 3,445,222,0,987,988,3,417,208,0,988,989,3,427,213,0,989,990,3,413,206, + 0,990,128,1,0,0,0,991,992,3,411,205,0,992,993,3,429,214,0,993,994,3,435, + 217,0,994,130,1,0,0,0,995,996,3,411,205,0,996,997,3,429,214,0,997,998, + 3,435,217,0,998,999,3,425,212,0,999,1000,3,401,200,0,1000,1001,3,439, + 219,0,1001,132,1,0,0,0,1002,1003,3,411,205,0,1003,1004,3,435,217,0,1004, + 1005,3,409,204,0,1005,1006,3,409,204,0,1006,1007,3,451,225,0,1007,1008, + 3,409,204,0,1008,134,1,0,0,0,1009,1010,3,411,205,0,1010,1011,3,435,217, + 0,1011,1012,3,429,214,0,1012,1013,3,425,212,0,1013,136,1,0,0,0,1014,1015, + 3,411,205,0,1015,1016,3,441,220,0,1016,1017,3,423,211,0,1017,1018,3,423, + 211,0,1018,138,1,0,0,0,1019,1020,3,411,205,0,1020,1021,3,441,220,0,1021, + 1022,3,427,213,0,1022,1023,3,405,202,0,1023,1024,3,439,219,0,1024,1025, + 3,417,208,0,1025,1026,3,429,214,0,1026,1027,3,427,213,0,1027,140,1,0, + 0,0,1028,1029,3,413,206,0,1029,1030,3,423,211,0,1030,1031,3,429,214,0, + 1031,1032,3,403,201,0,1032,1033,3,401,200,0,1033,1034,3,423,211,0,1034, + 142,1,0,0,0,1035,1036,3,413,206,0,1036,1037,3,435,217,0,1037,1038,3,401, + 200,0,1038,1039,3,427,213,0,1039,1040,3,441,220,0,1040,1041,3,423,211, + 0,1041,1042,3,401,200,0,1042,1043,3,435,217,0,1043,1044,3,417,208,0,1044, + 1045,3,439,219,0,1045,1046,3,449,224,0,1046,144,1,0,0,0,1047,1048,3,413, + 206,0,1048,1049,3,435,217,0,1049,1050,3,429,214,0,1050,1051,3,441,220, + 0,1051,1052,3,431,215,0,1052,146,1,0,0,0,1053,1054,3,415,207,0,1054,1055, + 3,401,200,0,1055,1056,3,443,221,0,1056,1057,3,417,208,0,1057,1058,3,427, + 213,0,1058,1059,3,413,206,0,1059,148,1,0,0,0,1060,1061,3,415,207,0,1061, + 1062,3,417,208,0,1062,1063,3,409,204,0,1063,1064,3,435,217,0,1064,1065, + 3,401,200,0,1065,1066,3,435,217,0,1066,1067,3,405,202,0,1067,1068,3,415, + 207,0,1068,1069,3,417,208,0,1069,1070,3,405,202,0,1070,1071,3,401,200, + 0,1071,1072,3,423,211,0,1072,150,1,0,0,0,1073,1074,3,415,207,0,1074,1075, + 3,429,214,0,1075,1076,3,441,220,0,1076,1077,3,435,217,0,1077,152,1,0, + 0,0,1078,1079,3,417,208,0,1079,1080,3,407,203,0,1080,154,1,0,0,0,1081, + 1082,3,417,208,0,1082,1083,3,411,205,0,1083,156,1,0,0,0,1084,1085,3,417, + 208,0,1085,1086,3,423,211,0,1086,1087,3,417,208,0,1087,1088,3,421,210, + 0,1088,1089,3,409,204,0,1089,158,1,0,0,0,1090,1091,3,417,208,0,1091,1092, + 3,427,213,0,1092,160,1,0,0,0,1093,1094,3,417,208,0,1094,1095,3,427,213, + 0,1095,1096,3,407,203,0,1096,1097,3,409,204,0,1097,1098,3,447,223,0,1098, + 162,1,0,0,0,1099,1100,3,417,208,0,1100,1101,3,427,213,0,1101,1102,3,411, + 205,0,1102,1113,1,0,0,0,1103,1104,3,417,208,0,1104,1105,3,427,213,0,1105, + 1106,3,411,205,0,1106,1107,3,417,208,0,1107,1108,3,427,213,0,1108,1109, + 3,417,208,0,1109,1110,3,439,219,0,1110,1111,3,449,224,0,1111,1113,1,0, + 0,0,1112,1099,1,0,0,0,1112,1103,1,0,0,0,1113,164,1,0,0,0,1114,1115,3, + 417,208,0,1115,1116,3,427,213,0,1116,1117,3,419,209,0,1117,1118,3,409, + 204,0,1118,1119,3,405,202,0,1119,1120,3,439,219,0,1120,1121,3,417,208, + 0,1121,1122,3,443,221,0,1122,1123,3,409,204,0,1123,166,1,0,0,0,1124,1125, + 3,417,208,0,1125,1126,3,427,213,0,1126,1127,3,427,213,0,1127,1128,3,409, + 204,0,1128,1129,3,435,217,0,1129,168,1,0,0,0,1130,1131,3,417,208,0,1131, + 1132,3,427,213,0,1132,1133,3,437,218,0,1133,1134,3,409,204,0,1134,1135, + 3,435,217,0,1135,1136,3,439,219,0,1136,170,1,0,0,0,1137,1138,3,417,208, + 0,1138,1139,3,427,213,0,1139,1140,3,439,219,0,1140,1141,3,409,204,0,1141, + 1142,3,435,217,0,1142,1143,3,443,221,0,1143,1144,3,401,200,0,1144,1145, + 3,423,211,0,1145,172,1,0,0,0,1146,1147,3,417,208,0,1147,1148,3,427,213, + 0,1148,1149,3,439,219,0,1149,1150,3,429,214,0,1150,174,1,0,0,0,1151,1152, + 3,417,208,0,1152,1153,3,437,218,0,1153,176,1,0,0,0,1154,1155,3,417,208, + 0,1155,1156,3,437,218,0,1156,1157,3,537,268,0,1157,1158,3,429,214,0,1158, + 1159,3,403,201,0,1159,1160,3,419,209,0,1160,1161,3,409,204,0,1161,1162, + 3,405,202,0,1162,1163,3,439,219,0,1163,1164,3,537,268,0,1164,1165,3,417, + 208,0,1165,1166,3,407,203,0,1166,178,1,0,0,0,1167,1168,3,419,209,0,1168, + 1169,3,429,214,0,1169,1170,3,417,208,0,1170,1171,3,427,213,0,1171,180, + 1,0,0,0,1172,1173,3,421,210,0,1173,1174,3,409,204,0,1174,1175,3,449,224, + 0,1175,182,1,0,0,0,1176,1177,3,421,210,0,1177,1178,3,417,208,0,1178,1179, + 3,423,211,0,1179,1180,3,423,211,0,1180,184,1,0,0,0,1181,1182,3,423,211, + 0,1182,1183,3,401,200,0,1183,1184,3,437,218,0,1184,1185,3,439,219,0,1185, + 186,1,0,0,0,1186,1187,3,423,211,0,1187,1188,3,401,200,0,1188,1189,3,449, + 224,0,1189,1190,3,429,214,0,1190,1191,3,441,220,0,1191,1192,3,439,219, + 0,1192,188,1,0,0,0,1193,1194,3,423,211,0,1194,1195,3,409,204,0,1195,1196, + 3,401,200,0,1196,1197,3,407,203,0,1197,1198,3,417,208,0,1198,1199,3,427, + 213,0,1199,1200,3,413,206,0,1200,190,1,0,0,0,1201,1202,3,423,211,0,1202, + 1203,3,409,204,0,1203,1204,3,411,205,0,1204,1205,3,439,219,0,1205,192, + 1,0,0,0,1206,1207,3,423,211,0,1207,1208,3,417,208,0,1208,1209,3,411,205, + 0,1209,1210,3,409,204,0,1210,1211,3,439,219,0,1211,1212,3,417,208,0,1212, + 1213,3,425,212,0,1213,1214,3,409,204,0,1214,194,1,0,0,0,1215,1216,3,423, + 211,0,1216,1217,3,417,208,0,1217,1218,3,421,210,0,1218,1219,3,409,204, + 0,1219,196,1,0,0,0,1220,1221,3,423,211,0,1221,1222,3,417,208,0,1222,1223, + 3,425,212,0,1223,1224,3,417,208,0,1224,1225,3,439,219,0,1225,198,1,0, + 0,0,1226,1227,3,423,211,0,1227,1228,3,417,208,0,1228,1229,3,443,221,0, + 1229,1230,3,409,204,0,1230,200,1,0,0,0,1231,1232,3,423,211,0,1232,1233, + 3,429,214,0,1233,1234,3,405,202,0,1234,1235,3,401,200,0,1235,1236,3,423, + 211,0,1236,202,1,0,0,0,1237,1238,3,423,211,0,1238,1239,3,429,214,0,1239, + 1240,3,413,206,0,1240,1241,3,437,218,0,1241,204,1,0,0,0,1242,1243,3,425, + 212,0,1243,1244,3,401,200,0,1244,1245,3,439,219,0,1245,1246,3,409,204, + 0,1246,1247,3,435,217,0,1247,1248,3,417,208,0,1248,1249,3,401,200,0,1249, + 1250,3,423,211,0,1250,1251,3,417,208,0,1251,1252,3,451,225,0,1252,1253, + 3,409,204,0,1253,206,1,0,0,0,1254,1255,3,425,212,0,1255,1256,3,401,200, + 0,1256,1257,3,439,219,0,1257,1258,3,409,204,0,1258,1259,3,435,217,0,1259, + 1260,3,417,208,0,1260,1261,3,401,200,0,1261,1262,3,423,211,0,1262,1263, + 3,417,208,0,1263,1264,3,451,225,0,1264,1265,3,409,204,0,1265,1266,3,407, + 203,0,1266,208,1,0,0,0,1267,1268,3,425,212,0,1268,1269,3,401,200,0,1269, + 1270,3,447,223,0,1270,210,1,0,0,0,1271,1272,3,425,212,0,1272,1273,3,409, + 204,0,1273,1274,3,435,217,0,1274,1275,3,413,206,0,1275,1276,3,409,204, + 0,1276,1277,3,437,218,0,1277,212,1,0,0,0,1278,1279,3,425,212,0,1279,1280, + 3,417,208,0,1280,1281,3,427,213,0,1281,214,1,0,0,0,1282,1283,3,425,212, + 0,1283,1284,3,417,208,0,1284,1285,3,427,213,0,1285,1286,3,441,220,0,1286, + 1287,3,439,219,0,1287,1288,3,409,204,0,1288,216,1,0,0,0,1289,1290,3,425, + 212,0,1290,1291,3,429,214,0,1291,1292,3,407,203,0,1292,1293,3,417,208, + 0,1293,1294,3,411,205,0,1294,1295,3,449,224,0,1295,218,1,0,0,0,1296,1297, + 3,425,212,0,1297,1298,3,429,214,0,1298,1299,3,427,213,0,1299,1300,3,439, + 219,0,1300,1301,3,415,207,0,1301,220,1,0,0,0,1302,1303,3,425,212,0,1303, + 1304,3,429,214,0,1304,1305,3,443,221,0,1305,1306,3,409,204,0,1306,222, + 1,0,0,0,1307,1308,3,425,212,0,1308,1309,3,441,220,0,1309,1310,3,439,219, + 0,1310,1311,3,401,200,0,1311,1312,3,439,219,0,1312,1313,3,417,208,0,1313, + 1314,3,429,214,0,1314,1315,3,427,213,0,1315,224,1,0,0,0,1316,1317,3,427, + 213,0,1317,1318,3,401,200,0,1318,1319,3,427,213,0,1319,226,1,0,0,0,1320, + 1321,3,427,213,0,1321,1322,3,429,214,0,1322,228,1,0,0,0,1323,1324,3,427, + 213,0,1324,1325,3,429,214,0,1325,1326,3,439,219,0,1326,230,1,0,0,0,1327, + 1328,3,427,213,0,1328,1329,3,441,220,0,1329,1330,3,423,211,0,1330,1331, + 3,423,211,0,1331,232,1,0,0,0,1332,1333,3,427,213,0,1333,1334,3,441,220, + 0,1334,1335,3,423,211,0,1335,1336,3,423,211,0,1336,1337,3,437,218,0,1337, + 234,1,0,0,0,1338,1339,3,429,214,0,1339,1340,3,411,205,0,1340,1341,3,411, + 205,0,1341,1342,3,437,218,0,1342,1343,3,409,204,0,1343,1344,3,439,219, + 0,1344,236,1,0,0,0,1345,1346,3,429,214,0,1346,1347,3,427,213,0,1347,238, + 1,0,0,0,1348,1349,3,429,214,0,1349,1350,3,431,215,0,1350,1351,3,439,219, + 0,1351,1352,3,417,208,0,1352,1353,3,425,212,0,1353,1354,3,417,208,0,1354, + 1355,3,451,225,0,1355,1356,3,409,204,0,1356,240,1,0,0,0,1357,1358,3,429, + 214,0,1358,1359,3,435,217,0,1359,242,1,0,0,0,1360,1361,3,429,214,0,1361, + 1362,3,435,217,0,1362,1363,3,407,203,0,1363,1364,3,409,204,0,1364,1365, + 3,435,217,0,1365,244,1,0,0,0,1366,1367,3,429,214,0,1367,1368,3,441,220, + 0,1368,1369,3,439,219,0,1369,1370,3,409,204,0,1370,1371,3,435,217,0,1371, + 246,1,0,0,0,1372,1373,3,429,214,0,1373,1374,3,441,220,0,1374,1375,3,439, + 219,0,1375,1376,3,411,205,0,1376,1377,3,417,208,0,1377,1378,3,423,211, + 0,1378,1379,3,409,204,0,1379,248,1,0,0,0,1380,1381,3,429,214,0,1381,1382, + 3,443,221,0,1382,1383,3,409,204,0,1383,1384,3,435,217,0,1384,250,1,0, + 0,0,1385,1386,3,431,215,0,1386,1387,3,401,200,0,1387,1388,3,435,217,0, + 1388,1389,3,439,219,0,1389,1390,3,417,208,0,1390,1391,3,439,219,0,1391, + 1392,3,417,208,0,1392,1393,3,429,214,0,1393,1394,3,427,213,0,1394,252, + 1,0,0,0,1395,1396,3,431,215,0,1396,1397,3,429,214,0,1397,1398,3,431,215, + 0,1398,1399,3,441,220,0,1399,1400,3,423,211,0,1400,1401,3,401,200,0,1401, + 1402,3,439,219,0,1402,1403,3,409,204,0,1403,254,1,0,0,0,1404,1405,3,431, + 215,0,1405,1406,3,435,217,0,1406,1407,3,409,204,0,1407,1408,3,405,202, + 0,1408,1409,3,409,204,0,1409,1410,3,407,203,0,1410,1411,3,417,208,0,1411, + 1412,3,427,213,0,1412,1413,3,413,206,0,1413,256,1,0,0,0,1414,1415,3,431, + 215,0,1415,1416,3,435,217,0,1416,1417,3,409,204,0,1417,1418,3,445,222, + 0,1418,1419,3,415,207,0,1419,1420,3,409,204,0,1420,1421,3,435,217,0,1421, + 1422,3,409,204,0,1422,258,1,0,0,0,1423,1424,3,431,215,0,1424,1425,3,435, + 217,0,1425,1426,3,417,208,0,1426,1427,3,425,212,0,1427,1428,3,401,200, + 0,1428,1429,3,435,217,0,1429,1430,3,449,224,0,1430,260,1,0,0,0,1431,1432, + 3,431,215,0,1432,1433,3,435,217,0,1433,1434,3,429,214,0,1434,1435,3,419, + 209,0,1435,1436,3,409,204,0,1436,1437,3,405,202,0,1437,1438,3,439,219, + 0,1438,1439,3,417,208,0,1439,1440,3,429,214,0,1440,1441,3,427,213,0,1441, + 262,1,0,0,0,1442,1443,3,433,216,0,1443,1444,3,441,220,0,1444,1445,3,401, + 200,0,1445,1446,3,435,217,0,1446,1447,3,439,219,0,1447,1448,3,409,204, + 0,1448,1449,3,435,217,0,1449,264,1,0,0,0,1450,1451,3,435,217,0,1451,1452, + 3,401,200,0,1452,1453,3,427,213,0,1453,1454,3,413,206,0,1454,1455,3,409, + 204,0,1455,266,1,0,0,0,1456,1457,3,435,217,0,1457,1458,3,409,204,0,1458, + 1459,3,423,211,0,1459,1460,3,429,214,0,1460,1461,3,401,200,0,1461,1462, + 3,407,203,0,1462,268,1,0,0,0,1463,1464,3,435,217,0,1464,1465,3,409,204, + 0,1465,1466,3,425,212,0,1466,1467,3,429,214,0,1467,1468,3,443,221,0,1468, + 1469,3,409,204,0,1469,270,1,0,0,0,1470,1471,3,435,217,0,1471,1472,3,409, + 204,0,1472,1473,3,427,213,0,1473,1474,3,401,200,0,1474,1475,3,425,212, + 0,1475,1476,3,409,204,0,1476,272,1,0,0,0,1477,1478,3,435,217,0,1478,1479, + 3,409,204,0,1479,1480,3,431,215,0,1480,1481,3,423,211,0,1481,1482,3,401, + 200,0,1482,1483,3,405,202,0,1483,1484,3,409,204,0,1484,274,1,0,0,0,1485, + 1486,3,435,217,0,1486,1487,3,409,204,0,1487,1488,3,431,215,0,1488,1489, + 3,423,211,0,1489,1490,3,417,208,0,1490,1491,3,405,202,0,1491,1492,3,401, + 200,0,1492,276,1,0,0,0,1493,1494,3,435,217,0,1494,1495,3,409,204,0,1495, + 1496,3,431,215,0,1496,1497,3,423,211,0,1497,1498,3,417,208,0,1498,1499, + 3,405,202,0,1499,1500,3,401,200,0,1500,1501,3,439,219,0,1501,1502,3,409, + 204,0,1502,1503,3,407,203,0,1503,278,1,0,0,0,1504,1505,3,435,217,0,1505, + 1506,3,417,208,0,1506,1507,3,413,206,0,1507,1508,3,415,207,0,1508,1509, + 3,439,219,0,1509,280,1,0,0,0,1510,1511,3,435,217,0,1511,1512,3,429,214, + 0,1512,1513,3,423,211,0,1513,1514,3,423,211,0,1514,1515,3,441,220,0,1515, + 1516,3,431,215,0,1516,282,1,0,0,0,1517,1518,3,435,217,0,1518,1519,3,429, + 214,0,1519,1520,3,445,222,0,1520,284,1,0,0,0,1521,1522,3,435,217,0,1522, + 1523,3,429,214,0,1523,1524,3,445,222,0,1524,1525,3,437,218,0,1525,286, + 1,0,0,0,1526,1527,3,437,218,0,1527,1528,3,401,200,0,1528,1529,3,425,212, + 0,1529,1530,3,431,215,0,1530,1531,3,423,211,0,1531,1532,3,409,204,0,1532, + 288,1,0,0,0,1533,1534,3,437,218,0,1534,1535,3,409,204,0,1535,1536,3,405, + 202,0,1536,1537,3,429,214,0,1537,1538,3,427,213,0,1538,1539,3,407,203, + 0,1539,290,1,0,0,0,1540,1541,3,437,218,0,1541,1542,3,409,204,0,1542,1543, + 3,423,211,0,1543,1544,3,409,204,0,1544,1545,3,405,202,0,1545,1546,3,439, + 219,0,1546,292,1,0,0,0,1547,1548,3,437,218,0,1548,1549,3,409,204,0,1549, + 1550,3,425,212,0,1550,1551,3,417,208,0,1551,294,1,0,0,0,1552,1553,3,437, + 218,0,1553,1554,3,409,204,0,1554,1555,3,427,213,0,1555,1556,3,407,203, + 0,1556,1557,3,437,218,0,1557,296,1,0,0,0,1558,1559,3,437,218,0,1559,1560, + 3,409,204,0,1560,1561,3,439,219,0,1561,298,1,0,0,0,1562,1563,3,437,218, + 0,1563,1564,3,409,204,0,1564,1565,3,439,219,0,1565,1566,3,439,219,0,1566, + 1567,3,417,208,0,1567,1568,3,427,213,0,1568,1569,3,413,206,0,1569,1570, + 3,437,218,0,1570,300,1,0,0,0,1571,1572,3,437,218,0,1572,1573,3,415,207, + 0,1573,1574,3,429,214,0,1574,1575,3,445,222,0,1575,302,1,0,0,0,1576,1577, + 3,437,218,0,1577,1578,3,429,214,0,1578,1579,3,441,220,0,1579,1580,3,435, + 217,0,1580,1581,3,405,202,0,1581,1582,3,409,204,0,1582,304,1,0,0,0,1583, + 1584,3,437,218,0,1584,1585,3,439,219,0,1585,1586,3,401,200,0,1586,1587, + 3,435,217,0,1587,1588,3,439,219,0,1588,306,1,0,0,0,1589,1590,3,437,218, + 0,1590,1591,3,439,219,0,1591,1592,3,429,214,0,1592,1593,3,431,215,0,1593, + 308,1,0,0,0,1594,1595,3,437,218,0,1595,1596,3,441,220,0,1596,1597,3,403, + 201,0,1597,1598,3,437,218,0,1598,1599,3,439,219,0,1599,1600,3,435,217, + 0,1600,1601,3,417,208,0,1601,1602,3,427,213,0,1602,1603,3,413,206,0,1603, + 310,1,0,0,0,1604,1605,3,437,218,0,1605,1606,3,449,224,0,1606,1607,3,427, + 213,0,1607,1608,3,405,202,0,1608,312,1,0,0,0,1609,1610,3,437,218,0,1610, + 1611,3,449,224,0,1611,1612,3,427,213,0,1612,1613,3,439,219,0,1613,1614, + 3,401,200,0,1614,1615,3,447,223,0,1615,314,1,0,0,0,1616,1617,3,437,218, + 0,1617,1618,3,449,224,0,1618,1619,3,437,218,0,1619,1620,3,439,219,0,1620, + 1621,3,409,204,0,1621,1622,3,425,212,0,1622,316,1,0,0,0,1623,1624,3,439, + 219,0,1624,1625,3,401,200,0,1625,1626,3,403,201,0,1626,1627,3,423,211, + 0,1627,1628,3,409,204,0,1628,318,1,0,0,0,1629,1630,3,439,219,0,1630,1631, + 3,401,200,0,1631,1632,3,403,201,0,1632,1633,3,423,211,0,1633,1634,3,409, + 204,0,1634,1635,3,437,218,0,1635,320,1,0,0,0,1636,1637,3,439,219,0,1637, + 1638,3,409,204,0,1638,1639,3,425,212,0,1639,1640,3,431,215,0,1640,1641, + 3,429,214,0,1641,1642,3,435,217,0,1642,1643,3,401,200,0,1643,1644,3,435, + 217,0,1644,1645,3,449,224,0,1645,322,1,0,0,0,1646,1647,3,439,219,0,1647, + 1648,3,409,204,0,1648,1649,3,437,218,0,1649,1650,3,439,219,0,1650,324, + 1,0,0,0,1651,1652,3,439,219,0,1652,1653,3,415,207,0,1653,1654,3,409,204, + 0,1654,1655,3,427,213,0,1655,326,1,0,0,0,1656,1657,3,439,219,0,1657,1658, + 3,417,208,0,1658,1659,3,409,204,0,1659,1660,3,437,218,0,1660,328,1,0, + 0,0,1661,1662,3,439,219,0,1662,1663,3,417,208,0,1663,1664,3,425,212,0, + 1664,1665,3,409,204,0,1665,1666,3,429,214,0,1666,1667,3,441,220,0,1667, + 1668,3,439,219,0,1668,330,1,0,0,0,1669,1670,3,439,219,0,1670,1671,3,417, + 208,0,1671,1672,3,425,212,0,1672,1673,3,409,204,0,1673,1674,3,437,218, + 0,1674,1675,3,439,219,0,1675,1676,3,401,200,0,1676,1677,3,425,212,0,1677, + 1678,3,431,215,0,1678,332,1,0,0,0,1679,1680,3,439,219,0,1680,1681,3,429, + 214,0,1681,334,1,0,0,0,1682,1683,3,439,219,0,1683,1684,3,429,214,0,1684, + 1685,3,431,215,0,1685,336,1,0,0,0,1686,1687,3,439,219,0,1687,1688,3,429, + 214,0,1688,1689,3,439,219,0,1689,1690,3,401,200,0,1690,1691,3,423,211, + 0,1691,1692,3,437,218,0,1692,338,1,0,0,0,1693,1694,3,439,219,0,1694,1695, + 3,435,217,0,1695,1696,3,401,200,0,1696,1697,3,417,208,0,1697,1698,3,423, + 211,0,1698,1699,3,417,208,0,1699,1700,3,427,213,0,1700,1701,3,413,206, + 0,1701,340,1,0,0,0,1702,1703,3,439,219,0,1703,1704,3,435,217,0,1704,1705, + 3,417,208,0,1705,1706,3,425,212,0,1706,342,1,0,0,0,1707,1708,3,439,219, + 0,1708,1709,3,435,217,0,1709,1710,3,441,220,0,1710,1711,3,427,213,0,1711, + 1712,3,405,202,0,1712,1713,3,401,200,0,1713,1714,3,439,219,0,1714,1715, + 3,409,204,0,1715,344,1,0,0,0,1716,1717,3,439,219,0,1717,1718,3,439,219, + 0,1718,1719,3,423,211,0,1719,346,1,0,0,0,1720,1721,3,439,219,0,1721,1722, + 3,449,224,0,1722,1723,3,431,215,0,1723,1724,3,409,204,0,1724,348,1,0, + 0,0,1725,1726,3,441,220,0,1726,1727,3,427,213,0,1727,1728,3,403,201,0, + 1728,1729,3,429,214,0,1729,1730,3,441,220,0,1730,1731,3,427,213,0,1731, + 1732,3,407,203,0,1732,1733,3,409,204,0,1733,1734,3,407,203,0,1734,350, + 1,0,0,0,1735,1736,3,441,220,0,1736,1737,3,427,213,0,1737,1738,3,417,208, + 0,1738,1739,3,429,214,0,1739,1740,3,427,213,0,1740,352,1,0,0,0,1741,1742, + 3,441,220,0,1742,1743,3,431,215,0,1743,1744,3,407,203,0,1744,1745,3,401, + 200,0,1745,1746,3,439,219,0,1746,1747,3,409,204,0,1747,354,1,0,0,0,1748, + 1749,3,441,220,0,1749,1750,3,437,218,0,1750,1751,3,409,204,0,1751,356, + 1,0,0,0,1752,1753,3,441,220,0,1753,1754,3,437,218,0,1754,1755,3,417,208, + 0,1755,1756,3,427,213,0,1756,1757,3,413,206,0,1757,358,1,0,0,0,1758,1759, + 3,441,220,0,1759,1760,3,441,220,0,1760,1761,3,417,208,0,1761,1762,3,407, + 203,0,1762,360,1,0,0,0,1763,1764,3,443,221,0,1764,1765,3,401,200,0,1765, + 1766,3,423,211,0,1766,1767,3,441,220,0,1767,1768,3,409,204,0,1768,1769, + 3,437,218,0,1769,362,1,0,0,0,1770,1771,3,443,221,0,1771,1772,3,417,208, + 0,1772,1773,3,409,204,0,1773,1774,3,445,222,0,1774,364,1,0,0,0,1775,1776, + 3,443,221,0,1776,1777,3,429,214,0,1777,1778,3,423,211,0,1778,1779,3,441, + 220,0,1779,1780,3,425,212,0,1780,1781,3,409,204,0,1781,366,1,0,0,0,1782, + 1783,3,445,222,0,1783,1784,3,401,200,0,1784,1785,3,439,219,0,1785,1786, + 3,405,202,0,1786,1787,3,415,207,0,1787,368,1,0,0,0,1788,1789,3,445,222, + 0,1789,1790,3,409,204,0,1790,1791,3,409,204,0,1791,1792,3,421,210,0,1792, + 370,1,0,0,0,1793,1794,3,445,222,0,1794,1795,3,415,207,0,1795,1796,3,409, + 204,0,1796,1797,3,427,213,0,1797,372,1,0,0,0,1798,1799,3,445,222,0,1799, + 1800,3,415,207,0,1800,1801,3,409,204,0,1801,1802,3,435,217,0,1802,1803, + 3,409,204,0,1803,374,1,0,0,0,1804,1805,3,445,222,0,1805,1806,3,417,208, + 0,1806,1807,3,427,213,0,1807,1808,3,407,203,0,1808,1809,3,429,214,0,1809, + 1810,3,445,222,0,1810,376,1,0,0,0,1811,1812,3,445,222,0,1812,1813,3,417, + 208,0,1813,1814,3,439,219,0,1814,1815,3,415,207,0,1815,378,1,0,0,0,1816, + 1817,3,449,224,0,1817,1818,3,409,204,0,1818,1819,3,401,200,0,1819,1820, + 3,435,217,0,1820,1827,1,0,0,0,1821,1822,3,449,224,0,1822,1823,3,449,224, + 0,1823,1824,3,449,224,0,1824,1825,3,449,224,0,1825,1827,1,0,0,0,1826, + 1816,1,0,0,0,1826,1821,1,0,0,0,1827,380,1,0,0,0,1828,1829,5,102,0,0,1829, + 1830,5,97,0,0,1830,1831,5,108,0,0,1831,1832,5,115,0,0,1832,1833,5,101, + 0,0,1833,382,1,0,0,0,1834,1835,5,116,0,0,1835,1836,5,114,0,0,1836,1837, + 5,117,0,0,1837,1838,5,101,0,0,1838,384,1,0,0,0,1839,1840,3,467,233,0, + 1840,1841,3,403,201,0,1841,1870,1,0,0,0,1842,1843,3,467,233,0,1843,1844, + 3,411,205,0,1844,1870,1,0,0,0,1845,1846,3,467,233,0,1846,1847,3,435,217, + 0,1847,1870,1,0,0,0,1848,1849,3,467,233,0,1849,1850,3,427,213,0,1850, + 1870,1,0,0,0,1851,1852,3,467,233,0,1852,1853,3,439,219,0,1853,1870,1, + 0,0,0,1854,1855,3,467,233,0,1855,1856,5,48,0,0,1856,1870,1,0,0,0,1857, + 1858,3,467,233,0,1858,1859,3,401,200,0,1859,1870,1,0,0,0,1860,1861,3, + 467,233,0,1861,1862,3,443,221,0,1862,1870,1,0,0,0,1863,1864,3,467,233, + 0,1864,1865,3,467,233,0,1865,1870,1,0,0,0,1866,1867,3,467,233,0,1867, + 1868,3,521,260,0,1868,1870,1,0,0,0,1869,1839,1,0,0,0,1869,1842,1,0,0, + 0,1869,1845,1,0,0,0,1869,1848,1,0,0,0,1869,1851,1,0,0,0,1869,1854,1,0, + 0,0,1869,1857,1,0,0,0,1869,1860,1,0,0,0,1869,1863,1,0,0,0,1869,1866,1, + 0,0,0,1870,386,1,0,0,0,1871,1875,3,453,226,0,1872,1875,3,537,268,0,1873, + 1875,3,477,238,0,1874,1871,1,0,0,0,1874,1872,1,0,0,0,1874,1873,1,0,0, + 0,1875,1882,1,0,0,0,1876,1881,3,453,226,0,1877,1881,3,537,268,0,1878, + 1881,3,457,228,0,1879,1881,3,477,238,0,1880,1876,1,0,0,0,1880,1877,1, + 0,0,0,1880,1878,1,0,0,0,1880,1879,1,0,0,0,1881,1884,1,0,0,0,1882,1880, + 1,0,0,0,1882,1883,1,0,0,0,1883,1912,1,0,0,0,1884,1882,1,0,0,0,1885,1893, + 3,465,232,0,1886,1892,8,0,0,0,1887,1892,3,385,192,0,1888,1889,3,465,232, + 0,1889,1890,3,465,232,0,1890,1892,1,0,0,0,1891,1886,1,0,0,0,1891,1887, + 1,0,0,0,1891,1888,1,0,0,0,1892,1895,1,0,0,0,1893,1891,1,0,0,0,1893,1894, + 1,0,0,0,1894,1896,1,0,0,0,1895,1893,1,0,0,0,1896,1897,3,465,232,0,1897, + 1912,1,0,0,0,1898,1906,3,519,259,0,1899,1905,8,1,0,0,1900,1905,3,385, + 192,0,1901,1902,3,519,259,0,1902,1903,3,519,259,0,1903,1905,1,0,0,0,1904, + 1899,1,0,0,0,1904,1900,1,0,0,0,1904,1901,1,0,0,0,1905,1908,1,0,0,0,1906, + 1904,1,0,0,0,1906,1907,1,0,0,0,1907,1909,1,0,0,0,1908,1906,1,0,0,0,1909, + 1910,3,519,259,0,1910,1912,1,0,0,0,1911,1874,1,0,0,0,1911,1885,1,0,0, + 0,1911,1898,1,0,0,0,1912,388,1,0,0,0,1913,1914,3,395,197,0,1914,1918, + 3,479,239,0,1915,1917,3,459,229,0,1916,1915,1,0,0,0,1917,1920,1,0,0,0, + 1918,1916,1,0,0,0,1918,1919,1,0,0,0,1919,1923,1,0,0,0,1920,1918,1,0,0, + 0,1921,1924,3,431,215,0,1922,1924,3,409,204,0,1923,1921,1,0,0,0,1923, + 1922,1,0,0,0,1924,1927,1,0,0,0,1925,1928,3,515,257,0,1926,1928,3,475, + 237,0,1927,1925,1,0,0,0,1927,1926,1,0,0,0,1927,1928,1,0,0,0,1928,1930, + 1,0,0,0,1929,1931,3,457,228,0,1930,1929,1,0,0,0,1931,1932,1,0,0,0,1932, + 1930,1,0,0,0,1932,1933,1,0,0,0,1933,1990,1,0,0,0,1934,1937,3,395,197, + 0,1935,1938,3,431,215,0,1936,1938,3,409,204,0,1937,1935,1,0,0,0,1937, + 1936,1,0,0,0,1938,1941,1,0,0,0,1939,1942,3,515,257,0,1940,1942,3,475, + 237,0,1941,1939,1,0,0,0,1941,1940,1,0,0,0,1941,1942,1,0,0,0,1942,1944, + 1,0,0,0,1943,1945,3,457,228,0,1944,1943,1,0,0,0,1945,1946,1,0,0,0,1946, + 1944,1,0,0,0,1946,1947,1,0,0,0,1947,1990,1,0,0,0,1948,1949,3,393,196, + 0,1949,1953,3,479,239,0,1950,1952,3,457,228,0,1951,1950,1,0,0,0,1952, + 1955,1,0,0,0,1953,1951,1,0,0,0,1953,1954,1,0,0,0,1954,1956,1,0,0,0,1955, + 1953,1,0,0,0,1956,1959,3,409,204,0,1957,1960,3,515,257,0,1958,1960,3, + 475,237,0,1959,1957,1,0,0,0,1959,1958,1,0,0,0,1959,1960,1,0,0,0,1960, + 1962,1,0,0,0,1961,1963,3,457,228,0,1962,1961,1,0,0,0,1963,1964,1,0,0, + 0,1964,1962,1,0,0,0,1964,1965,1,0,0,0,1965,1990,1,0,0,0,1966,1967,3,479, + 239,0,1967,1968,3,393,196,0,1968,1971,3,409,204,0,1969,1972,3,515,257, + 0,1970,1972,3,475,237,0,1971,1969,1,0,0,0,1971,1970,1,0,0,0,1971,1972, + 1,0,0,0,1972,1974,1,0,0,0,1973,1975,3,457,228,0,1974,1973,1,0,0,0,1975, + 1976,1,0,0,0,1976,1974,1,0,0,0,1976,1977,1,0,0,0,1977,1990,1,0,0,0,1978, + 1979,3,393,196,0,1979,1982,3,409,204,0,1980,1983,3,515,257,0,1981,1983, + 3,475,237,0,1982,1980,1,0,0,0,1982,1981,1,0,0,0,1982,1983,1,0,0,0,1983, + 1985,1,0,0,0,1984,1986,3,457,228,0,1985,1984,1,0,0,0,1986,1987,1,0,0, + 0,1987,1985,1,0,0,0,1987,1988,1,0,0,0,1988,1990,1,0,0,0,1989,1913,1,0, + 0,0,1989,1934,1,0,0,0,1989,1948,1,0,0,0,1989,1966,1,0,0,0,1989,1978,1, + 0,0,0,1990,390,1,0,0,0,1991,1993,5,48,0,0,1992,1994,3,455,227,0,1993, + 1992,1,0,0,0,1994,1995,1,0,0,0,1995,1993,1,0,0,0,1995,1996,1,0,0,0,1996, + 392,1,0,0,0,1997,1999,3,457,228,0,1998,1997,1,0,0,0,1999,2000,1,0,0,0, + 2000,1998,1,0,0,0,2000,2001,1,0,0,0,2001,394,1,0,0,0,2002,2003,5,48,0, + 0,2003,2005,3,447,223,0,2004,2006,3,459,229,0,2005,2004,1,0,0,0,2006, + 2007,1,0,0,0,2007,2005,1,0,0,0,2007,2008,1,0,0,0,2008,396,1,0,0,0,2009, + 2017,3,521,260,0,2010,2016,8,2,0,0,2011,2016,3,385,192,0,2012,2013,3, + 521,260,0,2013,2014,3,521,260,0,2014,2016,1,0,0,0,2015,2010,1,0,0,0,2015, + 2011,1,0,0,0,2015,2012,1,0,0,0,2016,2019,1,0,0,0,2017,2015,1,0,0,0,2017, + 2018,1,0,0,0,2018,2020,1,0,0,0,2019,2017,1,0,0,0,2020,2021,3,521,260, + 0,2021,398,1,0,0,0,2022,2030,3,495,247,0,2023,2029,8,3,0,0,2024,2029, + 3,385,192,0,2025,2026,3,495,247,0,2026,2027,3,495,247,0,2027,2029,1,0, + 0,0,2028,2023,1,0,0,0,2028,2024,1,0,0,0,2028,2025,1,0,0,0,2029,2032,1, + 0,0,0,2030,2028,1,0,0,0,2030,2031,1,0,0,0,2031,2033,1,0,0,0,2032,2030, + 1,0,0,0,2033,2034,3,527,263,0,2034,400,1,0,0,0,2035,2036,7,4,0,0,2036, + 402,1,0,0,0,2037,2038,7,5,0,0,2038,404,1,0,0,0,2039,2040,7,6,0,0,2040, + 406,1,0,0,0,2041,2042,7,7,0,0,2042,408,1,0,0,0,2043,2044,7,8,0,0,2044, + 410,1,0,0,0,2045,2046,7,9,0,0,2046,412,1,0,0,0,2047,2048,7,10,0,0,2048, + 414,1,0,0,0,2049,2050,7,11,0,0,2050,416,1,0,0,0,2051,2052,7,12,0,0,2052, + 418,1,0,0,0,2053,2054,7,13,0,0,2054,420,1,0,0,0,2055,2056,7,14,0,0,2056, + 422,1,0,0,0,2057,2058,7,15,0,0,2058,424,1,0,0,0,2059,2060,7,16,0,0,2060, + 426,1,0,0,0,2061,2062,7,17,0,0,2062,428,1,0,0,0,2063,2064,7,18,0,0,2064, + 430,1,0,0,0,2065,2066,7,19,0,0,2066,432,1,0,0,0,2067,2068,7,20,0,0,2068, + 434,1,0,0,0,2069,2070,7,21,0,0,2070,436,1,0,0,0,2071,2072,7,22,0,0,2072, + 438,1,0,0,0,2073,2074,7,23,0,0,2074,440,1,0,0,0,2075,2076,7,24,0,0,2076, + 442,1,0,0,0,2077,2078,7,25,0,0,2078,444,1,0,0,0,2079,2080,7,26,0,0,2080, + 446,1,0,0,0,2081,2082,7,27,0,0,2082,448,1,0,0,0,2083,2084,7,28,0,0,2084, + 450,1,0,0,0,2085,2086,7,29,0,0,2086,452,1,0,0,0,2087,2088,7,30,0,0,2088, + 454,1,0,0,0,2089,2090,7,31,0,0,2090,456,1,0,0,0,2091,2092,7,32,0,0,2092, + 458,1,0,0,0,2093,2094,7,33,0,0,2094,460,1,0,0,0,2095,2096,5,45,0,0,2096, + 2097,5,62,0,0,2097,462,1,0,0,0,2098,2099,5,42,0,0,2099,464,1,0,0,0,2100, + 2101,5,96,0,0,2101,466,1,0,0,0,2102,2103,5,92,0,0,2103,468,1,0,0,0,2104, + 2105,5,58,0,0,2105,470,1,0,0,0,2106,2107,5,44,0,0,2107,472,1,0,0,0,2108, + 2109,5,124,0,0,2109,2110,5,124,0,0,2110,474,1,0,0,0,2111,2112,5,45,0, + 0,2112,476,1,0,0,0,2113,2114,5,36,0,0,2114,478,1,0,0,0,2115,2116,5,46, + 0,0,2116,480,1,0,0,0,2117,2118,5,61,0,0,2118,2119,5,61,0,0,2119,482,1, + 0,0,0,2120,2121,5,61,0,0,2121,484,1,0,0,0,2122,2123,5,62,0,0,2123,2124, + 5,61,0,0,2124,486,1,0,0,0,2125,2126,5,62,0,0,2126,488,1,0,0,0,2127,2128, + 5,35,0,0,2128,490,1,0,0,0,2129,2130,5,126,0,0,2130,2131,5,42,0,0,2131, + 492,1,0,0,0,2132,2133,5,61,0,0,2133,2134,5,126,0,0,2134,2135,5,42,0,0, + 2135,494,1,0,0,0,2136,2137,5,123,0,0,2137,496,1,0,0,0,2138,2139,5,91, + 0,0,2139,498,1,0,0,0,2140,2141,5,40,0,0,2141,500,1,0,0,0,2142,2143,5, + 60,0,0,2143,2144,5,61,0,0,2144,502,1,0,0,0,2145,2146,5,60,0,0,2146,504, + 1,0,0,0,2147,2148,5,33,0,0,2148,2152,5,61,0,0,2149,2150,5,60,0,0,2150, + 2152,5,62,0,0,2151,2147,1,0,0,0,2151,2149,1,0,0,0,2152,506,1,0,0,0,2153, + 2154,5,33,0,0,2154,2155,5,126,0,0,2155,2156,5,42,0,0,2156,508,1,0,0,0, + 2157,2158,5,33,0,0,2158,2159,5,126,0,0,2159,510,1,0,0,0,2160,2161,5,63, + 0,0,2161,2162,5,63,0,0,2162,512,1,0,0,0,2163,2164,5,37,0,0,2164,514,1, + 0,0,0,2165,2166,5,43,0,0,2166,516,1,0,0,0,2167,2168,5,63,0,0,2168,518, + 1,0,0,0,2169,2170,5,34,0,0,2170,520,1,0,0,0,2171,2172,5,39,0,0,2172,522, + 1,0,0,0,2173,2174,5,126,0,0,2174,524,1,0,0,0,2175,2176,5,61,0,0,2176, + 2177,5,126,0,0,2177,526,1,0,0,0,2178,2179,5,125,0,0,2179,528,1,0,0,0, + 2180,2181,5,93,0,0,2181,530,1,0,0,0,2182,2183,5,41,0,0,2183,532,1,0,0, + 0,2184,2185,5,59,0,0,2185,534,1,0,0,0,2186,2187,5,47,0,0,2187,536,1,0, + 0,0,2188,2189,5,95,0,0,2189,538,1,0,0,0,2190,2191,5,47,0,0,2191,2192, + 5,42,0,0,2192,2196,1,0,0,0,2193,2195,9,0,0,0,2194,2193,1,0,0,0,2195,2198, + 1,0,0,0,2196,2197,1,0,0,0,2196,2194,1,0,0,0,2197,2199,1,0,0,0,2198,2196, + 1,0,0,0,2199,2200,5,42,0,0,2200,2201,5,47,0,0,2201,2202,1,0,0,0,2202, + 2203,6,269,0,0,2203,540,1,0,0,0,2204,2205,5,45,0,0,2205,2206,5,45,0,0, + 2206,2210,1,0,0,0,2207,2209,8,34,0,0,2208,2207,1,0,0,0,2209,2212,1,0, + 0,0,2210,2208,1,0,0,0,2210,2211,1,0,0,0,2211,2214,1,0,0,0,2212,2210,1, + 0,0,0,2213,2215,7,35,0,0,2214,2213,1,0,0,0,2215,2216,1,0,0,0,2216,2217, + 6,270,0,0,2217,542,1,0,0,0,2218,2219,7,36,0,0,2219,2220,1,0,0,0,2220, + 2221,6,271,1,0,2221,544,1,0,0,0,39,0,607,1112,1826,1869,1874,1880,1882, + 1891,1893,1904,1906,1911,1918,1923,1927,1932,1937,1941,1946,1953,1959, + 1964,1971,1976,1982,1987,1989,1995,2000,2007,2015,2017,2028,2030,2151, + 2196,2210,2214,2,6,0,0,0,1,0 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + hogqllexerLexerStaticData = staticData.release(); +} + +} + +HogQLLexer::HogQLLexer(CharStream *input) : Lexer(input) { + HogQLLexer::initialize(); + _interpreter = new atn::LexerATNSimulator(this, *hogqllexerLexerStaticData->atn, hogqllexerLexerStaticData->decisionToDFA, hogqllexerLexerStaticData->sharedContextCache); +} + +HogQLLexer::~HogQLLexer() { + delete _interpreter; +} + +std::string HogQLLexer::getGrammarFileName() const { + return "HogQLLexer.g4"; +} + +const std::vector& HogQLLexer::getRuleNames() const { + return hogqllexerLexerStaticData->ruleNames; +} + +const std::vector& HogQLLexer::getChannelNames() const { + return hogqllexerLexerStaticData->channelNames; +} + +const std::vector& HogQLLexer::getModeNames() const { + return hogqllexerLexerStaticData->modeNames; +} + +const dfa::Vocabulary& HogQLLexer::getVocabulary() const { + return hogqllexerLexerStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView HogQLLexer::getSerializedATN() const { + return hogqllexerLexerStaticData->serializedATN; +} + +const atn::ATN& HogQLLexer::getATN() const { + return *hogqllexerLexerStaticData->atn; +} + + + + +void HogQLLexer::initialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + hogqllexerLexerInitialize(); +#else + ::antlr4::internal::call_once(hogqllexerLexerOnceFlag, hogqllexerLexerInitialize); +#endif +} diff --git a/hogql_parser/HogQLLexer.h b/hogql_parser/HogQLLexer.h new file mode 100644 index 0000000000000..78bfe64dc0bfc --- /dev/null +++ b/hogql_parser/HogQLLexer.h @@ -0,0 +1,94 @@ + +// Generated from HogQLLexer.g4 by ANTLR 4.13.0 + +#pragma once + + +#include "antlr4-runtime.h" + + + + +class HogQLLexer : 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, COHORT = 25, COLLATE = 26, + COLUMN = 27, COMMENT = 28, CONSTRAINT = 29, CREATE = 30, CROSS = 31, + CUBE = 32, CURRENT = 33, DATABASE = 34, DATABASES = 35, DATE = 36, DAY = 37, + DEDUPLICATE = 38, DEFAULT = 39, DELAY = 40, DELETE = 41, DESC = 42, + DESCENDING = 43, DESCRIBE = 44, DETACH = 45, DICTIONARIES = 46, DICTIONARY = 47, + DISK = 48, DISTINCT = 49, DISTRIBUTED = 50, DROP = 51, ELSE = 52, END = 53, + ENGINE = 54, EVENTS = 55, EXISTS = 56, EXPLAIN = 57, EXPRESSION = 58, + EXTRACT = 59, FETCHES = 60, FINAL = 61, FIRST = 62, FLUSH = 63, FOLLOWING = 64, + FOR = 65, FORMAT = 66, FREEZE = 67, FROM = 68, FULL = 69, FUNCTION = 70, + GLOBAL = 71, GRANULARITY = 72, GROUP = 73, HAVING = 74, HIERARCHICAL = 75, + HOUR = 76, ID = 77, IF = 78, ILIKE = 79, IN = 80, INDEX = 81, INF = 82, + INJECTIVE = 83, INNER = 84, INSERT = 85, INTERVAL = 86, INTO = 87, IS = 88, + IS_OBJECT_ID = 89, JOIN = 90, KEY = 91, KILL = 92, LAST = 93, LAYOUT = 94, + LEADING = 95, LEFT = 96, LIFETIME = 97, LIKE = 98, LIMIT = 99, LIVE = 100, + LOCAL = 101, LOGS = 102, MATERIALIZE = 103, MATERIALIZED = 104, MAX = 105, + MERGES = 106, MIN = 107, MINUTE = 108, MODIFY = 109, MONTH = 110, MOVE = 111, + MUTATION = 112, NAN_SQL = 113, NO = 114, NOT = 115, NULL_SQL = 116, + NULLS = 117, OFFSET = 118, ON = 119, OPTIMIZE = 120, OR = 121, ORDER = 122, + OUTER = 123, OUTFILE = 124, OVER = 125, PARTITION = 126, POPULATE = 127, + PRECEDING = 128, PREWHERE = 129, PRIMARY = 130, PROJECTION = 131, QUARTER = 132, + RANGE = 133, RELOAD = 134, REMOVE = 135, RENAME = 136, REPLACE = 137, + REPLICA = 138, REPLICATED = 139, RIGHT = 140, ROLLUP = 141, ROW = 142, + ROWS = 143, SAMPLE = 144, SECOND = 145, SELECT = 146, SEMI = 147, SENDS = 148, + SET = 149, SETTINGS = 150, SHOW = 151, SOURCE = 152, START = 153, STOP = 154, + SUBSTRING = 155, SYNC = 156, SYNTAX = 157, SYSTEM = 158, TABLE = 159, + TABLES = 160, TEMPORARY = 161, TEST = 162, THEN = 163, TIES = 164, TIMEOUT = 165, + TIMESTAMP = 166, TO = 167, TOP = 168, TOTALS = 169, TRAILING = 170, + TRIM = 171, TRUNCATE = 172, TTL = 173, TYPE = 174, UNBOUNDED = 175, + UNION = 176, UPDATE = 177, USE = 178, USING = 179, UUID = 180, VALUES = 181, + VIEW = 182, VOLUME = 183, WATCH = 184, WEEK = 185, WHEN = 186, WHERE = 187, + WINDOW = 188, WITH = 189, YEAR = 190, JSON_FALSE = 191, JSON_TRUE = 192, + ESCAPE_CHAR = 193, IDENTIFIER = 194, FLOATING_LITERAL = 195, OCTAL_LITERAL = 196, + DECIMAL_LITERAL = 197, HEXADECIMAL_LITERAL = 198, STRING_LITERAL = 199, + PLACEHOLDER = 200, ARROW = 201, ASTERISK = 202, BACKQUOTE = 203, BACKSLASH = 204, + COLON = 205, COMMA = 206, CONCAT = 207, DASH = 208, DOLLAR = 209, DOT = 210, + EQ_DOUBLE = 211, EQ_SINGLE = 212, GT_EQ = 213, GT = 214, HASH = 215, + IREGEX_SINGLE = 216, IREGEX_DOUBLE = 217, LBRACE = 218, LBRACKET = 219, + LPAREN = 220, LT_EQ = 221, LT = 222, NOT_EQ = 223, NOT_IREGEX = 224, + NOT_REGEX = 225, NULLISH = 226, PERCENT = 227, PLUS = 228, QUERY = 229, + QUOTE_DOUBLE = 230, QUOTE_SINGLE = 231, REGEX_SINGLE = 232, REGEX_DOUBLE = 233, + RBRACE = 234, RBRACKET = 235, RPAREN = 236, SEMICOLON = 237, SLASH = 238, + UNDERSCORE = 239, MULTI_LINE_COMMENT = 240, SINGLE_LINE_COMMENT = 241, + WHITESPACE = 242 + }; + + explicit HogQLLexer(antlr4::CharStream *input); + + ~HogQLLexer() override; + + + std::string getGrammarFileName() const override; + + const std::vector& getRuleNames() const override; + + const std::vector& getChannelNames() const override; + + const std::vector& getModeNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + const antlr4::atn::ATN& getATN() const override; + + // By default the static state used to implement the lexer is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: + + // Individual action functions triggered by action() above. + + // Individual semantic predicate functions triggered by sempred() above. + +}; + diff --git a/hogql_parser/HogQLLexer.interp b/hogql_parser/HogQLLexer.interp new file mode 100644 index 0000000000000..3e078ad307c5d --- /dev/null +++ b/hogql_parser/HogQLLexer.interp @@ -0,0 +1,773 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'false' +'true' +null +null +null +null +null +null +null +null +'->' +'*' +'`' +'\\' +':' +',' +'||' +'-' +'$' +'.' +'==' +'=' +'>=' +'>' +'#' +'~*' +'=~*' +'{' +'[' +'(' +'<=' +'<' +null +'!~*' +'!~' +'??' +'%' +'+' +'?' +'"' +'\'' +'~' +'=~' +'}' +']' +')' +';' +'/' +'_' +null +null +null + +token symbolic names: +null +ADD +AFTER +ALIAS +ALL +ALTER +AND +ANTI +ANY +ARRAY +AS +ASCENDING +ASOF +AST +ASYNC +ATTACH +BETWEEN +BOTH +BY +CASE +CAST +CHECK +CLEAR +CLUSTER +CODEC +COHORT +COLLATE +COLUMN +COMMENT +CONSTRAINT +CREATE +CROSS +CUBE +CURRENT +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 +FOLLOWING +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 +OVER +PARTITION +POPULATE +PRECEDING +PREWHERE +PRIMARY +PROJECTION +QUARTER +RANGE +RELOAD +REMOVE +RENAME +REPLACE +REPLICA +REPLICATED +RIGHT +ROLLUP +ROW +ROWS +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 +UNBOUNDED +UNION +UPDATE +USE +USING +UUID +VALUES +VIEW +VOLUME +WATCH +WEEK +WHEN +WHERE +WINDOW +WITH +YEAR +JSON_FALSE +JSON_TRUE +ESCAPE_CHAR +IDENTIFIER +FLOATING_LITERAL +OCTAL_LITERAL +DECIMAL_LITERAL +HEXADECIMAL_LITERAL +STRING_LITERAL +PLACEHOLDER +ARROW +ASTERISK +BACKQUOTE +BACKSLASH +COLON +COMMA +CONCAT +DASH +DOLLAR +DOT +EQ_DOUBLE +EQ_SINGLE +GT_EQ +GT +HASH +IREGEX_SINGLE +IREGEX_DOUBLE +LBRACE +LBRACKET +LPAREN +LT_EQ +LT +NOT_EQ +NOT_IREGEX +NOT_REGEX +NULLISH +PERCENT +PLUS +QUERY +QUOTE_DOUBLE +QUOTE_SINGLE +REGEX_SINGLE +REGEX_DOUBLE +RBRACE +RBRACKET +RPAREN +SEMICOLON +SLASH +UNDERSCORE +MULTI_LINE_COMMENT +SINGLE_LINE_COMMENT +WHITESPACE + +rule names: +ADD +AFTER +ALIAS +ALL +ALTER +AND +ANTI +ANY +ARRAY +AS +ASCENDING +ASOF +AST +ASYNC +ATTACH +BETWEEN +BOTH +BY +CASE +CAST +CHECK +CLEAR +CLUSTER +CODEC +COHORT +COLLATE +COLUMN +COMMENT +CONSTRAINT +CREATE +CROSS +CUBE +CURRENT +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 +FOLLOWING +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 +OVER +PARTITION +POPULATE +PRECEDING +PREWHERE +PRIMARY +PROJECTION +QUARTER +RANGE +RELOAD +REMOVE +RENAME +REPLACE +REPLICA +REPLICATED +RIGHT +ROLLUP +ROW +ROWS +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 +UNBOUNDED +UNION +UPDATE +USE +USING +UUID +VALUES +VIEW +VOLUME +WATCH +WEEK +WHEN +WHERE +WINDOW +WITH +YEAR +JSON_FALSE +JSON_TRUE +ESCAPE_CHAR +IDENTIFIER +FLOATING_LITERAL +OCTAL_LITERAL +DECIMAL_LITERAL +HEXADECIMAL_LITERAL +STRING_LITERAL +PLACEHOLDER +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +LETTER +OCT_DIGIT +DEC_DIGIT +HEX_DIGIT +ARROW +ASTERISK +BACKQUOTE +BACKSLASH +COLON +COMMA +CONCAT +DASH +DOLLAR +DOT +EQ_DOUBLE +EQ_SINGLE +GT_EQ +GT +HASH +IREGEX_SINGLE +IREGEX_DOUBLE +LBRACE +LBRACKET +LPAREN +LT_EQ +LT +NOT_EQ +NOT_IREGEX +NOT_REGEX +NULLISH +PERCENT +PLUS +QUERY +QUOTE_DOUBLE +QUOTE_SINGLE +REGEX_SINGLE +REGEX_DOUBLE +RBRACE +RBRACKET +RPAREN +SEMICOLON +SLASH +UNDERSCORE +MULTI_LINE_COMMENT +SINGLE_LINE_COMMENT +WHITESPACE + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 242, 2222, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 2, 225, 7, 225, 2, 226, 7, 226, 2, 227, 7, 227, 2, 228, 7, 228, 2, 229, 7, 229, 2, 230, 7, 230, 2, 231, 7, 231, 2, 232, 7, 232, 2, 233, 7, 233, 2, 234, 7, 234, 2, 235, 7, 235, 2, 236, 7, 236, 2, 237, 7, 237, 2, 238, 7, 238, 2, 239, 7, 239, 2, 240, 7, 240, 2, 241, 7, 241, 2, 242, 7, 242, 2, 243, 7, 243, 2, 244, 7, 244, 2, 245, 7, 245, 2, 246, 7, 246, 2, 247, 7, 247, 2, 248, 7, 248, 2, 249, 7, 249, 2, 250, 7, 250, 2, 251, 7, 251, 2, 252, 7, 252, 2, 253, 7, 253, 2, 254, 7, 254, 2, 255, 7, 255, 2, 256, 7, 256, 2, 257, 7, 257, 2, 258, 7, 258, 2, 259, 7, 259, 2, 260, 7, 260, 2, 261, 7, 261, 2, 262, 7, 262, 2, 263, 7, 263, 2, 264, 7, 264, 2, 265, 7, 265, 2, 266, 7, 266, 2, 267, 7, 267, 2, 268, 7, 268, 2, 269, 7, 269, 2, 270, 7, 270, 2, 271, 7, 271, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 608, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 3, 81, 1113, 8, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 3, 189, 1827, 8, 189, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 3, 192, 1870, 8, 192, 1, 193, 1, 193, 1, 193, 3, 193, 1875, 8, 193, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 1881, 8, 193, 10, 193, 12, 193, 1884, 9, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 1892, 8, 193, 10, 193, 12, 193, 1895, 9, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 5, 193, 1905, 8, 193, 10, 193, 12, 193, 1908, 9, 193, 1, 193, 1, 193, 3, 193, 1912, 8, 193, 1, 194, 1, 194, 1, 194, 5, 194, 1917, 8, 194, 10, 194, 12, 194, 1920, 9, 194, 1, 194, 1, 194, 3, 194, 1924, 8, 194, 1, 194, 1, 194, 3, 194, 1928, 8, 194, 1, 194, 4, 194, 1931, 8, 194, 11, 194, 12, 194, 1932, 1, 194, 1, 194, 1, 194, 3, 194, 1938, 8, 194, 1, 194, 1, 194, 3, 194, 1942, 8, 194, 1, 194, 4, 194, 1945, 8, 194, 11, 194, 12, 194, 1946, 1, 194, 1, 194, 1, 194, 5, 194, 1952, 8, 194, 10, 194, 12, 194, 1955, 9, 194, 1, 194, 1, 194, 1, 194, 3, 194, 1960, 8, 194, 1, 194, 4, 194, 1963, 8, 194, 11, 194, 12, 194, 1964, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 3, 194, 1972, 8, 194, 1, 194, 4, 194, 1975, 8, 194, 11, 194, 12, 194, 1976, 1, 194, 1, 194, 1, 194, 1, 194, 3, 194, 1983, 8, 194, 1, 194, 4, 194, 1986, 8, 194, 11, 194, 12, 194, 1987, 3, 194, 1990, 8, 194, 1, 195, 1, 195, 4, 195, 1994, 8, 195, 11, 195, 12, 195, 1995, 1, 196, 4, 196, 1999, 8, 196, 11, 196, 12, 196, 2000, 1, 197, 1, 197, 1, 197, 4, 197, 2006, 8, 197, 11, 197, 12, 197, 2007, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 5, 198, 2016, 8, 198, 10, 198, 12, 198, 2019, 9, 198, 1, 198, 1, 198, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 5, 199, 2029, 8, 199, 10, 199, 12, 199, 2032, 9, 199, 1, 199, 1, 199, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 205, 1, 205, 1, 206, 1, 206, 1, 207, 1, 207, 1, 208, 1, 208, 1, 209, 1, 209, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 1, 220, 1, 220, 1, 221, 1, 221, 1, 222, 1, 222, 1, 223, 1, 223, 1, 224, 1, 224, 1, 225, 1, 225, 1, 226, 1, 226, 1, 227, 1, 227, 1, 228, 1, 228, 1, 229, 1, 229, 1, 230, 1, 230, 1, 230, 1, 231, 1, 231, 1, 232, 1, 232, 1, 233, 1, 233, 1, 234, 1, 234, 1, 235, 1, 235, 1, 236, 1, 236, 1, 236, 1, 237, 1, 237, 1, 238, 1, 238, 1, 239, 1, 239, 1, 240, 1, 240, 1, 240, 1, 241, 1, 241, 1, 242, 1, 242, 1, 242, 1, 243, 1, 243, 1, 244, 1, 244, 1, 245, 1, 245, 1, 245, 1, 246, 1, 246, 1, 246, 1, 246, 1, 247, 1, 247, 1, 248, 1, 248, 1, 249, 1, 249, 1, 250, 1, 250, 1, 250, 1, 251, 1, 251, 1, 252, 1, 252, 1, 252, 1, 252, 3, 252, 2152, 8, 252, 1, 253, 1, 253, 1, 253, 1, 253, 1, 254, 1, 254, 1, 254, 1, 255, 1, 255, 1, 255, 1, 256, 1, 256, 1, 257, 1, 257, 1, 258, 1, 258, 1, 259, 1, 259, 1, 260, 1, 260, 1, 261, 1, 261, 1, 262, 1, 262, 1, 262, 1, 263, 1, 263, 1, 264, 1, 264, 1, 265, 1, 265, 1, 266, 1, 266, 1, 267, 1, 267, 1, 268, 1, 268, 1, 269, 1, 269, 1, 269, 1, 269, 5, 269, 2195, 8, 269, 10, 269, 12, 269, 2198, 9, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 270, 1, 270, 1, 270, 1, 270, 5, 270, 2209, 8, 270, 10, 270, 12, 270, 2212, 9, 270, 1, 270, 3, 270, 2215, 8, 270, 1, 270, 1, 270, 1, 271, 1, 271, 1, 271, 1, 271, 1, 2196, 0, 272, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 129, 259, 130, 261, 131, 263, 132, 265, 133, 267, 134, 269, 135, 271, 136, 273, 137, 275, 138, 277, 139, 279, 140, 281, 141, 283, 142, 285, 143, 287, 144, 289, 145, 291, 146, 293, 147, 295, 148, 297, 149, 299, 150, 301, 151, 303, 152, 305, 153, 307, 154, 309, 155, 311, 156, 313, 157, 315, 158, 317, 159, 319, 160, 321, 161, 323, 162, 325, 163, 327, 164, 329, 165, 331, 166, 333, 167, 335, 168, 337, 169, 339, 170, 341, 171, 343, 172, 345, 173, 347, 174, 349, 175, 351, 176, 353, 177, 355, 178, 357, 179, 359, 180, 361, 181, 363, 182, 365, 183, 367, 184, 369, 185, 371, 186, 373, 187, 375, 188, 377, 189, 379, 190, 381, 191, 383, 192, 385, 193, 387, 194, 389, 195, 391, 196, 393, 197, 395, 198, 397, 199, 399, 200, 401, 0, 403, 0, 405, 0, 407, 0, 409, 0, 411, 0, 413, 0, 415, 0, 417, 0, 419, 0, 421, 0, 423, 0, 425, 0, 427, 0, 429, 0, 431, 0, 433, 0, 435, 0, 437, 0, 439, 0, 441, 0, 443, 0, 445, 0, 447, 0, 449, 0, 451, 0, 453, 0, 455, 0, 457, 0, 459, 0, 461, 201, 463, 202, 465, 203, 467, 204, 469, 205, 471, 206, 473, 207, 475, 208, 477, 209, 479, 210, 481, 211, 483, 212, 485, 213, 487, 214, 489, 215, 491, 216, 493, 217, 495, 218, 497, 219, 499, 220, 501, 221, 503, 222, 505, 223, 507, 224, 509, 225, 511, 226, 513, 227, 515, 228, 517, 229, 519, 230, 521, 231, 523, 232, 525, 233, 527, 234, 529, 235, 531, 236, 533, 237, 535, 238, 537, 239, 539, 240, 541, 241, 543, 242, 1, 0, 37, 2, 0, 92, 92, 96, 96, 2, 0, 34, 34, 92, 92, 2, 0, 39, 39, 92, 92, 2, 0, 92, 92, 125, 125, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, 122, 2, 0, 65, 90, 97, 122, 1, 0, 48, 55, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102, 2, 0, 10, 10, 13, 13, 2, 1, 10, 10, 13, 13, 2, 0, 9, 13, 32, 32, 2252, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 0, 395, 1, 0, 0, 0, 0, 397, 1, 0, 0, 0, 0, 399, 1, 0, 0, 0, 0, 461, 1, 0, 0, 0, 0, 463, 1, 0, 0, 0, 0, 465, 1, 0, 0, 0, 0, 467, 1, 0, 0, 0, 0, 469, 1, 0, 0, 0, 0, 471, 1, 0, 0, 0, 0, 473, 1, 0, 0, 0, 0, 475, 1, 0, 0, 0, 0, 477, 1, 0, 0, 0, 0, 479, 1, 0, 0, 0, 0, 481, 1, 0, 0, 0, 0, 483, 1, 0, 0, 0, 0, 485, 1, 0, 0, 0, 0, 487, 1, 0, 0, 0, 0, 489, 1, 0, 0, 0, 0, 491, 1, 0, 0, 0, 0, 493, 1, 0, 0, 0, 0, 495, 1, 0, 0, 0, 0, 497, 1, 0, 0, 0, 0, 499, 1, 0, 0, 0, 0, 501, 1, 0, 0, 0, 0, 503, 1, 0, 0, 0, 0, 505, 1, 0, 0, 0, 0, 507, 1, 0, 0, 0, 0, 509, 1, 0, 0, 0, 0, 511, 1, 0, 0, 0, 0, 513, 1, 0, 0, 0, 0, 515, 1, 0, 0, 0, 0, 517, 1, 0, 0, 0, 0, 519, 1, 0, 0, 0, 0, 521, 1, 0, 0, 0, 0, 523, 1, 0, 0, 0, 0, 525, 1, 0, 0, 0, 0, 527, 1, 0, 0, 0, 0, 529, 1, 0, 0, 0, 0, 531, 1, 0, 0, 0, 0, 533, 1, 0, 0, 0, 0, 535, 1, 0, 0, 0, 0, 537, 1, 0, 0, 0, 0, 539, 1, 0, 0, 0, 0, 541, 1, 0, 0, 0, 0, 543, 1, 0, 0, 0, 1, 545, 1, 0, 0, 0, 3, 549, 1, 0, 0, 0, 5, 555, 1, 0, 0, 0, 7, 561, 1, 0, 0, 0, 9, 565, 1, 0, 0, 0, 11, 571, 1, 0, 0, 0, 13, 575, 1, 0, 0, 0, 15, 580, 1, 0, 0, 0, 17, 584, 1, 0, 0, 0, 19, 590, 1, 0, 0, 0, 21, 607, 1, 0, 0, 0, 23, 609, 1, 0, 0, 0, 25, 614, 1, 0, 0, 0, 27, 618, 1, 0, 0, 0, 29, 624, 1, 0, 0, 0, 31, 631, 1, 0, 0, 0, 33, 639, 1, 0, 0, 0, 35, 644, 1, 0, 0, 0, 37, 647, 1, 0, 0, 0, 39, 652, 1, 0, 0, 0, 41, 657, 1, 0, 0, 0, 43, 663, 1, 0, 0, 0, 45, 669, 1, 0, 0, 0, 47, 677, 1, 0, 0, 0, 49, 683, 1, 0, 0, 0, 51, 690, 1, 0, 0, 0, 53, 698, 1, 0, 0, 0, 55, 705, 1, 0, 0, 0, 57, 713, 1, 0, 0, 0, 59, 724, 1, 0, 0, 0, 61, 731, 1, 0, 0, 0, 63, 737, 1, 0, 0, 0, 65, 742, 1, 0, 0, 0, 67, 750, 1, 0, 0, 0, 69, 759, 1, 0, 0, 0, 71, 769, 1, 0, 0, 0, 73, 774, 1, 0, 0, 0, 75, 778, 1, 0, 0, 0, 77, 790, 1, 0, 0, 0, 79, 798, 1, 0, 0, 0, 81, 804, 1, 0, 0, 0, 83, 811, 1, 0, 0, 0, 85, 816, 1, 0, 0, 0, 87, 827, 1, 0, 0, 0, 89, 836, 1, 0, 0, 0, 91, 843, 1, 0, 0, 0, 93, 856, 1, 0, 0, 0, 95, 867, 1, 0, 0, 0, 97, 872, 1, 0, 0, 0, 99, 881, 1, 0, 0, 0, 101, 893, 1, 0, 0, 0, 103, 898, 1, 0, 0, 0, 105, 903, 1, 0, 0, 0, 107, 907, 1, 0, 0, 0, 109, 914, 1, 0, 0, 0, 111, 921, 1, 0, 0, 0, 113, 928, 1, 0, 0, 0, 115, 936, 1, 0, 0, 0, 117, 947, 1, 0, 0, 0, 119, 955, 1, 0, 0, 0, 121, 963, 1, 0, 0, 0, 123, 969, 1, 0, 0, 0, 125, 975, 1, 0, 0, 0, 127, 981, 1, 0, 0, 0, 129, 991, 1, 0, 0, 0, 131, 995, 1, 0, 0, 0, 133, 1002, 1, 0, 0, 0, 135, 1009, 1, 0, 0, 0, 137, 1014, 1, 0, 0, 0, 139, 1019, 1, 0, 0, 0, 141, 1028, 1, 0, 0, 0, 143, 1035, 1, 0, 0, 0, 145, 1047, 1, 0, 0, 0, 147, 1053, 1, 0, 0, 0, 149, 1060, 1, 0, 0, 0, 151, 1073, 1, 0, 0, 0, 153, 1078, 1, 0, 0, 0, 155, 1081, 1, 0, 0, 0, 157, 1084, 1, 0, 0, 0, 159, 1090, 1, 0, 0, 0, 161, 1093, 1, 0, 0, 0, 163, 1112, 1, 0, 0, 0, 165, 1114, 1, 0, 0, 0, 167, 1124, 1, 0, 0, 0, 169, 1130, 1, 0, 0, 0, 171, 1137, 1, 0, 0, 0, 173, 1146, 1, 0, 0, 0, 175, 1151, 1, 0, 0, 0, 177, 1154, 1, 0, 0, 0, 179, 1167, 1, 0, 0, 0, 181, 1172, 1, 0, 0, 0, 183, 1176, 1, 0, 0, 0, 185, 1181, 1, 0, 0, 0, 187, 1186, 1, 0, 0, 0, 189, 1193, 1, 0, 0, 0, 191, 1201, 1, 0, 0, 0, 193, 1206, 1, 0, 0, 0, 195, 1215, 1, 0, 0, 0, 197, 1220, 1, 0, 0, 0, 199, 1226, 1, 0, 0, 0, 201, 1231, 1, 0, 0, 0, 203, 1237, 1, 0, 0, 0, 205, 1242, 1, 0, 0, 0, 207, 1254, 1, 0, 0, 0, 209, 1267, 1, 0, 0, 0, 211, 1271, 1, 0, 0, 0, 213, 1278, 1, 0, 0, 0, 215, 1282, 1, 0, 0, 0, 217, 1289, 1, 0, 0, 0, 219, 1296, 1, 0, 0, 0, 221, 1302, 1, 0, 0, 0, 223, 1307, 1, 0, 0, 0, 225, 1316, 1, 0, 0, 0, 227, 1320, 1, 0, 0, 0, 229, 1323, 1, 0, 0, 0, 231, 1327, 1, 0, 0, 0, 233, 1332, 1, 0, 0, 0, 235, 1338, 1, 0, 0, 0, 237, 1345, 1, 0, 0, 0, 239, 1348, 1, 0, 0, 0, 241, 1357, 1, 0, 0, 0, 243, 1360, 1, 0, 0, 0, 245, 1366, 1, 0, 0, 0, 247, 1372, 1, 0, 0, 0, 249, 1380, 1, 0, 0, 0, 251, 1385, 1, 0, 0, 0, 253, 1395, 1, 0, 0, 0, 255, 1404, 1, 0, 0, 0, 257, 1414, 1, 0, 0, 0, 259, 1423, 1, 0, 0, 0, 261, 1431, 1, 0, 0, 0, 263, 1442, 1, 0, 0, 0, 265, 1450, 1, 0, 0, 0, 267, 1456, 1, 0, 0, 0, 269, 1463, 1, 0, 0, 0, 271, 1470, 1, 0, 0, 0, 273, 1477, 1, 0, 0, 0, 275, 1485, 1, 0, 0, 0, 277, 1493, 1, 0, 0, 0, 279, 1504, 1, 0, 0, 0, 281, 1510, 1, 0, 0, 0, 283, 1517, 1, 0, 0, 0, 285, 1521, 1, 0, 0, 0, 287, 1526, 1, 0, 0, 0, 289, 1533, 1, 0, 0, 0, 291, 1540, 1, 0, 0, 0, 293, 1547, 1, 0, 0, 0, 295, 1552, 1, 0, 0, 0, 297, 1558, 1, 0, 0, 0, 299, 1562, 1, 0, 0, 0, 301, 1571, 1, 0, 0, 0, 303, 1576, 1, 0, 0, 0, 305, 1583, 1, 0, 0, 0, 307, 1589, 1, 0, 0, 0, 309, 1594, 1, 0, 0, 0, 311, 1604, 1, 0, 0, 0, 313, 1609, 1, 0, 0, 0, 315, 1616, 1, 0, 0, 0, 317, 1623, 1, 0, 0, 0, 319, 1629, 1, 0, 0, 0, 321, 1636, 1, 0, 0, 0, 323, 1646, 1, 0, 0, 0, 325, 1651, 1, 0, 0, 0, 327, 1656, 1, 0, 0, 0, 329, 1661, 1, 0, 0, 0, 331, 1669, 1, 0, 0, 0, 333, 1679, 1, 0, 0, 0, 335, 1682, 1, 0, 0, 0, 337, 1686, 1, 0, 0, 0, 339, 1693, 1, 0, 0, 0, 341, 1702, 1, 0, 0, 0, 343, 1707, 1, 0, 0, 0, 345, 1716, 1, 0, 0, 0, 347, 1720, 1, 0, 0, 0, 349, 1725, 1, 0, 0, 0, 351, 1735, 1, 0, 0, 0, 353, 1741, 1, 0, 0, 0, 355, 1748, 1, 0, 0, 0, 357, 1752, 1, 0, 0, 0, 359, 1758, 1, 0, 0, 0, 361, 1763, 1, 0, 0, 0, 363, 1770, 1, 0, 0, 0, 365, 1775, 1, 0, 0, 0, 367, 1782, 1, 0, 0, 0, 369, 1788, 1, 0, 0, 0, 371, 1793, 1, 0, 0, 0, 373, 1798, 1, 0, 0, 0, 375, 1804, 1, 0, 0, 0, 377, 1811, 1, 0, 0, 0, 379, 1826, 1, 0, 0, 0, 381, 1828, 1, 0, 0, 0, 383, 1834, 1, 0, 0, 0, 385, 1869, 1, 0, 0, 0, 387, 1911, 1, 0, 0, 0, 389, 1989, 1, 0, 0, 0, 391, 1991, 1, 0, 0, 0, 393, 1998, 1, 0, 0, 0, 395, 2002, 1, 0, 0, 0, 397, 2009, 1, 0, 0, 0, 399, 2022, 1, 0, 0, 0, 401, 2035, 1, 0, 0, 0, 403, 2037, 1, 0, 0, 0, 405, 2039, 1, 0, 0, 0, 407, 2041, 1, 0, 0, 0, 409, 2043, 1, 0, 0, 0, 411, 2045, 1, 0, 0, 0, 413, 2047, 1, 0, 0, 0, 415, 2049, 1, 0, 0, 0, 417, 2051, 1, 0, 0, 0, 419, 2053, 1, 0, 0, 0, 421, 2055, 1, 0, 0, 0, 423, 2057, 1, 0, 0, 0, 425, 2059, 1, 0, 0, 0, 427, 2061, 1, 0, 0, 0, 429, 2063, 1, 0, 0, 0, 431, 2065, 1, 0, 0, 0, 433, 2067, 1, 0, 0, 0, 435, 2069, 1, 0, 0, 0, 437, 2071, 1, 0, 0, 0, 439, 2073, 1, 0, 0, 0, 441, 2075, 1, 0, 0, 0, 443, 2077, 1, 0, 0, 0, 445, 2079, 1, 0, 0, 0, 447, 2081, 1, 0, 0, 0, 449, 2083, 1, 0, 0, 0, 451, 2085, 1, 0, 0, 0, 453, 2087, 1, 0, 0, 0, 455, 2089, 1, 0, 0, 0, 457, 2091, 1, 0, 0, 0, 459, 2093, 1, 0, 0, 0, 461, 2095, 1, 0, 0, 0, 463, 2098, 1, 0, 0, 0, 465, 2100, 1, 0, 0, 0, 467, 2102, 1, 0, 0, 0, 469, 2104, 1, 0, 0, 0, 471, 2106, 1, 0, 0, 0, 473, 2108, 1, 0, 0, 0, 475, 2111, 1, 0, 0, 0, 477, 2113, 1, 0, 0, 0, 479, 2115, 1, 0, 0, 0, 481, 2117, 1, 0, 0, 0, 483, 2120, 1, 0, 0, 0, 485, 2122, 1, 0, 0, 0, 487, 2125, 1, 0, 0, 0, 489, 2127, 1, 0, 0, 0, 491, 2129, 1, 0, 0, 0, 493, 2132, 1, 0, 0, 0, 495, 2136, 1, 0, 0, 0, 497, 2138, 1, 0, 0, 0, 499, 2140, 1, 0, 0, 0, 501, 2142, 1, 0, 0, 0, 503, 2145, 1, 0, 0, 0, 505, 2151, 1, 0, 0, 0, 507, 2153, 1, 0, 0, 0, 509, 2157, 1, 0, 0, 0, 511, 2160, 1, 0, 0, 0, 513, 2163, 1, 0, 0, 0, 515, 2165, 1, 0, 0, 0, 517, 2167, 1, 0, 0, 0, 519, 2169, 1, 0, 0, 0, 521, 2171, 1, 0, 0, 0, 523, 2173, 1, 0, 0, 0, 525, 2175, 1, 0, 0, 0, 527, 2178, 1, 0, 0, 0, 529, 2180, 1, 0, 0, 0, 531, 2182, 1, 0, 0, 0, 533, 2184, 1, 0, 0, 0, 535, 2186, 1, 0, 0, 0, 537, 2188, 1, 0, 0, 0, 539, 2190, 1, 0, 0, 0, 541, 2204, 1, 0, 0, 0, 543, 2218, 1, 0, 0, 0, 545, 546, 3, 401, 200, 0, 546, 547, 3, 407, 203, 0, 547, 548, 3, 407, 203, 0, 548, 2, 1, 0, 0, 0, 549, 550, 3, 401, 200, 0, 550, 551, 3, 411, 205, 0, 551, 552, 3, 439, 219, 0, 552, 553, 3, 409, 204, 0, 553, 554, 3, 435, 217, 0, 554, 4, 1, 0, 0, 0, 555, 556, 3, 401, 200, 0, 556, 557, 3, 423, 211, 0, 557, 558, 3, 417, 208, 0, 558, 559, 3, 401, 200, 0, 559, 560, 3, 437, 218, 0, 560, 6, 1, 0, 0, 0, 561, 562, 3, 401, 200, 0, 562, 563, 3, 423, 211, 0, 563, 564, 3, 423, 211, 0, 564, 8, 1, 0, 0, 0, 565, 566, 3, 401, 200, 0, 566, 567, 3, 423, 211, 0, 567, 568, 3, 439, 219, 0, 568, 569, 3, 409, 204, 0, 569, 570, 3, 435, 217, 0, 570, 10, 1, 0, 0, 0, 571, 572, 3, 401, 200, 0, 572, 573, 3, 427, 213, 0, 573, 574, 3, 407, 203, 0, 574, 12, 1, 0, 0, 0, 575, 576, 3, 401, 200, 0, 576, 577, 3, 427, 213, 0, 577, 578, 3, 439, 219, 0, 578, 579, 3, 417, 208, 0, 579, 14, 1, 0, 0, 0, 580, 581, 3, 401, 200, 0, 581, 582, 3, 427, 213, 0, 582, 583, 3, 449, 224, 0, 583, 16, 1, 0, 0, 0, 584, 585, 3, 401, 200, 0, 585, 586, 3, 435, 217, 0, 586, 587, 3, 435, 217, 0, 587, 588, 3, 401, 200, 0, 588, 589, 3, 449, 224, 0, 589, 18, 1, 0, 0, 0, 590, 591, 3, 401, 200, 0, 591, 592, 3, 437, 218, 0, 592, 20, 1, 0, 0, 0, 593, 594, 3, 401, 200, 0, 594, 595, 3, 437, 218, 0, 595, 596, 3, 405, 202, 0, 596, 608, 1, 0, 0, 0, 597, 598, 3, 401, 200, 0, 598, 599, 3, 437, 218, 0, 599, 600, 3, 405, 202, 0, 600, 601, 3, 409, 204, 0, 601, 602, 3, 427, 213, 0, 602, 603, 3, 407, 203, 0, 603, 604, 3, 417, 208, 0, 604, 605, 3, 427, 213, 0, 605, 606, 3, 413, 206, 0, 606, 608, 1, 0, 0, 0, 607, 593, 1, 0, 0, 0, 607, 597, 1, 0, 0, 0, 608, 22, 1, 0, 0, 0, 609, 610, 3, 401, 200, 0, 610, 611, 3, 437, 218, 0, 611, 612, 3, 429, 214, 0, 612, 613, 3, 411, 205, 0, 613, 24, 1, 0, 0, 0, 614, 615, 3, 401, 200, 0, 615, 616, 3, 437, 218, 0, 616, 617, 3, 439, 219, 0, 617, 26, 1, 0, 0, 0, 618, 619, 3, 401, 200, 0, 619, 620, 3, 437, 218, 0, 620, 621, 3, 449, 224, 0, 621, 622, 3, 427, 213, 0, 622, 623, 3, 405, 202, 0, 623, 28, 1, 0, 0, 0, 624, 625, 3, 401, 200, 0, 625, 626, 3, 439, 219, 0, 626, 627, 3, 439, 219, 0, 627, 628, 3, 401, 200, 0, 628, 629, 3, 405, 202, 0, 629, 630, 3, 415, 207, 0, 630, 30, 1, 0, 0, 0, 631, 632, 3, 403, 201, 0, 632, 633, 3, 409, 204, 0, 633, 634, 3, 439, 219, 0, 634, 635, 3, 445, 222, 0, 635, 636, 3, 409, 204, 0, 636, 637, 3, 409, 204, 0, 637, 638, 3, 427, 213, 0, 638, 32, 1, 0, 0, 0, 639, 640, 3, 403, 201, 0, 640, 641, 3, 429, 214, 0, 641, 642, 3, 439, 219, 0, 642, 643, 3, 415, 207, 0, 643, 34, 1, 0, 0, 0, 644, 645, 3, 403, 201, 0, 645, 646, 3, 449, 224, 0, 646, 36, 1, 0, 0, 0, 647, 648, 3, 405, 202, 0, 648, 649, 3, 401, 200, 0, 649, 650, 3, 437, 218, 0, 650, 651, 3, 409, 204, 0, 651, 38, 1, 0, 0, 0, 652, 653, 3, 405, 202, 0, 653, 654, 3, 401, 200, 0, 654, 655, 3, 437, 218, 0, 655, 656, 3, 439, 219, 0, 656, 40, 1, 0, 0, 0, 657, 658, 3, 405, 202, 0, 658, 659, 3, 415, 207, 0, 659, 660, 3, 409, 204, 0, 660, 661, 3, 405, 202, 0, 661, 662, 3, 421, 210, 0, 662, 42, 1, 0, 0, 0, 663, 664, 3, 405, 202, 0, 664, 665, 3, 423, 211, 0, 665, 666, 3, 409, 204, 0, 666, 667, 3, 401, 200, 0, 667, 668, 3, 435, 217, 0, 668, 44, 1, 0, 0, 0, 669, 670, 3, 405, 202, 0, 670, 671, 3, 423, 211, 0, 671, 672, 3, 441, 220, 0, 672, 673, 3, 437, 218, 0, 673, 674, 3, 439, 219, 0, 674, 675, 3, 409, 204, 0, 675, 676, 3, 435, 217, 0, 676, 46, 1, 0, 0, 0, 677, 678, 3, 405, 202, 0, 678, 679, 3, 429, 214, 0, 679, 680, 3, 407, 203, 0, 680, 681, 3, 409, 204, 0, 681, 682, 3, 405, 202, 0, 682, 48, 1, 0, 0, 0, 683, 684, 3, 405, 202, 0, 684, 685, 3, 429, 214, 0, 685, 686, 3, 415, 207, 0, 686, 687, 3, 429, 214, 0, 687, 688, 3, 435, 217, 0, 688, 689, 3, 439, 219, 0, 689, 50, 1, 0, 0, 0, 690, 691, 3, 405, 202, 0, 691, 692, 3, 429, 214, 0, 692, 693, 3, 423, 211, 0, 693, 694, 3, 423, 211, 0, 694, 695, 3, 401, 200, 0, 695, 696, 3, 439, 219, 0, 696, 697, 3, 409, 204, 0, 697, 52, 1, 0, 0, 0, 698, 699, 3, 405, 202, 0, 699, 700, 3, 429, 214, 0, 700, 701, 3, 423, 211, 0, 701, 702, 3, 441, 220, 0, 702, 703, 3, 425, 212, 0, 703, 704, 3, 427, 213, 0, 704, 54, 1, 0, 0, 0, 705, 706, 3, 405, 202, 0, 706, 707, 3, 429, 214, 0, 707, 708, 3, 425, 212, 0, 708, 709, 3, 425, 212, 0, 709, 710, 3, 409, 204, 0, 710, 711, 3, 427, 213, 0, 711, 712, 3, 439, 219, 0, 712, 56, 1, 0, 0, 0, 713, 714, 3, 405, 202, 0, 714, 715, 3, 429, 214, 0, 715, 716, 3, 427, 213, 0, 716, 717, 3, 437, 218, 0, 717, 718, 3, 439, 219, 0, 718, 719, 3, 435, 217, 0, 719, 720, 3, 401, 200, 0, 720, 721, 3, 417, 208, 0, 721, 722, 3, 427, 213, 0, 722, 723, 3, 439, 219, 0, 723, 58, 1, 0, 0, 0, 724, 725, 3, 405, 202, 0, 725, 726, 3, 435, 217, 0, 726, 727, 3, 409, 204, 0, 727, 728, 3, 401, 200, 0, 728, 729, 3, 439, 219, 0, 729, 730, 3, 409, 204, 0, 730, 60, 1, 0, 0, 0, 731, 732, 3, 405, 202, 0, 732, 733, 3, 435, 217, 0, 733, 734, 3, 429, 214, 0, 734, 735, 3, 437, 218, 0, 735, 736, 3, 437, 218, 0, 736, 62, 1, 0, 0, 0, 737, 738, 3, 405, 202, 0, 738, 739, 3, 441, 220, 0, 739, 740, 3, 403, 201, 0, 740, 741, 3, 409, 204, 0, 741, 64, 1, 0, 0, 0, 742, 743, 3, 405, 202, 0, 743, 744, 3, 441, 220, 0, 744, 745, 3, 435, 217, 0, 745, 746, 3, 435, 217, 0, 746, 747, 3, 409, 204, 0, 747, 748, 3, 427, 213, 0, 748, 749, 3, 439, 219, 0, 749, 66, 1, 0, 0, 0, 750, 751, 3, 407, 203, 0, 751, 752, 3, 401, 200, 0, 752, 753, 3, 439, 219, 0, 753, 754, 3, 401, 200, 0, 754, 755, 3, 403, 201, 0, 755, 756, 3, 401, 200, 0, 756, 757, 3, 437, 218, 0, 757, 758, 3, 409, 204, 0, 758, 68, 1, 0, 0, 0, 759, 760, 3, 407, 203, 0, 760, 761, 3, 401, 200, 0, 761, 762, 3, 439, 219, 0, 762, 763, 3, 401, 200, 0, 763, 764, 3, 403, 201, 0, 764, 765, 3, 401, 200, 0, 765, 766, 3, 437, 218, 0, 766, 767, 3, 409, 204, 0, 767, 768, 3, 437, 218, 0, 768, 70, 1, 0, 0, 0, 769, 770, 3, 407, 203, 0, 770, 771, 3, 401, 200, 0, 771, 772, 3, 439, 219, 0, 772, 773, 3, 409, 204, 0, 773, 72, 1, 0, 0, 0, 774, 775, 3, 407, 203, 0, 775, 776, 3, 401, 200, 0, 776, 777, 3, 449, 224, 0, 777, 74, 1, 0, 0, 0, 778, 779, 3, 407, 203, 0, 779, 780, 3, 409, 204, 0, 780, 781, 3, 407, 203, 0, 781, 782, 3, 441, 220, 0, 782, 783, 3, 431, 215, 0, 783, 784, 3, 423, 211, 0, 784, 785, 3, 417, 208, 0, 785, 786, 3, 405, 202, 0, 786, 787, 3, 401, 200, 0, 787, 788, 3, 439, 219, 0, 788, 789, 3, 409, 204, 0, 789, 76, 1, 0, 0, 0, 790, 791, 3, 407, 203, 0, 791, 792, 3, 409, 204, 0, 792, 793, 3, 411, 205, 0, 793, 794, 3, 401, 200, 0, 794, 795, 3, 441, 220, 0, 795, 796, 3, 423, 211, 0, 796, 797, 3, 439, 219, 0, 797, 78, 1, 0, 0, 0, 798, 799, 3, 407, 203, 0, 799, 800, 3, 409, 204, 0, 800, 801, 3, 423, 211, 0, 801, 802, 3, 401, 200, 0, 802, 803, 3, 449, 224, 0, 803, 80, 1, 0, 0, 0, 804, 805, 3, 407, 203, 0, 805, 806, 3, 409, 204, 0, 806, 807, 3, 423, 211, 0, 807, 808, 3, 409, 204, 0, 808, 809, 3, 439, 219, 0, 809, 810, 3, 409, 204, 0, 810, 82, 1, 0, 0, 0, 811, 812, 3, 407, 203, 0, 812, 813, 3, 409, 204, 0, 813, 814, 3, 437, 218, 0, 814, 815, 3, 405, 202, 0, 815, 84, 1, 0, 0, 0, 816, 817, 3, 407, 203, 0, 817, 818, 3, 409, 204, 0, 818, 819, 3, 437, 218, 0, 819, 820, 3, 405, 202, 0, 820, 821, 3, 409, 204, 0, 821, 822, 3, 427, 213, 0, 822, 823, 3, 407, 203, 0, 823, 824, 3, 417, 208, 0, 824, 825, 3, 427, 213, 0, 825, 826, 3, 413, 206, 0, 826, 86, 1, 0, 0, 0, 827, 828, 3, 407, 203, 0, 828, 829, 3, 409, 204, 0, 829, 830, 3, 437, 218, 0, 830, 831, 3, 405, 202, 0, 831, 832, 3, 435, 217, 0, 832, 833, 3, 417, 208, 0, 833, 834, 3, 403, 201, 0, 834, 835, 3, 409, 204, 0, 835, 88, 1, 0, 0, 0, 836, 837, 3, 407, 203, 0, 837, 838, 3, 409, 204, 0, 838, 839, 3, 439, 219, 0, 839, 840, 3, 401, 200, 0, 840, 841, 3, 405, 202, 0, 841, 842, 3, 415, 207, 0, 842, 90, 1, 0, 0, 0, 843, 844, 3, 407, 203, 0, 844, 845, 3, 417, 208, 0, 845, 846, 3, 405, 202, 0, 846, 847, 3, 439, 219, 0, 847, 848, 3, 417, 208, 0, 848, 849, 3, 429, 214, 0, 849, 850, 3, 427, 213, 0, 850, 851, 3, 401, 200, 0, 851, 852, 3, 435, 217, 0, 852, 853, 3, 417, 208, 0, 853, 854, 3, 409, 204, 0, 854, 855, 3, 437, 218, 0, 855, 92, 1, 0, 0, 0, 856, 857, 3, 407, 203, 0, 857, 858, 3, 417, 208, 0, 858, 859, 3, 405, 202, 0, 859, 860, 3, 439, 219, 0, 860, 861, 3, 417, 208, 0, 861, 862, 3, 429, 214, 0, 862, 863, 3, 427, 213, 0, 863, 864, 3, 401, 200, 0, 864, 865, 3, 435, 217, 0, 865, 866, 3, 449, 224, 0, 866, 94, 1, 0, 0, 0, 867, 868, 3, 407, 203, 0, 868, 869, 3, 417, 208, 0, 869, 870, 3, 437, 218, 0, 870, 871, 3, 421, 210, 0, 871, 96, 1, 0, 0, 0, 872, 873, 3, 407, 203, 0, 873, 874, 3, 417, 208, 0, 874, 875, 3, 437, 218, 0, 875, 876, 3, 439, 219, 0, 876, 877, 3, 417, 208, 0, 877, 878, 3, 427, 213, 0, 878, 879, 3, 405, 202, 0, 879, 880, 3, 439, 219, 0, 880, 98, 1, 0, 0, 0, 881, 882, 3, 407, 203, 0, 882, 883, 3, 417, 208, 0, 883, 884, 3, 437, 218, 0, 884, 885, 3, 439, 219, 0, 885, 886, 3, 435, 217, 0, 886, 887, 3, 417, 208, 0, 887, 888, 3, 403, 201, 0, 888, 889, 3, 441, 220, 0, 889, 890, 3, 439, 219, 0, 890, 891, 3, 409, 204, 0, 891, 892, 3, 407, 203, 0, 892, 100, 1, 0, 0, 0, 893, 894, 3, 407, 203, 0, 894, 895, 3, 435, 217, 0, 895, 896, 3, 429, 214, 0, 896, 897, 3, 431, 215, 0, 897, 102, 1, 0, 0, 0, 898, 899, 3, 409, 204, 0, 899, 900, 3, 423, 211, 0, 900, 901, 3, 437, 218, 0, 901, 902, 3, 409, 204, 0, 902, 104, 1, 0, 0, 0, 903, 904, 3, 409, 204, 0, 904, 905, 3, 427, 213, 0, 905, 906, 3, 407, 203, 0, 906, 106, 1, 0, 0, 0, 907, 908, 3, 409, 204, 0, 908, 909, 3, 427, 213, 0, 909, 910, 3, 413, 206, 0, 910, 911, 3, 417, 208, 0, 911, 912, 3, 427, 213, 0, 912, 913, 3, 409, 204, 0, 913, 108, 1, 0, 0, 0, 914, 915, 3, 409, 204, 0, 915, 916, 3, 443, 221, 0, 916, 917, 3, 409, 204, 0, 917, 918, 3, 427, 213, 0, 918, 919, 3, 439, 219, 0, 919, 920, 3, 437, 218, 0, 920, 110, 1, 0, 0, 0, 921, 922, 3, 409, 204, 0, 922, 923, 3, 447, 223, 0, 923, 924, 3, 417, 208, 0, 924, 925, 3, 437, 218, 0, 925, 926, 3, 439, 219, 0, 926, 927, 3, 437, 218, 0, 927, 112, 1, 0, 0, 0, 928, 929, 3, 409, 204, 0, 929, 930, 3, 447, 223, 0, 930, 931, 3, 431, 215, 0, 931, 932, 3, 423, 211, 0, 932, 933, 3, 401, 200, 0, 933, 934, 3, 417, 208, 0, 934, 935, 3, 427, 213, 0, 935, 114, 1, 0, 0, 0, 936, 937, 3, 409, 204, 0, 937, 938, 3, 447, 223, 0, 938, 939, 3, 431, 215, 0, 939, 940, 3, 435, 217, 0, 940, 941, 3, 409, 204, 0, 941, 942, 3, 437, 218, 0, 942, 943, 3, 437, 218, 0, 943, 944, 3, 417, 208, 0, 944, 945, 3, 429, 214, 0, 945, 946, 3, 427, 213, 0, 946, 116, 1, 0, 0, 0, 947, 948, 3, 409, 204, 0, 948, 949, 3, 447, 223, 0, 949, 950, 3, 439, 219, 0, 950, 951, 3, 435, 217, 0, 951, 952, 3, 401, 200, 0, 952, 953, 3, 405, 202, 0, 953, 954, 3, 439, 219, 0, 954, 118, 1, 0, 0, 0, 955, 956, 3, 411, 205, 0, 956, 957, 3, 409, 204, 0, 957, 958, 3, 439, 219, 0, 958, 959, 3, 405, 202, 0, 959, 960, 3, 415, 207, 0, 960, 961, 3, 409, 204, 0, 961, 962, 3, 437, 218, 0, 962, 120, 1, 0, 0, 0, 963, 964, 3, 411, 205, 0, 964, 965, 3, 417, 208, 0, 965, 966, 3, 427, 213, 0, 966, 967, 3, 401, 200, 0, 967, 968, 3, 423, 211, 0, 968, 122, 1, 0, 0, 0, 969, 970, 3, 411, 205, 0, 970, 971, 3, 417, 208, 0, 971, 972, 3, 435, 217, 0, 972, 973, 3, 437, 218, 0, 973, 974, 3, 439, 219, 0, 974, 124, 1, 0, 0, 0, 975, 976, 3, 411, 205, 0, 976, 977, 3, 423, 211, 0, 977, 978, 3, 441, 220, 0, 978, 979, 3, 437, 218, 0, 979, 980, 3, 415, 207, 0, 980, 126, 1, 0, 0, 0, 981, 982, 3, 411, 205, 0, 982, 983, 3, 429, 214, 0, 983, 984, 3, 423, 211, 0, 984, 985, 3, 423, 211, 0, 985, 986, 3, 429, 214, 0, 986, 987, 3, 445, 222, 0, 987, 988, 3, 417, 208, 0, 988, 989, 3, 427, 213, 0, 989, 990, 3, 413, 206, 0, 990, 128, 1, 0, 0, 0, 991, 992, 3, 411, 205, 0, 992, 993, 3, 429, 214, 0, 993, 994, 3, 435, 217, 0, 994, 130, 1, 0, 0, 0, 995, 996, 3, 411, 205, 0, 996, 997, 3, 429, 214, 0, 997, 998, 3, 435, 217, 0, 998, 999, 3, 425, 212, 0, 999, 1000, 3, 401, 200, 0, 1000, 1001, 3, 439, 219, 0, 1001, 132, 1, 0, 0, 0, 1002, 1003, 3, 411, 205, 0, 1003, 1004, 3, 435, 217, 0, 1004, 1005, 3, 409, 204, 0, 1005, 1006, 3, 409, 204, 0, 1006, 1007, 3, 451, 225, 0, 1007, 1008, 3, 409, 204, 0, 1008, 134, 1, 0, 0, 0, 1009, 1010, 3, 411, 205, 0, 1010, 1011, 3, 435, 217, 0, 1011, 1012, 3, 429, 214, 0, 1012, 1013, 3, 425, 212, 0, 1013, 136, 1, 0, 0, 0, 1014, 1015, 3, 411, 205, 0, 1015, 1016, 3, 441, 220, 0, 1016, 1017, 3, 423, 211, 0, 1017, 1018, 3, 423, 211, 0, 1018, 138, 1, 0, 0, 0, 1019, 1020, 3, 411, 205, 0, 1020, 1021, 3, 441, 220, 0, 1021, 1022, 3, 427, 213, 0, 1022, 1023, 3, 405, 202, 0, 1023, 1024, 3, 439, 219, 0, 1024, 1025, 3, 417, 208, 0, 1025, 1026, 3, 429, 214, 0, 1026, 1027, 3, 427, 213, 0, 1027, 140, 1, 0, 0, 0, 1028, 1029, 3, 413, 206, 0, 1029, 1030, 3, 423, 211, 0, 1030, 1031, 3, 429, 214, 0, 1031, 1032, 3, 403, 201, 0, 1032, 1033, 3, 401, 200, 0, 1033, 1034, 3, 423, 211, 0, 1034, 142, 1, 0, 0, 0, 1035, 1036, 3, 413, 206, 0, 1036, 1037, 3, 435, 217, 0, 1037, 1038, 3, 401, 200, 0, 1038, 1039, 3, 427, 213, 0, 1039, 1040, 3, 441, 220, 0, 1040, 1041, 3, 423, 211, 0, 1041, 1042, 3, 401, 200, 0, 1042, 1043, 3, 435, 217, 0, 1043, 1044, 3, 417, 208, 0, 1044, 1045, 3, 439, 219, 0, 1045, 1046, 3, 449, 224, 0, 1046, 144, 1, 0, 0, 0, 1047, 1048, 3, 413, 206, 0, 1048, 1049, 3, 435, 217, 0, 1049, 1050, 3, 429, 214, 0, 1050, 1051, 3, 441, 220, 0, 1051, 1052, 3, 431, 215, 0, 1052, 146, 1, 0, 0, 0, 1053, 1054, 3, 415, 207, 0, 1054, 1055, 3, 401, 200, 0, 1055, 1056, 3, 443, 221, 0, 1056, 1057, 3, 417, 208, 0, 1057, 1058, 3, 427, 213, 0, 1058, 1059, 3, 413, 206, 0, 1059, 148, 1, 0, 0, 0, 1060, 1061, 3, 415, 207, 0, 1061, 1062, 3, 417, 208, 0, 1062, 1063, 3, 409, 204, 0, 1063, 1064, 3, 435, 217, 0, 1064, 1065, 3, 401, 200, 0, 1065, 1066, 3, 435, 217, 0, 1066, 1067, 3, 405, 202, 0, 1067, 1068, 3, 415, 207, 0, 1068, 1069, 3, 417, 208, 0, 1069, 1070, 3, 405, 202, 0, 1070, 1071, 3, 401, 200, 0, 1071, 1072, 3, 423, 211, 0, 1072, 150, 1, 0, 0, 0, 1073, 1074, 3, 415, 207, 0, 1074, 1075, 3, 429, 214, 0, 1075, 1076, 3, 441, 220, 0, 1076, 1077, 3, 435, 217, 0, 1077, 152, 1, 0, 0, 0, 1078, 1079, 3, 417, 208, 0, 1079, 1080, 3, 407, 203, 0, 1080, 154, 1, 0, 0, 0, 1081, 1082, 3, 417, 208, 0, 1082, 1083, 3, 411, 205, 0, 1083, 156, 1, 0, 0, 0, 1084, 1085, 3, 417, 208, 0, 1085, 1086, 3, 423, 211, 0, 1086, 1087, 3, 417, 208, 0, 1087, 1088, 3, 421, 210, 0, 1088, 1089, 3, 409, 204, 0, 1089, 158, 1, 0, 0, 0, 1090, 1091, 3, 417, 208, 0, 1091, 1092, 3, 427, 213, 0, 1092, 160, 1, 0, 0, 0, 1093, 1094, 3, 417, 208, 0, 1094, 1095, 3, 427, 213, 0, 1095, 1096, 3, 407, 203, 0, 1096, 1097, 3, 409, 204, 0, 1097, 1098, 3, 447, 223, 0, 1098, 162, 1, 0, 0, 0, 1099, 1100, 3, 417, 208, 0, 1100, 1101, 3, 427, 213, 0, 1101, 1102, 3, 411, 205, 0, 1102, 1113, 1, 0, 0, 0, 1103, 1104, 3, 417, 208, 0, 1104, 1105, 3, 427, 213, 0, 1105, 1106, 3, 411, 205, 0, 1106, 1107, 3, 417, 208, 0, 1107, 1108, 3, 427, 213, 0, 1108, 1109, 3, 417, 208, 0, 1109, 1110, 3, 439, 219, 0, 1110, 1111, 3, 449, 224, 0, 1111, 1113, 1, 0, 0, 0, 1112, 1099, 1, 0, 0, 0, 1112, 1103, 1, 0, 0, 0, 1113, 164, 1, 0, 0, 0, 1114, 1115, 3, 417, 208, 0, 1115, 1116, 3, 427, 213, 0, 1116, 1117, 3, 419, 209, 0, 1117, 1118, 3, 409, 204, 0, 1118, 1119, 3, 405, 202, 0, 1119, 1120, 3, 439, 219, 0, 1120, 1121, 3, 417, 208, 0, 1121, 1122, 3, 443, 221, 0, 1122, 1123, 3, 409, 204, 0, 1123, 166, 1, 0, 0, 0, 1124, 1125, 3, 417, 208, 0, 1125, 1126, 3, 427, 213, 0, 1126, 1127, 3, 427, 213, 0, 1127, 1128, 3, 409, 204, 0, 1128, 1129, 3, 435, 217, 0, 1129, 168, 1, 0, 0, 0, 1130, 1131, 3, 417, 208, 0, 1131, 1132, 3, 427, 213, 0, 1132, 1133, 3, 437, 218, 0, 1133, 1134, 3, 409, 204, 0, 1134, 1135, 3, 435, 217, 0, 1135, 1136, 3, 439, 219, 0, 1136, 170, 1, 0, 0, 0, 1137, 1138, 3, 417, 208, 0, 1138, 1139, 3, 427, 213, 0, 1139, 1140, 3, 439, 219, 0, 1140, 1141, 3, 409, 204, 0, 1141, 1142, 3, 435, 217, 0, 1142, 1143, 3, 443, 221, 0, 1143, 1144, 3, 401, 200, 0, 1144, 1145, 3, 423, 211, 0, 1145, 172, 1, 0, 0, 0, 1146, 1147, 3, 417, 208, 0, 1147, 1148, 3, 427, 213, 0, 1148, 1149, 3, 439, 219, 0, 1149, 1150, 3, 429, 214, 0, 1150, 174, 1, 0, 0, 0, 1151, 1152, 3, 417, 208, 0, 1152, 1153, 3, 437, 218, 0, 1153, 176, 1, 0, 0, 0, 1154, 1155, 3, 417, 208, 0, 1155, 1156, 3, 437, 218, 0, 1156, 1157, 3, 537, 268, 0, 1157, 1158, 3, 429, 214, 0, 1158, 1159, 3, 403, 201, 0, 1159, 1160, 3, 419, 209, 0, 1160, 1161, 3, 409, 204, 0, 1161, 1162, 3, 405, 202, 0, 1162, 1163, 3, 439, 219, 0, 1163, 1164, 3, 537, 268, 0, 1164, 1165, 3, 417, 208, 0, 1165, 1166, 3, 407, 203, 0, 1166, 178, 1, 0, 0, 0, 1167, 1168, 3, 419, 209, 0, 1168, 1169, 3, 429, 214, 0, 1169, 1170, 3, 417, 208, 0, 1170, 1171, 3, 427, 213, 0, 1171, 180, 1, 0, 0, 0, 1172, 1173, 3, 421, 210, 0, 1173, 1174, 3, 409, 204, 0, 1174, 1175, 3, 449, 224, 0, 1175, 182, 1, 0, 0, 0, 1176, 1177, 3, 421, 210, 0, 1177, 1178, 3, 417, 208, 0, 1178, 1179, 3, 423, 211, 0, 1179, 1180, 3, 423, 211, 0, 1180, 184, 1, 0, 0, 0, 1181, 1182, 3, 423, 211, 0, 1182, 1183, 3, 401, 200, 0, 1183, 1184, 3, 437, 218, 0, 1184, 1185, 3, 439, 219, 0, 1185, 186, 1, 0, 0, 0, 1186, 1187, 3, 423, 211, 0, 1187, 1188, 3, 401, 200, 0, 1188, 1189, 3, 449, 224, 0, 1189, 1190, 3, 429, 214, 0, 1190, 1191, 3, 441, 220, 0, 1191, 1192, 3, 439, 219, 0, 1192, 188, 1, 0, 0, 0, 1193, 1194, 3, 423, 211, 0, 1194, 1195, 3, 409, 204, 0, 1195, 1196, 3, 401, 200, 0, 1196, 1197, 3, 407, 203, 0, 1197, 1198, 3, 417, 208, 0, 1198, 1199, 3, 427, 213, 0, 1199, 1200, 3, 413, 206, 0, 1200, 190, 1, 0, 0, 0, 1201, 1202, 3, 423, 211, 0, 1202, 1203, 3, 409, 204, 0, 1203, 1204, 3, 411, 205, 0, 1204, 1205, 3, 439, 219, 0, 1205, 192, 1, 0, 0, 0, 1206, 1207, 3, 423, 211, 0, 1207, 1208, 3, 417, 208, 0, 1208, 1209, 3, 411, 205, 0, 1209, 1210, 3, 409, 204, 0, 1210, 1211, 3, 439, 219, 0, 1211, 1212, 3, 417, 208, 0, 1212, 1213, 3, 425, 212, 0, 1213, 1214, 3, 409, 204, 0, 1214, 194, 1, 0, 0, 0, 1215, 1216, 3, 423, 211, 0, 1216, 1217, 3, 417, 208, 0, 1217, 1218, 3, 421, 210, 0, 1218, 1219, 3, 409, 204, 0, 1219, 196, 1, 0, 0, 0, 1220, 1221, 3, 423, 211, 0, 1221, 1222, 3, 417, 208, 0, 1222, 1223, 3, 425, 212, 0, 1223, 1224, 3, 417, 208, 0, 1224, 1225, 3, 439, 219, 0, 1225, 198, 1, 0, 0, 0, 1226, 1227, 3, 423, 211, 0, 1227, 1228, 3, 417, 208, 0, 1228, 1229, 3, 443, 221, 0, 1229, 1230, 3, 409, 204, 0, 1230, 200, 1, 0, 0, 0, 1231, 1232, 3, 423, 211, 0, 1232, 1233, 3, 429, 214, 0, 1233, 1234, 3, 405, 202, 0, 1234, 1235, 3, 401, 200, 0, 1235, 1236, 3, 423, 211, 0, 1236, 202, 1, 0, 0, 0, 1237, 1238, 3, 423, 211, 0, 1238, 1239, 3, 429, 214, 0, 1239, 1240, 3, 413, 206, 0, 1240, 1241, 3, 437, 218, 0, 1241, 204, 1, 0, 0, 0, 1242, 1243, 3, 425, 212, 0, 1243, 1244, 3, 401, 200, 0, 1244, 1245, 3, 439, 219, 0, 1245, 1246, 3, 409, 204, 0, 1246, 1247, 3, 435, 217, 0, 1247, 1248, 3, 417, 208, 0, 1248, 1249, 3, 401, 200, 0, 1249, 1250, 3, 423, 211, 0, 1250, 1251, 3, 417, 208, 0, 1251, 1252, 3, 451, 225, 0, 1252, 1253, 3, 409, 204, 0, 1253, 206, 1, 0, 0, 0, 1254, 1255, 3, 425, 212, 0, 1255, 1256, 3, 401, 200, 0, 1256, 1257, 3, 439, 219, 0, 1257, 1258, 3, 409, 204, 0, 1258, 1259, 3, 435, 217, 0, 1259, 1260, 3, 417, 208, 0, 1260, 1261, 3, 401, 200, 0, 1261, 1262, 3, 423, 211, 0, 1262, 1263, 3, 417, 208, 0, 1263, 1264, 3, 451, 225, 0, 1264, 1265, 3, 409, 204, 0, 1265, 1266, 3, 407, 203, 0, 1266, 208, 1, 0, 0, 0, 1267, 1268, 3, 425, 212, 0, 1268, 1269, 3, 401, 200, 0, 1269, 1270, 3, 447, 223, 0, 1270, 210, 1, 0, 0, 0, 1271, 1272, 3, 425, 212, 0, 1272, 1273, 3, 409, 204, 0, 1273, 1274, 3, 435, 217, 0, 1274, 1275, 3, 413, 206, 0, 1275, 1276, 3, 409, 204, 0, 1276, 1277, 3, 437, 218, 0, 1277, 212, 1, 0, 0, 0, 1278, 1279, 3, 425, 212, 0, 1279, 1280, 3, 417, 208, 0, 1280, 1281, 3, 427, 213, 0, 1281, 214, 1, 0, 0, 0, 1282, 1283, 3, 425, 212, 0, 1283, 1284, 3, 417, 208, 0, 1284, 1285, 3, 427, 213, 0, 1285, 1286, 3, 441, 220, 0, 1286, 1287, 3, 439, 219, 0, 1287, 1288, 3, 409, 204, 0, 1288, 216, 1, 0, 0, 0, 1289, 1290, 3, 425, 212, 0, 1290, 1291, 3, 429, 214, 0, 1291, 1292, 3, 407, 203, 0, 1292, 1293, 3, 417, 208, 0, 1293, 1294, 3, 411, 205, 0, 1294, 1295, 3, 449, 224, 0, 1295, 218, 1, 0, 0, 0, 1296, 1297, 3, 425, 212, 0, 1297, 1298, 3, 429, 214, 0, 1298, 1299, 3, 427, 213, 0, 1299, 1300, 3, 439, 219, 0, 1300, 1301, 3, 415, 207, 0, 1301, 220, 1, 0, 0, 0, 1302, 1303, 3, 425, 212, 0, 1303, 1304, 3, 429, 214, 0, 1304, 1305, 3, 443, 221, 0, 1305, 1306, 3, 409, 204, 0, 1306, 222, 1, 0, 0, 0, 1307, 1308, 3, 425, 212, 0, 1308, 1309, 3, 441, 220, 0, 1309, 1310, 3, 439, 219, 0, 1310, 1311, 3, 401, 200, 0, 1311, 1312, 3, 439, 219, 0, 1312, 1313, 3, 417, 208, 0, 1313, 1314, 3, 429, 214, 0, 1314, 1315, 3, 427, 213, 0, 1315, 224, 1, 0, 0, 0, 1316, 1317, 3, 427, 213, 0, 1317, 1318, 3, 401, 200, 0, 1318, 1319, 3, 427, 213, 0, 1319, 226, 1, 0, 0, 0, 1320, 1321, 3, 427, 213, 0, 1321, 1322, 3, 429, 214, 0, 1322, 228, 1, 0, 0, 0, 1323, 1324, 3, 427, 213, 0, 1324, 1325, 3, 429, 214, 0, 1325, 1326, 3, 439, 219, 0, 1326, 230, 1, 0, 0, 0, 1327, 1328, 3, 427, 213, 0, 1328, 1329, 3, 441, 220, 0, 1329, 1330, 3, 423, 211, 0, 1330, 1331, 3, 423, 211, 0, 1331, 232, 1, 0, 0, 0, 1332, 1333, 3, 427, 213, 0, 1333, 1334, 3, 441, 220, 0, 1334, 1335, 3, 423, 211, 0, 1335, 1336, 3, 423, 211, 0, 1336, 1337, 3, 437, 218, 0, 1337, 234, 1, 0, 0, 0, 1338, 1339, 3, 429, 214, 0, 1339, 1340, 3, 411, 205, 0, 1340, 1341, 3, 411, 205, 0, 1341, 1342, 3, 437, 218, 0, 1342, 1343, 3, 409, 204, 0, 1343, 1344, 3, 439, 219, 0, 1344, 236, 1, 0, 0, 0, 1345, 1346, 3, 429, 214, 0, 1346, 1347, 3, 427, 213, 0, 1347, 238, 1, 0, 0, 0, 1348, 1349, 3, 429, 214, 0, 1349, 1350, 3, 431, 215, 0, 1350, 1351, 3, 439, 219, 0, 1351, 1352, 3, 417, 208, 0, 1352, 1353, 3, 425, 212, 0, 1353, 1354, 3, 417, 208, 0, 1354, 1355, 3, 451, 225, 0, 1355, 1356, 3, 409, 204, 0, 1356, 240, 1, 0, 0, 0, 1357, 1358, 3, 429, 214, 0, 1358, 1359, 3, 435, 217, 0, 1359, 242, 1, 0, 0, 0, 1360, 1361, 3, 429, 214, 0, 1361, 1362, 3, 435, 217, 0, 1362, 1363, 3, 407, 203, 0, 1363, 1364, 3, 409, 204, 0, 1364, 1365, 3, 435, 217, 0, 1365, 244, 1, 0, 0, 0, 1366, 1367, 3, 429, 214, 0, 1367, 1368, 3, 441, 220, 0, 1368, 1369, 3, 439, 219, 0, 1369, 1370, 3, 409, 204, 0, 1370, 1371, 3, 435, 217, 0, 1371, 246, 1, 0, 0, 0, 1372, 1373, 3, 429, 214, 0, 1373, 1374, 3, 441, 220, 0, 1374, 1375, 3, 439, 219, 0, 1375, 1376, 3, 411, 205, 0, 1376, 1377, 3, 417, 208, 0, 1377, 1378, 3, 423, 211, 0, 1378, 1379, 3, 409, 204, 0, 1379, 248, 1, 0, 0, 0, 1380, 1381, 3, 429, 214, 0, 1381, 1382, 3, 443, 221, 0, 1382, 1383, 3, 409, 204, 0, 1383, 1384, 3, 435, 217, 0, 1384, 250, 1, 0, 0, 0, 1385, 1386, 3, 431, 215, 0, 1386, 1387, 3, 401, 200, 0, 1387, 1388, 3, 435, 217, 0, 1388, 1389, 3, 439, 219, 0, 1389, 1390, 3, 417, 208, 0, 1390, 1391, 3, 439, 219, 0, 1391, 1392, 3, 417, 208, 0, 1392, 1393, 3, 429, 214, 0, 1393, 1394, 3, 427, 213, 0, 1394, 252, 1, 0, 0, 0, 1395, 1396, 3, 431, 215, 0, 1396, 1397, 3, 429, 214, 0, 1397, 1398, 3, 431, 215, 0, 1398, 1399, 3, 441, 220, 0, 1399, 1400, 3, 423, 211, 0, 1400, 1401, 3, 401, 200, 0, 1401, 1402, 3, 439, 219, 0, 1402, 1403, 3, 409, 204, 0, 1403, 254, 1, 0, 0, 0, 1404, 1405, 3, 431, 215, 0, 1405, 1406, 3, 435, 217, 0, 1406, 1407, 3, 409, 204, 0, 1407, 1408, 3, 405, 202, 0, 1408, 1409, 3, 409, 204, 0, 1409, 1410, 3, 407, 203, 0, 1410, 1411, 3, 417, 208, 0, 1411, 1412, 3, 427, 213, 0, 1412, 1413, 3, 413, 206, 0, 1413, 256, 1, 0, 0, 0, 1414, 1415, 3, 431, 215, 0, 1415, 1416, 3, 435, 217, 0, 1416, 1417, 3, 409, 204, 0, 1417, 1418, 3, 445, 222, 0, 1418, 1419, 3, 415, 207, 0, 1419, 1420, 3, 409, 204, 0, 1420, 1421, 3, 435, 217, 0, 1421, 1422, 3, 409, 204, 0, 1422, 258, 1, 0, 0, 0, 1423, 1424, 3, 431, 215, 0, 1424, 1425, 3, 435, 217, 0, 1425, 1426, 3, 417, 208, 0, 1426, 1427, 3, 425, 212, 0, 1427, 1428, 3, 401, 200, 0, 1428, 1429, 3, 435, 217, 0, 1429, 1430, 3, 449, 224, 0, 1430, 260, 1, 0, 0, 0, 1431, 1432, 3, 431, 215, 0, 1432, 1433, 3, 435, 217, 0, 1433, 1434, 3, 429, 214, 0, 1434, 1435, 3, 419, 209, 0, 1435, 1436, 3, 409, 204, 0, 1436, 1437, 3, 405, 202, 0, 1437, 1438, 3, 439, 219, 0, 1438, 1439, 3, 417, 208, 0, 1439, 1440, 3, 429, 214, 0, 1440, 1441, 3, 427, 213, 0, 1441, 262, 1, 0, 0, 0, 1442, 1443, 3, 433, 216, 0, 1443, 1444, 3, 441, 220, 0, 1444, 1445, 3, 401, 200, 0, 1445, 1446, 3, 435, 217, 0, 1446, 1447, 3, 439, 219, 0, 1447, 1448, 3, 409, 204, 0, 1448, 1449, 3, 435, 217, 0, 1449, 264, 1, 0, 0, 0, 1450, 1451, 3, 435, 217, 0, 1451, 1452, 3, 401, 200, 0, 1452, 1453, 3, 427, 213, 0, 1453, 1454, 3, 413, 206, 0, 1454, 1455, 3, 409, 204, 0, 1455, 266, 1, 0, 0, 0, 1456, 1457, 3, 435, 217, 0, 1457, 1458, 3, 409, 204, 0, 1458, 1459, 3, 423, 211, 0, 1459, 1460, 3, 429, 214, 0, 1460, 1461, 3, 401, 200, 0, 1461, 1462, 3, 407, 203, 0, 1462, 268, 1, 0, 0, 0, 1463, 1464, 3, 435, 217, 0, 1464, 1465, 3, 409, 204, 0, 1465, 1466, 3, 425, 212, 0, 1466, 1467, 3, 429, 214, 0, 1467, 1468, 3, 443, 221, 0, 1468, 1469, 3, 409, 204, 0, 1469, 270, 1, 0, 0, 0, 1470, 1471, 3, 435, 217, 0, 1471, 1472, 3, 409, 204, 0, 1472, 1473, 3, 427, 213, 0, 1473, 1474, 3, 401, 200, 0, 1474, 1475, 3, 425, 212, 0, 1475, 1476, 3, 409, 204, 0, 1476, 272, 1, 0, 0, 0, 1477, 1478, 3, 435, 217, 0, 1478, 1479, 3, 409, 204, 0, 1479, 1480, 3, 431, 215, 0, 1480, 1481, 3, 423, 211, 0, 1481, 1482, 3, 401, 200, 0, 1482, 1483, 3, 405, 202, 0, 1483, 1484, 3, 409, 204, 0, 1484, 274, 1, 0, 0, 0, 1485, 1486, 3, 435, 217, 0, 1486, 1487, 3, 409, 204, 0, 1487, 1488, 3, 431, 215, 0, 1488, 1489, 3, 423, 211, 0, 1489, 1490, 3, 417, 208, 0, 1490, 1491, 3, 405, 202, 0, 1491, 1492, 3, 401, 200, 0, 1492, 276, 1, 0, 0, 0, 1493, 1494, 3, 435, 217, 0, 1494, 1495, 3, 409, 204, 0, 1495, 1496, 3, 431, 215, 0, 1496, 1497, 3, 423, 211, 0, 1497, 1498, 3, 417, 208, 0, 1498, 1499, 3, 405, 202, 0, 1499, 1500, 3, 401, 200, 0, 1500, 1501, 3, 439, 219, 0, 1501, 1502, 3, 409, 204, 0, 1502, 1503, 3, 407, 203, 0, 1503, 278, 1, 0, 0, 0, 1504, 1505, 3, 435, 217, 0, 1505, 1506, 3, 417, 208, 0, 1506, 1507, 3, 413, 206, 0, 1507, 1508, 3, 415, 207, 0, 1508, 1509, 3, 439, 219, 0, 1509, 280, 1, 0, 0, 0, 1510, 1511, 3, 435, 217, 0, 1511, 1512, 3, 429, 214, 0, 1512, 1513, 3, 423, 211, 0, 1513, 1514, 3, 423, 211, 0, 1514, 1515, 3, 441, 220, 0, 1515, 1516, 3, 431, 215, 0, 1516, 282, 1, 0, 0, 0, 1517, 1518, 3, 435, 217, 0, 1518, 1519, 3, 429, 214, 0, 1519, 1520, 3, 445, 222, 0, 1520, 284, 1, 0, 0, 0, 1521, 1522, 3, 435, 217, 0, 1522, 1523, 3, 429, 214, 0, 1523, 1524, 3, 445, 222, 0, 1524, 1525, 3, 437, 218, 0, 1525, 286, 1, 0, 0, 0, 1526, 1527, 3, 437, 218, 0, 1527, 1528, 3, 401, 200, 0, 1528, 1529, 3, 425, 212, 0, 1529, 1530, 3, 431, 215, 0, 1530, 1531, 3, 423, 211, 0, 1531, 1532, 3, 409, 204, 0, 1532, 288, 1, 0, 0, 0, 1533, 1534, 3, 437, 218, 0, 1534, 1535, 3, 409, 204, 0, 1535, 1536, 3, 405, 202, 0, 1536, 1537, 3, 429, 214, 0, 1537, 1538, 3, 427, 213, 0, 1538, 1539, 3, 407, 203, 0, 1539, 290, 1, 0, 0, 0, 1540, 1541, 3, 437, 218, 0, 1541, 1542, 3, 409, 204, 0, 1542, 1543, 3, 423, 211, 0, 1543, 1544, 3, 409, 204, 0, 1544, 1545, 3, 405, 202, 0, 1545, 1546, 3, 439, 219, 0, 1546, 292, 1, 0, 0, 0, 1547, 1548, 3, 437, 218, 0, 1548, 1549, 3, 409, 204, 0, 1549, 1550, 3, 425, 212, 0, 1550, 1551, 3, 417, 208, 0, 1551, 294, 1, 0, 0, 0, 1552, 1553, 3, 437, 218, 0, 1553, 1554, 3, 409, 204, 0, 1554, 1555, 3, 427, 213, 0, 1555, 1556, 3, 407, 203, 0, 1556, 1557, 3, 437, 218, 0, 1557, 296, 1, 0, 0, 0, 1558, 1559, 3, 437, 218, 0, 1559, 1560, 3, 409, 204, 0, 1560, 1561, 3, 439, 219, 0, 1561, 298, 1, 0, 0, 0, 1562, 1563, 3, 437, 218, 0, 1563, 1564, 3, 409, 204, 0, 1564, 1565, 3, 439, 219, 0, 1565, 1566, 3, 439, 219, 0, 1566, 1567, 3, 417, 208, 0, 1567, 1568, 3, 427, 213, 0, 1568, 1569, 3, 413, 206, 0, 1569, 1570, 3, 437, 218, 0, 1570, 300, 1, 0, 0, 0, 1571, 1572, 3, 437, 218, 0, 1572, 1573, 3, 415, 207, 0, 1573, 1574, 3, 429, 214, 0, 1574, 1575, 3, 445, 222, 0, 1575, 302, 1, 0, 0, 0, 1576, 1577, 3, 437, 218, 0, 1577, 1578, 3, 429, 214, 0, 1578, 1579, 3, 441, 220, 0, 1579, 1580, 3, 435, 217, 0, 1580, 1581, 3, 405, 202, 0, 1581, 1582, 3, 409, 204, 0, 1582, 304, 1, 0, 0, 0, 1583, 1584, 3, 437, 218, 0, 1584, 1585, 3, 439, 219, 0, 1585, 1586, 3, 401, 200, 0, 1586, 1587, 3, 435, 217, 0, 1587, 1588, 3, 439, 219, 0, 1588, 306, 1, 0, 0, 0, 1589, 1590, 3, 437, 218, 0, 1590, 1591, 3, 439, 219, 0, 1591, 1592, 3, 429, 214, 0, 1592, 1593, 3, 431, 215, 0, 1593, 308, 1, 0, 0, 0, 1594, 1595, 3, 437, 218, 0, 1595, 1596, 3, 441, 220, 0, 1596, 1597, 3, 403, 201, 0, 1597, 1598, 3, 437, 218, 0, 1598, 1599, 3, 439, 219, 0, 1599, 1600, 3, 435, 217, 0, 1600, 1601, 3, 417, 208, 0, 1601, 1602, 3, 427, 213, 0, 1602, 1603, 3, 413, 206, 0, 1603, 310, 1, 0, 0, 0, 1604, 1605, 3, 437, 218, 0, 1605, 1606, 3, 449, 224, 0, 1606, 1607, 3, 427, 213, 0, 1607, 1608, 3, 405, 202, 0, 1608, 312, 1, 0, 0, 0, 1609, 1610, 3, 437, 218, 0, 1610, 1611, 3, 449, 224, 0, 1611, 1612, 3, 427, 213, 0, 1612, 1613, 3, 439, 219, 0, 1613, 1614, 3, 401, 200, 0, 1614, 1615, 3, 447, 223, 0, 1615, 314, 1, 0, 0, 0, 1616, 1617, 3, 437, 218, 0, 1617, 1618, 3, 449, 224, 0, 1618, 1619, 3, 437, 218, 0, 1619, 1620, 3, 439, 219, 0, 1620, 1621, 3, 409, 204, 0, 1621, 1622, 3, 425, 212, 0, 1622, 316, 1, 0, 0, 0, 1623, 1624, 3, 439, 219, 0, 1624, 1625, 3, 401, 200, 0, 1625, 1626, 3, 403, 201, 0, 1626, 1627, 3, 423, 211, 0, 1627, 1628, 3, 409, 204, 0, 1628, 318, 1, 0, 0, 0, 1629, 1630, 3, 439, 219, 0, 1630, 1631, 3, 401, 200, 0, 1631, 1632, 3, 403, 201, 0, 1632, 1633, 3, 423, 211, 0, 1633, 1634, 3, 409, 204, 0, 1634, 1635, 3, 437, 218, 0, 1635, 320, 1, 0, 0, 0, 1636, 1637, 3, 439, 219, 0, 1637, 1638, 3, 409, 204, 0, 1638, 1639, 3, 425, 212, 0, 1639, 1640, 3, 431, 215, 0, 1640, 1641, 3, 429, 214, 0, 1641, 1642, 3, 435, 217, 0, 1642, 1643, 3, 401, 200, 0, 1643, 1644, 3, 435, 217, 0, 1644, 1645, 3, 449, 224, 0, 1645, 322, 1, 0, 0, 0, 1646, 1647, 3, 439, 219, 0, 1647, 1648, 3, 409, 204, 0, 1648, 1649, 3, 437, 218, 0, 1649, 1650, 3, 439, 219, 0, 1650, 324, 1, 0, 0, 0, 1651, 1652, 3, 439, 219, 0, 1652, 1653, 3, 415, 207, 0, 1653, 1654, 3, 409, 204, 0, 1654, 1655, 3, 427, 213, 0, 1655, 326, 1, 0, 0, 0, 1656, 1657, 3, 439, 219, 0, 1657, 1658, 3, 417, 208, 0, 1658, 1659, 3, 409, 204, 0, 1659, 1660, 3, 437, 218, 0, 1660, 328, 1, 0, 0, 0, 1661, 1662, 3, 439, 219, 0, 1662, 1663, 3, 417, 208, 0, 1663, 1664, 3, 425, 212, 0, 1664, 1665, 3, 409, 204, 0, 1665, 1666, 3, 429, 214, 0, 1666, 1667, 3, 441, 220, 0, 1667, 1668, 3, 439, 219, 0, 1668, 330, 1, 0, 0, 0, 1669, 1670, 3, 439, 219, 0, 1670, 1671, 3, 417, 208, 0, 1671, 1672, 3, 425, 212, 0, 1672, 1673, 3, 409, 204, 0, 1673, 1674, 3, 437, 218, 0, 1674, 1675, 3, 439, 219, 0, 1675, 1676, 3, 401, 200, 0, 1676, 1677, 3, 425, 212, 0, 1677, 1678, 3, 431, 215, 0, 1678, 332, 1, 0, 0, 0, 1679, 1680, 3, 439, 219, 0, 1680, 1681, 3, 429, 214, 0, 1681, 334, 1, 0, 0, 0, 1682, 1683, 3, 439, 219, 0, 1683, 1684, 3, 429, 214, 0, 1684, 1685, 3, 431, 215, 0, 1685, 336, 1, 0, 0, 0, 1686, 1687, 3, 439, 219, 0, 1687, 1688, 3, 429, 214, 0, 1688, 1689, 3, 439, 219, 0, 1689, 1690, 3, 401, 200, 0, 1690, 1691, 3, 423, 211, 0, 1691, 1692, 3, 437, 218, 0, 1692, 338, 1, 0, 0, 0, 1693, 1694, 3, 439, 219, 0, 1694, 1695, 3, 435, 217, 0, 1695, 1696, 3, 401, 200, 0, 1696, 1697, 3, 417, 208, 0, 1697, 1698, 3, 423, 211, 0, 1698, 1699, 3, 417, 208, 0, 1699, 1700, 3, 427, 213, 0, 1700, 1701, 3, 413, 206, 0, 1701, 340, 1, 0, 0, 0, 1702, 1703, 3, 439, 219, 0, 1703, 1704, 3, 435, 217, 0, 1704, 1705, 3, 417, 208, 0, 1705, 1706, 3, 425, 212, 0, 1706, 342, 1, 0, 0, 0, 1707, 1708, 3, 439, 219, 0, 1708, 1709, 3, 435, 217, 0, 1709, 1710, 3, 441, 220, 0, 1710, 1711, 3, 427, 213, 0, 1711, 1712, 3, 405, 202, 0, 1712, 1713, 3, 401, 200, 0, 1713, 1714, 3, 439, 219, 0, 1714, 1715, 3, 409, 204, 0, 1715, 344, 1, 0, 0, 0, 1716, 1717, 3, 439, 219, 0, 1717, 1718, 3, 439, 219, 0, 1718, 1719, 3, 423, 211, 0, 1719, 346, 1, 0, 0, 0, 1720, 1721, 3, 439, 219, 0, 1721, 1722, 3, 449, 224, 0, 1722, 1723, 3, 431, 215, 0, 1723, 1724, 3, 409, 204, 0, 1724, 348, 1, 0, 0, 0, 1725, 1726, 3, 441, 220, 0, 1726, 1727, 3, 427, 213, 0, 1727, 1728, 3, 403, 201, 0, 1728, 1729, 3, 429, 214, 0, 1729, 1730, 3, 441, 220, 0, 1730, 1731, 3, 427, 213, 0, 1731, 1732, 3, 407, 203, 0, 1732, 1733, 3, 409, 204, 0, 1733, 1734, 3, 407, 203, 0, 1734, 350, 1, 0, 0, 0, 1735, 1736, 3, 441, 220, 0, 1736, 1737, 3, 427, 213, 0, 1737, 1738, 3, 417, 208, 0, 1738, 1739, 3, 429, 214, 0, 1739, 1740, 3, 427, 213, 0, 1740, 352, 1, 0, 0, 0, 1741, 1742, 3, 441, 220, 0, 1742, 1743, 3, 431, 215, 0, 1743, 1744, 3, 407, 203, 0, 1744, 1745, 3, 401, 200, 0, 1745, 1746, 3, 439, 219, 0, 1746, 1747, 3, 409, 204, 0, 1747, 354, 1, 0, 0, 0, 1748, 1749, 3, 441, 220, 0, 1749, 1750, 3, 437, 218, 0, 1750, 1751, 3, 409, 204, 0, 1751, 356, 1, 0, 0, 0, 1752, 1753, 3, 441, 220, 0, 1753, 1754, 3, 437, 218, 0, 1754, 1755, 3, 417, 208, 0, 1755, 1756, 3, 427, 213, 0, 1756, 1757, 3, 413, 206, 0, 1757, 358, 1, 0, 0, 0, 1758, 1759, 3, 441, 220, 0, 1759, 1760, 3, 441, 220, 0, 1760, 1761, 3, 417, 208, 0, 1761, 1762, 3, 407, 203, 0, 1762, 360, 1, 0, 0, 0, 1763, 1764, 3, 443, 221, 0, 1764, 1765, 3, 401, 200, 0, 1765, 1766, 3, 423, 211, 0, 1766, 1767, 3, 441, 220, 0, 1767, 1768, 3, 409, 204, 0, 1768, 1769, 3, 437, 218, 0, 1769, 362, 1, 0, 0, 0, 1770, 1771, 3, 443, 221, 0, 1771, 1772, 3, 417, 208, 0, 1772, 1773, 3, 409, 204, 0, 1773, 1774, 3, 445, 222, 0, 1774, 364, 1, 0, 0, 0, 1775, 1776, 3, 443, 221, 0, 1776, 1777, 3, 429, 214, 0, 1777, 1778, 3, 423, 211, 0, 1778, 1779, 3, 441, 220, 0, 1779, 1780, 3, 425, 212, 0, 1780, 1781, 3, 409, 204, 0, 1781, 366, 1, 0, 0, 0, 1782, 1783, 3, 445, 222, 0, 1783, 1784, 3, 401, 200, 0, 1784, 1785, 3, 439, 219, 0, 1785, 1786, 3, 405, 202, 0, 1786, 1787, 3, 415, 207, 0, 1787, 368, 1, 0, 0, 0, 1788, 1789, 3, 445, 222, 0, 1789, 1790, 3, 409, 204, 0, 1790, 1791, 3, 409, 204, 0, 1791, 1792, 3, 421, 210, 0, 1792, 370, 1, 0, 0, 0, 1793, 1794, 3, 445, 222, 0, 1794, 1795, 3, 415, 207, 0, 1795, 1796, 3, 409, 204, 0, 1796, 1797, 3, 427, 213, 0, 1797, 372, 1, 0, 0, 0, 1798, 1799, 3, 445, 222, 0, 1799, 1800, 3, 415, 207, 0, 1800, 1801, 3, 409, 204, 0, 1801, 1802, 3, 435, 217, 0, 1802, 1803, 3, 409, 204, 0, 1803, 374, 1, 0, 0, 0, 1804, 1805, 3, 445, 222, 0, 1805, 1806, 3, 417, 208, 0, 1806, 1807, 3, 427, 213, 0, 1807, 1808, 3, 407, 203, 0, 1808, 1809, 3, 429, 214, 0, 1809, 1810, 3, 445, 222, 0, 1810, 376, 1, 0, 0, 0, 1811, 1812, 3, 445, 222, 0, 1812, 1813, 3, 417, 208, 0, 1813, 1814, 3, 439, 219, 0, 1814, 1815, 3, 415, 207, 0, 1815, 378, 1, 0, 0, 0, 1816, 1817, 3, 449, 224, 0, 1817, 1818, 3, 409, 204, 0, 1818, 1819, 3, 401, 200, 0, 1819, 1820, 3, 435, 217, 0, 1820, 1827, 1, 0, 0, 0, 1821, 1822, 3, 449, 224, 0, 1822, 1823, 3, 449, 224, 0, 1823, 1824, 3, 449, 224, 0, 1824, 1825, 3, 449, 224, 0, 1825, 1827, 1, 0, 0, 0, 1826, 1816, 1, 0, 0, 0, 1826, 1821, 1, 0, 0, 0, 1827, 380, 1, 0, 0, 0, 1828, 1829, 5, 102, 0, 0, 1829, 1830, 5, 97, 0, 0, 1830, 1831, 5, 108, 0, 0, 1831, 1832, 5, 115, 0, 0, 1832, 1833, 5, 101, 0, 0, 1833, 382, 1, 0, 0, 0, 1834, 1835, 5, 116, 0, 0, 1835, 1836, 5, 114, 0, 0, 1836, 1837, 5, 117, 0, 0, 1837, 1838, 5, 101, 0, 0, 1838, 384, 1, 0, 0, 0, 1839, 1840, 3, 467, 233, 0, 1840, 1841, 3, 403, 201, 0, 1841, 1870, 1, 0, 0, 0, 1842, 1843, 3, 467, 233, 0, 1843, 1844, 3, 411, 205, 0, 1844, 1870, 1, 0, 0, 0, 1845, 1846, 3, 467, 233, 0, 1846, 1847, 3, 435, 217, 0, 1847, 1870, 1, 0, 0, 0, 1848, 1849, 3, 467, 233, 0, 1849, 1850, 3, 427, 213, 0, 1850, 1870, 1, 0, 0, 0, 1851, 1852, 3, 467, 233, 0, 1852, 1853, 3, 439, 219, 0, 1853, 1870, 1, 0, 0, 0, 1854, 1855, 3, 467, 233, 0, 1855, 1856, 5, 48, 0, 0, 1856, 1870, 1, 0, 0, 0, 1857, 1858, 3, 467, 233, 0, 1858, 1859, 3, 401, 200, 0, 1859, 1870, 1, 0, 0, 0, 1860, 1861, 3, 467, 233, 0, 1861, 1862, 3, 443, 221, 0, 1862, 1870, 1, 0, 0, 0, 1863, 1864, 3, 467, 233, 0, 1864, 1865, 3, 467, 233, 0, 1865, 1870, 1, 0, 0, 0, 1866, 1867, 3, 467, 233, 0, 1867, 1868, 3, 521, 260, 0, 1868, 1870, 1, 0, 0, 0, 1869, 1839, 1, 0, 0, 0, 1869, 1842, 1, 0, 0, 0, 1869, 1845, 1, 0, 0, 0, 1869, 1848, 1, 0, 0, 0, 1869, 1851, 1, 0, 0, 0, 1869, 1854, 1, 0, 0, 0, 1869, 1857, 1, 0, 0, 0, 1869, 1860, 1, 0, 0, 0, 1869, 1863, 1, 0, 0, 0, 1869, 1866, 1, 0, 0, 0, 1870, 386, 1, 0, 0, 0, 1871, 1875, 3, 453, 226, 0, 1872, 1875, 3, 537, 268, 0, 1873, 1875, 3, 477, 238, 0, 1874, 1871, 1, 0, 0, 0, 1874, 1872, 1, 0, 0, 0, 1874, 1873, 1, 0, 0, 0, 1875, 1882, 1, 0, 0, 0, 1876, 1881, 3, 453, 226, 0, 1877, 1881, 3, 537, 268, 0, 1878, 1881, 3, 457, 228, 0, 1879, 1881, 3, 477, 238, 0, 1880, 1876, 1, 0, 0, 0, 1880, 1877, 1, 0, 0, 0, 1880, 1878, 1, 0, 0, 0, 1880, 1879, 1, 0, 0, 0, 1881, 1884, 1, 0, 0, 0, 1882, 1880, 1, 0, 0, 0, 1882, 1883, 1, 0, 0, 0, 1883, 1912, 1, 0, 0, 0, 1884, 1882, 1, 0, 0, 0, 1885, 1893, 3, 465, 232, 0, 1886, 1892, 8, 0, 0, 0, 1887, 1892, 3, 385, 192, 0, 1888, 1889, 3, 465, 232, 0, 1889, 1890, 3, 465, 232, 0, 1890, 1892, 1, 0, 0, 0, 1891, 1886, 1, 0, 0, 0, 1891, 1887, 1, 0, 0, 0, 1891, 1888, 1, 0, 0, 0, 1892, 1895, 1, 0, 0, 0, 1893, 1891, 1, 0, 0, 0, 1893, 1894, 1, 0, 0, 0, 1894, 1896, 1, 0, 0, 0, 1895, 1893, 1, 0, 0, 0, 1896, 1897, 3, 465, 232, 0, 1897, 1912, 1, 0, 0, 0, 1898, 1906, 3, 519, 259, 0, 1899, 1905, 8, 1, 0, 0, 1900, 1905, 3, 385, 192, 0, 1901, 1902, 3, 519, 259, 0, 1902, 1903, 3, 519, 259, 0, 1903, 1905, 1, 0, 0, 0, 1904, 1899, 1, 0, 0, 0, 1904, 1900, 1, 0, 0, 0, 1904, 1901, 1, 0, 0, 0, 1905, 1908, 1, 0, 0, 0, 1906, 1904, 1, 0, 0, 0, 1906, 1907, 1, 0, 0, 0, 1907, 1909, 1, 0, 0, 0, 1908, 1906, 1, 0, 0, 0, 1909, 1910, 3, 519, 259, 0, 1910, 1912, 1, 0, 0, 0, 1911, 1874, 1, 0, 0, 0, 1911, 1885, 1, 0, 0, 0, 1911, 1898, 1, 0, 0, 0, 1912, 388, 1, 0, 0, 0, 1913, 1914, 3, 395, 197, 0, 1914, 1918, 3, 479, 239, 0, 1915, 1917, 3, 459, 229, 0, 1916, 1915, 1, 0, 0, 0, 1917, 1920, 1, 0, 0, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, 0, 0, 1919, 1923, 1, 0, 0, 0, 1920, 1918, 1, 0, 0, 0, 1921, 1924, 3, 431, 215, 0, 1922, 1924, 3, 409, 204, 0, 1923, 1921, 1, 0, 0, 0, 1923, 1922, 1, 0, 0, 0, 1924, 1927, 1, 0, 0, 0, 1925, 1928, 3, 515, 257, 0, 1926, 1928, 3, 475, 237, 0, 1927, 1925, 1, 0, 0, 0, 1927, 1926, 1, 0, 0, 0, 1927, 1928, 1, 0, 0, 0, 1928, 1930, 1, 0, 0, 0, 1929, 1931, 3, 457, 228, 0, 1930, 1929, 1, 0, 0, 0, 1931, 1932, 1, 0, 0, 0, 1932, 1930, 1, 0, 0, 0, 1932, 1933, 1, 0, 0, 0, 1933, 1990, 1, 0, 0, 0, 1934, 1937, 3, 395, 197, 0, 1935, 1938, 3, 431, 215, 0, 1936, 1938, 3, 409, 204, 0, 1937, 1935, 1, 0, 0, 0, 1937, 1936, 1, 0, 0, 0, 1938, 1941, 1, 0, 0, 0, 1939, 1942, 3, 515, 257, 0, 1940, 1942, 3, 475, 237, 0, 1941, 1939, 1, 0, 0, 0, 1941, 1940, 1, 0, 0, 0, 1941, 1942, 1, 0, 0, 0, 1942, 1944, 1, 0, 0, 0, 1943, 1945, 3, 457, 228, 0, 1944, 1943, 1, 0, 0, 0, 1945, 1946, 1, 0, 0, 0, 1946, 1944, 1, 0, 0, 0, 1946, 1947, 1, 0, 0, 0, 1947, 1990, 1, 0, 0, 0, 1948, 1949, 3, 393, 196, 0, 1949, 1953, 3, 479, 239, 0, 1950, 1952, 3, 457, 228, 0, 1951, 1950, 1, 0, 0, 0, 1952, 1955, 1, 0, 0, 0, 1953, 1951, 1, 0, 0, 0, 1953, 1954, 1, 0, 0, 0, 1954, 1956, 1, 0, 0, 0, 1955, 1953, 1, 0, 0, 0, 1956, 1959, 3, 409, 204, 0, 1957, 1960, 3, 515, 257, 0, 1958, 1960, 3, 475, 237, 0, 1959, 1957, 1, 0, 0, 0, 1959, 1958, 1, 0, 0, 0, 1959, 1960, 1, 0, 0, 0, 1960, 1962, 1, 0, 0, 0, 1961, 1963, 3, 457, 228, 0, 1962, 1961, 1, 0, 0, 0, 1963, 1964, 1, 0, 0, 0, 1964, 1962, 1, 0, 0, 0, 1964, 1965, 1, 0, 0, 0, 1965, 1990, 1, 0, 0, 0, 1966, 1967, 3, 479, 239, 0, 1967, 1968, 3, 393, 196, 0, 1968, 1971, 3, 409, 204, 0, 1969, 1972, 3, 515, 257, 0, 1970, 1972, 3, 475, 237, 0, 1971, 1969, 1, 0, 0, 0, 1971, 1970, 1, 0, 0, 0, 1971, 1972, 1, 0, 0, 0, 1972, 1974, 1, 0, 0, 0, 1973, 1975, 3, 457, 228, 0, 1974, 1973, 1, 0, 0, 0, 1975, 1976, 1, 0, 0, 0, 1976, 1974, 1, 0, 0, 0, 1976, 1977, 1, 0, 0, 0, 1977, 1990, 1, 0, 0, 0, 1978, 1979, 3, 393, 196, 0, 1979, 1982, 3, 409, 204, 0, 1980, 1983, 3, 515, 257, 0, 1981, 1983, 3, 475, 237, 0, 1982, 1980, 1, 0, 0, 0, 1982, 1981, 1, 0, 0, 0, 1982, 1983, 1, 0, 0, 0, 1983, 1985, 1, 0, 0, 0, 1984, 1986, 3, 457, 228, 0, 1985, 1984, 1, 0, 0, 0, 1986, 1987, 1, 0, 0, 0, 1987, 1985, 1, 0, 0, 0, 1987, 1988, 1, 0, 0, 0, 1988, 1990, 1, 0, 0, 0, 1989, 1913, 1, 0, 0, 0, 1989, 1934, 1, 0, 0, 0, 1989, 1948, 1, 0, 0, 0, 1989, 1966, 1, 0, 0, 0, 1989, 1978, 1, 0, 0, 0, 1990, 390, 1, 0, 0, 0, 1991, 1993, 5, 48, 0, 0, 1992, 1994, 3, 455, 227, 0, 1993, 1992, 1, 0, 0, 0, 1994, 1995, 1, 0, 0, 0, 1995, 1993, 1, 0, 0, 0, 1995, 1996, 1, 0, 0, 0, 1996, 392, 1, 0, 0, 0, 1997, 1999, 3, 457, 228, 0, 1998, 1997, 1, 0, 0, 0, 1999, 2000, 1, 0, 0, 0, 2000, 1998, 1, 0, 0, 0, 2000, 2001, 1, 0, 0, 0, 2001, 394, 1, 0, 0, 0, 2002, 2003, 5, 48, 0, 0, 2003, 2005, 3, 447, 223, 0, 2004, 2006, 3, 459, 229, 0, 2005, 2004, 1, 0, 0, 0, 2006, 2007, 1, 0, 0, 0, 2007, 2005, 1, 0, 0, 0, 2007, 2008, 1, 0, 0, 0, 2008, 396, 1, 0, 0, 0, 2009, 2017, 3, 521, 260, 0, 2010, 2016, 8, 2, 0, 0, 2011, 2016, 3, 385, 192, 0, 2012, 2013, 3, 521, 260, 0, 2013, 2014, 3, 521, 260, 0, 2014, 2016, 1, 0, 0, 0, 2015, 2010, 1, 0, 0, 0, 2015, 2011, 1, 0, 0, 0, 2015, 2012, 1, 0, 0, 0, 2016, 2019, 1, 0, 0, 0, 2017, 2015, 1, 0, 0, 0, 2017, 2018, 1, 0, 0, 0, 2018, 2020, 1, 0, 0, 0, 2019, 2017, 1, 0, 0, 0, 2020, 2021, 3, 521, 260, 0, 2021, 398, 1, 0, 0, 0, 2022, 2030, 3, 495, 247, 0, 2023, 2029, 8, 3, 0, 0, 2024, 2029, 3, 385, 192, 0, 2025, 2026, 3, 495, 247, 0, 2026, 2027, 3, 495, 247, 0, 2027, 2029, 1, 0, 0, 0, 2028, 2023, 1, 0, 0, 0, 2028, 2024, 1, 0, 0, 0, 2028, 2025, 1, 0, 0, 0, 2029, 2032, 1, 0, 0, 0, 2030, 2028, 1, 0, 0, 0, 2030, 2031, 1, 0, 0, 0, 2031, 2033, 1, 0, 0, 0, 2032, 2030, 1, 0, 0, 0, 2033, 2034, 3, 527, 263, 0, 2034, 400, 1, 0, 0, 0, 2035, 2036, 7, 4, 0, 0, 2036, 402, 1, 0, 0, 0, 2037, 2038, 7, 5, 0, 0, 2038, 404, 1, 0, 0, 0, 2039, 2040, 7, 6, 0, 0, 2040, 406, 1, 0, 0, 0, 2041, 2042, 7, 7, 0, 0, 2042, 408, 1, 0, 0, 0, 2043, 2044, 7, 8, 0, 0, 2044, 410, 1, 0, 0, 0, 2045, 2046, 7, 9, 0, 0, 2046, 412, 1, 0, 0, 0, 2047, 2048, 7, 10, 0, 0, 2048, 414, 1, 0, 0, 0, 2049, 2050, 7, 11, 0, 0, 2050, 416, 1, 0, 0, 0, 2051, 2052, 7, 12, 0, 0, 2052, 418, 1, 0, 0, 0, 2053, 2054, 7, 13, 0, 0, 2054, 420, 1, 0, 0, 0, 2055, 2056, 7, 14, 0, 0, 2056, 422, 1, 0, 0, 0, 2057, 2058, 7, 15, 0, 0, 2058, 424, 1, 0, 0, 0, 2059, 2060, 7, 16, 0, 0, 2060, 426, 1, 0, 0, 0, 2061, 2062, 7, 17, 0, 0, 2062, 428, 1, 0, 0, 0, 2063, 2064, 7, 18, 0, 0, 2064, 430, 1, 0, 0, 0, 2065, 2066, 7, 19, 0, 0, 2066, 432, 1, 0, 0, 0, 2067, 2068, 7, 20, 0, 0, 2068, 434, 1, 0, 0, 0, 2069, 2070, 7, 21, 0, 0, 2070, 436, 1, 0, 0, 0, 2071, 2072, 7, 22, 0, 0, 2072, 438, 1, 0, 0, 0, 2073, 2074, 7, 23, 0, 0, 2074, 440, 1, 0, 0, 0, 2075, 2076, 7, 24, 0, 0, 2076, 442, 1, 0, 0, 0, 2077, 2078, 7, 25, 0, 0, 2078, 444, 1, 0, 0, 0, 2079, 2080, 7, 26, 0, 0, 2080, 446, 1, 0, 0, 0, 2081, 2082, 7, 27, 0, 0, 2082, 448, 1, 0, 0, 0, 2083, 2084, 7, 28, 0, 0, 2084, 450, 1, 0, 0, 0, 2085, 2086, 7, 29, 0, 0, 2086, 452, 1, 0, 0, 0, 2087, 2088, 7, 30, 0, 0, 2088, 454, 1, 0, 0, 0, 2089, 2090, 7, 31, 0, 0, 2090, 456, 1, 0, 0, 0, 2091, 2092, 7, 32, 0, 0, 2092, 458, 1, 0, 0, 0, 2093, 2094, 7, 33, 0, 0, 2094, 460, 1, 0, 0, 0, 2095, 2096, 5, 45, 0, 0, 2096, 2097, 5, 62, 0, 0, 2097, 462, 1, 0, 0, 0, 2098, 2099, 5, 42, 0, 0, 2099, 464, 1, 0, 0, 0, 2100, 2101, 5, 96, 0, 0, 2101, 466, 1, 0, 0, 0, 2102, 2103, 5, 92, 0, 0, 2103, 468, 1, 0, 0, 0, 2104, 2105, 5, 58, 0, 0, 2105, 470, 1, 0, 0, 0, 2106, 2107, 5, 44, 0, 0, 2107, 472, 1, 0, 0, 0, 2108, 2109, 5, 124, 0, 0, 2109, 2110, 5, 124, 0, 0, 2110, 474, 1, 0, 0, 0, 2111, 2112, 5, 45, 0, 0, 2112, 476, 1, 0, 0, 0, 2113, 2114, 5, 36, 0, 0, 2114, 478, 1, 0, 0, 0, 2115, 2116, 5, 46, 0, 0, 2116, 480, 1, 0, 0, 0, 2117, 2118, 5, 61, 0, 0, 2118, 2119, 5, 61, 0, 0, 2119, 482, 1, 0, 0, 0, 2120, 2121, 5, 61, 0, 0, 2121, 484, 1, 0, 0, 0, 2122, 2123, 5, 62, 0, 0, 2123, 2124, 5, 61, 0, 0, 2124, 486, 1, 0, 0, 0, 2125, 2126, 5, 62, 0, 0, 2126, 488, 1, 0, 0, 0, 2127, 2128, 5, 35, 0, 0, 2128, 490, 1, 0, 0, 0, 2129, 2130, 5, 126, 0, 0, 2130, 2131, 5, 42, 0, 0, 2131, 492, 1, 0, 0, 0, 2132, 2133, 5, 61, 0, 0, 2133, 2134, 5, 126, 0, 0, 2134, 2135, 5, 42, 0, 0, 2135, 494, 1, 0, 0, 0, 2136, 2137, 5, 123, 0, 0, 2137, 496, 1, 0, 0, 0, 2138, 2139, 5, 91, 0, 0, 2139, 498, 1, 0, 0, 0, 2140, 2141, 5, 40, 0, 0, 2141, 500, 1, 0, 0, 0, 2142, 2143, 5, 60, 0, 0, 2143, 2144, 5, 61, 0, 0, 2144, 502, 1, 0, 0, 0, 2145, 2146, 5, 60, 0, 0, 2146, 504, 1, 0, 0, 0, 2147, 2148, 5, 33, 0, 0, 2148, 2152, 5, 61, 0, 0, 2149, 2150, 5, 60, 0, 0, 2150, 2152, 5, 62, 0, 0, 2151, 2147, 1, 0, 0, 0, 2151, 2149, 1, 0, 0, 0, 2152, 506, 1, 0, 0, 0, 2153, 2154, 5, 33, 0, 0, 2154, 2155, 5, 126, 0, 0, 2155, 2156, 5, 42, 0, 0, 2156, 508, 1, 0, 0, 0, 2157, 2158, 5, 33, 0, 0, 2158, 2159, 5, 126, 0, 0, 2159, 510, 1, 0, 0, 0, 2160, 2161, 5, 63, 0, 0, 2161, 2162, 5, 63, 0, 0, 2162, 512, 1, 0, 0, 0, 2163, 2164, 5, 37, 0, 0, 2164, 514, 1, 0, 0, 0, 2165, 2166, 5, 43, 0, 0, 2166, 516, 1, 0, 0, 0, 2167, 2168, 5, 63, 0, 0, 2168, 518, 1, 0, 0, 0, 2169, 2170, 5, 34, 0, 0, 2170, 520, 1, 0, 0, 0, 2171, 2172, 5, 39, 0, 0, 2172, 522, 1, 0, 0, 0, 2173, 2174, 5, 126, 0, 0, 2174, 524, 1, 0, 0, 0, 2175, 2176, 5, 61, 0, 0, 2176, 2177, 5, 126, 0, 0, 2177, 526, 1, 0, 0, 0, 2178, 2179, 5, 125, 0, 0, 2179, 528, 1, 0, 0, 0, 2180, 2181, 5, 93, 0, 0, 2181, 530, 1, 0, 0, 0, 2182, 2183, 5, 41, 0, 0, 2183, 532, 1, 0, 0, 0, 2184, 2185, 5, 59, 0, 0, 2185, 534, 1, 0, 0, 0, 2186, 2187, 5, 47, 0, 0, 2187, 536, 1, 0, 0, 0, 2188, 2189, 5, 95, 0, 0, 2189, 538, 1, 0, 0, 0, 2190, 2191, 5, 47, 0, 0, 2191, 2192, 5, 42, 0, 0, 2192, 2196, 1, 0, 0, 0, 2193, 2195, 9, 0, 0, 0, 2194, 2193, 1, 0, 0, 0, 2195, 2198, 1, 0, 0, 0, 2196, 2197, 1, 0, 0, 0, 2196, 2194, 1, 0, 0, 0, 2197, 2199, 1, 0, 0, 0, 2198, 2196, 1, 0, 0, 0, 2199, 2200, 5, 42, 0, 0, 2200, 2201, 5, 47, 0, 0, 2201, 2202, 1, 0, 0, 0, 2202, 2203, 6, 269, 0, 0, 2203, 540, 1, 0, 0, 0, 2204, 2205, 5, 45, 0, 0, 2205, 2206, 5, 45, 0, 0, 2206, 2210, 1, 0, 0, 0, 2207, 2209, 8, 34, 0, 0, 2208, 2207, 1, 0, 0, 0, 2209, 2212, 1, 0, 0, 0, 2210, 2208, 1, 0, 0, 0, 2210, 2211, 1, 0, 0, 0, 2211, 2214, 1, 0, 0, 0, 2212, 2210, 1, 0, 0, 0, 2213, 2215, 7, 35, 0, 0, 2214, 2213, 1, 0, 0, 0, 2215, 2216, 1, 0, 0, 0, 2216, 2217, 6, 270, 0, 0, 2217, 542, 1, 0, 0, 0, 2218, 2219, 7, 36, 0, 0, 2219, 2220, 1, 0, 0, 0, 2220, 2221, 6, 271, 1, 0, 2221, 544, 1, 0, 0, 0, 39, 0, 607, 1112, 1826, 1869, 1874, 1880, 1882, 1891, 1893, 1904, 1906, 1911, 1918, 1923, 1927, 1932, 1937, 1941, 1946, 1953, 1959, 1964, 1971, 1976, 1982, 1987, 1989, 1995, 2000, 2007, 2015, 2017, 2028, 2030, 2151, 2196, 2210, 2214, 2, 6, 0, 0, 0, 1, 0] \ No newline at end of file diff --git a/hogql_parser/HogQLLexer.tokens b/hogql_parser/HogQLLexer.tokens new file mode 100644 index 0000000000000..10fd925b09195 --- /dev/null +++ b/hogql_parser/HogQLLexer.tokens @@ -0,0 +1,282 @@ +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 +COHORT=25 +COLLATE=26 +COLUMN=27 +COMMENT=28 +CONSTRAINT=29 +CREATE=30 +CROSS=31 +CUBE=32 +CURRENT=33 +DATABASE=34 +DATABASES=35 +DATE=36 +DAY=37 +DEDUPLICATE=38 +DEFAULT=39 +DELAY=40 +DELETE=41 +DESC=42 +DESCENDING=43 +DESCRIBE=44 +DETACH=45 +DICTIONARIES=46 +DICTIONARY=47 +DISK=48 +DISTINCT=49 +DISTRIBUTED=50 +DROP=51 +ELSE=52 +END=53 +ENGINE=54 +EVENTS=55 +EXISTS=56 +EXPLAIN=57 +EXPRESSION=58 +EXTRACT=59 +FETCHES=60 +FINAL=61 +FIRST=62 +FLUSH=63 +FOLLOWING=64 +FOR=65 +FORMAT=66 +FREEZE=67 +FROM=68 +FULL=69 +FUNCTION=70 +GLOBAL=71 +GRANULARITY=72 +GROUP=73 +HAVING=74 +HIERARCHICAL=75 +HOUR=76 +ID=77 +IF=78 +ILIKE=79 +IN=80 +INDEX=81 +INF=82 +INJECTIVE=83 +INNER=84 +INSERT=85 +INTERVAL=86 +INTO=87 +IS=88 +IS_OBJECT_ID=89 +JOIN=90 +KEY=91 +KILL=92 +LAST=93 +LAYOUT=94 +LEADING=95 +LEFT=96 +LIFETIME=97 +LIKE=98 +LIMIT=99 +LIVE=100 +LOCAL=101 +LOGS=102 +MATERIALIZE=103 +MATERIALIZED=104 +MAX=105 +MERGES=106 +MIN=107 +MINUTE=108 +MODIFY=109 +MONTH=110 +MOVE=111 +MUTATION=112 +NAN_SQL=113 +NO=114 +NOT=115 +NULL_SQL=116 +NULLS=117 +OFFSET=118 +ON=119 +OPTIMIZE=120 +OR=121 +ORDER=122 +OUTER=123 +OUTFILE=124 +OVER=125 +PARTITION=126 +POPULATE=127 +PRECEDING=128 +PREWHERE=129 +PRIMARY=130 +PROJECTION=131 +QUARTER=132 +RANGE=133 +RELOAD=134 +REMOVE=135 +RENAME=136 +REPLACE=137 +REPLICA=138 +REPLICATED=139 +RIGHT=140 +ROLLUP=141 +ROW=142 +ROWS=143 +SAMPLE=144 +SECOND=145 +SELECT=146 +SEMI=147 +SENDS=148 +SET=149 +SETTINGS=150 +SHOW=151 +SOURCE=152 +START=153 +STOP=154 +SUBSTRING=155 +SYNC=156 +SYNTAX=157 +SYSTEM=158 +TABLE=159 +TABLES=160 +TEMPORARY=161 +TEST=162 +THEN=163 +TIES=164 +TIMEOUT=165 +TIMESTAMP=166 +TO=167 +TOP=168 +TOTALS=169 +TRAILING=170 +TRIM=171 +TRUNCATE=172 +TTL=173 +TYPE=174 +UNBOUNDED=175 +UNION=176 +UPDATE=177 +USE=178 +USING=179 +UUID=180 +VALUES=181 +VIEW=182 +VOLUME=183 +WATCH=184 +WEEK=185 +WHEN=186 +WHERE=187 +WINDOW=188 +WITH=189 +YEAR=190 +JSON_FALSE=191 +JSON_TRUE=192 +ESCAPE_CHAR=193 +IDENTIFIER=194 +FLOATING_LITERAL=195 +OCTAL_LITERAL=196 +DECIMAL_LITERAL=197 +HEXADECIMAL_LITERAL=198 +STRING_LITERAL=199 +PLACEHOLDER=200 +ARROW=201 +ASTERISK=202 +BACKQUOTE=203 +BACKSLASH=204 +COLON=205 +COMMA=206 +CONCAT=207 +DASH=208 +DOLLAR=209 +DOT=210 +EQ_DOUBLE=211 +EQ_SINGLE=212 +GT_EQ=213 +GT=214 +HASH=215 +IREGEX_SINGLE=216 +IREGEX_DOUBLE=217 +LBRACE=218 +LBRACKET=219 +LPAREN=220 +LT_EQ=221 +LT=222 +NOT_EQ=223 +NOT_IREGEX=224 +NOT_REGEX=225 +NULLISH=226 +PERCENT=227 +PLUS=228 +QUERY=229 +QUOTE_DOUBLE=230 +QUOTE_SINGLE=231 +REGEX_SINGLE=232 +REGEX_DOUBLE=233 +RBRACE=234 +RBRACKET=235 +RPAREN=236 +SEMICOLON=237 +SLASH=238 +UNDERSCORE=239 +MULTI_LINE_COMMENT=240 +SINGLE_LINE_COMMENT=241 +WHITESPACE=242 +'false'=191 +'true'=192 +'->'=201 +'*'=202 +'`'=203 +'\\'=204 +':'=205 +','=206 +'||'=207 +'-'=208 +'$'=209 +'.'=210 +'=='=211 +'='=212 +'>='=213 +'>'=214 +'#'=215 +'~*'=216 +'=~*'=217 +'{'=218 +'['=219 +'('=220 +'<='=221 +'<'=222 +'!~*'=224 +'!~'=225 +'??'=226 +'%'=227 +'+'=228 +'?'=229 +'"'=230 +'\''=231 +'~'=232 +'=~'=233 +'}'=234 +']'=235 +')'=236 +';'=237 +'/'=238 +'_'=239 diff --git a/hogql_parser/HogQLParser.cpp b/hogql_parser/HogQLParser.cpp new file mode 100644 index 0000000000000..779d2dbf7d4ed --- /dev/null +++ b/hogql_parser/HogQLParser.cpp @@ -0,0 +1,9562 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + + +#include "HogQLParserVisitor.h" + +#include "HogQLParser.h" + + +using namespace antlrcpp; + +using namespace antlr4; + +namespace { + +struct HogQLParserStaticData final { + HogQLParserStaticData(std::vector ruleNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + HogQLParserStaticData(const HogQLParserStaticData&) = delete; + HogQLParserStaticData(HogQLParserStaticData&&) = delete; + HogQLParserStaticData& operator=(const HogQLParserStaticData&) = delete; + HogQLParserStaticData& operator=(HogQLParserStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag hogqlparserParserOnceFlag; +#if ANTLR4_USE_THREAD_LOCAL_CACHE +static thread_local +#endif +HogQLParserStaticData *hogqlparserParserStaticData = nullptr; + +void hogqlparserParserInitialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + if (hogqlparserParserStaticData != nullptr) { + return; + } +#else + assert(hogqlparserParserStaticData == nullptr); +#endif + auto staticData = std::make_unique( + std::vector{ + "select", "selectUnionStmt", "selectStmtWithParens", "selectStmt", + "withClause", "topClause", "fromClause", "arrayJoinClause", "windowClause", + "prewhereClause", "whereClause", "groupByClause", "havingClause", + "orderByClause", "projectionOrderByClause", "limitAndOffsetClause", + "offsetOnlyClause", "settingsClause", "joinExpr", "joinOp", "joinOpCross", + "joinConstraintClause", "sampleClause", "orderExprList", "orderExpr", + "ratioExpr", "settingExprList", "settingExpr", "windowExpr", "winPartitionByClause", + "winOrderByClause", "winFrameClause", "winFrameExtend", "winFrameBound", + "expr", "columnTypeExpr", "columnExprList", "columnExpr", "columnArgList", + "columnArgExpr", "columnLambdaExpr", "withExprList", "withExpr", "columnIdentifier", + "nestedIdentifier", "tableExpr", "tableFunctionExpr", "tableIdentifier", + "tableArgList", "databaseIdentifier", "floatingLiteral", "numberLiteral", + "literal", "interval", "keyword", "keywordForAlias", "alias", "identifier", + "enumValue" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "'false'", "'true'", "", "", "", "", "", "", "", "", + "'->'", "'*'", "'`'", "'\\'", "':'", "','", "'||'", "'-'", "'$'", + "'.'", "'=='", "'='", "'>='", "'>'", "'#'", "'~*'", "'=~*'", "'{'", + "'['", "'('", "'<='", "'<'", "", "'!~*'", "'!~'", "'\\u003F\\u003F'", + "'%'", "'+'", "'\\u003F'", "'\"'", "'''", "'~'", "'=~'", "'}'", "']'", + "')'", "';'", "'/'", "'_'" + }, + std::vector{ + "", "ADD", "AFTER", "ALIAS", "ALL", "ALTER", "AND", "ANTI", "ANY", + "ARRAY", "AS", "ASCENDING", "ASOF", "AST", "ASYNC", "ATTACH", "BETWEEN", + "BOTH", "BY", "CASE", "CAST", "CHECK", "CLEAR", "CLUSTER", "CODEC", + "COHORT", "COLLATE", "COLUMN", "COMMENT", "CONSTRAINT", "CREATE", + "CROSS", "CUBE", "CURRENT", "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", + "FOLLOWING", "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", "OVER", "PARTITION", "POPULATE", "PRECEDING", + "PREWHERE", "PRIMARY", "PROJECTION", "QUARTER", "RANGE", "RELOAD", + "REMOVE", "RENAME", "REPLACE", "REPLICA", "REPLICATED", "RIGHT", "ROLLUP", + "ROW", "ROWS", "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", "UNBOUNDED", "UNION", "UPDATE", + "USE", "USING", "UUID", "VALUES", "VIEW", "VOLUME", "WATCH", "WEEK", + "WHEN", "WHERE", "WINDOW", "WITH", "YEAR", "JSON_FALSE", "JSON_TRUE", + "ESCAPE_CHAR", "IDENTIFIER", "FLOATING_LITERAL", "OCTAL_LITERAL", + "DECIMAL_LITERAL", "HEXADECIMAL_LITERAL", "STRING_LITERAL", "PLACEHOLDER", + "ARROW", "ASTERISK", "BACKQUOTE", "BACKSLASH", "COLON", "COMMA", "CONCAT", + "DASH", "DOLLAR", "DOT", "EQ_DOUBLE", "EQ_SINGLE", "GT_EQ", "GT", + "HASH", "IREGEX_SINGLE", "IREGEX_DOUBLE", "LBRACE", "LBRACKET", "LPAREN", + "LT_EQ", "LT", "NOT_EQ", "NOT_IREGEX", "NOT_REGEX", "NULLISH", "PERCENT", + "PLUS", "QUERY", "QUOTE_DOUBLE", "QUOTE_SINGLE", "REGEX_SINGLE", "REGEX_DOUBLE", + "RBRACE", "RBRACKET", "RPAREN", "SEMICOLON", "SLASH", "UNDERSCORE", + "MULTI_LINE_COMMENT", "SINGLE_LINE_COMMENT", "WHITESPACE" + } + ); + static const int32_t serializedATNSegment[] = { + 4,1,242,919,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2, + 7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7, + 14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7, + 21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7, + 28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7, + 35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7, + 42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7, + 49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7, + 56,2,57,7,57,2,58,7,58,1,0,1,0,3,0,121,8,0,1,0,1,0,1,1,1,1,1,1,1,1,5, + 1,129,8,1,10,1,12,1,132,9,1,1,2,1,2,1,2,1,2,1,2,3,2,139,8,2,1,3,3,3,142, + 8,3,1,3,1,3,3,3,146,8,3,1,3,3,3,149,8,3,1,3,1,3,3,3,153,8,3,1,3,3,3,156, + 8,3,1,3,3,3,159,8,3,1,3,3,3,162,8,3,1,3,3,3,165,8,3,1,3,1,3,3,3,169,8, + 3,1,3,1,3,3,3,173,8,3,1,3,3,3,176,8,3,1,3,3,3,179,8,3,1,3,3,3,182,8,3, + 1,3,1,3,3,3,186,8,3,1,3,3,3,189,8,3,1,4,1,4,1,4,1,5,1,5,1,5,1,5,3,5,198, + 8,5,1,6,1,6,1,6,1,7,3,7,204,8,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1, + 8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,5,8,223,8,8,10,8,12,8,226,9,8,1,9,1,9,1, + 9,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,242,8,11, + 1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,15,1,15,1,15, + 1,15,3,15,259,8,15,1,15,1,15,1,15,1,15,3,15,265,8,15,1,15,1,15,1,15,1, + 15,3,15,271,8,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,3,15,282, + 8,15,3,15,284,8,15,1,16,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,3,18, + 295,8,18,1,18,3,18,298,8,18,1,18,1,18,1,18,1,18,3,18,304,8,18,1,18,1, + 18,1,18,1,18,1,18,1,18,3,18,312,8,18,1,18,1,18,1,18,1,18,5,18,318,8,18, + 10,18,12,18,321,9,18,1,19,3,19,324,8,19,1,19,1,19,1,19,3,19,329,8,19, + 1,19,3,19,332,8,19,1,19,3,19,335,8,19,1,19,1,19,3,19,339,8,19,1,19,1, + 19,3,19,343,8,19,1,19,3,19,346,8,19,3,19,348,8,19,1,19,3,19,351,8,19, + 1,19,1,19,3,19,355,8,19,1,19,1,19,3,19,359,8,19,1,19,3,19,362,8,19,3, + 19,364,8,19,3,19,366,8,19,1,20,1,20,1,20,3,20,371,8,20,1,21,1,21,1,21, + 1,21,1,21,1,21,1,21,1,21,1,21,3,21,382,8,21,1,22,1,22,1,22,1,22,3,22, + 388,8,22,1,23,1,23,1,23,5,23,393,8,23,10,23,12,23,396,9,23,1,24,1,24, + 3,24,400,8,24,1,24,1,24,3,24,404,8,24,1,24,1,24,3,24,408,8,24,1,25,1, + 25,1,25,3,25,413,8,25,1,26,1,26,1,26,5,26,418,8,26,10,26,12,26,421,9, + 26,1,27,1,27,1,27,1,27,1,28,3,28,428,8,28,1,28,3,28,431,8,28,1,28,3,28, + 434,8,28,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,32, + 1,32,1,32,1,32,1,32,1,32,3,32,453,8,32,1,33,1,33,1,33,1,33,1,33,1,33, + 1,33,1,33,1,33,1,33,1,33,1,33,3,33,467,8,33,1,34,1,34,1,34,1,35,1,35, + 1,35,1,35,1,35,1,35,1,35,1,35,1,35,5,35,481,8,35,10,35,12,35,484,9,35, + 1,35,1,35,1,35,1,35,1,35,1,35,1,35,5,35,493,8,35,10,35,12,35,496,9,35, + 1,35,1,35,1,35,1,35,1,35,1,35,1,35,5,35,505,8,35,10,35,12,35,508,9,35, + 1,35,1,35,1,35,1,35,1,35,3,35,515,8,35,1,35,1,35,3,35,519,8,35,1,36,1, + 36,1,36,5,36,524,8,36,10,36,12,36,527,9,36,1,37,1,37,1,37,3,37,532,8, + 37,1,37,1,37,1,37,1,37,1,37,4,37,539,8,37,11,37,12,37,540,1,37,1,37,3, + 37,545,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,3,37,576,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,593,8,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,605,8,37,1,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,3,37,615,8,37,1,37,3,37,618,8,37,1,37,1,37,3,37,622, + 8,37,1,37,3,37,625,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37, + 1,37,3,37,637,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37, + 1,37,1,37,1,37,1,37,1,37,3,37,654,8,37,1,37,1,37,3,37,658,8,37,1,37,1, + 37,1,37,1,37,3,37,664,8,37,1,37,1,37,1,37,1,37,1,37,3,37,671,8,37,1,37, + 1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,683,8,37,1,37,1,37, + 3,37,687,8,37,1,37,3,37,690,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3, + 37,699,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,3,37,713,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1, + 37,3,37,740,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,37,3,37,749,8,37,5,37, + 751,8,37,10,37,12,37,754,9,37,1,38,1,38,1,38,5,38,759,8,38,10,38,12,38, + 762,9,38,1,39,1,39,3,39,766,8,39,1,40,1,40,1,40,1,40,5,40,772,8,40,10, + 40,12,40,775,9,40,1,40,1,40,1,40,1,40,1,40,5,40,782,8,40,10,40,12,40, + 785,9,40,3,40,787,8,40,1,40,1,40,1,40,1,41,1,41,1,41,5,41,795,8,41,10, + 41,12,41,798,9,41,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,3, + 42,810,8,42,1,43,1,43,1,43,1,43,3,43,816,8,43,1,43,3,43,819,8,43,1,44, + 1,44,1,44,5,44,824,8,44,10,44,12,44,827,9,44,1,45,1,45,1,45,1,45,1,45, + 1,45,1,45,1,45,3,45,837,8,45,1,45,1,45,1,45,1,45,3,45,843,8,45,5,45,845, + 8,45,10,45,12,45,848,9,45,1,46,1,46,1,46,3,46,853,8,46,1,46,1,46,1,47, + 1,47,1,47,3,47,860,8,47,1,47,1,47,1,48,1,48,1,48,5,48,867,8,48,10,48, + 12,48,870,9,48,1,49,1,49,1,50,1,50,1,50,1,50,1,50,1,50,3,50,880,8,50, + 3,50,882,8,50,1,51,3,51,885,8,51,1,51,1,51,1,51,1,51,1,51,1,51,3,51,893, + 8,51,1,52,1,52,1,52,3,52,898,8,52,1,53,1,53,1,54,1,54,1,55,1,55,1,56, + 1,56,3,56,908,8,56,1,57,1,57,1,57,3,57,913,8,57,1,58,1,58,1,58,1,58,1, + 58,0,3,36,74,90,59,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36, + 38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82, + 84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,0,16,2,0, + 32,32,141,141,2,0,84,84,96,96,3,0,4,4,8,8,12,12,4,0,4,4,7,8,12,12,147, + 147,2,0,96,96,140,140,2,0,4,4,8,8,2,0,11,11,42,43,2,0,62,62,93,93,2,0, + 133,133,143,143,3,0,17,17,95,95,170,170,2,0,79,79,98,98,1,0,196,197,2, + 0,208,208,228,228,8,0,37,37,76,76,108,108,110,110,132,132,145,145,185, + 185,190,190,13,0,2,24,26,36,38,75,77,81,83,107,109,109,111,112,114,115, + 117,130,133,144,146,184,186,189,191,192,4,0,36,36,62,62,77,77,91,91,1039, + 0,120,1,0,0,0,2,124,1,0,0,0,4,138,1,0,0,0,6,141,1,0,0,0,8,190,1,0,0,0, + 10,193,1,0,0,0,12,199,1,0,0,0,14,203,1,0,0,0,16,209,1,0,0,0,18,227,1, + 0,0,0,20,230,1,0,0,0,22,233,1,0,0,0,24,243,1,0,0,0,26,246,1,0,0,0,28, + 250,1,0,0,0,30,283,1,0,0,0,32,285,1,0,0,0,34,288,1,0,0,0,36,303,1,0,0, + 0,38,365,1,0,0,0,40,370,1,0,0,0,42,381,1,0,0,0,44,383,1,0,0,0,46,389, + 1,0,0,0,48,397,1,0,0,0,50,409,1,0,0,0,52,414,1,0,0,0,54,422,1,0,0,0,56, + 427,1,0,0,0,58,435,1,0,0,0,60,439,1,0,0,0,62,443,1,0,0,0,64,452,1,0,0, + 0,66,466,1,0,0,0,68,468,1,0,0,0,70,518,1,0,0,0,72,520,1,0,0,0,74,657, + 1,0,0,0,76,755,1,0,0,0,78,765,1,0,0,0,80,786,1,0,0,0,82,791,1,0,0,0,84, + 809,1,0,0,0,86,818,1,0,0,0,88,820,1,0,0,0,90,836,1,0,0,0,92,849,1,0,0, + 0,94,859,1,0,0,0,96,863,1,0,0,0,98,871,1,0,0,0,100,881,1,0,0,0,102,884, + 1,0,0,0,104,897,1,0,0,0,106,899,1,0,0,0,108,901,1,0,0,0,110,903,1,0,0, + 0,112,907,1,0,0,0,114,912,1,0,0,0,116,914,1,0,0,0,118,121,3,2,1,0,119, + 121,3,6,3,0,120,118,1,0,0,0,120,119,1,0,0,0,121,122,1,0,0,0,122,123,5, + 0,0,1,123,1,1,0,0,0,124,130,3,4,2,0,125,126,5,176,0,0,126,127,5,4,0,0, + 127,129,3,4,2,0,128,125,1,0,0,0,129,132,1,0,0,0,130,128,1,0,0,0,130,131, + 1,0,0,0,131,3,1,0,0,0,132,130,1,0,0,0,133,139,3,6,3,0,134,135,5,220,0, + 0,135,136,3,2,1,0,136,137,5,236,0,0,137,139,1,0,0,0,138,133,1,0,0,0,138, + 134,1,0,0,0,139,5,1,0,0,0,140,142,3,8,4,0,141,140,1,0,0,0,141,142,1,0, + 0,0,142,143,1,0,0,0,143,145,5,146,0,0,144,146,5,49,0,0,145,144,1,0,0, + 0,145,146,1,0,0,0,146,148,1,0,0,0,147,149,3,10,5,0,148,147,1,0,0,0,148, + 149,1,0,0,0,149,150,1,0,0,0,150,152,3,72,36,0,151,153,3,12,6,0,152,151, + 1,0,0,0,152,153,1,0,0,0,153,155,1,0,0,0,154,156,3,14,7,0,155,154,1,0, + 0,0,155,156,1,0,0,0,156,158,1,0,0,0,157,159,3,18,9,0,158,157,1,0,0,0, + 158,159,1,0,0,0,159,161,1,0,0,0,160,162,3,20,10,0,161,160,1,0,0,0,161, + 162,1,0,0,0,162,164,1,0,0,0,163,165,3,22,11,0,164,163,1,0,0,0,164,165, + 1,0,0,0,165,168,1,0,0,0,166,167,5,189,0,0,167,169,7,0,0,0,168,166,1,0, + 0,0,168,169,1,0,0,0,169,172,1,0,0,0,170,171,5,189,0,0,171,173,5,169,0, + 0,172,170,1,0,0,0,172,173,1,0,0,0,173,175,1,0,0,0,174,176,3,24,12,0,175, + 174,1,0,0,0,175,176,1,0,0,0,176,178,1,0,0,0,177,179,3,16,8,0,178,177, + 1,0,0,0,178,179,1,0,0,0,179,181,1,0,0,0,180,182,3,26,13,0,181,180,1,0, + 0,0,181,182,1,0,0,0,182,185,1,0,0,0,183,186,3,30,15,0,184,186,3,32,16, + 0,185,183,1,0,0,0,185,184,1,0,0,0,185,186,1,0,0,0,186,188,1,0,0,0,187, + 189,3,34,17,0,188,187,1,0,0,0,188,189,1,0,0,0,189,7,1,0,0,0,190,191,5, + 189,0,0,191,192,3,82,41,0,192,9,1,0,0,0,193,194,5,168,0,0,194,197,5,197, + 0,0,195,196,5,189,0,0,196,198,5,164,0,0,197,195,1,0,0,0,197,198,1,0,0, + 0,198,11,1,0,0,0,199,200,5,68,0,0,200,201,3,36,18,0,201,13,1,0,0,0,202, + 204,7,1,0,0,203,202,1,0,0,0,203,204,1,0,0,0,204,205,1,0,0,0,205,206,5, + 9,0,0,206,207,5,90,0,0,207,208,3,72,36,0,208,15,1,0,0,0,209,210,5,188, + 0,0,210,211,3,114,57,0,211,212,5,10,0,0,212,213,5,220,0,0,213,214,3,56, + 28,0,214,224,5,236,0,0,215,216,5,206,0,0,216,217,3,114,57,0,217,218,5, + 10,0,0,218,219,5,220,0,0,219,220,3,56,28,0,220,221,5,236,0,0,221,223, + 1,0,0,0,222,215,1,0,0,0,223,226,1,0,0,0,224,222,1,0,0,0,224,225,1,0,0, + 0,225,17,1,0,0,0,226,224,1,0,0,0,227,228,5,129,0,0,228,229,3,74,37,0, + 229,19,1,0,0,0,230,231,5,187,0,0,231,232,3,74,37,0,232,21,1,0,0,0,233, + 234,5,73,0,0,234,241,5,18,0,0,235,236,7,0,0,0,236,237,5,220,0,0,237,238, + 3,72,36,0,238,239,5,236,0,0,239,242,1,0,0,0,240,242,3,72,36,0,241,235, + 1,0,0,0,241,240,1,0,0,0,242,23,1,0,0,0,243,244,5,74,0,0,244,245,3,74, + 37,0,245,25,1,0,0,0,246,247,5,122,0,0,247,248,5,18,0,0,248,249,3,46,23, + 0,249,27,1,0,0,0,250,251,5,122,0,0,251,252,5,18,0,0,252,253,3,72,36,0, + 253,29,1,0,0,0,254,255,5,99,0,0,255,258,3,74,37,0,256,257,5,206,0,0,257, + 259,3,74,37,0,258,256,1,0,0,0,258,259,1,0,0,0,259,264,1,0,0,0,260,261, + 5,189,0,0,261,265,5,164,0,0,262,263,5,18,0,0,263,265,3,72,36,0,264,260, + 1,0,0,0,264,262,1,0,0,0,264,265,1,0,0,0,265,284,1,0,0,0,266,267,5,99, + 0,0,267,270,3,74,37,0,268,269,5,189,0,0,269,271,5,164,0,0,270,268,1,0, + 0,0,270,271,1,0,0,0,271,272,1,0,0,0,272,273,5,118,0,0,273,274,3,74,37, + 0,274,284,1,0,0,0,275,276,5,99,0,0,276,277,3,74,37,0,277,278,5,118,0, + 0,278,281,3,74,37,0,279,280,5,18,0,0,280,282,3,72,36,0,281,279,1,0,0, + 0,281,282,1,0,0,0,282,284,1,0,0,0,283,254,1,0,0,0,283,266,1,0,0,0,283, + 275,1,0,0,0,284,31,1,0,0,0,285,286,5,118,0,0,286,287,3,74,37,0,287,33, + 1,0,0,0,288,289,5,150,0,0,289,290,3,52,26,0,290,35,1,0,0,0,291,292,6, + 18,-1,0,292,294,3,90,45,0,293,295,5,61,0,0,294,293,1,0,0,0,294,295,1, + 0,0,0,295,297,1,0,0,0,296,298,3,44,22,0,297,296,1,0,0,0,297,298,1,0,0, + 0,298,304,1,0,0,0,299,300,5,220,0,0,300,301,3,36,18,0,301,302,5,236,0, + 0,302,304,1,0,0,0,303,291,1,0,0,0,303,299,1,0,0,0,304,319,1,0,0,0,305, + 306,10,3,0,0,306,307,3,40,20,0,307,308,3,36,18,4,308,318,1,0,0,0,309, + 311,10,4,0,0,310,312,3,38,19,0,311,310,1,0,0,0,311,312,1,0,0,0,312,313, + 1,0,0,0,313,314,5,90,0,0,314,315,3,36,18,0,315,316,3,42,21,0,316,318, + 1,0,0,0,317,305,1,0,0,0,317,309,1,0,0,0,318,321,1,0,0,0,319,317,1,0,0, + 0,319,320,1,0,0,0,320,37,1,0,0,0,321,319,1,0,0,0,322,324,7,2,0,0,323, + 322,1,0,0,0,323,324,1,0,0,0,324,325,1,0,0,0,325,332,5,84,0,0,326,328, + 5,84,0,0,327,329,7,2,0,0,328,327,1,0,0,0,328,329,1,0,0,0,329,332,1,0, + 0,0,330,332,7,2,0,0,331,323,1,0,0,0,331,326,1,0,0,0,331,330,1,0,0,0,332, + 366,1,0,0,0,333,335,7,3,0,0,334,333,1,0,0,0,334,335,1,0,0,0,335,336,1, + 0,0,0,336,338,7,4,0,0,337,339,5,123,0,0,338,337,1,0,0,0,338,339,1,0,0, + 0,339,348,1,0,0,0,340,342,7,4,0,0,341,343,5,123,0,0,342,341,1,0,0,0,342, + 343,1,0,0,0,343,345,1,0,0,0,344,346,7,3,0,0,345,344,1,0,0,0,345,346,1, + 0,0,0,346,348,1,0,0,0,347,334,1,0,0,0,347,340,1,0,0,0,348,366,1,0,0,0, + 349,351,7,5,0,0,350,349,1,0,0,0,350,351,1,0,0,0,351,352,1,0,0,0,352,354, + 5,69,0,0,353,355,5,123,0,0,354,353,1,0,0,0,354,355,1,0,0,0,355,364,1, + 0,0,0,356,358,5,69,0,0,357,359,5,123,0,0,358,357,1,0,0,0,358,359,1,0, + 0,0,359,361,1,0,0,0,360,362,7,5,0,0,361,360,1,0,0,0,361,362,1,0,0,0,362, + 364,1,0,0,0,363,350,1,0,0,0,363,356,1,0,0,0,364,366,1,0,0,0,365,331,1, + 0,0,0,365,347,1,0,0,0,365,363,1,0,0,0,366,39,1,0,0,0,367,368,5,31,0,0, + 368,371,5,90,0,0,369,371,5,206,0,0,370,367,1,0,0,0,370,369,1,0,0,0,371, + 41,1,0,0,0,372,373,5,119,0,0,373,382,3,72,36,0,374,375,5,179,0,0,375, + 376,5,220,0,0,376,377,3,72,36,0,377,378,5,236,0,0,378,382,1,0,0,0,379, + 380,5,179,0,0,380,382,3,72,36,0,381,372,1,0,0,0,381,374,1,0,0,0,381,379, + 1,0,0,0,382,43,1,0,0,0,383,384,5,144,0,0,384,387,3,50,25,0,385,386,5, + 118,0,0,386,388,3,50,25,0,387,385,1,0,0,0,387,388,1,0,0,0,388,45,1,0, + 0,0,389,394,3,48,24,0,390,391,5,206,0,0,391,393,3,48,24,0,392,390,1,0, + 0,0,393,396,1,0,0,0,394,392,1,0,0,0,394,395,1,0,0,0,395,47,1,0,0,0,396, + 394,1,0,0,0,397,399,3,74,37,0,398,400,7,6,0,0,399,398,1,0,0,0,399,400, + 1,0,0,0,400,403,1,0,0,0,401,402,5,117,0,0,402,404,7,7,0,0,403,401,1,0, + 0,0,403,404,1,0,0,0,404,407,1,0,0,0,405,406,5,26,0,0,406,408,5,199,0, + 0,407,405,1,0,0,0,407,408,1,0,0,0,408,49,1,0,0,0,409,412,3,102,51,0,410, + 411,5,238,0,0,411,413,3,102,51,0,412,410,1,0,0,0,412,413,1,0,0,0,413, + 51,1,0,0,0,414,419,3,54,27,0,415,416,5,206,0,0,416,418,3,54,27,0,417, + 415,1,0,0,0,418,421,1,0,0,0,419,417,1,0,0,0,419,420,1,0,0,0,420,53,1, + 0,0,0,421,419,1,0,0,0,422,423,3,114,57,0,423,424,5,212,0,0,424,425,3, + 104,52,0,425,55,1,0,0,0,426,428,3,58,29,0,427,426,1,0,0,0,427,428,1,0, + 0,0,428,430,1,0,0,0,429,431,3,60,30,0,430,429,1,0,0,0,430,431,1,0,0,0, + 431,433,1,0,0,0,432,434,3,62,31,0,433,432,1,0,0,0,433,434,1,0,0,0,434, + 57,1,0,0,0,435,436,5,126,0,0,436,437,5,18,0,0,437,438,3,72,36,0,438,59, + 1,0,0,0,439,440,5,122,0,0,440,441,5,18,0,0,441,442,3,46,23,0,442,61,1, + 0,0,0,443,444,7,8,0,0,444,445,3,64,32,0,445,63,1,0,0,0,446,453,3,66,33, + 0,447,448,5,16,0,0,448,449,3,66,33,0,449,450,5,6,0,0,450,451,3,66,33, + 0,451,453,1,0,0,0,452,446,1,0,0,0,452,447,1,0,0,0,453,65,1,0,0,0,454, + 455,5,33,0,0,455,467,5,142,0,0,456,457,5,175,0,0,457,467,5,128,0,0,458, + 459,5,175,0,0,459,467,5,64,0,0,460,461,3,102,51,0,461,462,5,128,0,0,462, + 467,1,0,0,0,463,464,3,102,51,0,464,465,5,64,0,0,465,467,1,0,0,0,466,454, + 1,0,0,0,466,456,1,0,0,0,466,458,1,0,0,0,466,460,1,0,0,0,466,463,1,0,0, + 0,467,67,1,0,0,0,468,469,3,74,37,0,469,470,5,0,0,1,470,69,1,0,0,0,471, + 519,3,114,57,0,472,473,3,114,57,0,473,474,5,220,0,0,474,475,3,114,57, + 0,475,482,3,70,35,0,476,477,5,206,0,0,477,478,3,114,57,0,478,479,3,70, + 35,0,479,481,1,0,0,0,480,476,1,0,0,0,481,484,1,0,0,0,482,480,1,0,0,0, + 482,483,1,0,0,0,483,485,1,0,0,0,484,482,1,0,0,0,485,486,5,236,0,0,486, + 519,1,0,0,0,487,488,3,114,57,0,488,489,5,220,0,0,489,494,3,116,58,0,490, + 491,5,206,0,0,491,493,3,116,58,0,492,490,1,0,0,0,493,496,1,0,0,0,494, + 492,1,0,0,0,494,495,1,0,0,0,495,497,1,0,0,0,496,494,1,0,0,0,497,498,5, + 236,0,0,498,519,1,0,0,0,499,500,3,114,57,0,500,501,5,220,0,0,501,506, + 3,70,35,0,502,503,5,206,0,0,503,505,3,70,35,0,504,502,1,0,0,0,505,508, + 1,0,0,0,506,504,1,0,0,0,506,507,1,0,0,0,507,509,1,0,0,0,508,506,1,0,0, + 0,509,510,5,236,0,0,510,519,1,0,0,0,511,512,3,114,57,0,512,514,5,220, + 0,0,513,515,3,72,36,0,514,513,1,0,0,0,514,515,1,0,0,0,515,516,1,0,0,0, + 516,517,5,236,0,0,517,519,1,0,0,0,518,471,1,0,0,0,518,472,1,0,0,0,518, + 487,1,0,0,0,518,499,1,0,0,0,518,511,1,0,0,0,519,71,1,0,0,0,520,525,3, + 74,37,0,521,522,5,206,0,0,522,524,3,74,37,0,523,521,1,0,0,0,524,527,1, + 0,0,0,525,523,1,0,0,0,525,526,1,0,0,0,526,73,1,0,0,0,527,525,1,0,0,0, + 528,529,6,37,-1,0,529,531,5,19,0,0,530,532,3,74,37,0,531,530,1,0,0,0, + 531,532,1,0,0,0,532,538,1,0,0,0,533,534,5,186,0,0,534,535,3,74,37,0,535, + 536,5,163,0,0,536,537,3,74,37,0,537,539,1,0,0,0,538,533,1,0,0,0,539,540, + 1,0,0,0,540,538,1,0,0,0,540,541,1,0,0,0,541,544,1,0,0,0,542,543,5,52, + 0,0,543,545,3,74,37,0,544,542,1,0,0,0,544,545,1,0,0,0,545,546,1,0,0,0, + 546,547,5,53,0,0,547,658,1,0,0,0,548,549,5,20,0,0,549,550,5,220,0,0,550, + 551,3,74,37,0,551,552,5,10,0,0,552,553,3,70,35,0,553,554,5,236,0,0,554, + 658,1,0,0,0,555,556,5,36,0,0,556,658,5,199,0,0,557,558,5,59,0,0,558,559, + 5,220,0,0,559,560,3,106,53,0,560,561,5,68,0,0,561,562,3,74,37,0,562,563, + 5,236,0,0,563,658,1,0,0,0,564,565,5,86,0,0,565,566,3,74,37,0,566,567, + 3,106,53,0,567,658,1,0,0,0,568,569,5,155,0,0,569,570,5,220,0,0,570,571, + 3,74,37,0,571,572,5,68,0,0,572,575,3,74,37,0,573,574,5,65,0,0,574,576, + 3,74,37,0,575,573,1,0,0,0,575,576,1,0,0,0,576,577,1,0,0,0,577,578,5,236, + 0,0,578,658,1,0,0,0,579,580,5,166,0,0,580,658,5,199,0,0,581,582,5,171, + 0,0,582,583,5,220,0,0,583,584,7,9,0,0,584,585,5,199,0,0,585,586,5,68, + 0,0,586,587,3,74,37,0,587,588,5,236,0,0,588,658,1,0,0,0,589,590,3,114, + 57,0,590,592,5,220,0,0,591,593,3,72,36,0,592,591,1,0,0,0,592,593,1,0, + 0,0,593,594,1,0,0,0,594,595,5,236,0,0,595,596,1,0,0,0,596,597,5,125,0, + 0,597,598,5,220,0,0,598,599,3,56,28,0,599,600,5,236,0,0,600,658,1,0,0, + 0,601,602,3,114,57,0,602,604,5,220,0,0,603,605,3,72,36,0,604,603,1,0, + 0,0,604,605,1,0,0,0,605,606,1,0,0,0,606,607,5,236,0,0,607,608,1,0,0,0, + 608,609,5,125,0,0,609,610,3,114,57,0,610,658,1,0,0,0,611,617,3,114,57, + 0,612,614,5,220,0,0,613,615,3,72,36,0,614,613,1,0,0,0,614,615,1,0,0,0, + 615,616,1,0,0,0,616,618,5,236,0,0,617,612,1,0,0,0,617,618,1,0,0,0,618, + 619,1,0,0,0,619,621,5,220,0,0,620,622,5,49,0,0,621,620,1,0,0,0,621,622, + 1,0,0,0,622,624,1,0,0,0,623,625,3,76,38,0,624,623,1,0,0,0,624,625,1,0, + 0,0,625,626,1,0,0,0,626,627,5,236,0,0,627,658,1,0,0,0,628,658,3,104,52, + 0,629,630,5,208,0,0,630,658,3,74,37,18,631,632,5,115,0,0,632,658,3,74, + 37,12,633,634,3,94,47,0,634,635,5,210,0,0,635,637,1,0,0,0,636,633,1,0, + 0,0,636,637,1,0,0,0,637,638,1,0,0,0,638,658,5,202,0,0,639,640,5,220,0, + 0,640,641,3,2,1,0,641,642,5,236,0,0,642,658,1,0,0,0,643,644,5,220,0,0, + 644,645,3,74,37,0,645,646,5,236,0,0,646,658,1,0,0,0,647,648,5,220,0,0, + 648,649,3,72,36,0,649,650,5,236,0,0,650,658,1,0,0,0,651,653,5,219,0,0, + 652,654,3,72,36,0,653,652,1,0,0,0,653,654,1,0,0,0,654,655,1,0,0,0,655, + 658,5,235,0,0,656,658,3,86,43,0,657,528,1,0,0,0,657,548,1,0,0,0,657,555, + 1,0,0,0,657,557,1,0,0,0,657,564,1,0,0,0,657,568,1,0,0,0,657,579,1,0,0, + 0,657,581,1,0,0,0,657,589,1,0,0,0,657,601,1,0,0,0,657,611,1,0,0,0,657, + 628,1,0,0,0,657,629,1,0,0,0,657,631,1,0,0,0,657,636,1,0,0,0,657,639,1, + 0,0,0,657,643,1,0,0,0,657,647,1,0,0,0,657,651,1,0,0,0,657,656,1,0,0,0, + 658,752,1,0,0,0,659,663,10,17,0,0,660,664,5,202,0,0,661,664,5,238,0,0, + 662,664,5,227,0,0,663,660,1,0,0,0,663,661,1,0,0,0,663,662,1,0,0,0,664, + 665,1,0,0,0,665,751,3,74,37,18,666,670,10,16,0,0,667,671,5,228,0,0,668, + 671,5,208,0,0,669,671,5,207,0,0,670,667,1,0,0,0,670,668,1,0,0,0,670,669, + 1,0,0,0,671,672,1,0,0,0,672,751,3,74,37,17,673,698,10,15,0,0,674,699, + 5,211,0,0,675,699,5,212,0,0,676,699,5,223,0,0,677,699,5,221,0,0,678,699, + 5,222,0,0,679,699,5,213,0,0,680,699,5,214,0,0,681,683,5,115,0,0,682,681, + 1,0,0,0,682,683,1,0,0,0,683,684,1,0,0,0,684,686,5,80,0,0,685,687,5,25, + 0,0,686,685,1,0,0,0,686,687,1,0,0,0,687,699,1,0,0,0,688,690,5,115,0,0, + 689,688,1,0,0,0,689,690,1,0,0,0,690,691,1,0,0,0,691,699,7,10,0,0,692, + 699,5,232,0,0,693,699,5,233,0,0,694,699,5,225,0,0,695,699,5,216,0,0,696, + 699,5,217,0,0,697,699,5,224,0,0,698,674,1,0,0,0,698,675,1,0,0,0,698,676, + 1,0,0,0,698,677,1,0,0,0,698,678,1,0,0,0,698,679,1,0,0,0,698,680,1,0,0, + 0,698,682,1,0,0,0,698,689,1,0,0,0,698,692,1,0,0,0,698,693,1,0,0,0,698, + 694,1,0,0,0,698,695,1,0,0,0,698,696,1,0,0,0,698,697,1,0,0,0,699,700,1, + 0,0,0,700,751,3,74,37,16,701,702,10,13,0,0,702,703,5,226,0,0,703,751, + 3,74,37,14,704,705,10,11,0,0,705,706,5,6,0,0,706,751,3,74,37,12,707,708, + 10,10,0,0,708,709,5,121,0,0,709,751,3,74,37,11,710,712,10,9,0,0,711,713, + 5,115,0,0,712,711,1,0,0,0,712,713,1,0,0,0,713,714,1,0,0,0,714,715,5,16, + 0,0,715,716,3,74,37,0,716,717,5,6,0,0,717,718,3,74,37,10,718,751,1,0, + 0,0,719,720,10,8,0,0,720,721,5,229,0,0,721,722,3,74,37,0,722,723,5,205, + 0,0,723,724,3,74,37,8,724,751,1,0,0,0,725,726,10,21,0,0,726,727,5,219, + 0,0,727,728,3,74,37,0,728,729,5,235,0,0,729,751,1,0,0,0,730,731,10,20, + 0,0,731,732,5,210,0,0,732,751,5,197,0,0,733,734,10,19,0,0,734,735,5,210, + 0,0,735,751,3,114,57,0,736,737,10,14,0,0,737,739,5,88,0,0,738,740,5,115, + 0,0,739,738,1,0,0,0,739,740,1,0,0,0,740,741,1,0,0,0,741,751,5,116,0,0, + 742,748,10,7,0,0,743,749,3,112,56,0,744,745,5,10,0,0,745,749,3,114,57, + 0,746,747,5,10,0,0,747,749,5,199,0,0,748,743,1,0,0,0,748,744,1,0,0,0, + 748,746,1,0,0,0,749,751,1,0,0,0,750,659,1,0,0,0,750,666,1,0,0,0,750,673, + 1,0,0,0,750,701,1,0,0,0,750,704,1,0,0,0,750,707,1,0,0,0,750,710,1,0,0, + 0,750,719,1,0,0,0,750,725,1,0,0,0,750,730,1,0,0,0,750,733,1,0,0,0,750, + 736,1,0,0,0,750,742,1,0,0,0,751,754,1,0,0,0,752,750,1,0,0,0,752,753,1, + 0,0,0,753,75,1,0,0,0,754,752,1,0,0,0,755,760,3,78,39,0,756,757,5,206, + 0,0,757,759,3,78,39,0,758,756,1,0,0,0,759,762,1,0,0,0,760,758,1,0,0,0, + 760,761,1,0,0,0,761,77,1,0,0,0,762,760,1,0,0,0,763,766,3,80,40,0,764, + 766,3,74,37,0,765,763,1,0,0,0,765,764,1,0,0,0,766,79,1,0,0,0,767,768, + 5,220,0,0,768,773,3,114,57,0,769,770,5,206,0,0,770,772,3,114,57,0,771, + 769,1,0,0,0,772,775,1,0,0,0,773,771,1,0,0,0,773,774,1,0,0,0,774,776,1, + 0,0,0,775,773,1,0,0,0,776,777,5,236,0,0,777,787,1,0,0,0,778,783,3,114, + 57,0,779,780,5,206,0,0,780,782,3,114,57,0,781,779,1,0,0,0,782,785,1,0, + 0,0,783,781,1,0,0,0,783,784,1,0,0,0,784,787,1,0,0,0,785,783,1,0,0,0,786, + 767,1,0,0,0,786,778,1,0,0,0,787,788,1,0,0,0,788,789,5,201,0,0,789,790, + 3,74,37,0,790,81,1,0,0,0,791,796,3,84,42,0,792,793,5,206,0,0,793,795, + 3,84,42,0,794,792,1,0,0,0,795,798,1,0,0,0,796,794,1,0,0,0,796,797,1,0, + 0,0,797,83,1,0,0,0,798,796,1,0,0,0,799,800,3,114,57,0,800,801,5,10,0, + 0,801,802,5,220,0,0,802,803,3,2,1,0,803,804,5,236,0,0,804,810,1,0,0,0, + 805,806,3,74,37,0,806,807,5,10,0,0,807,808,3,114,57,0,808,810,1,0,0,0, + 809,799,1,0,0,0,809,805,1,0,0,0,810,85,1,0,0,0,811,819,5,200,0,0,812, + 813,3,94,47,0,813,814,5,210,0,0,814,816,1,0,0,0,815,812,1,0,0,0,815,816, + 1,0,0,0,816,817,1,0,0,0,817,819,3,88,44,0,818,811,1,0,0,0,818,815,1,0, + 0,0,819,87,1,0,0,0,820,825,3,114,57,0,821,822,5,210,0,0,822,824,3,114, + 57,0,823,821,1,0,0,0,824,827,1,0,0,0,825,823,1,0,0,0,825,826,1,0,0,0, + 826,89,1,0,0,0,827,825,1,0,0,0,828,829,6,45,-1,0,829,837,3,94,47,0,830, + 837,3,92,46,0,831,832,5,220,0,0,832,833,3,2,1,0,833,834,5,236,0,0,834, + 837,1,0,0,0,835,837,5,200,0,0,836,828,1,0,0,0,836,830,1,0,0,0,836,831, + 1,0,0,0,836,835,1,0,0,0,837,846,1,0,0,0,838,842,10,2,0,0,839,843,3,112, + 56,0,840,841,5,10,0,0,841,843,3,114,57,0,842,839,1,0,0,0,842,840,1,0, + 0,0,843,845,1,0,0,0,844,838,1,0,0,0,845,848,1,0,0,0,846,844,1,0,0,0,846, + 847,1,0,0,0,847,91,1,0,0,0,848,846,1,0,0,0,849,850,3,114,57,0,850,852, + 5,220,0,0,851,853,3,96,48,0,852,851,1,0,0,0,852,853,1,0,0,0,853,854,1, + 0,0,0,854,855,5,236,0,0,855,93,1,0,0,0,856,857,3,98,49,0,857,858,5,210, + 0,0,858,860,1,0,0,0,859,856,1,0,0,0,859,860,1,0,0,0,860,861,1,0,0,0,861, + 862,3,114,57,0,862,95,1,0,0,0,863,868,3,74,37,0,864,865,5,206,0,0,865, + 867,3,74,37,0,866,864,1,0,0,0,867,870,1,0,0,0,868,866,1,0,0,0,868,869, + 1,0,0,0,869,97,1,0,0,0,870,868,1,0,0,0,871,872,3,114,57,0,872,99,1,0, + 0,0,873,882,5,195,0,0,874,875,5,210,0,0,875,882,7,11,0,0,876,877,5,197, + 0,0,877,879,5,210,0,0,878,880,7,11,0,0,879,878,1,0,0,0,879,880,1,0,0, + 0,880,882,1,0,0,0,881,873,1,0,0,0,881,874,1,0,0,0,881,876,1,0,0,0,882, + 101,1,0,0,0,883,885,7,12,0,0,884,883,1,0,0,0,884,885,1,0,0,0,885,892, + 1,0,0,0,886,893,3,100,50,0,887,893,5,196,0,0,888,893,5,197,0,0,889,893, + 5,198,0,0,890,893,5,82,0,0,891,893,5,113,0,0,892,886,1,0,0,0,892,887, + 1,0,0,0,892,888,1,0,0,0,892,889,1,0,0,0,892,890,1,0,0,0,892,891,1,0,0, + 0,893,103,1,0,0,0,894,898,3,102,51,0,895,898,5,199,0,0,896,898,5,116, + 0,0,897,894,1,0,0,0,897,895,1,0,0,0,897,896,1,0,0,0,898,105,1,0,0,0,899, + 900,7,13,0,0,900,107,1,0,0,0,901,902,7,14,0,0,902,109,1,0,0,0,903,904, + 7,15,0,0,904,111,1,0,0,0,905,908,5,194,0,0,906,908,3,110,55,0,907,905, + 1,0,0,0,907,906,1,0,0,0,908,113,1,0,0,0,909,913,5,194,0,0,910,913,3,106, + 53,0,911,913,3,108,54,0,912,909,1,0,0,0,912,910,1,0,0,0,912,911,1,0,0, + 0,913,115,1,0,0,0,914,915,5,199,0,0,915,916,5,212,0,0,916,917,3,102,51, + 0,917,117,1,0,0,0,114,120,130,138,141,145,148,152,155,158,161,164,168, + 172,175,178,181,185,188,197,203,224,241,258,264,270,281,283,294,297,303, + 311,317,319,323,328,331,334,338,342,345,347,350,354,358,361,363,365,370, + 381,387,394,399,403,407,412,419,427,430,433,452,466,482,494,506,514,518, + 525,531,540,544,575,592,604,614,617,621,624,636,653,657,663,670,682,686, + 689,698,712,739,748,750,752,760,765,773,783,786,796,809,815,818,825,836, + 842,846,852,859,868,879,881,884,892,897,907,912 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + hogqlparserParserStaticData = staticData.release(); +} + +} + +HogQLParser::HogQLParser(TokenStream *input) : HogQLParser(input, antlr4::atn::ParserATNSimulatorOptions()) {} + +HogQLParser::HogQLParser(TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options) : Parser(input) { + HogQLParser::initialize(); + _interpreter = new atn::ParserATNSimulator(this, *hogqlparserParserStaticData->atn, hogqlparserParserStaticData->decisionToDFA, hogqlparserParserStaticData->sharedContextCache, options); +} + +HogQLParser::~HogQLParser() { + delete _interpreter; +} + +const atn::ATN& HogQLParser::getATN() const { + return *hogqlparserParserStaticData->atn; +} + +std::string HogQLParser::getGrammarFileName() const { + return "HogQLParser.g4"; +} + +const std::vector& HogQLParser::getRuleNames() const { + return hogqlparserParserStaticData->ruleNames; +} + +const dfa::Vocabulary& HogQLParser::getVocabulary() const { + return hogqlparserParserStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView HogQLParser::getSerializedATN() const { + return hogqlparserParserStaticData->serializedATN; +} + + +//----------------- SelectContext ------------------------------------------------------------------ + +HogQLParser::SelectContext::SelectContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::SelectContext::EOF() { + return getToken(HogQLParser::EOF, 0); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::SelectContext::selectUnionStmt() { + return getRuleContext(0); +} + +HogQLParser::SelectStmtContext* HogQLParser::SelectContext::selectStmt() { + return getRuleContext(0); +} + + +size_t HogQLParser::SelectContext::getRuleIndex() const { + return HogQLParser::RuleSelect; +} + + +std::any HogQLParser::SelectContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelect(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SelectContext* HogQLParser::select() { + SelectContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 0, HogQLParser::RuleSelect); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(120); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 0, _ctx)) { + case 1: { + setState(118); + selectUnionStmt(); + break; + } + + case 2: { + setState(119); + selectStmt(); + break; + } + + default: + break; + } + setState(122); + match(HogQLParser::EOF); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SelectUnionStmtContext ------------------------------------------------------------------ + +HogQLParser::SelectUnionStmtContext::SelectUnionStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::SelectUnionStmtContext::selectStmtWithParens() { + return getRuleContexts(); +} + +HogQLParser::SelectStmtWithParensContext* HogQLParser::SelectUnionStmtContext::selectStmtWithParens(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::SelectUnionStmtContext::UNION() { + return getTokens(HogQLParser::UNION); +} + +tree::TerminalNode* HogQLParser::SelectUnionStmtContext::UNION(size_t i) { + return getToken(HogQLParser::UNION, i); +} + +std::vector HogQLParser::SelectUnionStmtContext::ALL() { + return getTokens(HogQLParser::ALL); +} + +tree::TerminalNode* HogQLParser::SelectUnionStmtContext::ALL(size_t i) { + return getToken(HogQLParser::ALL, i); +} + + +size_t HogQLParser::SelectUnionStmtContext::getRuleIndex() const { + return HogQLParser::RuleSelectUnionStmt; +} + + +std::any HogQLParser::SelectUnionStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectUnionStmt(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::selectUnionStmt() { + SelectUnionStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 2, HogQLParser::RuleSelectUnionStmt); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(124); + selectStmtWithParens(); + setState(130); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::UNION) { + setState(125); + match(HogQLParser::UNION); + setState(126); + match(HogQLParser::ALL); + setState(127); + selectStmtWithParens(); + setState(132); + _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 ------------------------------------------------------------------ + +HogQLParser::SelectStmtWithParensContext::SelectStmtWithParensContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::SelectStmtContext* HogQLParser::SelectStmtWithParensContext::selectStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::SelectStmtWithParensContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::SelectStmtWithParensContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::SelectStmtWithParensContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + + +size_t HogQLParser::SelectStmtWithParensContext::getRuleIndex() const { + return HogQLParser::RuleSelectStmtWithParens; +} + + +std::any HogQLParser::SelectStmtWithParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectStmtWithParens(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SelectStmtWithParensContext* HogQLParser::selectStmtWithParens() { + SelectStmtWithParensContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 4, HogQLParser::RuleSelectStmtWithParens); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(138); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::SELECT: + case HogQLParser::WITH: { + enterOuterAlt(_localctx, 1); + setState(133); + selectStmt(); + break; + } + + case HogQLParser::LPAREN: { + enterOuterAlt(_localctx, 2); + setState(134); + match(HogQLParser::LPAREN); + setState(135); + selectUnionStmt(); + setState(136); + match(HogQLParser::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 ------------------------------------------------------------------ + +HogQLParser::SelectStmtContext::SelectStmtContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::SELECT() { + return getToken(HogQLParser::SELECT, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::SelectStmtContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::DISTINCT() { + return getToken(HogQLParser::DISTINCT, 0); +} + +HogQLParser::TopClauseContext* HogQLParser::SelectStmtContext::topClause() { + return getRuleContext(0); +} + +HogQLParser::ArrayJoinClauseContext* HogQLParser::SelectStmtContext::arrayJoinClause() { + return getRuleContext(0); +} + +HogQLParser::PrewhereClauseContext* HogQLParser::SelectStmtContext::prewhereClause() { + return getRuleContext(0); +} + +HogQLParser::GroupByClauseContext* HogQLParser::SelectStmtContext::groupByClause() { + return getRuleContext(0); +} + +std::vector HogQLParser::SelectStmtContext::WITH() { + return getTokens(HogQLParser::WITH); +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::WITH(size_t i) { + return getToken(HogQLParser::WITH, i); +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::TOTALS() { + return getToken(HogQLParser::TOTALS, 0); +} + +HogQLParser::HavingClauseContext* HogQLParser::SelectStmtContext::havingClause() { + return getRuleContext(0); +} + +HogQLParser::WindowClauseContext* HogQLParser::SelectStmtContext::windowClause() { + return getRuleContext(0); +} + +HogQLParser::OrderByClauseContext* HogQLParser::SelectStmtContext::orderByClause() { + return getRuleContext(0); +} + +HogQLParser::LimitAndOffsetClauseContext* HogQLParser::SelectStmtContext::limitAndOffsetClause() { + return getRuleContext(0); +} + +HogQLParser::OffsetOnlyClauseContext* HogQLParser::SelectStmtContext::offsetOnlyClause() { + return getRuleContext(0); +} + +HogQLParser::SettingsClauseContext* HogQLParser::SelectStmtContext::settingsClause() { + return getRuleContext(0); +} + +HogQLParser::WithClauseContext* HogQLParser::SelectStmtContext::withClause() { + return getRuleContext(0); +} + +HogQLParser::FromClauseContext* HogQLParser::SelectStmtContext::fromClause() { + return getRuleContext(0); +} + +HogQLParser::WhereClauseContext* HogQLParser::SelectStmtContext::whereClause() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::CUBE() { + return getToken(HogQLParser::CUBE, 0); +} + +tree::TerminalNode* HogQLParser::SelectStmtContext::ROLLUP() { + return getToken(HogQLParser::ROLLUP, 0); +} + + +size_t HogQLParser::SelectStmtContext::getRuleIndex() const { + return HogQLParser::RuleSelectStmt; +} + + +std::any HogQLParser::SelectStmtContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSelectStmt(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SelectStmtContext* HogQLParser::selectStmt() { + SelectStmtContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 6, HogQLParser::RuleSelectStmt); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(141); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::WITH) { + setState(140); + antlrcpp::downCast(_localctx)->with = withClause(); + } + setState(143); + match(HogQLParser::SELECT); + setState(145); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 4, _ctx)) { + case 1: { + setState(144); + match(HogQLParser::DISTINCT); + break; + } + + default: + break; + } + setState(148); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 5, _ctx)) { + case 1: { + setState(147); + topClause(); + break; + } + + default: + break; + } + setState(150); + antlrcpp::downCast(_localctx)->columns = columnExprList(); + setState(152); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::FROM) { + setState(151); + antlrcpp::downCast(_localctx)->from = fromClause(); + } + setState(155); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ARRAY || _la == HogQLParser::INNER + + || _la == HogQLParser::LEFT) { + setState(154); + arrayJoinClause(); + } + setState(158); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::PREWHERE) { + setState(157); + prewhereClause(); + } + setState(161); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::WHERE) { + setState(160); + antlrcpp::downCast(_localctx)->where = whereClause(); + } + setState(164); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::GROUP) { + setState(163); + groupByClause(); + } + setState(168); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 11, _ctx)) { + case 1: { + setState(166); + match(HogQLParser::WITH); + setState(167); + _la = _input->LA(1); + if (!(_la == HogQLParser::CUBE || _la == HogQLParser::ROLLUP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + default: + break; + } + setState(172); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::WITH) { + setState(170); + match(HogQLParser::WITH); + setState(171); + match(HogQLParser::TOTALS); + } + setState(175); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::HAVING) { + setState(174); + havingClause(); + } + setState(178); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::WINDOW) { + setState(177); + windowClause(); + } + setState(181); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ORDER) { + setState(180); + orderByClause(); + } + setState(185); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::LIMIT: { + setState(183); + limitAndOffsetClause(); + break; + } + + case HogQLParser::OFFSET: { + setState(184); + offsetOnlyClause(); + break; + } + + case HogQLParser::EOF: + case HogQLParser::SETTINGS: + case HogQLParser::UNION: + case HogQLParser::RPAREN: { + break; + } + + default: + break; + } + setState(188); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::SETTINGS) { + setState(187); + settingsClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WithClauseContext ------------------------------------------------------------------ + +HogQLParser::WithClauseContext::WithClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WithClauseContext::WITH() { + return getToken(HogQLParser::WITH, 0); +} + +HogQLParser::WithExprListContext* HogQLParser::WithClauseContext::withExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::WithClauseContext::getRuleIndex() const { + return HogQLParser::RuleWithClause; +} + + +std::any HogQLParser::WithClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWithClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WithClauseContext* HogQLParser::withClause() { + WithClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 8, HogQLParser::RuleWithClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(190); + match(HogQLParser::WITH); + setState(191); + withExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TopClauseContext ------------------------------------------------------------------ + +HogQLParser::TopClauseContext::TopClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::TopClauseContext::TOP() { + return getToken(HogQLParser::TOP, 0); +} + +tree::TerminalNode* HogQLParser::TopClauseContext::DECIMAL_LITERAL() { + return getToken(HogQLParser::DECIMAL_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::TopClauseContext::WITH() { + return getToken(HogQLParser::WITH, 0); +} + +tree::TerminalNode* HogQLParser::TopClauseContext::TIES() { + return getToken(HogQLParser::TIES, 0); +} + + +size_t HogQLParser::TopClauseContext::getRuleIndex() const { + return HogQLParser::RuleTopClause; +} + + +std::any HogQLParser::TopClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTopClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::TopClauseContext* HogQLParser::topClause() { + TopClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 10, HogQLParser::RuleTopClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(193); + match(HogQLParser::TOP); + setState(194); + match(HogQLParser::DECIMAL_LITERAL); + setState(197); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 18, _ctx)) { + case 1: { + setState(195); + match(HogQLParser::WITH); + setState(196); + match(HogQLParser::TIES); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FromClauseContext ------------------------------------------------------------------ + +HogQLParser::FromClauseContext::FromClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::FromClauseContext::FROM() { + return getToken(HogQLParser::FROM, 0); +} + +HogQLParser::JoinExprContext* HogQLParser::FromClauseContext::joinExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::FromClauseContext::getRuleIndex() const { + return HogQLParser::RuleFromClause; +} + + +std::any HogQLParser::FromClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFromClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::FromClauseContext* HogQLParser::fromClause() { + FromClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 12, HogQLParser::RuleFromClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(199); + match(HogQLParser::FROM); + setState(200); + joinExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ArrayJoinClauseContext ------------------------------------------------------------------ + +HogQLParser::ArrayJoinClauseContext::ArrayJoinClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::ArrayJoinClauseContext::ARRAY() { + return getToken(HogQLParser::ARRAY, 0); +} + +tree::TerminalNode* HogQLParser::ArrayJoinClauseContext::JOIN() { + return getToken(HogQLParser::JOIN, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ArrayJoinClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ArrayJoinClauseContext::LEFT() { + return getToken(HogQLParser::LEFT, 0); +} + +tree::TerminalNode* HogQLParser::ArrayJoinClauseContext::INNER() { + return getToken(HogQLParser::INNER, 0); +} + + +size_t HogQLParser::ArrayJoinClauseContext::getRuleIndex() const { + return HogQLParser::RuleArrayJoinClause; +} + + +std::any HogQLParser::ArrayJoinClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitArrayJoinClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ArrayJoinClauseContext* HogQLParser::arrayJoinClause() { + ArrayJoinClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 14, HogQLParser::RuleArrayJoinClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(203); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::INNER + + || _la == HogQLParser::LEFT) { + setState(202); + _la = _input->LA(1); + if (!(_la == HogQLParser::INNER + + || _la == HogQLParser::LEFT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(205); + match(HogQLParser::ARRAY); + setState(206); + match(HogQLParser::JOIN); + setState(207); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WindowClauseContext ------------------------------------------------------------------ + +HogQLParser::WindowClauseContext::WindowClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WindowClauseContext::WINDOW() { + return getToken(HogQLParser::WINDOW, 0); +} + +std::vector HogQLParser::WindowClauseContext::identifier() { + return getRuleContexts(); +} + +HogQLParser::IdentifierContext* HogQLParser::WindowClauseContext::identifier(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::WindowClauseContext::AS() { + return getTokens(HogQLParser::AS); +} + +tree::TerminalNode* HogQLParser::WindowClauseContext::AS(size_t i) { + return getToken(HogQLParser::AS, i); +} + +std::vector HogQLParser::WindowClauseContext::LPAREN() { + return getTokens(HogQLParser::LPAREN); +} + +tree::TerminalNode* HogQLParser::WindowClauseContext::LPAREN(size_t i) { + return getToken(HogQLParser::LPAREN, i); +} + +std::vector HogQLParser::WindowClauseContext::windowExpr() { + return getRuleContexts(); +} + +HogQLParser::WindowExprContext* HogQLParser::WindowClauseContext::windowExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::WindowClauseContext::RPAREN() { + return getTokens(HogQLParser::RPAREN); +} + +tree::TerminalNode* HogQLParser::WindowClauseContext::RPAREN(size_t i) { + return getToken(HogQLParser::RPAREN, i); +} + +std::vector HogQLParser::WindowClauseContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::WindowClauseContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::WindowClauseContext::getRuleIndex() const { + return HogQLParser::RuleWindowClause; +} + + +std::any HogQLParser::WindowClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWindowClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WindowClauseContext* HogQLParser::windowClause() { + WindowClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 16, HogQLParser::RuleWindowClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(209); + match(HogQLParser::WINDOW); + setState(210); + identifier(); + setState(211); + match(HogQLParser::AS); + setState(212); + match(HogQLParser::LPAREN); + setState(213); + windowExpr(); + setState(214); + match(HogQLParser::RPAREN); + setState(224); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(215); + match(HogQLParser::COMMA); + setState(216); + identifier(); + setState(217); + match(HogQLParser::AS); + setState(218); + match(HogQLParser::LPAREN); + setState(219); + windowExpr(); + setState(220); + match(HogQLParser::RPAREN); + setState(226); + _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; +} + +//----------------- PrewhereClauseContext ------------------------------------------------------------------ + +HogQLParser::PrewhereClauseContext::PrewhereClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::PrewhereClauseContext::PREWHERE() { + return getToken(HogQLParser::PREWHERE, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::PrewhereClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::PrewhereClauseContext::getRuleIndex() const { + return HogQLParser::RulePrewhereClause; +} + + +std::any HogQLParser::PrewhereClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPrewhereClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::PrewhereClauseContext* HogQLParser::prewhereClause() { + PrewhereClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 18, HogQLParser::RulePrewhereClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(227); + match(HogQLParser::PREWHERE); + setState(228); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WhereClauseContext ------------------------------------------------------------------ + +HogQLParser::WhereClauseContext::WhereClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WhereClauseContext::WHERE() { + return getToken(HogQLParser::WHERE, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::WhereClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::WhereClauseContext::getRuleIndex() const { + return HogQLParser::RuleWhereClause; +} + + +std::any HogQLParser::WhereClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWhereClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WhereClauseContext* HogQLParser::whereClause() { + WhereClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 20, HogQLParser::RuleWhereClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(230); + match(HogQLParser::WHERE); + setState(231); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- GroupByClauseContext ------------------------------------------------------------------ + +HogQLParser::GroupByClauseContext::GroupByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::GROUP() { + return getToken(HogQLParser::GROUP, 0); +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::GroupByClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::CUBE() { + return getToken(HogQLParser::CUBE, 0); +} + +tree::TerminalNode* HogQLParser::GroupByClauseContext::ROLLUP() { + return getToken(HogQLParser::ROLLUP, 0); +} + + +size_t HogQLParser::GroupByClauseContext::getRuleIndex() const { + return HogQLParser::RuleGroupByClause; +} + + +std::any HogQLParser::GroupByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitGroupByClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::GroupByClauseContext* HogQLParser::groupByClause() { + GroupByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 22, HogQLParser::RuleGroupByClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(233); + match(HogQLParser::GROUP); + setState(234); + match(HogQLParser::BY); + setState(241); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 21, _ctx)) { + case 1: { + setState(235); + _la = _input->LA(1); + if (!(_la == HogQLParser::CUBE || _la == HogQLParser::ROLLUP)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(236); + match(HogQLParser::LPAREN); + setState(237); + columnExprList(); + setState(238); + match(HogQLParser::RPAREN); + break; + } + + case 2: { + setState(240); + columnExprList(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- HavingClauseContext ------------------------------------------------------------------ + +HogQLParser::HavingClauseContext::HavingClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::HavingClauseContext::HAVING() { + return getToken(HogQLParser::HAVING, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::HavingClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::HavingClauseContext::getRuleIndex() const { + return HogQLParser::RuleHavingClause; +} + + +std::any HogQLParser::HavingClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitHavingClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::HavingClauseContext* HogQLParser::havingClause() { + HavingClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 24, HogQLParser::RuleHavingClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(243); + match(HogQLParser::HAVING); + setState(244); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OrderByClauseContext ------------------------------------------------------------------ + +HogQLParser::OrderByClauseContext::OrderByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::OrderByClauseContext::ORDER() { + return getToken(HogQLParser::ORDER, 0); +} + +tree::TerminalNode* HogQLParser::OrderByClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +HogQLParser::OrderExprListContext* HogQLParser::OrderByClauseContext::orderExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::OrderByClauseContext::getRuleIndex() const { + return HogQLParser::RuleOrderByClause; +} + + +std::any HogQLParser::OrderByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderByClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::OrderByClauseContext* HogQLParser::orderByClause() { + OrderByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 26, HogQLParser::RuleOrderByClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(246); + match(HogQLParser::ORDER); + setState(247); + match(HogQLParser::BY); + setState(248); + orderExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ProjectionOrderByClauseContext ------------------------------------------------------------------ + +HogQLParser::ProjectionOrderByClauseContext::ProjectionOrderByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::ProjectionOrderByClauseContext::ORDER() { + return getToken(HogQLParser::ORDER, 0); +} + +tree::TerminalNode* HogQLParser::ProjectionOrderByClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ProjectionOrderByClauseContext::columnExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::ProjectionOrderByClauseContext::getRuleIndex() const { + return HogQLParser::RuleProjectionOrderByClause; +} + + +std::any HogQLParser::ProjectionOrderByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitProjectionOrderByClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ProjectionOrderByClauseContext* HogQLParser::projectionOrderByClause() { + ProjectionOrderByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 28, HogQLParser::RuleProjectionOrderByClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(250); + match(HogQLParser::ORDER); + setState(251); + match(HogQLParser::BY); + setState(252); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LimitAndOffsetClauseContext ------------------------------------------------------------------ + +HogQLParser::LimitAndOffsetClauseContext::LimitAndOffsetClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::LIMIT() { + return getToken(HogQLParser::LIMIT, 0); +} + +std::vector HogQLParser::LimitAndOffsetClauseContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::LimitAndOffsetClauseContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::COMMA() { + return getToken(HogQLParser::COMMA, 0); +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::LimitAndOffsetClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::WITH() { + return getToken(HogQLParser::WITH, 0); +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::TIES() { + return getToken(HogQLParser::TIES, 0); +} + +tree::TerminalNode* HogQLParser::LimitAndOffsetClauseContext::OFFSET() { + return getToken(HogQLParser::OFFSET, 0); +} + + +size_t HogQLParser::LimitAndOffsetClauseContext::getRuleIndex() const { + return HogQLParser::RuleLimitAndOffsetClause; +} + + +std::any HogQLParser::LimitAndOffsetClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLimitAndOffsetClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::LimitAndOffsetClauseContext* HogQLParser::limitAndOffsetClause() { + LimitAndOffsetClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 30, HogQLParser::RuleLimitAndOffsetClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(283); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 26, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(254); + match(HogQLParser::LIMIT); + setState(255); + columnExpr(0); + setState(258); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::COMMA) { + setState(256); + match(HogQLParser::COMMA); + setState(257); + columnExpr(0); + } + setState(264); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::WITH: { + setState(260); + match(HogQLParser::WITH); + setState(261); + match(HogQLParser::TIES); + break; + } + + case HogQLParser::BY: { + setState(262); + match(HogQLParser::BY); + setState(263); + columnExprList(); + break; + } + + case HogQLParser::EOF: + case HogQLParser::SETTINGS: + case HogQLParser::UNION: + case HogQLParser::RPAREN: { + break; + } + + default: + break; + } + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(266); + match(HogQLParser::LIMIT); + setState(267); + columnExpr(0); + setState(270); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::WITH) { + setState(268); + match(HogQLParser::WITH); + setState(269); + match(HogQLParser::TIES); + } + setState(272); + match(HogQLParser::OFFSET); + setState(273); + columnExpr(0); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(275); + match(HogQLParser::LIMIT); + setState(276); + columnExpr(0); + setState(277); + match(HogQLParser::OFFSET); + setState(278); + columnExpr(0); + setState(281); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::BY) { + setState(279); + match(HogQLParser::BY); + setState(280); + columnExprList(); + } + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OffsetOnlyClauseContext ------------------------------------------------------------------ + +HogQLParser::OffsetOnlyClauseContext::OffsetOnlyClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::OffsetOnlyClauseContext::OFFSET() { + return getToken(HogQLParser::OFFSET, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::OffsetOnlyClauseContext::columnExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::OffsetOnlyClauseContext::getRuleIndex() const { + return HogQLParser::RuleOffsetOnlyClause; +} + + +std::any HogQLParser::OffsetOnlyClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOffsetOnlyClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::OffsetOnlyClauseContext* HogQLParser::offsetOnlyClause() { + OffsetOnlyClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 32, HogQLParser::RuleOffsetOnlyClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(285); + match(HogQLParser::OFFSET); + setState(286); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SettingsClauseContext ------------------------------------------------------------------ + +HogQLParser::SettingsClauseContext::SettingsClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::SettingsClauseContext::SETTINGS() { + return getToken(HogQLParser::SETTINGS, 0); +} + +HogQLParser::SettingExprListContext* HogQLParser::SettingsClauseContext::settingExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::SettingsClauseContext::getRuleIndex() const { + return HogQLParser::RuleSettingsClause; +} + + +std::any HogQLParser::SettingsClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingsClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SettingsClauseContext* HogQLParser::settingsClause() { + SettingsClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 34, HogQLParser::RuleSettingsClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(288); + match(HogQLParser::SETTINGS); + setState(289); + settingExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JoinExprContext ------------------------------------------------------------------ + +HogQLParser::JoinExprContext::JoinExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::JoinExprContext::getRuleIndex() const { + return HogQLParser::RuleJoinExpr; +} + +void HogQLParser::JoinExprContext::copyFrom(JoinExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- JoinExprOpContext ------------------------------------------------------------------ + +std::vector HogQLParser::JoinExprOpContext::joinExpr() { + return getRuleContexts(); +} + +HogQLParser::JoinExprContext* HogQLParser::JoinExprOpContext::joinExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::JoinExprOpContext::JOIN() { + return getToken(HogQLParser::JOIN, 0); +} + +HogQLParser::JoinConstraintClauseContext* HogQLParser::JoinExprOpContext::joinConstraintClause() { + return getRuleContext(0); +} + +HogQLParser::JoinOpContext* HogQLParser::JoinExprOpContext::joinOp() { + return getRuleContext(0); +} + +HogQLParser::JoinExprOpContext::JoinExprOpContext(JoinExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinExprOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprOp(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprTableContext ------------------------------------------------------------------ + +HogQLParser::TableExprContext* HogQLParser::JoinExprTableContext::tableExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::JoinExprTableContext::FINAL() { + return getToken(HogQLParser::FINAL, 0); +} + +HogQLParser::SampleClauseContext* HogQLParser::JoinExprTableContext::sampleClause() { + return getRuleContext(0); +} + +HogQLParser::JoinExprTableContext::JoinExprTableContext(JoinExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinExprTableContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprTable(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprParensContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::JoinExprParensContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::JoinExprContext* HogQLParser::JoinExprParensContext::joinExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::JoinExprParensContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::JoinExprParensContext::JoinExprParensContext(JoinExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinExprParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprParens(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinExprCrossOpContext ------------------------------------------------------------------ + +std::vector HogQLParser::JoinExprCrossOpContext::joinExpr() { + return getRuleContexts(); +} + +HogQLParser::JoinExprContext* HogQLParser::JoinExprCrossOpContext::joinExpr(size_t i) { + return getRuleContext(i); +} + +HogQLParser::JoinOpCrossContext* HogQLParser::JoinExprCrossOpContext::joinOpCross() { + return getRuleContext(0); +} + +HogQLParser::JoinExprCrossOpContext::JoinExprCrossOpContext(JoinExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinExprCrossOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinExprCrossOp(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::JoinExprContext* HogQLParser::joinExpr() { + return joinExpr(0); +} + +HogQLParser::JoinExprContext* HogQLParser::joinExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + HogQLParser::JoinExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + HogQLParser::JoinExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 36; + enterRecursionRule(_localctx, 36, HogQLParser::RuleJoinExpr, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(303); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 29, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(292); + tableExpr(0); + setState(294); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 27, _ctx)) { + case 1: { + setState(293); + match(HogQLParser::FINAL); + break; + } + + default: + break; + } + setState(297); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 28, _ctx)) { + case 1: { + setState(296); + sampleClause(); + break; + } + + default: + break; + } + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(299); + match(HogQLParser::LPAREN); + setState(300); + joinExpr(0); + setState(301); + match(HogQLParser::RPAREN); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(319); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 32, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(317); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 31, _ctx)) { + case 1: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleJoinExpr); + setState(305); + + if (!(precpred(_ctx, 3))) throw FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(306); + joinOpCross(); + setState(307); + joinExpr(4); + break; + } + + case 2: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleJoinExpr); + setState(309); + + if (!(precpred(_ctx, 4))) throw FailedPredicateException(this, "precpred(_ctx, 4)"); + setState(311); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4496) != 0) || ((((_la - 69) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 69)) & 134250497) != 0) || _la == HogQLParser::RIGHT + + || _la == HogQLParser::SEMI) { + setState(310); + joinOp(); + } + setState(313); + match(HogQLParser::JOIN); + setState(314); + joinExpr(0); + setState(315); + joinConstraintClause(); + break; + } + + default: + break; + } + } + setState(321); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 32, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- JoinOpContext ------------------------------------------------------------------ + +HogQLParser::JoinOpContext::JoinOpContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::JoinOpContext::getRuleIndex() const { + return HogQLParser::RuleJoinOp; +} + +void HogQLParser::JoinOpContext::copyFrom(JoinOpContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- JoinOpFullContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::JoinOpFullContext::FULL() { + return getToken(HogQLParser::FULL, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpFullContext::OUTER() { + return getToken(HogQLParser::OUTER, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpFullContext::ALL() { + return getToken(HogQLParser::ALL, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpFullContext::ANY() { + return getToken(HogQLParser::ANY, 0); +} + +HogQLParser::JoinOpFullContext::JoinOpFullContext(JoinOpContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinOpFullContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpFull(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinOpInnerContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::JoinOpInnerContext::INNER() { + return getToken(HogQLParser::INNER, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpInnerContext::ALL() { + return getToken(HogQLParser::ALL, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpInnerContext::ANY() { + return getToken(HogQLParser::ANY, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpInnerContext::ASOF() { + return getToken(HogQLParser::ASOF, 0); +} + +HogQLParser::JoinOpInnerContext::JoinOpInnerContext(JoinOpContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinOpInnerContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpInner(this); + else + return visitor->visitChildren(this); +} +//----------------- JoinOpLeftRightContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::LEFT() { + return getToken(HogQLParser::LEFT, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::RIGHT() { + return getToken(HogQLParser::RIGHT, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::OUTER() { + return getToken(HogQLParser::OUTER, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::SEMI() { + return getToken(HogQLParser::SEMI, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::ALL() { + return getToken(HogQLParser::ALL, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::ANTI() { + return getToken(HogQLParser::ANTI, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::ANY() { + return getToken(HogQLParser::ANY, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpLeftRightContext::ASOF() { + return getToken(HogQLParser::ASOF, 0); +} + +HogQLParser::JoinOpLeftRightContext::JoinOpLeftRightContext(JoinOpContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::JoinOpLeftRightContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpLeftRight(this); + else + return visitor->visitChildren(this); +} +HogQLParser::JoinOpContext* HogQLParser::joinOp() { + JoinOpContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 38, HogQLParser::RuleJoinOp); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(365); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 46, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 1); + setState(331); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 35, _ctx)) { + case 1: { + setState(323); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4368) != 0)) { + setState(322); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4368) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(325); + match(HogQLParser::INNER); + break; + } + + case 2: { + setState(326); + match(HogQLParser::INNER); + setState(328); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4368) != 0)) { + setState(327); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4368) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + case 3: { + setState(330); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4368) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + default: + break; + } + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 2); + setState(347); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 40, _ctx)) { + case 1: { + setState(334); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4496) != 0) || _la == HogQLParser::SEMI) { + setState(333); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4496) != 0) || _la == HogQLParser::SEMI)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(336); + _la = _input->LA(1); + if (!(_la == HogQLParser::LEFT + + || _la == HogQLParser::RIGHT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(338); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::OUTER) { + setState(337); + match(HogQLParser::OUTER); + } + break; + } + + case 2: { + setState(340); + _la = _input->LA(1); + if (!(_la == HogQLParser::LEFT + + || _la == HogQLParser::RIGHT)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(342); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::OUTER) { + setState(341); + match(HogQLParser::OUTER); + } + setState(345); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4496) != 0) || _la == HogQLParser::SEMI) { + setState(344); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 4496) != 0) || _la == HogQLParser::SEMI)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + default: + break; + } + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 3); + setState(363); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 45, _ctx)) { + case 1: { + setState(350); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ALL + + || _la == HogQLParser::ANY) { + setState(349); + _la = _input->LA(1); + if (!(_la == HogQLParser::ALL + + || _la == HogQLParser::ANY)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(352); + match(HogQLParser::FULL); + setState(354); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::OUTER) { + setState(353); + match(HogQLParser::OUTER); + } + break; + } + + case 2: { + setState(356); + match(HogQLParser::FULL); + setState(358); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::OUTER) { + setState(357); + match(HogQLParser::OUTER); + } + setState(361); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ALL + + || _la == HogQLParser::ANY) { + setState(360); + _la = _input->LA(1); + if (!(_la == HogQLParser::ALL + + || _la == HogQLParser::ANY)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + break; + } + + default: + break; + } + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- JoinOpCrossContext ------------------------------------------------------------------ + +HogQLParser::JoinOpCrossContext::JoinOpCrossContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::JoinOpCrossContext::CROSS() { + return getToken(HogQLParser::CROSS, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpCrossContext::JOIN() { + return getToken(HogQLParser::JOIN, 0); +} + +tree::TerminalNode* HogQLParser::JoinOpCrossContext::COMMA() { + return getToken(HogQLParser::COMMA, 0); +} + + +size_t HogQLParser::JoinOpCrossContext::getRuleIndex() const { + return HogQLParser::RuleJoinOpCross; +} + + +std::any HogQLParser::JoinOpCrossContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinOpCross(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::JoinOpCrossContext* HogQLParser::joinOpCross() { + JoinOpCrossContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 40, HogQLParser::RuleJoinOpCross); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(370); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::CROSS: { + enterOuterAlt(_localctx, 1); + setState(367); + match(HogQLParser::CROSS); + setState(368); + match(HogQLParser::JOIN); + break; + } + + case HogQLParser::COMMA: { + enterOuterAlt(_localctx, 2); + setState(369); + match(HogQLParser::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 ------------------------------------------------------------------ + +HogQLParser::JoinConstraintClauseContext::JoinConstraintClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::JoinConstraintClauseContext::ON() { + return getToken(HogQLParser::ON, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::JoinConstraintClauseContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::JoinConstraintClauseContext::USING() { + return getToken(HogQLParser::USING, 0); +} + +tree::TerminalNode* HogQLParser::JoinConstraintClauseContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +tree::TerminalNode* HogQLParser::JoinConstraintClauseContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + + +size_t HogQLParser::JoinConstraintClauseContext::getRuleIndex() const { + return HogQLParser::RuleJoinConstraintClause; +} + + +std::any HogQLParser::JoinConstraintClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitJoinConstraintClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::JoinConstraintClauseContext* HogQLParser::joinConstraintClause() { + JoinConstraintClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 42, HogQLParser::RuleJoinConstraintClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(381); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 48, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(372); + match(HogQLParser::ON); + setState(373); + columnExprList(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(374); + match(HogQLParser::USING); + setState(375); + match(HogQLParser::LPAREN); + setState(376); + columnExprList(); + setState(377); + match(HogQLParser::RPAREN); + break; + } + + case 3: { + enterOuterAlt(_localctx, 3); + setState(379); + match(HogQLParser::USING); + setState(380); + columnExprList(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SampleClauseContext ------------------------------------------------------------------ + +HogQLParser::SampleClauseContext::SampleClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::SampleClauseContext::SAMPLE() { + return getToken(HogQLParser::SAMPLE, 0); +} + +std::vector HogQLParser::SampleClauseContext::ratioExpr() { + return getRuleContexts(); +} + +HogQLParser::RatioExprContext* HogQLParser::SampleClauseContext::ratioExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::SampleClauseContext::OFFSET() { + return getToken(HogQLParser::OFFSET, 0); +} + + +size_t HogQLParser::SampleClauseContext::getRuleIndex() const { + return HogQLParser::RuleSampleClause; +} + + +std::any HogQLParser::SampleClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSampleClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SampleClauseContext* HogQLParser::sampleClause() { + SampleClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 44, HogQLParser::RuleSampleClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(383); + match(HogQLParser::SAMPLE); + setState(384); + ratioExpr(); + setState(387); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 49, _ctx)) { + case 1: { + setState(385); + match(HogQLParser::OFFSET); + setState(386); + ratioExpr(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- OrderExprListContext ------------------------------------------------------------------ + +HogQLParser::OrderExprListContext::OrderExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::OrderExprListContext::orderExpr() { + return getRuleContexts(); +} + +HogQLParser::OrderExprContext* HogQLParser::OrderExprListContext::orderExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::OrderExprListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::OrderExprListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::OrderExprListContext::getRuleIndex() const { + return HogQLParser::RuleOrderExprList; +} + + +std::any HogQLParser::OrderExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderExprList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::OrderExprListContext* HogQLParser::orderExprList() { + OrderExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 46, HogQLParser::RuleOrderExprList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(389); + orderExpr(); + setState(394); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(390); + match(HogQLParser::COMMA); + setState(391); + orderExpr(); + setState(396); + _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; +} + +//----------------- OrderExprContext ------------------------------------------------------------------ + +HogQLParser::OrderExprContext::OrderExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::ColumnExprContext* HogQLParser::OrderExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::NULLS() { + return getToken(HogQLParser::NULLS, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::COLLATE() { + return getToken(HogQLParser::COLLATE, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::ASCENDING() { + return getToken(HogQLParser::ASCENDING, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::DESCENDING() { + return getToken(HogQLParser::DESCENDING, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::DESC() { + return getToken(HogQLParser::DESC, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::FIRST() { + return getToken(HogQLParser::FIRST, 0); +} + +tree::TerminalNode* HogQLParser::OrderExprContext::LAST() { + return getToken(HogQLParser::LAST, 0); +} + + +size_t HogQLParser::OrderExprContext::getRuleIndex() const { + return HogQLParser::RuleOrderExpr; +} + + +std::any HogQLParser::OrderExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitOrderExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::OrderExprContext* HogQLParser::orderExpr() { + OrderExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 48, HogQLParser::RuleOrderExpr); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(397); + columnExpr(0); + setState(399); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 13194139535360) != 0)) { + setState(398); + _la = _input->LA(1); + if (!((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & 13194139535360) != 0))) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(403); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::NULLS) { + setState(401); + match(HogQLParser::NULLS); + setState(402); + _la = _input->LA(1); + if (!(_la == HogQLParser::FIRST + + || _la == HogQLParser::LAST)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(407); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::COLLATE) { + setState(405); + match(HogQLParser::COLLATE); + setState(406); + match(HogQLParser::STRING_LITERAL); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- RatioExprContext ------------------------------------------------------------------ + +HogQLParser::RatioExprContext::RatioExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::RatioExprContext::numberLiteral() { + return getRuleContexts(); +} + +HogQLParser::NumberLiteralContext* HogQLParser::RatioExprContext::numberLiteral(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::RatioExprContext::SLASH() { + return getToken(HogQLParser::SLASH, 0); +} + + +size_t HogQLParser::RatioExprContext::getRuleIndex() const { + return HogQLParser::RuleRatioExpr; +} + + +std::any HogQLParser::RatioExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitRatioExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::RatioExprContext* HogQLParser::ratioExpr() { + RatioExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 50, HogQLParser::RuleRatioExpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(409); + numberLiteral(); + setState(412); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 54, _ctx)) { + case 1: { + setState(410); + match(HogQLParser::SLASH); + setState(411); + numberLiteral(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- SettingExprListContext ------------------------------------------------------------------ + +HogQLParser::SettingExprListContext::SettingExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::SettingExprListContext::settingExpr() { + return getRuleContexts(); +} + +HogQLParser::SettingExprContext* HogQLParser::SettingExprListContext::settingExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::SettingExprListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::SettingExprListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::SettingExprListContext::getRuleIndex() const { + return HogQLParser::RuleSettingExprList; +} + + +std::any HogQLParser::SettingExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingExprList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SettingExprListContext* HogQLParser::settingExprList() { + SettingExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 52, HogQLParser::RuleSettingExprList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(414); + settingExpr(); + setState(419); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(415); + match(HogQLParser::COMMA); + setState(416); + settingExpr(); + setState(421); + _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; +} + +//----------------- SettingExprContext ------------------------------------------------------------------ + +HogQLParser::SettingExprContext::SettingExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::IdentifierContext* HogQLParser::SettingExprContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::SettingExprContext::EQ_SINGLE() { + return getToken(HogQLParser::EQ_SINGLE, 0); +} + +HogQLParser::LiteralContext* HogQLParser::SettingExprContext::literal() { + return getRuleContext(0); +} + + +size_t HogQLParser::SettingExprContext::getRuleIndex() const { + return HogQLParser::RuleSettingExpr; +} + + +std::any HogQLParser::SettingExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitSettingExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::SettingExprContext* HogQLParser::settingExpr() { + SettingExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 54, HogQLParser::RuleSettingExpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(422); + identifier(); + setState(423); + match(HogQLParser::EQ_SINGLE); + setState(424); + literal(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WindowExprContext ------------------------------------------------------------------ + +HogQLParser::WindowExprContext::WindowExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::WinPartitionByClauseContext* HogQLParser::WindowExprContext::winPartitionByClause() { + return getRuleContext(0); +} + +HogQLParser::WinOrderByClauseContext* HogQLParser::WindowExprContext::winOrderByClause() { + return getRuleContext(0); +} + +HogQLParser::WinFrameClauseContext* HogQLParser::WindowExprContext::winFrameClause() { + return getRuleContext(0); +} + + +size_t HogQLParser::WindowExprContext::getRuleIndex() const { + return HogQLParser::RuleWindowExpr; +} + + +std::any HogQLParser::WindowExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWindowExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WindowExprContext* HogQLParser::windowExpr() { + WindowExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 56, HogQLParser::RuleWindowExpr); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(427); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::PARTITION) { + setState(426); + winPartitionByClause(); + } + setState(430); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ORDER) { + setState(429); + winOrderByClause(); + } + setState(433); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::RANGE + + || _la == HogQLParser::ROWS) { + setState(432); + winFrameClause(); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WinPartitionByClauseContext ------------------------------------------------------------------ + +HogQLParser::WinPartitionByClauseContext::WinPartitionByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WinPartitionByClauseContext::PARTITION() { + return getToken(HogQLParser::PARTITION, 0); +} + +tree::TerminalNode* HogQLParser::WinPartitionByClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::WinPartitionByClauseContext::columnExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::WinPartitionByClauseContext::getRuleIndex() const { + return HogQLParser::RuleWinPartitionByClause; +} + + +std::any HogQLParser::WinPartitionByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWinPartitionByClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WinPartitionByClauseContext* HogQLParser::winPartitionByClause() { + WinPartitionByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 58, HogQLParser::RuleWinPartitionByClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(435); + match(HogQLParser::PARTITION); + setState(436); + match(HogQLParser::BY); + setState(437); + columnExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WinOrderByClauseContext ------------------------------------------------------------------ + +HogQLParser::WinOrderByClauseContext::WinOrderByClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WinOrderByClauseContext::ORDER() { + return getToken(HogQLParser::ORDER, 0); +} + +tree::TerminalNode* HogQLParser::WinOrderByClauseContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +HogQLParser::OrderExprListContext* HogQLParser::WinOrderByClauseContext::orderExprList() { + return getRuleContext(0); +} + + +size_t HogQLParser::WinOrderByClauseContext::getRuleIndex() const { + return HogQLParser::RuleWinOrderByClause; +} + + +std::any HogQLParser::WinOrderByClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWinOrderByClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WinOrderByClauseContext* HogQLParser::winOrderByClause() { + WinOrderByClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 60, HogQLParser::RuleWinOrderByClause); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(439); + match(HogQLParser::ORDER); + setState(440); + match(HogQLParser::BY); + setState(441); + orderExprList(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WinFrameClauseContext ------------------------------------------------------------------ + +HogQLParser::WinFrameClauseContext::WinFrameClauseContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::WinFrameExtendContext* HogQLParser::WinFrameClauseContext::winFrameExtend() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::WinFrameClauseContext::ROWS() { + return getToken(HogQLParser::ROWS, 0); +} + +tree::TerminalNode* HogQLParser::WinFrameClauseContext::RANGE() { + return getToken(HogQLParser::RANGE, 0); +} + + +size_t HogQLParser::WinFrameClauseContext::getRuleIndex() const { + return HogQLParser::RuleWinFrameClause; +} + + +std::any HogQLParser::WinFrameClauseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWinFrameClause(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WinFrameClauseContext* HogQLParser::winFrameClause() { + WinFrameClauseContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 62, HogQLParser::RuleWinFrameClause); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(443); + _la = _input->LA(1); + if (!(_la == HogQLParser::RANGE + + || _la == HogQLParser::ROWS)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(444); + winFrameExtend(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WinFrameExtendContext ------------------------------------------------------------------ + +HogQLParser::WinFrameExtendContext::WinFrameExtendContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::WinFrameExtendContext::getRuleIndex() const { + return HogQLParser::RuleWinFrameExtend; +} + +void HogQLParser::WinFrameExtendContext::copyFrom(WinFrameExtendContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- FrameStartContext ------------------------------------------------------------------ + +HogQLParser::WinFrameBoundContext* HogQLParser::FrameStartContext::winFrameBound() { + return getRuleContext(0); +} + +HogQLParser::FrameStartContext::FrameStartContext(WinFrameExtendContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::FrameStartContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFrameStart(this); + else + return visitor->visitChildren(this); +} +//----------------- FrameBetweenContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::FrameBetweenContext::BETWEEN() { + return getToken(HogQLParser::BETWEEN, 0); +} + +std::vector HogQLParser::FrameBetweenContext::winFrameBound() { + return getRuleContexts(); +} + +HogQLParser::WinFrameBoundContext* HogQLParser::FrameBetweenContext::winFrameBound(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::FrameBetweenContext::AND() { + return getToken(HogQLParser::AND, 0); +} + +HogQLParser::FrameBetweenContext::FrameBetweenContext(WinFrameExtendContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::FrameBetweenContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFrameBetween(this); + else + return visitor->visitChildren(this); +} +HogQLParser::WinFrameExtendContext* HogQLParser::winFrameExtend() { + WinFrameExtendContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 64, HogQLParser::RuleWinFrameExtend); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(452); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::CURRENT: + case HogQLParser::INF: + case HogQLParser::NAN_SQL: + case HogQLParser::UNBOUNDED: + case HogQLParser::FLOATING_LITERAL: + case HogQLParser::OCTAL_LITERAL: + case HogQLParser::DECIMAL_LITERAL: + case HogQLParser::HEXADECIMAL_LITERAL: + case HogQLParser::DASH: + case HogQLParser::DOT: + case HogQLParser::PLUS: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 1); + setState(446); + winFrameBound(); + break; + } + + case HogQLParser::BETWEEN: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 2); + setState(447); + match(HogQLParser::BETWEEN); + setState(448); + winFrameBound(); + setState(449); + match(HogQLParser::AND); + setState(450); + winFrameBound(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WinFrameBoundContext ------------------------------------------------------------------ + +HogQLParser::WinFrameBoundContext::WinFrameBoundContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::WinFrameBoundContext::CURRENT() { + return getToken(HogQLParser::CURRENT, 0); +} + +tree::TerminalNode* HogQLParser::WinFrameBoundContext::ROW() { + return getToken(HogQLParser::ROW, 0); +} + +tree::TerminalNode* HogQLParser::WinFrameBoundContext::UNBOUNDED() { + return getToken(HogQLParser::UNBOUNDED, 0); +} + +tree::TerminalNode* HogQLParser::WinFrameBoundContext::PRECEDING() { + return getToken(HogQLParser::PRECEDING, 0); +} + +tree::TerminalNode* HogQLParser::WinFrameBoundContext::FOLLOWING() { + return getToken(HogQLParser::FOLLOWING, 0); +} + +HogQLParser::NumberLiteralContext* HogQLParser::WinFrameBoundContext::numberLiteral() { + return getRuleContext(0); +} + + +size_t HogQLParser::WinFrameBoundContext::getRuleIndex() const { + return HogQLParser::RuleWinFrameBound; +} + + +std::any HogQLParser::WinFrameBoundContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWinFrameBound(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WinFrameBoundContext* HogQLParser::winFrameBound() { + WinFrameBoundContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 66, HogQLParser::RuleWinFrameBound); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(466); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 60, _ctx)) { + case 1: { + setState(454); + match(HogQLParser::CURRENT); + setState(455); + match(HogQLParser::ROW); + break; + } + + case 2: { + setState(456); + match(HogQLParser::UNBOUNDED); + setState(457); + match(HogQLParser::PRECEDING); + break; + } + + case 3: { + setState(458); + match(HogQLParser::UNBOUNDED); + setState(459); + match(HogQLParser::FOLLOWING); + break; + } + + case 4: { + setState(460); + numberLiteral(); + setState(461); + match(HogQLParser::PRECEDING); + break; + } + + case 5: { + setState(463); + numberLiteral(); + setState(464); + match(HogQLParser::FOLLOWING); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExprContext ------------------------------------------------------------------ + +HogQLParser::ExprContext::ExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::ColumnExprContext* HogQLParser::ExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ExprContext::EOF() { + return getToken(HogQLParser::EOF, 0); +} + + +size_t HogQLParser::ExprContext::getRuleIndex() const { + return HogQLParser::RuleExpr; +} + + +std::any HogQLParser::ExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ExprContext* HogQLParser::expr() { + ExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 68, HogQLParser::RuleExpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(468); + columnExpr(0); + setState(469); + match(HogQLParser::EOF); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnTypeExprContext ------------------------------------------------------------------ + +HogQLParser::ColumnTypeExprContext::ColumnTypeExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::ColumnTypeExprContext::getRuleIndex() const { + return HogQLParser::RuleColumnTypeExpr; +} + +void HogQLParser::ColumnTypeExprContext::copyFrom(ColumnTypeExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ColumnTypeExprNestedContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnTypeExprNestedContext::identifier() { + return getRuleContexts(); +} + +HogQLParser::IdentifierContext* HogQLParser::ColumnTypeExprNestedContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprNestedContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprNestedContext::columnTypeExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnTypeExprContext* HogQLParser::ColumnTypeExprNestedContext::columnTypeExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprNestedContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprNestedContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprNestedContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + +HogQLParser::ColumnTypeExprNestedContext::ColumnTypeExprNestedContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnTypeExprNestedContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprNested(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprParamContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnTypeExprParamContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprParamContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprParamContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnTypeExprParamContext::columnExprList() { + return getRuleContext(0); +} + +HogQLParser::ColumnTypeExprParamContext::ColumnTypeExprParamContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnTypeExprParamContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprParam(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprSimpleContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnTypeExprSimpleContext::identifier() { + return getRuleContext(0); +} + +HogQLParser::ColumnTypeExprSimpleContext::ColumnTypeExprSimpleContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnTypeExprSimpleContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprSimple(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprComplexContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnTypeExprComplexContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprComplexContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprComplexContext::columnTypeExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnTypeExprContext* HogQLParser::ColumnTypeExprComplexContext::columnTypeExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprComplexContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprComplexContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprComplexContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + +HogQLParser::ColumnTypeExprComplexContext::ColumnTypeExprComplexContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnTypeExprComplexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprComplex(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnTypeExprEnumContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnTypeExprEnumContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprEnumContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprEnumContext::enumValue() { + return getRuleContexts(); +} + +HogQLParser::EnumValueContext* HogQLParser::ColumnTypeExprEnumContext::enumValue(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprEnumContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +std::vector HogQLParser::ColumnTypeExprEnumContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnTypeExprEnumContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + +HogQLParser::ColumnTypeExprEnumContext::ColumnTypeExprEnumContext(ColumnTypeExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnTypeExprEnumContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnTypeExprEnum(this); + else + return visitor->visitChildren(this); +} +HogQLParser::ColumnTypeExprContext* HogQLParser::columnTypeExpr() { + ColumnTypeExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 70, HogQLParser::RuleColumnTypeExpr); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(518); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 65, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 1); + setState(471); + identifier(); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 2); + setState(472); + identifier(); + setState(473); + match(HogQLParser::LPAREN); + setState(474); + identifier(); + setState(475); + columnTypeExpr(); + setState(482); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(476); + match(HogQLParser::COMMA); + setState(477); + identifier(); + setState(478); + columnTypeExpr(); + setState(484); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(485); + match(HogQLParser::RPAREN); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 3); + setState(487); + identifier(); + setState(488); + match(HogQLParser::LPAREN); + setState(489); + enumValue(); + setState(494); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(490); + match(HogQLParser::COMMA); + setState(491); + enumValue(); + setState(496); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(497); + match(HogQLParser::RPAREN); + break; + } + + case 4: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 4); + setState(499); + identifier(); + setState(500); + match(HogQLParser::LPAREN); + setState(501); + columnTypeExpr(); + setState(506); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(502); + match(HogQLParser::COMMA); + setState(503); + columnTypeExpr(); + setState(508); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(509); + match(HogQLParser::RPAREN); + break; + } + + case 5: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 5); + setState(511); + identifier(); + setState(512); + match(HogQLParser::LPAREN); + setState(514); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(513); + columnExprList(); + } + setState(516); + match(HogQLParser::RPAREN); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnExprListContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprListContext::ColumnExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::ColumnExprListContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprListContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::ColumnExprListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnExprListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::ColumnExprListContext::getRuleIndex() const { + return HogQLParser::RuleColumnExprList; +} + + +std::any HogQLParser::ColumnExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnExprListContext* HogQLParser::columnExprList() { + ColumnExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 72, HogQLParser::RuleColumnExprList); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(520); + columnExpr(0); + setState(525); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 66, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(521); + match(HogQLParser::COMMA); + setState(522); + columnExpr(0); + } + setState(527); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 66, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnExprContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext::ColumnExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::ColumnExprContext::getRuleIndex() const { + return HogQLParser::RuleColumnExpr; +} + +void HogQLParser::ColumnExprContext::copyFrom(ColumnExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- ColumnExprTernaryOpContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprTernaryOpContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprTernaryOpContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprTernaryOpContext::QUERY() { + return getToken(HogQLParser::QUERY, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTernaryOpContext::COLON() { + return getToken(HogQLParser::COLON, 0); +} + +HogQLParser::ColumnExprTernaryOpContext::ColumnExprTernaryOpContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprTernaryOpContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTernaryOp(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAliasContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprAliasContext::columnExpr() { + return getRuleContext(0); +} + +HogQLParser::AliasContext* HogQLParser::ColumnExprAliasContext::alias() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprAliasContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +HogQLParser::IdentifierContext* HogQLParser::ColumnExprAliasContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprAliasContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +HogQLParser::ColumnExprAliasContext::ColumnExprAliasContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAlias(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprExtractContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprExtractContext::EXTRACT() { + return getToken(HogQLParser::EXTRACT, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprExtractContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::IntervalContext* HogQLParser::ColumnExprExtractContext::interval() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprExtractContext::FROM() { + return getToken(HogQLParser::FROM, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprExtractContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprExtractContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprExtractContext::ColumnExprExtractContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprExtractContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprExtract(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprNegateContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprNegateContext::DASH() { + return getToken(HogQLParser::DASH, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprNegateContext::columnExpr() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprNegateContext::ColumnExprNegateContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprNegateContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprNegate(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprSubqueryContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprSubqueryContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::ColumnExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprSubqueryContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprSubqueryContext::ColumnExprSubqueryContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprSubquery(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprLiteralContext ------------------------------------------------------------------ + +HogQLParser::LiteralContext* HogQLParser::ColumnExprLiteralContext::literal() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprLiteralContext::ColumnExprLiteralContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprLiteral(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprArrayContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprArrayContext::LBRACKET() { + return getToken(HogQLParser::LBRACKET, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprArrayContext::RBRACKET() { + return getToken(HogQLParser::RBRACKET, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnExprArrayContext::columnExprList() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprArrayContext::ColumnExprArrayContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprArrayContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprArray(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprSubstringContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprSubstringContext::SUBSTRING() { + return getToken(HogQLParser::SUBSTRING, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprSubstringContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +std::vector HogQLParser::ColumnExprSubstringContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprSubstringContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprSubstringContext::FROM() { + return getToken(HogQLParser::FROM, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprSubstringContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprSubstringContext::FOR() { + return getToken(HogQLParser::FOR, 0); +} + +HogQLParser::ColumnExprSubstringContext::ColumnExprSubstringContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprSubstringContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprSubstring(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprCastContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprCastContext::CAST() { + return getToken(HogQLParser::CAST, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprCastContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprCastContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprCastContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +HogQLParser::ColumnTypeExprContext* HogQLParser::ColumnExprCastContext::columnTypeExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprCastContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprCastContext::ColumnExprCastContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprCastContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprCast(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprOrContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprOrContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprOrContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprOrContext::OR() { + return getToken(HogQLParser::OR, 0); +} + +HogQLParser::ColumnExprOrContext::ColumnExprOrContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprOrContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprOr(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence1Context ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprPrecedence1Context::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprPrecedence1Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence1Context::ASTERISK() { + return getToken(HogQLParser::ASTERISK, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence1Context::SLASH() { + return getToken(HogQLParser::SLASH, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence1Context::PERCENT() { + return getToken(HogQLParser::PERCENT, 0); +} + +HogQLParser::ColumnExprPrecedence1Context::ColumnExprPrecedence1Context(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprPrecedence1Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence1(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence2Context ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprPrecedence2Context::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprPrecedence2Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence2Context::PLUS() { + return getToken(HogQLParser::PLUS, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence2Context::DASH() { + return getToken(HogQLParser::DASH, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence2Context::CONCAT() { + return getToken(HogQLParser::CONCAT, 0); +} + +HogQLParser::ColumnExprPrecedence2Context::ColumnExprPrecedence2Context(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprPrecedence2Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence2(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPrecedence3Context ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprPrecedence3Context::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprPrecedence3Context::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::IN() { + return getToken(HogQLParser::IN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::EQ_DOUBLE() { + return getToken(HogQLParser::EQ_DOUBLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::EQ_SINGLE() { + return getToken(HogQLParser::EQ_SINGLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::NOT_EQ() { + return getToken(HogQLParser::NOT_EQ, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::LT_EQ() { + return getToken(HogQLParser::LT_EQ, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::LT() { + return getToken(HogQLParser::LT, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::GT_EQ() { + return getToken(HogQLParser::GT_EQ, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::GT() { + return getToken(HogQLParser::GT, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::LIKE() { + return getToken(HogQLParser::LIKE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::ILIKE() { + return getToken(HogQLParser::ILIKE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::REGEX_SINGLE() { + return getToken(HogQLParser::REGEX_SINGLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::REGEX_DOUBLE() { + return getToken(HogQLParser::REGEX_DOUBLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::NOT_REGEX() { + return getToken(HogQLParser::NOT_REGEX, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::IREGEX_SINGLE() { + return getToken(HogQLParser::IREGEX_SINGLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::IREGEX_DOUBLE() { + return getToken(HogQLParser::IREGEX_DOUBLE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::NOT_IREGEX() { + return getToken(HogQLParser::NOT_IREGEX, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::COHORT() { + return getToken(HogQLParser::COHORT, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPrecedence3Context::NOT() { + return getToken(HogQLParser::NOT, 0); +} + +HogQLParser::ColumnExprPrecedence3Context::ColumnExprPrecedence3Context(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprPrecedence3Context::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPrecedence3(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIntervalContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprIntervalContext::INTERVAL() { + return getToken(HogQLParser::INTERVAL, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprIntervalContext::columnExpr() { + return getRuleContext(0); +} + +HogQLParser::IntervalContext* HogQLParser::ColumnExprIntervalContext::interval() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprIntervalContext::ColumnExprIntervalContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprIntervalContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprInterval(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIsNullContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprIsNullContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprIsNullContext::IS() { + return getToken(HogQLParser::IS, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprIsNullContext::NULL_SQL() { + return getToken(HogQLParser::NULL_SQL, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprIsNullContext::NOT() { + return getToken(HogQLParser::NOT, 0); +} + +HogQLParser::ColumnExprIsNullContext::ColumnExprIsNullContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprIsNullContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprIsNull(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprWinFunctionTargetContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprWinFunctionTargetContext::identifier() { + return getRuleContexts(); +} + +HogQLParser::IdentifierContext* HogQLParser::ColumnExprWinFunctionTargetContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionTargetContext::OVER() { + return getToken(HogQLParser::OVER, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionTargetContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionTargetContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnExprWinFunctionTargetContext::columnExprList() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprWinFunctionTargetContext::ColumnExprWinFunctionTargetContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprWinFunctionTargetContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprWinFunctionTarget(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTrimContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::TRIM() { + return getToken(HogQLParser::TRIM, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::FROM() { + return getToken(HogQLParser::FROM, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprTrimContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::BOTH() { + return getToken(HogQLParser::BOTH, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::LEADING() { + return getToken(HogQLParser::LEADING, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTrimContext::TRAILING() { + return getToken(HogQLParser::TRAILING, 0); +} + +HogQLParser::ColumnExprTrimContext::ColumnExprTrimContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprTrimContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTrim(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTupleContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprTupleContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnExprTupleContext::columnExprList() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTupleContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprTupleContext::ColumnExprTupleContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprTupleContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTuple(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprArrayAccessContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprArrayAccessContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprArrayAccessContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprArrayAccessContext::LBRACKET() { + return getToken(HogQLParser::LBRACKET, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprArrayAccessContext::RBRACKET() { + return getToken(HogQLParser::RBRACKET, 0); +} + +HogQLParser::ColumnExprArrayAccessContext::ColumnExprArrayAccessContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprArrayAccessContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprArrayAccess(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprBetweenContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprBetweenContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprBetweenContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprBetweenContext::BETWEEN() { + return getToken(HogQLParser::BETWEEN, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprBetweenContext::AND() { + return getToken(HogQLParser::AND, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprBetweenContext::NOT() { + return getToken(HogQLParser::NOT, 0); +} + +HogQLParser::ColumnExprBetweenContext::ColumnExprBetweenContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprBetweenContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprBetween(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprPropertyAccessContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprPropertyAccessContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprPropertyAccessContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + +HogQLParser::IdentifierContext* HogQLParser::ColumnExprPropertyAccessContext::identifier() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprPropertyAccessContext::ColumnExprPropertyAccessContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprPropertyAccessContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprPropertyAccess(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprParensContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprParensContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprParensContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprParensContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::ColumnExprParensContext::ColumnExprParensContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprParensContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprParens(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTimestampContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprTimestampContext::TIMESTAMP() { + return getToken(HogQLParser::TIMESTAMP, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTimestampContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +HogQLParser::ColumnExprTimestampContext::ColumnExprTimestampContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprTimestampContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTimestamp(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprNullishContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprNullishContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprNullishContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprNullishContext::NULLISH() { + return getToken(HogQLParser::NULLISH, 0); +} + +HogQLParser::ColumnExprNullishContext::ColumnExprNullishContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprNullishContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprNullish(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAndContext ------------------------------------------------------------------ + +std::vector HogQLParser::ColumnExprAndContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprAndContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnExprAndContext::AND() { + return getToken(HogQLParser::AND, 0); +} + +HogQLParser::ColumnExprAndContext::ColumnExprAndContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprAndContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAnd(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprTupleAccessContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprTupleAccessContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTupleAccessContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprTupleAccessContext::DECIMAL_LITERAL() { + return getToken(HogQLParser::DECIMAL_LITERAL, 0); +} + +HogQLParser::ColumnExprTupleAccessContext::ColumnExprTupleAccessContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprTupleAccessContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprTupleAccess(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprCaseContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprCaseContext::CASE() { + return getToken(HogQLParser::CASE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprCaseContext::END() { + return getToken(HogQLParser::END, 0); +} + +std::vector HogQLParser::ColumnExprCaseContext::WHEN() { + return getTokens(HogQLParser::WHEN); +} + +tree::TerminalNode* HogQLParser::ColumnExprCaseContext::WHEN(size_t i) { + return getToken(HogQLParser::WHEN, i); +} + +std::vector HogQLParser::ColumnExprCaseContext::THEN() { + return getTokens(HogQLParser::THEN); +} + +tree::TerminalNode* HogQLParser::ColumnExprCaseContext::THEN(size_t i) { + return getToken(HogQLParser::THEN, i); +} + +tree::TerminalNode* HogQLParser::ColumnExprCaseContext::ELSE() { + return getToken(HogQLParser::ELSE, 0); +} + +std::vector HogQLParser::ColumnExprCaseContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprCaseContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +HogQLParser::ColumnExprCaseContext::ColumnExprCaseContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprCaseContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprCase(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprDateContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprDateContext::DATE() { + return getToken(HogQLParser::DATE, 0); +} + +tree::TerminalNode* HogQLParser::ColumnExprDateContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +HogQLParser::ColumnExprDateContext::ColumnExprDateContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprDateContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprDate(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprNotContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprNotContext::NOT() { + return getToken(HogQLParser::NOT, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnExprNotContext::columnExpr() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprNotContext::ColumnExprNotContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprNotContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprNot(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprWinFunctionContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnExprWinFunctionContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionContext::OVER() { + return getToken(HogQLParser::OVER, 0); +} + +std::vector HogQLParser::ColumnExprWinFunctionContext::LPAREN() { + return getTokens(HogQLParser::LPAREN); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionContext::LPAREN(size_t i) { + return getToken(HogQLParser::LPAREN, i); +} + +HogQLParser::WindowExprContext* HogQLParser::ColumnExprWinFunctionContext::windowExpr() { + return getRuleContext(0); +} + +std::vector HogQLParser::ColumnExprWinFunctionContext::RPAREN() { + return getTokens(HogQLParser::RPAREN); +} + +tree::TerminalNode* HogQLParser::ColumnExprWinFunctionContext::RPAREN(size_t i) { + return getToken(HogQLParser::RPAREN, i); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnExprWinFunctionContext::columnExprList() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprWinFunctionContext::ColumnExprWinFunctionContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprWinFunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprWinFunction(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprIdentifierContext ------------------------------------------------------------------ + +HogQLParser::ColumnIdentifierContext* HogQLParser::ColumnExprIdentifierContext::columnIdentifier() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprIdentifierContext::ColumnExprIdentifierContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprIdentifier(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprFunctionContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::ColumnExprFunctionContext::identifier() { + return getRuleContext(0); +} + +std::vector HogQLParser::ColumnExprFunctionContext::LPAREN() { + return getTokens(HogQLParser::LPAREN); +} + +tree::TerminalNode* HogQLParser::ColumnExprFunctionContext::LPAREN(size_t i) { + return getToken(HogQLParser::LPAREN, i); +} + +std::vector HogQLParser::ColumnExprFunctionContext::RPAREN() { + return getTokens(HogQLParser::RPAREN); +} + +tree::TerminalNode* HogQLParser::ColumnExprFunctionContext::RPAREN(size_t i) { + return getToken(HogQLParser::RPAREN, i); +} + +tree::TerminalNode* HogQLParser::ColumnExprFunctionContext::DISTINCT() { + return getToken(HogQLParser::DISTINCT, 0); +} + +HogQLParser::ColumnArgListContext* HogQLParser::ColumnExprFunctionContext::columnArgList() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprListContext* HogQLParser::ColumnExprFunctionContext::columnExprList() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprFunctionContext::ColumnExprFunctionContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprFunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprFunction(this); + else + return visitor->visitChildren(this); +} +//----------------- ColumnExprAsteriskContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::ColumnExprAsteriskContext::ASTERISK() { + return getToken(HogQLParser::ASTERISK, 0); +} + +HogQLParser::TableIdentifierContext* HogQLParser::ColumnExprAsteriskContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnExprAsteriskContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + +HogQLParser::ColumnExprAsteriskContext::ColumnExprAsteriskContext(ColumnExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::ColumnExprAsteriskContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnExprAsterisk(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnExprContext* HogQLParser::columnExpr() { + return columnExpr(0); +} + +HogQLParser::ColumnExprContext* HogQLParser::columnExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + HogQLParser::ColumnExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + HogQLParser::ColumnExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 74; + enterRecursionRule(_localctx, 74, HogQLParser::RuleColumnExpr, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(657); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 79, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(529); + match(HogQLParser::CASE); + setState(531); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 67, _ctx)) { + case 1: { + setState(530); + antlrcpp::downCast(_localctx)->caseExpr = columnExpr(0); + break; + } + + default: + break; + } + setState(538); + _errHandler->sync(this); + _la = _input->LA(1); + do { + setState(533); + match(HogQLParser::WHEN); + setState(534); + antlrcpp::downCast(_localctx)->whenExpr = columnExpr(0); + setState(535); + match(HogQLParser::THEN); + setState(536); + antlrcpp::downCast(_localctx)->thenExpr = columnExpr(0); + setState(540); + _errHandler->sync(this); + _la = _input->LA(1); + } while (_la == HogQLParser::WHEN); + setState(544); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::ELSE) { + setState(542); + match(HogQLParser::ELSE); + setState(543); + antlrcpp::downCast(_localctx)->elseExpr = columnExpr(0); + } + setState(546); + match(HogQLParser::END); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(548); + match(HogQLParser::CAST); + setState(549); + match(HogQLParser::LPAREN); + setState(550); + columnExpr(0); + setState(551); + match(HogQLParser::AS); + setState(552); + columnTypeExpr(); + setState(553); + match(HogQLParser::RPAREN); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(555); + match(HogQLParser::DATE); + setState(556); + match(HogQLParser::STRING_LITERAL); + break; + } + + case 4: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(557); + match(HogQLParser::EXTRACT); + setState(558); + match(HogQLParser::LPAREN); + setState(559); + interval(); + setState(560); + match(HogQLParser::FROM); + setState(561); + columnExpr(0); + setState(562); + match(HogQLParser::RPAREN); + break; + } + + case 5: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(564); + match(HogQLParser::INTERVAL); + setState(565); + columnExpr(0); + setState(566); + interval(); + break; + } + + case 6: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(568); + match(HogQLParser::SUBSTRING); + setState(569); + match(HogQLParser::LPAREN); + setState(570); + columnExpr(0); + setState(571); + match(HogQLParser::FROM); + setState(572); + columnExpr(0); + setState(575); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::FOR) { + setState(573); + match(HogQLParser::FOR); + setState(574); + columnExpr(0); + } + setState(577); + match(HogQLParser::RPAREN); + break; + } + + case 7: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(579); + match(HogQLParser::TIMESTAMP); + setState(580); + match(HogQLParser::STRING_LITERAL); + break; + } + + case 8: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(581); + match(HogQLParser::TRIM); + setState(582); + match(HogQLParser::LPAREN); + setState(583); + _la = _input->LA(1); + if (!(_la == HogQLParser::BOTH || _la == HogQLParser::LEADING || _la == HogQLParser::TRAILING)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(584); + match(HogQLParser::STRING_LITERAL); + setState(585); + match(HogQLParser::FROM); + setState(586); + columnExpr(0); + setState(587); + match(HogQLParser::RPAREN); + break; + } + + case 9: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(589); + identifier(); + + setState(590); + match(HogQLParser::LPAREN); + setState(592); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(591); + columnExprList(); + } + setState(594); + match(HogQLParser::RPAREN); + setState(596); + match(HogQLParser::OVER); + setState(597); + match(HogQLParser::LPAREN); + setState(598); + windowExpr(); + setState(599); + match(HogQLParser::RPAREN); + break; + } + + case 10: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(601); + identifier(); + + setState(602); + match(HogQLParser::LPAREN); + setState(604); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(603); + columnExprList(); + } + setState(606); + match(HogQLParser::RPAREN); + setState(608); + match(HogQLParser::OVER); + setState(609); + identifier(); + break; + } + + case 11: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(611); + identifier(); + setState(617); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 74, _ctx)) { + case 1: { + setState(612); + match(HogQLParser::LPAREN); + setState(614); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(613); + columnExprList(); + } + setState(616); + match(HogQLParser::RPAREN); + break; + } + + default: + break; + } + setState(619); + match(HogQLParser::LPAREN); + setState(621); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 75, _ctx)) { + case 1: { + setState(620); + match(HogQLParser::DISTINCT); + break; + } + + default: + break; + } + setState(624); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(623); + columnArgList(); + } + setState(626); + match(HogQLParser::RPAREN); + break; + } + + case 12: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(628); + literal(); + break; + } + + case 13: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(629); + match(HogQLParser::DASH); + setState(630); + columnExpr(18); + break; + } + + case 14: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(631); + match(HogQLParser::NOT); + setState(632); + columnExpr(12); + break; + } + + case 15: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(636); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -5066549581053953) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || _la == HogQLParser::JSON_TRUE + + || _la == HogQLParser::IDENTIFIER) { + setState(633); + tableIdentifier(); + setState(634); + match(HogQLParser::DOT); + } + setState(638); + match(HogQLParser::ASTERISK); + break; + } + + case 16: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(639); + match(HogQLParser::LPAREN); + setState(640); + selectUnionStmt(); + setState(641); + match(HogQLParser::RPAREN); + break; + } + + case 17: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(643); + match(HogQLParser::LPAREN); + setState(644); + columnExpr(0); + setState(645); + match(HogQLParser::RPAREN); + break; + } + + case 18: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(647); + match(HogQLParser::LPAREN); + setState(648); + columnExprList(); + setState(649); + match(HogQLParser::RPAREN); + break; + } + + case 19: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(651); + match(HogQLParser::LBRACKET); + setState(653); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(652); + columnExprList(); + } + setState(655); + match(HogQLParser::RBRACKET); + break; + } + + case 20: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(656); + columnIdentifier(); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(752); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 90, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(750); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 89, _ctx)) { + case 1: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + newContext->left = previousContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(659); + + if (!(precpred(_ctx, 17))) throw FailedPredicateException(this, "precpred(_ctx, 17)"); + setState(663); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::ASTERISK: { + setState(660); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::ASTERISK); + break; + } + + case HogQLParser::SLASH: { + setState(661); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::SLASH); + break; + } + + case HogQLParser::PERCENT: { + setState(662); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::PERCENT); + break; + } + + default: + throw NoViableAltException(this); + } + setState(665); + antlrcpp::downCast(_localctx)->right = columnExpr(18); + break; + } + + case 2: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + newContext->left = previousContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(666); + + if (!(precpred(_ctx, 16))) throw FailedPredicateException(this, "precpred(_ctx, 16)"); + setState(670); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::PLUS: { + setState(667); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::PLUS); + break; + } + + case HogQLParser::DASH: { + setState(668); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::DASH); + break; + } + + case HogQLParser::CONCAT: { + setState(669); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::CONCAT); + break; + } + + default: + throw NoViableAltException(this); + } + setState(672); + antlrcpp::downCast(_localctx)->right = columnExpr(17); + break; + } + + case 3: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + newContext->left = previousContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(673); + + if (!(precpred(_ctx, 15))) throw FailedPredicateException(this, "precpred(_ctx, 15)"); + setState(698); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 85, _ctx)) { + case 1: { + setState(674); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::EQ_DOUBLE); + break; + } + + case 2: { + setState(675); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::EQ_SINGLE); + break; + } + + case 3: { + setState(676); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::NOT_EQ); + break; + } + + case 4: { + setState(677); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::LT_EQ); + break; + } + + case 5: { + setState(678); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::LT); + break; + } + + case 6: { + setState(679); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::GT_EQ); + break; + } + + case 7: { + setState(680); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::GT); + break; + } + + case 8: { + setState(682); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::NOT) { + setState(681); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::NOT); + } + setState(684); + match(HogQLParser::IN); + setState(686); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::COHORT) { + setState(685); + match(HogQLParser::COHORT); + } + break; + } + + case 9: { + setState(689); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::NOT) { + setState(688); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::NOT); + } + setState(691); + _la = _input->LA(1); + if (!(_la == HogQLParser::ILIKE + + || _la == HogQLParser::LIKE)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + case 10: { + setState(692); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::REGEX_SINGLE); + break; + } + + case 11: { + setState(693); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::REGEX_DOUBLE); + break; + } + + case 12: { + setState(694); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::NOT_REGEX); + break; + } + + case 13: { + setState(695); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::IREGEX_SINGLE); + break; + } + + case 14: { + setState(696); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::IREGEX_DOUBLE); + break; + } + + case 15: { + setState(697); + antlrcpp::downCast(_localctx)->operator_ = match(HogQLParser::NOT_IREGEX); + break; + } + + default: + break; + } + setState(700); + antlrcpp::downCast(_localctx)->right = columnExpr(16); + break; + } + + case 4: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(701); + + if (!(precpred(_ctx, 13))) throw FailedPredicateException(this, "precpred(_ctx, 13)"); + setState(702); + match(HogQLParser::NULLISH); + setState(703); + columnExpr(14); + break; + } + + case 5: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(704); + + if (!(precpred(_ctx, 11))) throw FailedPredicateException(this, "precpred(_ctx, 11)"); + setState(705); + match(HogQLParser::AND); + setState(706); + columnExpr(12); + break; + } + + case 6: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(707); + + if (!(precpred(_ctx, 10))) throw FailedPredicateException(this, "precpred(_ctx, 10)"); + setState(708); + match(HogQLParser::OR); + setState(709); + columnExpr(11); + break; + } + + case 7: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(710); + + if (!(precpred(_ctx, 9))) throw FailedPredicateException(this, "precpred(_ctx, 9)"); + setState(712); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::NOT) { + setState(711); + match(HogQLParser::NOT); + } + setState(714); + match(HogQLParser::BETWEEN); + setState(715); + columnExpr(0); + setState(716); + match(HogQLParser::AND); + setState(717); + columnExpr(10); + break; + } + + case 8: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(719); + + if (!(precpred(_ctx, 8))) throw FailedPredicateException(this, "precpred(_ctx, 8)"); + setState(720); + match(HogQLParser::QUERY); + setState(721); + columnExpr(0); + setState(722); + match(HogQLParser::COLON); + setState(723); + columnExpr(8); + break; + } + + case 9: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(725); + + if (!(precpred(_ctx, 21))) throw FailedPredicateException(this, "precpred(_ctx, 21)"); + setState(726); + match(HogQLParser::LBRACKET); + setState(727); + columnExpr(0); + setState(728); + match(HogQLParser::RBRACKET); + break; + } + + case 10: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(730); + + if (!(precpred(_ctx, 20))) throw FailedPredicateException(this, "precpred(_ctx, 20)"); + setState(731); + match(HogQLParser::DOT); + setState(732); + match(HogQLParser::DECIMAL_LITERAL); + break; + } + + case 11: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(733); + + if (!(precpred(_ctx, 19))) throw FailedPredicateException(this, "precpred(_ctx, 19)"); + setState(734); + match(HogQLParser::DOT); + setState(735); + identifier(); + break; + } + + case 12: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(736); + + if (!(precpred(_ctx, 14))) throw FailedPredicateException(this, "precpred(_ctx, 14)"); + setState(737); + match(HogQLParser::IS); + setState(739); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::NOT) { + setState(738); + match(HogQLParser::NOT); + } + setState(741); + match(HogQLParser::NULL_SQL); + break; + } + + case 13: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleColumnExpr); + setState(742); + + if (!(precpred(_ctx, 7))) throw FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(748); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 88, _ctx)) { + case 1: { + setState(743); + alias(); + break; + } + + case 2: { + setState(744); + match(HogQLParser::AS); + setState(745); + identifier(); + break; + } + + case 3: { + setState(746); + match(HogQLParser::AS); + setState(747); + match(HogQLParser::STRING_LITERAL); + break; + } + + default: + break; + } + break; + } + + default: + break; + } + } + setState(754); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 90, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- ColumnArgListContext ------------------------------------------------------------------ + +HogQLParser::ColumnArgListContext::ColumnArgListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::ColumnArgListContext::columnArgExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnArgExprContext* HogQLParser::ColumnArgListContext::columnArgExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::ColumnArgListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnArgListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::ColumnArgListContext::getRuleIndex() const { + return HogQLParser::RuleColumnArgList; +} + + +std::any HogQLParser::ColumnArgListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnArgList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnArgListContext* HogQLParser::columnArgList() { + ColumnArgListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 76, HogQLParser::RuleColumnArgList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(755); + columnArgExpr(); + setState(760); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(756); + match(HogQLParser::COMMA); + setState(757); + columnArgExpr(); + setState(762); + _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 ------------------------------------------------------------------ + +HogQLParser::ColumnArgExprContext::ColumnArgExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::ColumnLambdaExprContext* HogQLParser::ColumnArgExprContext::columnLambdaExpr() { + return getRuleContext(0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnArgExprContext::columnExpr() { + return getRuleContext(0); +} + + +size_t HogQLParser::ColumnArgExprContext::getRuleIndex() const { + return HogQLParser::RuleColumnArgExpr; +} + + +std::any HogQLParser::ColumnArgExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnArgExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnArgExprContext* HogQLParser::columnArgExpr() { + ColumnArgExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 78, HogQLParser::RuleColumnArgExpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(765); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 92, _ctx)) { + case 1: { + enterOuterAlt(_localctx, 1); + setState(763); + columnLambdaExpr(); + break; + } + + case 2: { + enterOuterAlt(_localctx, 2); + setState(764); + columnExpr(0); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnLambdaExprContext ------------------------------------------------------------------ + +HogQLParser::ColumnLambdaExprContext::ColumnLambdaExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::ColumnLambdaExprContext::ARROW() { + return getToken(HogQLParser::ARROW, 0); +} + +HogQLParser::ColumnExprContext* HogQLParser::ColumnLambdaExprContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnLambdaExprContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +std::vector HogQLParser::ColumnLambdaExprContext::identifier() { + return getRuleContexts(); +} + +HogQLParser::IdentifierContext* HogQLParser::ColumnLambdaExprContext::identifier(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* HogQLParser::ColumnLambdaExprContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +std::vector HogQLParser::ColumnLambdaExprContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::ColumnLambdaExprContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::ColumnLambdaExprContext::getRuleIndex() const { + return HogQLParser::RuleColumnLambdaExpr; +} + + +std::any HogQLParser::ColumnLambdaExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnLambdaExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnLambdaExprContext* HogQLParser::columnLambdaExpr() { + ColumnLambdaExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 80, HogQLParser::RuleColumnLambdaExpr); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(786); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::LPAREN: { + setState(767); + match(HogQLParser::LPAREN); + setState(768); + identifier(); + setState(773); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(769); + match(HogQLParser::COMMA); + setState(770); + identifier(); + setState(775); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(776); + match(HogQLParser::RPAREN); + break; + } + + case HogQLParser::AFTER: + case HogQLParser::ALIAS: + case HogQLParser::ALL: + case HogQLParser::ALTER: + case HogQLParser::AND: + case HogQLParser::ANTI: + case HogQLParser::ANY: + case HogQLParser::ARRAY: + case HogQLParser::AS: + case HogQLParser::ASCENDING: + case HogQLParser::ASOF: + case HogQLParser::AST: + case HogQLParser::ASYNC: + case HogQLParser::ATTACH: + case HogQLParser::BETWEEN: + case HogQLParser::BOTH: + case HogQLParser::BY: + case HogQLParser::CASE: + case HogQLParser::CAST: + case HogQLParser::CHECK: + case HogQLParser::CLEAR: + case HogQLParser::CLUSTER: + case HogQLParser::CODEC: + case HogQLParser::COLLATE: + case HogQLParser::COLUMN: + case HogQLParser::COMMENT: + case HogQLParser::CONSTRAINT: + case HogQLParser::CREATE: + case HogQLParser::CROSS: + case HogQLParser::CUBE: + case HogQLParser::CURRENT: + case HogQLParser::DATABASE: + case HogQLParser::DATABASES: + case HogQLParser::DATE: + case HogQLParser::DAY: + case HogQLParser::DEDUPLICATE: + case HogQLParser::DEFAULT: + case HogQLParser::DELAY: + case HogQLParser::DELETE: + case HogQLParser::DESC: + case HogQLParser::DESCENDING: + case HogQLParser::DESCRIBE: + case HogQLParser::DETACH: + case HogQLParser::DICTIONARIES: + case HogQLParser::DICTIONARY: + case HogQLParser::DISK: + case HogQLParser::DISTINCT: + case HogQLParser::DISTRIBUTED: + case HogQLParser::DROP: + case HogQLParser::ELSE: + case HogQLParser::END: + case HogQLParser::ENGINE: + case HogQLParser::EVENTS: + case HogQLParser::EXISTS: + case HogQLParser::EXPLAIN: + case HogQLParser::EXPRESSION: + case HogQLParser::EXTRACT: + case HogQLParser::FETCHES: + case HogQLParser::FINAL: + case HogQLParser::FIRST: + case HogQLParser::FLUSH: + case HogQLParser::FOLLOWING: + case HogQLParser::FOR: + case HogQLParser::FORMAT: + case HogQLParser::FREEZE: + case HogQLParser::FROM: + case HogQLParser::FULL: + case HogQLParser::FUNCTION: + case HogQLParser::GLOBAL: + case HogQLParser::GRANULARITY: + case HogQLParser::GROUP: + case HogQLParser::HAVING: + case HogQLParser::HIERARCHICAL: + case HogQLParser::HOUR: + case HogQLParser::ID: + case HogQLParser::IF: + case HogQLParser::ILIKE: + case HogQLParser::IN: + case HogQLParser::INDEX: + case HogQLParser::INJECTIVE: + case HogQLParser::INNER: + case HogQLParser::INSERT: + case HogQLParser::INTERVAL: + case HogQLParser::INTO: + case HogQLParser::IS: + case HogQLParser::IS_OBJECT_ID: + case HogQLParser::JOIN: + case HogQLParser::KEY: + case HogQLParser::KILL: + case HogQLParser::LAST: + case HogQLParser::LAYOUT: + case HogQLParser::LEADING: + case HogQLParser::LEFT: + case HogQLParser::LIFETIME: + case HogQLParser::LIKE: + case HogQLParser::LIMIT: + case HogQLParser::LIVE: + case HogQLParser::LOCAL: + case HogQLParser::LOGS: + case HogQLParser::MATERIALIZE: + case HogQLParser::MATERIALIZED: + case HogQLParser::MAX: + case HogQLParser::MERGES: + case HogQLParser::MIN: + case HogQLParser::MINUTE: + case HogQLParser::MODIFY: + case HogQLParser::MONTH: + case HogQLParser::MOVE: + case HogQLParser::MUTATION: + case HogQLParser::NO: + case HogQLParser::NOT: + case HogQLParser::NULLS: + case HogQLParser::OFFSET: + case HogQLParser::ON: + case HogQLParser::OPTIMIZE: + case HogQLParser::OR: + case HogQLParser::ORDER: + case HogQLParser::OUTER: + case HogQLParser::OUTFILE: + case HogQLParser::OVER: + case HogQLParser::PARTITION: + case HogQLParser::POPULATE: + case HogQLParser::PRECEDING: + case HogQLParser::PREWHERE: + case HogQLParser::PRIMARY: + case HogQLParser::QUARTER: + case HogQLParser::RANGE: + case HogQLParser::RELOAD: + case HogQLParser::REMOVE: + case HogQLParser::RENAME: + case HogQLParser::REPLACE: + case HogQLParser::REPLICA: + case HogQLParser::REPLICATED: + case HogQLParser::RIGHT: + case HogQLParser::ROLLUP: + case HogQLParser::ROW: + case HogQLParser::ROWS: + case HogQLParser::SAMPLE: + case HogQLParser::SECOND: + case HogQLParser::SELECT: + case HogQLParser::SEMI: + case HogQLParser::SENDS: + case HogQLParser::SET: + case HogQLParser::SETTINGS: + case HogQLParser::SHOW: + case HogQLParser::SOURCE: + case HogQLParser::START: + case HogQLParser::STOP: + case HogQLParser::SUBSTRING: + case HogQLParser::SYNC: + case HogQLParser::SYNTAX: + case HogQLParser::SYSTEM: + case HogQLParser::TABLE: + case HogQLParser::TABLES: + case HogQLParser::TEMPORARY: + case HogQLParser::TEST: + case HogQLParser::THEN: + case HogQLParser::TIES: + case HogQLParser::TIMEOUT: + case HogQLParser::TIMESTAMP: + case HogQLParser::TO: + case HogQLParser::TOP: + case HogQLParser::TOTALS: + case HogQLParser::TRAILING: + case HogQLParser::TRIM: + case HogQLParser::TRUNCATE: + case HogQLParser::TTL: + case HogQLParser::TYPE: + case HogQLParser::UNBOUNDED: + case HogQLParser::UNION: + case HogQLParser::UPDATE: + case HogQLParser::USE: + case HogQLParser::USING: + case HogQLParser::UUID: + case HogQLParser::VALUES: + case HogQLParser::VIEW: + case HogQLParser::VOLUME: + case HogQLParser::WATCH: + case HogQLParser::WEEK: + case HogQLParser::WHEN: + case HogQLParser::WHERE: + case HogQLParser::WINDOW: + case HogQLParser::WITH: + case HogQLParser::YEAR: + case HogQLParser::JSON_FALSE: + case HogQLParser::JSON_TRUE: + case HogQLParser::IDENTIFIER: { + setState(778); + identifier(); + setState(783); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(779); + match(HogQLParser::COMMA); + setState(780); + identifier(); + setState(785); + _errHandler->sync(this); + _la = _input->LA(1); + } + break; + } + + default: + throw NoViableAltException(this); + } + setState(788); + match(HogQLParser::ARROW); + setState(789); + columnExpr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- WithExprListContext ------------------------------------------------------------------ + +HogQLParser::WithExprListContext::WithExprListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::WithExprListContext::withExpr() { + return getRuleContexts(); +} + +HogQLParser::WithExprContext* HogQLParser::WithExprListContext::withExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::WithExprListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::WithExprListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::WithExprListContext::getRuleIndex() const { + return HogQLParser::RuleWithExprList; +} + + +std::any HogQLParser::WithExprListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWithExprList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::WithExprListContext* HogQLParser::withExprList() { + WithExprListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 82, HogQLParser::RuleWithExprList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(791); + withExpr(); + setState(796); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(792); + match(HogQLParser::COMMA); + setState(793); + withExpr(); + setState(798); + _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; +} + +//----------------- WithExprContext ------------------------------------------------------------------ + +HogQLParser::WithExprContext::WithExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::WithExprContext::getRuleIndex() const { + return HogQLParser::RuleWithExpr; +} + +void HogQLParser::WithExprContext::copyFrom(WithExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- WithExprColumnContext ------------------------------------------------------------------ + +HogQLParser::ColumnExprContext* HogQLParser::WithExprColumnContext::columnExpr() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::WithExprColumnContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +HogQLParser::IdentifierContext* HogQLParser::WithExprColumnContext::identifier() { + return getRuleContext(0); +} + +HogQLParser::WithExprColumnContext::WithExprColumnContext(WithExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::WithExprColumnContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWithExprColumn(this); + else + return visitor->visitChildren(this); +} +//----------------- WithExprSubqueryContext ------------------------------------------------------------------ + +HogQLParser::IdentifierContext* HogQLParser::WithExprSubqueryContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::WithExprSubqueryContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +tree::TerminalNode* HogQLParser::WithExprSubqueryContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::WithExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::WithExprSubqueryContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::WithExprSubqueryContext::WithExprSubqueryContext(WithExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::WithExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitWithExprSubquery(this); + else + return visitor->visitChildren(this); +} +HogQLParser::WithExprContext* HogQLParser::withExpr() { + WithExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 84, HogQLParser::RuleWithExpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(809); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 97, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 1); + setState(799); + identifier(); + setState(800); + match(HogQLParser::AS); + setState(801); + match(HogQLParser::LPAREN); + setState(802); + selectUnionStmt(); + setState(803); + match(HogQLParser::RPAREN); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + enterOuterAlt(_localctx, 2); + setState(805); + columnExpr(0); + setState(806); + match(HogQLParser::AS); + setState(807); + identifier(); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ColumnIdentifierContext ------------------------------------------------------------------ + +HogQLParser::ColumnIdentifierContext::ColumnIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::ColumnIdentifierContext::PLACEHOLDER() { + return getToken(HogQLParser::PLACEHOLDER, 0); +} + +HogQLParser::NestedIdentifierContext* HogQLParser::ColumnIdentifierContext::nestedIdentifier() { + return getRuleContext(0); +} + +HogQLParser::TableIdentifierContext* HogQLParser::ColumnIdentifierContext::tableIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::ColumnIdentifierContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + + +size_t HogQLParser::ColumnIdentifierContext::getRuleIndex() const { + return HogQLParser::RuleColumnIdentifier; +} + + +std::any HogQLParser::ColumnIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitColumnIdentifier(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::ColumnIdentifierContext* HogQLParser::columnIdentifier() { + ColumnIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 86, HogQLParser::RuleColumnIdentifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(818); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::PLACEHOLDER: { + enterOuterAlt(_localctx, 1); + setState(811); + match(HogQLParser::PLACEHOLDER); + break; + } + + case HogQLParser::AFTER: + case HogQLParser::ALIAS: + case HogQLParser::ALL: + case HogQLParser::ALTER: + case HogQLParser::AND: + case HogQLParser::ANTI: + case HogQLParser::ANY: + case HogQLParser::ARRAY: + case HogQLParser::AS: + case HogQLParser::ASCENDING: + case HogQLParser::ASOF: + case HogQLParser::AST: + case HogQLParser::ASYNC: + case HogQLParser::ATTACH: + case HogQLParser::BETWEEN: + case HogQLParser::BOTH: + case HogQLParser::BY: + case HogQLParser::CASE: + case HogQLParser::CAST: + case HogQLParser::CHECK: + case HogQLParser::CLEAR: + case HogQLParser::CLUSTER: + case HogQLParser::CODEC: + case HogQLParser::COLLATE: + case HogQLParser::COLUMN: + case HogQLParser::COMMENT: + case HogQLParser::CONSTRAINT: + case HogQLParser::CREATE: + case HogQLParser::CROSS: + case HogQLParser::CUBE: + case HogQLParser::CURRENT: + case HogQLParser::DATABASE: + case HogQLParser::DATABASES: + case HogQLParser::DATE: + case HogQLParser::DAY: + case HogQLParser::DEDUPLICATE: + case HogQLParser::DEFAULT: + case HogQLParser::DELAY: + case HogQLParser::DELETE: + case HogQLParser::DESC: + case HogQLParser::DESCENDING: + case HogQLParser::DESCRIBE: + case HogQLParser::DETACH: + case HogQLParser::DICTIONARIES: + case HogQLParser::DICTIONARY: + case HogQLParser::DISK: + case HogQLParser::DISTINCT: + case HogQLParser::DISTRIBUTED: + case HogQLParser::DROP: + case HogQLParser::ELSE: + case HogQLParser::END: + case HogQLParser::ENGINE: + case HogQLParser::EVENTS: + case HogQLParser::EXISTS: + case HogQLParser::EXPLAIN: + case HogQLParser::EXPRESSION: + case HogQLParser::EXTRACT: + case HogQLParser::FETCHES: + case HogQLParser::FINAL: + case HogQLParser::FIRST: + case HogQLParser::FLUSH: + case HogQLParser::FOLLOWING: + case HogQLParser::FOR: + case HogQLParser::FORMAT: + case HogQLParser::FREEZE: + case HogQLParser::FROM: + case HogQLParser::FULL: + case HogQLParser::FUNCTION: + case HogQLParser::GLOBAL: + case HogQLParser::GRANULARITY: + case HogQLParser::GROUP: + case HogQLParser::HAVING: + case HogQLParser::HIERARCHICAL: + case HogQLParser::HOUR: + case HogQLParser::ID: + case HogQLParser::IF: + case HogQLParser::ILIKE: + case HogQLParser::IN: + case HogQLParser::INDEX: + case HogQLParser::INJECTIVE: + case HogQLParser::INNER: + case HogQLParser::INSERT: + case HogQLParser::INTERVAL: + case HogQLParser::INTO: + case HogQLParser::IS: + case HogQLParser::IS_OBJECT_ID: + case HogQLParser::JOIN: + case HogQLParser::KEY: + case HogQLParser::KILL: + case HogQLParser::LAST: + case HogQLParser::LAYOUT: + case HogQLParser::LEADING: + case HogQLParser::LEFT: + case HogQLParser::LIFETIME: + case HogQLParser::LIKE: + case HogQLParser::LIMIT: + case HogQLParser::LIVE: + case HogQLParser::LOCAL: + case HogQLParser::LOGS: + case HogQLParser::MATERIALIZE: + case HogQLParser::MATERIALIZED: + case HogQLParser::MAX: + case HogQLParser::MERGES: + case HogQLParser::MIN: + case HogQLParser::MINUTE: + case HogQLParser::MODIFY: + case HogQLParser::MONTH: + case HogQLParser::MOVE: + case HogQLParser::MUTATION: + case HogQLParser::NO: + case HogQLParser::NOT: + case HogQLParser::NULLS: + case HogQLParser::OFFSET: + case HogQLParser::ON: + case HogQLParser::OPTIMIZE: + case HogQLParser::OR: + case HogQLParser::ORDER: + case HogQLParser::OUTER: + case HogQLParser::OUTFILE: + case HogQLParser::OVER: + case HogQLParser::PARTITION: + case HogQLParser::POPULATE: + case HogQLParser::PRECEDING: + case HogQLParser::PREWHERE: + case HogQLParser::PRIMARY: + case HogQLParser::QUARTER: + case HogQLParser::RANGE: + case HogQLParser::RELOAD: + case HogQLParser::REMOVE: + case HogQLParser::RENAME: + case HogQLParser::REPLACE: + case HogQLParser::REPLICA: + case HogQLParser::REPLICATED: + case HogQLParser::RIGHT: + case HogQLParser::ROLLUP: + case HogQLParser::ROW: + case HogQLParser::ROWS: + case HogQLParser::SAMPLE: + case HogQLParser::SECOND: + case HogQLParser::SELECT: + case HogQLParser::SEMI: + case HogQLParser::SENDS: + case HogQLParser::SET: + case HogQLParser::SETTINGS: + case HogQLParser::SHOW: + case HogQLParser::SOURCE: + case HogQLParser::START: + case HogQLParser::STOP: + case HogQLParser::SUBSTRING: + case HogQLParser::SYNC: + case HogQLParser::SYNTAX: + case HogQLParser::SYSTEM: + case HogQLParser::TABLE: + case HogQLParser::TABLES: + case HogQLParser::TEMPORARY: + case HogQLParser::TEST: + case HogQLParser::THEN: + case HogQLParser::TIES: + case HogQLParser::TIMEOUT: + case HogQLParser::TIMESTAMP: + case HogQLParser::TO: + case HogQLParser::TOP: + case HogQLParser::TOTALS: + case HogQLParser::TRAILING: + case HogQLParser::TRIM: + case HogQLParser::TRUNCATE: + case HogQLParser::TTL: + case HogQLParser::TYPE: + case HogQLParser::UNBOUNDED: + case HogQLParser::UNION: + case HogQLParser::UPDATE: + case HogQLParser::USE: + case HogQLParser::USING: + case HogQLParser::UUID: + case HogQLParser::VALUES: + case HogQLParser::VIEW: + case HogQLParser::VOLUME: + case HogQLParser::WATCH: + case HogQLParser::WEEK: + case HogQLParser::WHEN: + case HogQLParser::WHERE: + case HogQLParser::WINDOW: + case HogQLParser::WITH: + case HogQLParser::YEAR: + case HogQLParser::JSON_FALSE: + case HogQLParser::JSON_TRUE: + case HogQLParser::IDENTIFIER: { + enterOuterAlt(_localctx, 2); + setState(815); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 98, _ctx)) { + case 1: { + setState(812); + tableIdentifier(); + setState(813); + match(HogQLParser::DOT); + break; + } + + default: + break; + } + setState(817); + nestedIdentifier(); + break; + } + + default: + throw NoViableAltException(this); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- NestedIdentifierContext ------------------------------------------------------------------ + +HogQLParser::NestedIdentifierContext::NestedIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::NestedIdentifierContext::identifier() { + return getRuleContexts(); +} + +HogQLParser::IdentifierContext* HogQLParser::NestedIdentifierContext::identifier(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::NestedIdentifierContext::DOT() { + return getTokens(HogQLParser::DOT); +} + +tree::TerminalNode* HogQLParser::NestedIdentifierContext::DOT(size_t i) { + return getToken(HogQLParser::DOT, i); +} + + +size_t HogQLParser::NestedIdentifierContext::getRuleIndex() const { + return HogQLParser::RuleNestedIdentifier; +} + + +std::any HogQLParser::NestedIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNestedIdentifier(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::NestedIdentifierContext* HogQLParser::nestedIdentifier() { + NestedIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 88, HogQLParser::RuleNestedIdentifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(820); + identifier(); + setState(825); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 100, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + setState(821); + match(HogQLParser::DOT); + setState(822); + identifier(); + } + setState(827); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 100, _ctx); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableExprContext ------------------------------------------------------------------ + +HogQLParser::TableExprContext::TableExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t HogQLParser::TableExprContext::getRuleIndex() const { + return HogQLParser::RuleTableExpr; +} + +void HogQLParser::TableExprContext::copyFrom(TableExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- TableExprIdentifierContext ------------------------------------------------------------------ + +HogQLParser::TableIdentifierContext* HogQLParser::TableExprIdentifierContext::tableIdentifier() { + return getRuleContext(0); +} + +HogQLParser::TableExprIdentifierContext::TableExprIdentifierContext(TableExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::TableExprIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprIdentifier(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprPlaceholderContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::TableExprPlaceholderContext::PLACEHOLDER() { + return getToken(HogQLParser::PLACEHOLDER, 0); +} + +HogQLParser::TableExprPlaceholderContext::TableExprPlaceholderContext(TableExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::TableExprPlaceholderContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprPlaceholder(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprSubqueryContext ------------------------------------------------------------------ + +tree::TerminalNode* HogQLParser::TableExprSubqueryContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +HogQLParser::SelectUnionStmtContext* HogQLParser::TableExprSubqueryContext::selectUnionStmt() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::TableExprSubqueryContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::TableExprSubqueryContext::TableExprSubqueryContext(TableExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::TableExprSubqueryContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprSubquery(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprAliasContext ------------------------------------------------------------------ + +HogQLParser::TableExprContext* HogQLParser::TableExprAliasContext::tableExpr() { + return getRuleContext(0); +} + +HogQLParser::AliasContext* HogQLParser::TableExprAliasContext::alias() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::TableExprAliasContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +HogQLParser::IdentifierContext* HogQLParser::TableExprAliasContext::identifier() { + return getRuleContext(0); +} + +HogQLParser::TableExprAliasContext::TableExprAliasContext(TableExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::TableExprAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprAlias(this); + else + return visitor->visitChildren(this); +} +//----------------- TableExprFunctionContext ------------------------------------------------------------------ + +HogQLParser::TableFunctionExprContext* HogQLParser::TableExprFunctionContext::tableFunctionExpr() { + return getRuleContext(0); +} + +HogQLParser::TableExprFunctionContext::TableExprFunctionContext(TableExprContext *ctx) { copyFrom(ctx); } + + +std::any HogQLParser::TableExprFunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableExprFunction(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::TableExprContext* HogQLParser::tableExpr() { + return tableExpr(0); +} + +HogQLParser::TableExprContext* HogQLParser::tableExpr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + HogQLParser::TableExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + HogQLParser::TableExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 90; + enterRecursionRule(_localctx, 90, HogQLParser::RuleTableExpr, precedence); + + + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(836); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 101, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(829); + tableIdentifier(); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(830); + tableFunctionExpr(); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(831); + match(HogQLParser::LPAREN); + setState(832); + selectUnionStmt(); + setState(833); + match(HogQLParser::RPAREN); + break; + } + + case 4: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(835); + match(HogQLParser::PLACEHOLDER); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(846); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 103, _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(838); + + if (!(precpred(_ctx, 2))) throw FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(842); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::DATE: + case HogQLParser::FIRST: + case HogQLParser::ID: + case HogQLParser::KEY: + case HogQLParser::IDENTIFIER: { + setState(839); + alias(); + break; + } + + case HogQLParser::AS: { + setState(840); + match(HogQLParser::AS); + setState(841); + identifier(); + break; + } + + default: + throw NoViableAltException(this); + } + } + setState(848); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 103, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +//----------------- TableFunctionExprContext ------------------------------------------------------------------ + +HogQLParser::TableFunctionExprContext::TableFunctionExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::IdentifierContext* HogQLParser::TableFunctionExprContext::identifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::TableFunctionExprContext::LPAREN() { + return getToken(HogQLParser::LPAREN, 0); +} + +tree::TerminalNode* HogQLParser::TableFunctionExprContext::RPAREN() { + return getToken(HogQLParser::RPAREN, 0); +} + +HogQLParser::TableArgListContext* HogQLParser::TableFunctionExprContext::tableArgList() { + return getRuleContext(0); +} + + +size_t HogQLParser::TableFunctionExprContext::getRuleIndex() const { + return HogQLParser::RuleTableFunctionExpr; +} + + +std::any HogQLParser::TableFunctionExprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableFunctionExpr(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::TableFunctionExprContext* HogQLParser::tableFunctionExpr() { + TableFunctionExprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 92, HogQLParser::RuleTableFunctionExpr); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(849); + identifier(); + setState(850); + match(HogQLParser::LPAREN); + setState(852); + _errHandler->sync(this); + + _la = _input->LA(1); + if ((((_la & ~ 0x3fULL) == 0) && + ((1ULL << _la) & -33554436) != 0) || ((((_la - 64) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 64)) & -1) != 0) || ((((_la - 128) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 128)) & -9) != 0) || ((((_la - 192) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 192)) & 69122459133) != 0)) { + setState(851); + tableArgList(); + } + setState(854); + match(HogQLParser::RPAREN); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableIdentifierContext ------------------------------------------------------------------ + +HogQLParser::TableIdentifierContext::TableIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::IdentifierContext* HogQLParser::TableIdentifierContext::identifier() { + return getRuleContext(0); +} + +HogQLParser::DatabaseIdentifierContext* HogQLParser::TableIdentifierContext::databaseIdentifier() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::TableIdentifierContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + + +size_t HogQLParser::TableIdentifierContext::getRuleIndex() const { + return HogQLParser::RuleTableIdentifier; +} + + +std::any HogQLParser::TableIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableIdentifier(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::TableIdentifierContext* HogQLParser::tableIdentifier() { + TableIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 94, HogQLParser::RuleTableIdentifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(859); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 105, _ctx)) { + case 1: { + setState(856); + databaseIdentifier(); + setState(857); + match(HogQLParser::DOT); + break; + } + + default: + break; + } + setState(861); + identifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- TableArgListContext ------------------------------------------------------------------ + +HogQLParser::TableArgListContext::TableArgListContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +std::vector HogQLParser::TableArgListContext::columnExpr() { + return getRuleContexts(); +} + +HogQLParser::ColumnExprContext* HogQLParser::TableArgListContext::columnExpr(size_t i) { + return getRuleContext(i); +} + +std::vector HogQLParser::TableArgListContext::COMMA() { + return getTokens(HogQLParser::COMMA); +} + +tree::TerminalNode* HogQLParser::TableArgListContext::COMMA(size_t i) { + return getToken(HogQLParser::COMMA, i); +} + + +size_t HogQLParser::TableArgListContext::getRuleIndex() const { + return HogQLParser::RuleTableArgList; +} + + +std::any HogQLParser::TableArgListContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTableArgList(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::TableArgListContext* HogQLParser::tableArgList() { + TableArgListContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 96, HogQLParser::RuleTableArgList); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(863); + columnExpr(0); + setState(868); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == HogQLParser::COMMA) { + setState(864); + match(HogQLParser::COMMA); + setState(865); + columnExpr(0); + setState(870); + _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; +} + +//----------------- DatabaseIdentifierContext ------------------------------------------------------------------ + +HogQLParser::DatabaseIdentifierContext::DatabaseIdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::IdentifierContext* HogQLParser::DatabaseIdentifierContext::identifier() { + return getRuleContext(0); +} + + +size_t HogQLParser::DatabaseIdentifierContext::getRuleIndex() const { + return HogQLParser::RuleDatabaseIdentifier; +} + + +std::any HogQLParser::DatabaseIdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitDatabaseIdentifier(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::DatabaseIdentifierContext* HogQLParser::databaseIdentifier() { + DatabaseIdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 98, HogQLParser::RuleDatabaseIdentifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(871); + identifier(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- FloatingLiteralContext ------------------------------------------------------------------ + +HogQLParser::FloatingLiteralContext::FloatingLiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::FloatingLiteralContext::FLOATING_LITERAL() { + return getToken(HogQLParser::FLOATING_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::FloatingLiteralContext::DOT() { + return getToken(HogQLParser::DOT, 0); +} + +std::vector HogQLParser::FloatingLiteralContext::DECIMAL_LITERAL() { + return getTokens(HogQLParser::DECIMAL_LITERAL); +} + +tree::TerminalNode* HogQLParser::FloatingLiteralContext::DECIMAL_LITERAL(size_t i) { + return getToken(HogQLParser::DECIMAL_LITERAL, i); +} + +tree::TerminalNode* HogQLParser::FloatingLiteralContext::OCTAL_LITERAL() { + return getToken(HogQLParser::OCTAL_LITERAL, 0); +} + + +size_t HogQLParser::FloatingLiteralContext::getRuleIndex() const { + return HogQLParser::RuleFloatingLiteral; +} + + +std::any HogQLParser::FloatingLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFloatingLiteral(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::FloatingLiteralContext* HogQLParser::floatingLiteral() { + FloatingLiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 100, HogQLParser::RuleFloatingLiteral); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(881); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::FLOATING_LITERAL: { + enterOuterAlt(_localctx, 1); + setState(873); + match(HogQLParser::FLOATING_LITERAL); + break; + } + + case HogQLParser::DOT: { + enterOuterAlt(_localctx, 2); + setState(874); + match(HogQLParser::DOT); + setState(875); + _la = _input->LA(1); + if (!(_la == HogQLParser::OCTAL_LITERAL + + || _la == HogQLParser::DECIMAL_LITERAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + case HogQLParser::DECIMAL_LITERAL: { + enterOuterAlt(_localctx, 3); + setState(876); + match(HogQLParser::DECIMAL_LITERAL); + setState(877); + match(HogQLParser::DOT); + setState(879); + _errHandler->sync(this); + + switch (getInterpreter()->adaptivePredict(_input, 107, _ctx)) { + case 1: { + setState(878); + _la = _input->LA(1); + if (!(_la == HogQLParser::OCTAL_LITERAL + + || _la == HogQLParser::DECIMAL_LITERAL)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + break; + } + + default: + 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 ------------------------------------------------------------------ + +HogQLParser::NumberLiteralContext::NumberLiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::FloatingLiteralContext* HogQLParser::NumberLiteralContext::floatingLiteral() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::OCTAL_LITERAL() { + return getToken(HogQLParser::OCTAL_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::DECIMAL_LITERAL() { + return getToken(HogQLParser::DECIMAL_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::HEXADECIMAL_LITERAL() { + return getToken(HogQLParser::HEXADECIMAL_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::INF() { + return getToken(HogQLParser::INF, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::NAN_SQL() { + return getToken(HogQLParser::NAN_SQL, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::PLUS() { + return getToken(HogQLParser::PLUS, 0); +} + +tree::TerminalNode* HogQLParser::NumberLiteralContext::DASH() { + return getToken(HogQLParser::DASH, 0); +} + + +size_t HogQLParser::NumberLiteralContext::getRuleIndex() const { + return HogQLParser::RuleNumberLiteral; +} + + +std::any HogQLParser::NumberLiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNumberLiteral(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::NumberLiteralContext* HogQLParser::numberLiteral() { + NumberLiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 102, HogQLParser::RuleNumberLiteral); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(884); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == HogQLParser::DASH + + || _la == HogQLParser::PLUS) { + setState(883); + _la = _input->LA(1); + if (!(_la == HogQLParser::DASH + + || _la == HogQLParser::PLUS)) { + _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + } + setState(892); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 110, _ctx)) { + case 1: { + setState(886); + floatingLiteral(); + break; + } + + case 2: { + setState(887); + match(HogQLParser::OCTAL_LITERAL); + break; + } + + case 3: { + setState(888); + match(HogQLParser::DECIMAL_LITERAL); + break; + } + + case 4: { + setState(889); + match(HogQLParser::HEXADECIMAL_LITERAL); + break; + } + + case 5: { + setState(890); + match(HogQLParser::INF); + break; + } + + case 6: { + setState(891); + match(HogQLParser::NAN_SQL); + break; + } + + default: + break; + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- LiteralContext ------------------------------------------------------------------ + +HogQLParser::LiteralContext::LiteralContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +HogQLParser::NumberLiteralContext* HogQLParser::LiteralContext::numberLiteral() { + return getRuleContext(0); +} + +tree::TerminalNode* HogQLParser::LiteralContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::LiteralContext::NULL_SQL() { + return getToken(HogQLParser::NULL_SQL, 0); +} + + +size_t HogQLParser::LiteralContext::getRuleIndex() const { + return HogQLParser::RuleLiteral; +} + + +std::any HogQLParser::LiteralContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitLiteral(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::LiteralContext* HogQLParser::literal() { + LiteralContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 104, HogQLParser::RuleLiteral); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(897); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::INF: + case HogQLParser::NAN_SQL: + case HogQLParser::FLOATING_LITERAL: + case HogQLParser::OCTAL_LITERAL: + case HogQLParser::DECIMAL_LITERAL: + case HogQLParser::HEXADECIMAL_LITERAL: + case HogQLParser::DASH: + case HogQLParser::DOT: + case HogQLParser::PLUS: { + enterOuterAlt(_localctx, 1); + setState(894); + numberLiteral(); + break; + } + + case HogQLParser::STRING_LITERAL: { + enterOuterAlt(_localctx, 2); + setState(895); + match(HogQLParser::STRING_LITERAL); + break; + } + + case HogQLParser::NULL_SQL: { + enterOuterAlt(_localctx, 3); + setState(896); + match(HogQLParser::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 ------------------------------------------------------------------ + +HogQLParser::IntervalContext::IntervalContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::IntervalContext::SECOND() { + return getToken(HogQLParser::SECOND, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::MINUTE() { + return getToken(HogQLParser::MINUTE, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::HOUR() { + return getToken(HogQLParser::HOUR, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::DAY() { + return getToken(HogQLParser::DAY, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::WEEK() { + return getToken(HogQLParser::WEEK, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::MONTH() { + return getToken(HogQLParser::MONTH, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::QUARTER() { + return getToken(HogQLParser::QUARTER, 0); +} + +tree::TerminalNode* HogQLParser::IntervalContext::YEAR() { + return getToken(HogQLParser::YEAR, 0); +} + + +size_t HogQLParser::IntervalContext::getRuleIndex() const { + return HogQLParser::RuleInterval; +} + + +std::any HogQLParser::IntervalContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitInterval(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::IntervalContext* HogQLParser::interval() { + IntervalContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 106, HogQLParser::RuleInterval); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(899); + _la = _input->LA(1); + if (!(_la == HogQLParser::DAY || ((((_la - 76) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 76)) & 72057615512764417) != 0) || ((((_la - 145) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 145)) & 36283883716609) != 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 ------------------------------------------------------------------ + +HogQLParser::KeywordContext::KeywordContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::KeywordContext::AFTER() { + return getToken(HogQLParser::AFTER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ALIAS() { + return getToken(HogQLParser::ALIAS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ALL() { + return getToken(HogQLParser::ALL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ALTER() { + return getToken(HogQLParser::ALTER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::AND() { + return getToken(HogQLParser::AND, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ANTI() { + return getToken(HogQLParser::ANTI, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ANY() { + return getToken(HogQLParser::ANY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ARRAY() { + return getToken(HogQLParser::ARRAY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::AS() { + return getToken(HogQLParser::AS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ASCENDING() { + return getToken(HogQLParser::ASCENDING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ASOF() { + return getToken(HogQLParser::ASOF, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::AST() { + return getToken(HogQLParser::AST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ASYNC() { + return getToken(HogQLParser::ASYNC, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ATTACH() { + return getToken(HogQLParser::ATTACH, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::BETWEEN() { + return getToken(HogQLParser::BETWEEN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::BOTH() { + return getToken(HogQLParser::BOTH, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::BY() { + return getToken(HogQLParser::BY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CASE() { + return getToken(HogQLParser::CASE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CAST() { + return getToken(HogQLParser::CAST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CHECK() { + return getToken(HogQLParser::CHECK, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CLEAR() { + return getToken(HogQLParser::CLEAR, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CLUSTER() { + return getToken(HogQLParser::CLUSTER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CODEC() { + return getToken(HogQLParser::CODEC, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::COLLATE() { + return getToken(HogQLParser::COLLATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::COLUMN() { + return getToken(HogQLParser::COLUMN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::COMMENT() { + return getToken(HogQLParser::COMMENT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CONSTRAINT() { + return getToken(HogQLParser::CONSTRAINT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CREATE() { + return getToken(HogQLParser::CREATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CROSS() { + return getToken(HogQLParser::CROSS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CUBE() { + return getToken(HogQLParser::CUBE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::CURRENT() { + return getToken(HogQLParser::CURRENT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DATABASE() { + return getToken(HogQLParser::DATABASE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DATABASES() { + return getToken(HogQLParser::DATABASES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DATE() { + return getToken(HogQLParser::DATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DEDUPLICATE() { + return getToken(HogQLParser::DEDUPLICATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DEFAULT() { + return getToken(HogQLParser::DEFAULT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DELAY() { + return getToken(HogQLParser::DELAY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DELETE() { + return getToken(HogQLParser::DELETE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DESCRIBE() { + return getToken(HogQLParser::DESCRIBE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DESC() { + return getToken(HogQLParser::DESC, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DESCENDING() { + return getToken(HogQLParser::DESCENDING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DETACH() { + return getToken(HogQLParser::DETACH, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DICTIONARIES() { + return getToken(HogQLParser::DICTIONARIES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DICTIONARY() { + return getToken(HogQLParser::DICTIONARY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DISK() { + return getToken(HogQLParser::DISK, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DISTINCT() { + return getToken(HogQLParser::DISTINCT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DISTRIBUTED() { + return getToken(HogQLParser::DISTRIBUTED, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::DROP() { + return getToken(HogQLParser::DROP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ELSE() { + return getToken(HogQLParser::ELSE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::END() { + return getToken(HogQLParser::END, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ENGINE() { + return getToken(HogQLParser::ENGINE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::EVENTS() { + return getToken(HogQLParser::EVENTS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::EXISTS() { + return getToken(HogQLParser::EXISTS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::EXPLAIN() { + return getToken(HogQLParser::EXPLAIN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::EXPRESSION() { + return getToken(HogQLParser::EXPRESSION, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::EXTRACT() { + return getToken(HogQLParser::EXTRACT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FETCHES() { + return getToken(HogQLParser::FETCHES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FINAL() { + return getToken(HogQLParser::FINAL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FIRST() { + return getToken(HogQLParser::FIRST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FLUSH() { + return getToken(HogQLParser::FLUSH, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FOR() { + return getToken(HogQLParser::FOR, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FOLLOWING() { + return getToken(HogQLParser::FOLLOWING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FORMAT() { + return getToken(HogQLParser::FORMAT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FREEZE() { + return getToken(HogQLParser::FREEZE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FROM() { + return getToken(HogQLParser::FROM, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FULL() { + return getToken(HogQLParser::FULL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::FUNCTION() { + return getToken(HogQLParser::FUNCTION, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::GLOBAL() { + return getToken(HogQLParser::GLOBAL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::GRANULARITY() { + return getToken(HogQLParser::GRANULARITY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::GROUP() { + return getToken(HogQLParser::GROUP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::HAVING() { + return getToken(HogQLParser::HAVING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::HIERARCHICAL() { + return getToken(HogQLParser::HIERARCHICAL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ID() { + return getToken(HogQLParser::ID, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::IF() { + return getToken(HogQLParser::IF, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ILIKE() { + return getToken(HogQLParser::ILIKE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::IN() { + return getToken(HogQLParser::IN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INDEX() { + return getToken(HogQLParser::INDEX, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INJECTIVE() { + return getToken(HogQLParser::INJECTIVE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INNER() { + return getToken(HogQLParser::INNER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INSERT() { + return getToken(HogQLParser::INSERT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INTERVAL() { + return getToken(HogQLParser::INTERVAL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::INTO() { + return getToken(HogQLParser::INTO, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::IS() { + return getToken(HogQLParser::IS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::IS_OBJECT_ID() { + return getToken(HogQLParser::IS_OBJECT_ID, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::JOIN() { + return getToken(HogQLParser::JOIN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::JSON_FALSE() { + return getToken(HogQLParser::JSON_FALSE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::JSON_TRUE() { + return getToken(HogQLParser::JSON_TRUE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::KEY() { + return getToken(HogQLParser::KEY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::KILL() { + return getToken(HogQLParser::KILL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LAST() { + return getToken(HogQLParser::LAST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LAYOUT() { + return getToken(HogQLParser::LAYOUT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LEADING() { + return getToken(HogQLParser::LEADING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LEFT() { + return getToken(HogQLParser::LEFT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LIFETIME() { + return getToken(HogQLParser::LIFETIME, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LIKE() { + return getToken(HogQLParser::LIKE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LIMIT() { + return getToken(HogQLParser::LIMIT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LIVE() { + return getToken(HogQLParser::LIVE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LOCAL() { + return getToken(HogQLParser::LOCAL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::LOGS() { + return getToken(HogQLParser::LOGS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MATERIALIZE() { + return getToken(HogQLParser::MATERIALIZE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MATERIALIZED() { + return getToken(HogQLParser::MATERIALIZED, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MAX() { + return getToken(HogQLParser::MAX, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MERGES() { + return getToken(HogQLParser::MERGES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MIN() { + return getToken(HogQLParser::MIN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MODIFY() { + return getToken(HogQLParser::MODIFY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MOVE() { + return getToken(HogQLParser::MOVE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::MUTATION() { + return getToken(HogQLParser::MUTATION, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::NO() { + return getToken(HogQLParser::NO, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::NOT() { + return getToken(HogQLParser::NOT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::NULLS() { + return getToken(HogQLParser::NULLS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OFFSET() { + return getToken(HogQLParser::OFFSET, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ON() { + return getToken(HogQLParser::ON, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OPTIMIZE() { + return getToken(HogQLParser::OPTIMIZE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OR() { + return getToken(HogQLParser::OR, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ORDER() { + return getToken(HogQLParser::ORDER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OUTER() { + return getToken(HogQLParser::OUTER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OUTFILE() { + return getToken(HogQLParser::OUTFILE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::OVER() { + return getToken(HogQLParser::OVER, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::PARTITION() { + return getToken(HogQLParser::PARTITION, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::POPULATE() { + return getToken(HogQLParser::POPULATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::PRECEDING() { + return getToken(HogQLParser::PRECEDING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::PREWHERE() { + return getToken(HogQLParser::PREWHERE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::PRIMARY() { + return getToken(HogQLParser::PRIMARY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::RANGE() { + return getToken(HogQLParser::RANGE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::RELOAD() { + return getToken(HogQLParser::RELOAD, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::REMOVE() { + return getToken(HogQLParser::REMOVE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::RENAME() { + return getToken(HogQLParser::RENAME, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::REPLACE() { + return getToken(HogQLParser::REPLACE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::REPLICA() { + return getToken(HogQLParser::REPLICA, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::REPLICATED() { + return getToken(HogQLParser::REPLICATED, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::RIGHT() { + return getToken(HogQLParser::RIGHT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ROLLUP() { + return getToken(HogQLParser::ROLLUP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ROW() { + return getToken(HogQLParser::ROW, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::ROWS() { + return getToken(HogQLParser::ROWS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SAMPLE() { + return getToken(HogQLParser::SAMPLE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SELECT() { + return getToken(HogQLParser::SELECT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SEMI() { + return getToken(HogQLParser::SEMI, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SENDS() { + return getToken(HogQLParser::SENDS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SET() { + return getToken(HogQLParser::SET, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SETTINGS() { + return getToken(HogQLParser::SETTINGS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SHOW() { + return getToken(HogQLParser::SHOW, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SOURCE() { + return getToken(HogQLParser::SOURCE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::START() { + return getToken(HogQLParser::START, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::STOP() { + return getToken(HogQLParser::STOP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SUBSTRING() { + return getToken(HogQLParser::SUBSTRING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SYNC() { + return getToken(HogQLParser::SYNC, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SYNTAX() { + return getToken(HogQLParser::SYNTAX, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::SYSTEM() { + return getToken(HogQLParser::SYSTEM, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TABLE() { + return getToken(HogQLParser::TABLE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TABLES() { + return getToken(HogQLParser::TABLES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TEMPORARY() { + return getToken(HogQLParser::TEMPORARY, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TEST() { + return getToken(HogQLParser::TEST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::THEN() { + return getToken(HogQLParser::THEN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TIES() { + return getToken(HogQLParser::TIES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TIMEOUT() { + return getToken(HogQLParser::TIMEOUT, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TIMESTAMP() { + return getToken(HogQLParser::TIMESTAMP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TOTALS() { + return getToken(HogQLParser::TOTALS, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TRAILING() { + return getToken(HogQLParser::TRAILING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TRIM() { + return getToken(HogQLParser::TRIM, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TRUNCATE() { + return getToken(HogQLParser::TRUNCATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TO() { + return getToken(HogQLParser::TO, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TOP() { + return getToken(HogQLParser::TOP, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TTL() { + return getToken(HogQLParser::TTL, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::TYPE() { + return getToken(HogQLParser::TYPE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::UNBOUNDED() { + return getToken(HogQLParser::UNBOUNDED, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::UNION() { + return getToken(HogQLParser::UNION, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::UPDATE() { + return getToken(HogQLParser::UPDATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::USE() { + return getToken(HogQLParser::USE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::USING() { + return getToken(HogQLParser::USING, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::UUID() { + return getToken(HogQLParser::UUID, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::VALUES() { + return getToken(HogQLParser::VALUES, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::VIEW() { + return getToken(HogQLParser::VIEW, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::VOLUME() { + return getToken(HogQLParser::VOLUME, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::WATCH() { + return getToken(HogQLParser::WATCH, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::WHEN() { + return getToken(HogQLParser::WHEN, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::WHERE() { + return getToken(HogQLParser::WHERE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::WINDOW() { + return getToken(HogQLParser::WINDOW, 0); +} + +tree::TerminalNode* HogQLParser::KeywordContext::WITH() { + return getToken(HogQLParser::WITH, 0); +} + + +size_t HogQLParser::KeywordContext::getRuleIndex() const { + return HogQLParser::RuleKeyword; +} + + +std::any HogQLParser::KeywordContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitKeyword(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::KeywordContext* HogQLParser::keyword() { + KeywordContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 108, HogQLParser::RuleKeyword); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(901); + _la = _input->LA(1); + if (!(((((_la - 2) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 2)) & -34368126977) != 0) || ((((_la - 66) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 66)) & -1288627627820033) != 0) || ((((_la - 130) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 130)) & 8034421735228932089) != 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 ------------------------------------------------------------------ + +HogQLParser::KeywordForAliasContext::KeywordForAliasContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::KeywordForAliasContext::DATE() { + return getToken(HogQLParser::DATE, 0); +} + +tree::TerminalNode* HogQLParser::KeywordForAliasContext::FIRST() { + return getToken(HogQLParser::FIRST, 0); +} + +tree::TerminalNode* HogQLParser::KeywordForAliasContext::ID() { + return getToken(HogQLParser::ID, 0); +} + +tree::TerminalNode* HogQLParser::KeywordForAliasContext::KEY() { + return getToken(HogQLParser::KEY, 0); +} + + +size_t HogQLParser::KeywordForAliasContext::getRuleIndex() const { + return HogQLParser::RuleKeywordForAlias; +} + + +std::any HogQLParser::KeywordForAliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitKeywordForAlias(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::KeywordForAliasContext* HogQLParser::keywordForAlias() { + KeywordForAliasContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 110, HogQLParser::RuleKeywordForAlias); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(903); + _la = _input->LA(1); + if (!(((((_la - 36) & ~ 0x3fULL) == 0) && + ((1ULL << (_la - 36)) & 36030996109328385) != 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 ------------------------------------------------------------------ + +HogQLParser::AliasContext::AliasContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::AliasContext::IDENTIFIER() { + return getToken(HogQLParser::IDENTIFIER, 0); +} + +HogQLParser::KeywordForAliasContext* HogQLParser::AliasContext::keywordForAlias() { + return getRuleContext(0); +} + + +size_t HogQLParser::AliasContext::getRuleIndex() const { + return HogQLParser::RuleAlias; +} + + +std::any HogQLParser::AliasContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAlias(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::AliasContext* HogQLParser::alias() { + AliasContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 112, HogQLParser::RuleAlias); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(907); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::IDENTIFIER: { + enterOuterAlt(_localctx, 1); + setState(905); + match(HogQLParser::IDENTIFIER); + break; + } + + case HogQLParser::DATE: + case HogQLParser::FIRST: + case HogQLParser::ID: + case HogQLParser::KEY: { + enterOuterAlt(_localctx, 2); + setState(906); + 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 ------------------------------------------------------------------ + +HogQLParser::IdentifierContext::IdentifierContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::IdentifierContext::IDENTIFIER() { + return getToken(HogQLParser::IDENTIFIER, 0); +} + +HogQLParser::IntervalContext* HogQLParser::IdentifierContext::interval() { + return getRuleContext(0); +} + +HogQLParser::KeywordContext* HogQLParser::IdentifierContext::keyword() { + return getRuleContext(0); +} + + +size_t HogQLParser::IdentifierContext::getRuleIndex() const { + return HogQLParser::RuleIdentifier; +} + + +std::any HogQLParser::IdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitIdentifier(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::IdentifierContext* HogQLParser::identifier() { + IdentifierContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 114, HogQLParser::RuleIdentifier); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + setState(912); + _errHandler->sync(this); + switch (_input->LA(1)) { + case HogQLParser::IDENTIFIER: { + enterOuterAlt(_localctx, 1); + setState(909); + match(HogQLParser::IDENTIFIER); + break; + } + + case HogQLParser::DAY: + case HogQLParser::HOUR: + case HogQLParser::MINUTE: + case HogQLParser::MONTH: + case HogQLParser::QUARTER: + case HogQLParser::SECOND: + case HogQLParser::WEEK: + case HogQLParser::YEAR: { + enterOuterAlt(_localctx, 2); + setState(910); + interval(); + break; + } + + case HogQLParser::AFTER: + case HogQLParser::ALIAS: + case HogQLParser::ALL: + case HogQLParser::ALTER: + case HogQLParser::AND: + case HogQLParser::ANTI: + case HogQLParser::ANY: + case HogQLParser::ARRAY: + case HogQLParser::AS: + case HogQLParser::ASCENDING: + case HogQLParser::ASOF: + case HogQLParser::AST: + case HogQLParser::ASYNC: + case HogQLParser::ATTACH: + case HogQLParser::BETWEEN: + case HogQLParser::BOTH: + case HogQLParser::BY: + case HogQLParser::CASE: + case HogQLParser::CAST: + case HogQLParser::CHECK: + case HogQLParser::CLEAR: + case HogQLParser::CLUSTER: + case HogQLParser::CODEC: + case HogQLParser::COLLATE: + case HogQLParser::COLUMN: + case HogQLParser::COMMENT: + case HogQLParser::CONSTRAINT: + case HogQLParser::CREATE: + case HogQLParser::CROSS: + case HogQLParser::CUBE: + case HogQLParser::CURRENT: + case HogQLParser::DATABASE: + case HogQLParser::DATABASES: + case HogQLParser::DATE: + case HogQLParser::DEDUPLICATE: + case HogQLParser::DEFAULT: + case HogQLParser::DELAY: + case HogQLParser::DELETE: + case HogQLParser::DESC: + case HogQLParser::DESCENDING: + case HogQLParser::DESCRIBE: + case HogQLParser::DETACH: + case HogQLParser::DICTIONARIES: + case HogQLParser::DICTIONARY: + case HogQLParser::DISK: + case HogQLParser::DISTINCT: + case HogQLParser::DISTRIBUTED: + case HogQLParser::DROP: + case HogQLParser::ELSE: + case HogQLParser::END: + case HogQLParser::ENGINE: + case HogQLParser::EVENTS: + case HogQLParser::EXISTS: + case HogQLParser::EXPLAIN: + case HogQLParser::EXPRESSION: + case HogQLParser::EXTRACT: + case HogQLParser::FETCHES: + case HogQLParser::FINAL: + case HogQLParser::FIRST: + case HogQLParser::FLUSH: + case HogQLParser::FOLLOWING: + case HogQLParser::FOR: + case HogQLParser::FORMAT: + case HogQLParser::FREEZE: + case HogQLParser::FROM: + case HogQLParser::FULL: + case HogQLParser::FUNCTION: + case HogQLParser::GLOBAL: + case HogQLParser::GRANULARITY: + case HogQLParser::GROUP: + case HogQLParser::HAVING: + case HogQLParser::HIERARCHICAL: + case HogQLParser::ID: + case HogQLParser::IF: + case HogQLParser::ILIKE: + case HogQLParser::IN: + case HogQLParser::INDEX: + case HogQLParser::INJECTIVE: + case HogQLParser::INNER: + case HogQLParser::INSERT: + case HogQLParser::INTERVAL: + case HogQLParser::INTO: + case HogQLParser::IS: + case HogQLParser::IS_OBJECT_ID: + case HogQLParser::JOIN: + case HogQLParser::KEY: + case HogQLParser::KILL: + case HogQLParser::LAST: + case HogQLParser::LAYOUT: + case HogQLParser::LEADING: + case HogQLParser::LEFT: + case HogQLParser::LIFETIME: + case HogQLParser::LIKE: + case HogQLParser::LIMIT: + case HogQLParser::LIVE: + case HogQLParser::LOCAL: + case HogQLParser::LOGS: + case HogQLParser::MATERIALIZE: + case HogQLParser::MATERIALIZED: + case HogQLParser::MAX: + case HogQLParser::MERGES: + case HogQLParser::MIN: + case HogQLParser::MODIFY: + case HogQLParser::MOVE: + case HogQLParser::MUTATION: + case HogQLParser::NO: + case HogQLParser::NOT: + case HogQLParser::NULLS: + case HogQLParser::OFFSET: + case HogQLParser::ON: + case HogQLParser::OPTIMIZE: + case HogQLParser::OR: + case HogQLParser::ORDER: + case HogQLParser::OUTER: + case HogQLParser::OUTFILE: + case HogQLParser::OVER: + case HogQLParser::PARTITION: + case HogQLParser::POPULATE: + case HogQLParser::PRECEDING: + case HogQLParser::PREWHERE: + case HogQLParser::PRIMARY: + case HogQLParser::RANGE: + case HogQLParser::RELOAD: + case HogQLParser::REMOVE: + case HogQLParser::RENAME: + case HogQLParser::REPLACE: + case HogQLParser::REPLICA: + case HogQLParser::REPLICATED: + case HogQLParser::RIGHT: + case HogQLParser::ROLLUP: + case HogQLParser::ROW: + case HogQLParser::ROWS: + case HogQLParser::SAMPLE: + case HogQLParser::SELECT: + case HogQLParser::SEMI: + case HogQLParser::SENDS: + case HogQLParser::SET: + case HogQLParser::SETTINGS: + case HogQLParser::SHOW: + case HogQLParser::SOURCE: + case HogQLParser::START: + case HogQLParser::STOP: + case HogQLParser::SUBSTRING: + case HogQLParser::SYNC: + case HogQLParser::SYNTAX: + case HogQLParser::SYSTEM: + case HogQLParser::TABLE: + case HogQLParser::TABLES: + case HogQLParser::TEMPORARY: + case HogQLParser::TEST: + case HogQLParser::THEN: + case HogQLParser::TIES: + case HogQLParser::TIMEOUT: + case HogQLParser::TIMESTAMP: + case HogQLParser::TO: + case HogQLParser::TOP: + case HogQLParser::TOTALS: + case HogQLParser::TRAILING: + case HogQLParser::TRIM: + case HogQLParser::TRUNCATE: + case HogQLParser::TTL: + case HogQLParser::TYPE: + case HogQLParser::UNBOUNDED: + case HogQLParser::UNION: + case HogQLParser::UPDATE: + case HogQLParser::USE: + case HogQLParser::USING: + case HogQLParser::UUID: + case HogQLParser::VALUES: + case HogQLParser::VIEW: + case HogQLParser::VOLUME: + case HogQLParser::WATCH: + case HogQLParser::WHEN: + case HogQLParser::WHERE: + case HogQLParser::WINDOW: + case HogQLParser::WITH: + case HogQLParser::JSON_FALSE: + case HogQLParser::JSON_TRUE: { + enterOuterAlt(_localctx, 3); + setState(911); + 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; +} + +//----------------- EnumValueContext ------------------------------------------------------------------ + +HogQLParser::EnumValueContext::EnumValueContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* HogQLParser::EnumValueContext::STRING_LITERAL() { + return getToken(HogQLParser::STRING_LITERAL, 0); +} + +tree::TerminalNode* HogQLParser::EnumValueContext::EQ_SINGLE() { + return getToken(HogQLParser::EQ_SINGLE, 0); +} + +HogQLParser::NumberLiteralContext* HogQLParser::EnumValueContext::numberLiteral() { + return getRuleContext(0); +} + + +size_t HogQLParser::EnumValueContext::getRuleIndex() const { + return HogQLParser::RuleEnumValue; +} + + +std::any HogQLParser::EnumValueContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitEnumValue(this); + else + return visitor->visitChildren(this); +} + +HogQLParser::EnumValueContext* HogQLParser::enumValue() { + EnumValueContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 116, HogQLParser::RuleEnumValue); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(914); + match(HogQLParser::STRING_LITERAL); + setState(915); + match(HogQLParser::EQ_SINGLE); + setState(916); + numberLiteral(); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +bool HogQLParser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { + switch (ruleIndex) { + case 18: return joinExprSempred(antlrcpp::downCast(context), predicateIndex); + case 37: return columnExprSempred(antlrcpp::downCast(context), predicateIndex); + case 45: return tableExprSempred(antlrcpp::downCast(context), predicateIndex); + + default: + break; + } + return true; +} + +bool HogQLParser::joinExprSempred(JoinExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 0: return precpred(_ctx, 3); + case 1: return precpred(_ctx, 4); + + default: + break; + } + return true; +} + +bool HogQLParser::columnExprSempred(ColumnExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 2: return precpred(_ctx, 17); + case 3: return precpred(_ctx, 16); + case 4: return precpred(_ctx, 15); + case 5: return precpred(_ctx, 13); + case 6: return precpred(_ctx, 11); + case 7: return precpred(_ctx, 10); + case 8: return precpred(_ctx, 9); + case 9: return precpred(_ctx, 8); + case 10: return precpred(_ctx, 21); + case 11: return precpred(_ctx, 20); + case 12: return precpred(_ctx, 19); + case 13: return precpred(_ctx, 14); + case 14: return precpred(_ctx, 7); + + default: + break; + } + return true; +} + +bool HogQLParser::tableExprSempred(TableExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 15: return precpred(_ctx, 2); + + default: + break; + } + return true; +} + +void HogQLParser::initialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + hogqlparserParserInitialize(); +#else + ::antlr4::internal::call_once(hogqlparserParserOnceFlag, hogqlparserParserInitialize); +#endif +} diff --git a/hogql_parser/HogQLParser.h b/hogql_parser/HogQLParser.h new file mode 100644 index 0000000000000..0f1a21fa159ec --- /dev/null +++ b/hogql_parser/HogQLParser.h @@ -0,0 +1,1990 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + +#pragma once + + +#include "antlr4-runtime.h" + + + + +class HogQLParser : 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, COHORT = 25, COLLATE = 26, + COLUMN = 27, COMMENT = 28, CONSTRAINT = 29, CREATE = 30, CROSS = 31, + CUBE = 32, CURRENT = 33, DATABASE = 34, DATABASES = 35, DATE = 36, DAY = 37, + DEDUPLICATE = 38, DEFAULT = 39, DELAY = 40, DELETE = 41, DESC = 42, + DESCENDING = 43, DESCRIBE = 44, DETACH = 45, DICTIONARIES = 46, DICTIONARY = 47, + DISK = 48, DISTINCT = 49, DISTRIBUTED = 50, DROP = 51, ELSE = 52, END = 53, + ENGINE = 54, EVENTS = 55, EXISTS = 56, EXPLAIN = 57, EXPRESSION = 58, + EXTRACT = 59, FETCHES = 60, FINAL = 61, FIRST = 62, FLUSH = 63, FOLLOWING = 64, + FOR = 65, FORMAT = 66, FREEZE = 67, FROM = 68, FULL = 69, FUNCTION = 70, + GLOBAL = 71, GRANULARITY = 72, GROUP = 73, HAVING = 74, HIERARCHICAL = 75, + HOUR = 76, ID = 77, IF = 78, ILIKE = 79, IN = 80, INDEX = 81, INF = 82, + INJECTIVE = 83, INNER = 84, INSERT = 85, INTERVAL = 86, INTO = 87, IS = 88, + IS_OBJECT_ID = 89, JOIN = 90, KEY = 91, KILL = 92, LAST = 93, LAYOUT = 94, + LEADING = 95, LEFT = 96, LIFETIME = 97, LIKE = 98, LIMIT = 99, LIVE = 100, + LOCAL = 101, LOGS = 102, MATERIALIZE = 103, MATERIALIZED = 104, MAX = 105, + MERGES = 106, MIN = 107, MINUTE = 108, MODIFY = 109, MONTH = 110, MOVE = 111, + MUTATION = 112, NAN_SQL = 113, NO = 114, NOT = 115, NULL_SQL = 116, + NULLS = 117, OFFSET = 118, ON = 119, OPTIMIZE = 120, OR = 121, ORDER = 122, + OUTER = 123, OUTFILE = 124, OVER = 125, PARTITION = 126, POPULATE = 127, + PRECEDING = 128, PREWHERE = 129, PRIMARY = 130, PROJECTION = 131, QUARTER = 132, + RANGE = 133, RELOAD = 134, REMOVE = 135, RENAME = 136, REPLACE = 137, + REPLICA = 138, REPLICATED = 139, RIGHT = 140, ROLLUP = 141, ROW = 142, + ROWS = 143, SAMPLE = 144, SECOND = 145, SELECT = 146, SEMI = 147, SENDS = 148, + SET = 149, SETTINGS = 150, SHOW = 151, SOURCE = 152, START = 153, STOP = 154, + SUBSTRING = 155, SYNC = 156, SYNTAX = 157, SYSTEM = 158, TABLE = 159, + TABLES = 160, TEMPORARY = 161, TEST = 162, THEN = 163, TIES = 164, TIMEOUT = 165, + TIMESTAMP = 166, TO = 167, TOP = 168, TOTALS = 169, TRAILING = 170, + TRIM = 171, TRUNCATE = 172, TTL = 173, TYPE = 174, UNBOUNDED = 175, + UNION = 176, UPDATE = 177, USE = 178, USING = 179, UUID = 180, VALUES = 181, + VIEW = 182, VOLUME = 183, WATCH = 184, WEEK = 185, WHEN = 186, WHERE = 187, + WINDOW = 188, WITH = 189, YEAR = 190, JSON_FALSE = 191, JSON_TRUE = 192, + ESCAPE_CHAR = 193, IDENTIFIER = 194, FLOATING_LITERAL = 195, OCTAL_LITERAL = 196, + DECIMAL_LITERAL = 197, HEXADECIMAL_LITERAL = 198, STRING_LITERAL = 199, + PLACEHOLDER = 200, ARROW = 201, ASTERISK = 202, BACKQUOTE = 203, BACKSLASH = 204, + COLON = 205, COMMA = 206, CONCAT = 207, DASH = 208, DOLLAR = 209, DOT = 210, + EQ_DOUBLE = 211, EQ_SINGLE = 212, GT_EQ = 213, GT = 214, HASH = 215, + IREGEX_SINGLE = 216, IREGEX_DOUBLE = 217, LBRACE = 218, LBRACKET = 219, + LPAREN = 220, LT_EQ = 221, LT = 222, NOT_EQ = 223, NOT_IREGEX = 224, + NOT_REGEX = 225, NULLISH = 226, PERCENT = 227, PLUS = 228, QUERY = 229, + QUOTE_DOUBLE = 230, QUOTE_SINGLE = 231, REGEX_SINGLE = 232, REGEX_DOUBLE = 233, + RBRACE = 234, RBRACKET = 235, RPAREN = 236, SEMICOLON = 237, SLASH = 238, + UNDERSCORE = 239, MULTI_LINE_COMMENT = 240, SINGLE_LINE_COMMENT = 241, + WHITESPACE = 242 + }; + + enum { + RuleSelect = 0, RuleSelectUnionStmt = 1, RuleSelectStmtWithParens = 2, + RuleSelectStmt = 3, RuleWithClause = 4, RuleTopClause = 5, RuleFromClause = 6, + RuleArrayJoinClause = 7, RuleWindowClause = 8, RulePrewhereClause = 9, + RuleWhereClause = 10, RuleGroupByClause = 11, RuleHavingClause = 12, + RuleOrderByClause = 13, RuleProjectionOrderByClause = 14, RuleLimitAndOffsetClause = 15, + RuleOffsetOnlyClause = 16, RuleSettingsClause = 17, RuleJoinExpr = 18, + RuleJoinOp = 19, RuleJoinOpCross = 20, RuleJoinConstraintClause = 21, + RuleSampleClause = 22, RuleOrderExprList = 23, RuleOrderExpr = 24, RuleRatioExpr = 25, + RuleSettingExprList = 26, RuleSettingExpr = 27, RuleWindowExpr = 28, + RuleWinPartitionByClause = 29, RuleWinOrderByClause = 30, RuleWinFrameClause = 31, + RuleWinFrameExtend = 32, RuleWinFrameBound = 33, RuleExpr = 34, RuleColumnTypeExpr = 35, + RuleColumnExprList = 36, RuleColumnExpr = 37, RuleColumnArgList = 38, + RuleColumnArgExpr = 39, RuleColumnLambdaExpr = 40, RuleWithExprList = 41, + RuleWithExpr = 42, RuleColumnIdentifier = 43, RuleNestedIdentifier = 44, + RuleTableExpr = 45, RuleTableFunctionExpr = 46, RuleTableIdentifier = 47, + RuleTableArgList = 48, RuleDatabaseIdentifier = 49, RuleFloatingLiteral = 50, + RuleNumberLiteral = 51, RuleLiteral = 52, RuleInterval = 53, RuleKeyword = 54, + RuleKeywordForAlias = 55, RuleAlias = 56, RuleIdentifier = 57, RuleEnumValue = 58 + }; + + explicit HogQLParser(antlr4::TokenStream *input); + + HogQLParser(antlr4::TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options); + + ~HogQLParser() override; + + std::string getGrammarFileName() const override; + + const antlr4::atn::ATN& getATN() const override; + + const std::vector& getRuleNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + + class SelectContext; + class SelectUnionStmtContext; + class SelectStmtWithParensContext; + class SelectStmtContext; + class WithClauseContext; + class TopClauseContext; + class FromClauseContext; + class ArrayJoinClauseContext; + class WindowClauseContext; + class PrewhereClauseContext; + class WhereClauseContext; + class GroupByClauseContext; + class HavingClauseContext; + class OrderByClauseContext; + class ProjectionOrderByClauseContext; + class LimitAndOffsetClauseContext; + class OffsetOnlyClauseContext; + class SettingsClauseContext; + class JoinExprContext; + class JoinOpContext; + class JoinOpCrossContext; + class JoinConstraintClauseContext; + class SampleClauseContext; + class OrderExprListContext; + class OrderExprContext; + class RatioExprContext; + class SettingExprListContext; + class SettingExprContext; + class WindowExprContext; + class WinPartitionByClauseContext; + class WinOrderByClauseContext; + class WinFrameClauseContext; + class WinFrameExtendContext; + class WinFrameBoundContext; + class ExprContext; + class ColumnTypeExprContext; + class ColumnExprListContext; + class ColumnExprContext; + class ColumnArgListContext; + class ColumnArgExprContext; + class ColumnLambdaExprContext; + class WithExprListContext; + class WithExprContext; + class ColumnIdentifierContext; + class NestedIdentifierContext; + class TableExprContext; + class TableFunctionExprContext; + class TableIdentifierContext; + class TableArgListContext; + class DatabaseIdentifierContext; + class FloatingLiteralContext; + class NumberLiteralContext; + class LiteralContext; + class IntervalContext; + class KeywordContext; + class KeywordForAliasContext; + class AliasContext; + class IdentifierContext; + class EnumValueContext; + + class SelectContext : public antlr4::ParserRuleContext { + public: + SelectContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *EOF(); + SelectUnionStmtContext *selectUnionStmt(); + SelectStmtContext *selectStmt(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SelectContext* select(); + + 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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SelectStmtWithParensContext* selectStmtWithParens(); + + class SelectStmtContext : public antlr4::ParserRuleContext { + public: + HogQLParser::WithClauseContext *with = nullptr; + HogQLParser::ColumnExprListContext *columns = nullptr; + HogQLParser::FromClauseContext *from = nullptr; + HogQLParser::WhereClauseContext *where = nullptr; + SelectStmtContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *SELECT(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *DISTINCT(); + TopClauseContext *topClause(); + ArrayJoinClauseContext *arrayJoinClause(); + PrewhereClauseContext *prewhereClause(); + GroupByClauseContext *groupByClause(); + std::vector WITH(); + antlr4::tree::TerminalNode* WITH(size_t i); + antlr4::tree::TerminalNode *TOTALS(); + HavingClauseContext *havingClause(); + WindowClauseContext *windowClause(); + OrderByClauseContext *orderByClause(); + LimitAndOffsetClauseContext *limitAndOffsetClause(); + OffsetOnlyClauseContext *offsetOnlyClause(); + SettingsClauseContext *settingsClause(); + WithClauseContext *withClause(); + FromClauseContext *fromClause(); + WhereClauseContext *whereClause(); + antlr4::tree::TerminalNode *CUBE(); + antlr4::tree::TerminalNode *ROLLUP(); + + + virtual std::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(); + WithExprListContext *withExprList(); + + + virtual std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ArrayJoinClauseContext* arrayJoinClause(); + + class WindowClauseContext : public antlr4::ParserRuleContext { + public: + WindowClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *WINDOW(); + std::vector identifier(); + IdentifierContext* identifier(size_t i); + std::vector AS(); + antlr4::tree::TerminalNode* AS(size_t i); + std::vector LPAREN(); + antlr4::tree::TerminalNode* LPAREN(size_t i); + std::vector windowExpr(); + WindowExprContext* windowExpr(size_t i); + std::vector RPAREN(); + antlr4::tree::TerminalNode* RPAREN(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WindowClauseContext* windowClause(); + + 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 std::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 std::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 std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ProjectionOrderByClauseContext* projectionOrderByClause(); + + class LimitAndOffsetClauseContext : public antlr4::ParserRuleContext { + public: + LimitAndOffsetClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *LIMIT(); + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *COMMA(); + antlr4::tree::TerminalNode *BY(); + ColumnExprListContext *columnExprList(); + antlr4::tree::TerminalNode *WITH(); + antlr4::tree::TerminalNode *TIES(); + antlr4::tree::TerminalNode *OFFSET(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + LimitAndOffsetClauseContext* limitAndOffsetClause(); + + class OffsetOnlyClauseContext : public antlr4::ParserRuleContext { + public: + OffsetOnlyClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *OFFSET(); + ColumnExprContext *columnExpr(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + OffsetOnlyClauseContext* offsetOnlyClause(); + + 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 std::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(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class JoinExprTableContext : public JoinExprContext { + public: + JoinExprTableContext(JoinExprContext *ctx); + + TableExprContext *tableExpr(); + antlr4::tree::TerminalNode *FINAL(); + SampleClauseContext *sampleClause(); + + virtual std::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 std::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 std::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 std::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 std::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 std::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 *COMMA(); + + + virtual std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SampleClauseContext* sampleClause(); + + 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 std::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 std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + SettingExprContext* settingExpr(); + + class WindowExprContext : public antlr4::ParserRuleContext { + public: + WindowExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + WinPartitionByClauseContext *winPartitionByClause(); + WinOrderByClauseContext *winOrderByClause(); + WinFrameClauseContext *winFrameClause(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WindowExprContext* windowExpr(); + + class WinPartitionByClauseContext : public antlr4::ParserRuleContext { + public: + WinPartitionByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PARTITION(); + antlr4::tree::TerminalNode *BY(); + ColumnExprListContext *columnExprList(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WinPartitionByClauseContext* winPartitionByClause(); + + class WinOrderByClauseContext : public antlr4::ParserRuleContext { + public: + WinOrderByClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *ORDER(); + antlr4::tree::TerminalNode *BY(); + OrderExprListContext *orderExprList(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WinOrderByClauseContext* winOrderByClause(); + + class WinFrameClauseContext : public antlr4::ParserRuleContext { + public: + WinFrameClauseContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + WinFrameExtendContext *winFrameExtend(); + antlr4::tree::TerminalNode *ROWS(); + antlr4::tree::TerminalNode *RANGE(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WinFrameClauseContext* winFrameClause(); + + class WinFrameExtendContext : public antlr4::ParserRuleContext { + public: + WinFrameExtendContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + WinFrameExtendContext() = default; + void copyFrom(WinFrameExtendContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class FrameStartContext : public WinFrameExtendContext { + public: + FrameStartContext(WinFrameExtendContext *ctx); + + WinFrameBoundContext *winFrameBound(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class FrameBetweenContext : public WinFrameExtendContext { + public: + FrameBetweenContext(WinFrameExtendContext *ctx); + + antlr4::tree::TerminalNode *BETWEEN(); + std::vector winFrameBound(); + WinFrameBoundContext* winFrameBound(size_t i); + antlr4::tree::TerminalNode *AND(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + WinFrameExtendContext* winFrameExtend(); + + class WinFrameBoundContext : public antlr4::ParserRuleContext { + public: + WinFrameBoundContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *CURRENT(); + antlr4::tree::TerminalNode *ROW(); + antlr4::tree::TerminalNode *UNBOUNDED(); + antlr4::tree::TerminalNode *PRECEDING(); + antlr4::tree::TerminalNode *FOLLOWING(); + NumberLiteralContext *numberLiteral(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WinFrameBoundContext* winFrameBound(); + + class ExprContext : public antlr4::ParserRuleContext { + public: + ExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *EOF(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ExprContext* expr(); + + 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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnTypeExprSimpleContext : public ColumnTypeExprContext { + public: + ColumnTypeExprSimpleContext(ColumnTypeExprContext *ctx); + + IdentifierContext *identifier(); + + virtual std::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 std::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 std::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 columnExpr(); + ColumnExprContext* columnExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnExprListContext* columnExprList(); + + 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 std::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(); + antlr4::tree::TerminalNode *STRING_LITERAL(); + + virtual std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprNegateContext : public ColumnExprContext { + public: + ColumnExprNegateContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *DASH(); + ColumnExprContext *columnExpr(); + + virtual std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprLiteralContext : public ColumnExprContext { + public: + ColumnExprLiteralContext(ColumnExprContext *ctx); + + LiteralContext *literal(); + + virtual std::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 std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence1Context : public ColumnExprContext { + public: + ColumnExprPrecedence1Context(ColumnExprContext *ctx); + + HogQLParser::ColumnExprContext *left = nullptr; + antlr4::Token *operator_ = nullptr; + HogQLParser::ColumnExprContext *right = nullptr; + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *ASTERISK(); + antlr4::tree::TerminalNode *SLASH(); + antlr4::tree::TerminalNode *PERCENT(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence2Context : public ColumnExprContext { + public: + ColumnExprPrecedence2Context(ColumnExprContext *ctx); + + HogQLParser::ColumnExprContext *left = nullptr; + antlr4::Token *operator_ = nullptr; + HogQLParser::ColumnExprContext *right = nullptr; + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *PLUS(); + antlr4::tree::TerminalNode *DASH(); + antlr4::tree::TerminalNode *CONCAT(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPrecedence3Context : public ColumnExprContext { + public: + ColumnExprPrecedence3Context(ColumnExprContext *ctx); + + HogQLParser::ColumnExprContext *left = nullptr; + antlr4::Token *operator_ = nullptr; + HogQLParser::ColumnExprContext *right = nullptr; + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *IN(); + antlr4::tree::TerminalNode *EQ_DOUBLE(); + antlr4::tree::TerminalNode *EQ_SINGLE(); + antlr4::tree::TerminalNode *NOT_EQ(); + antlr4::tree::TerminalNode *LT_EQ(); + antlr4::tree::TerminalNode *LT(); + antlr4::tree::TerminalNode *GT_EQ(); + antlr4::tree::TerminalNode *GT(); + antlr4::tree::TerminalNode *LIKE(); + antlr4::tree::TerminalNode *ILIKE(); + antlr4::tree::TerminalNode *REGEX_SINGLE(); + antlr4::tree::TerminalNode *REGEX_DOUBLE(); + antlr4::tree::TerminalNode *NOT_REGEX(); + antlr4::tree::TerminalNode *IREGEX_SINGLE(); + antlr4::tree::TerminalNode *IREGEX_DOUBLE(); + antlr4::tree::TerminalNode *NOT_IREGEX(); + antlr4::tree::TerminalNode *COHORT(); + antlr4::tree::TerminalNode *NOT(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprIntervalContext : public ColumnExprContext { + public: + ColumnExprIntervalContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *INTERVAL(); + ColumnExprContext *columnExpr(); + IntervalContext *interval(); + + virtual std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprWinFunctionTargetContext : public ColumnExprContext { + public: + ColumnExprWinFunctionTargetContext(ColumnExprContext *ctx); + + std::vector identifier(); + IdentifierContext* identifier(size_t i); + antlr4::tree::TerminalNode *OVER(); + antlr4::tree::TerminalNode *LPAREN(); + antlr4::tree::TerminalNode *RPAREN(); + ColumnExprListContext *columnExprList(); + + virtual std::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 std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprPropertyAccessContext : public ColumnExprContext { + public: + ColumnExprPropertyAccessContext(ColumnExprContext *ctx); + + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *DOT(); + IdentifierContext *identifier(); + + virtual std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprNullishContext : public ColumnExprContext { + public: + ColumnExprNullishContext(ColumnExprContext *ctx); + + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + antlr4::tree::TerminalNode *NULLISH(); + + virtual std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprCaseContext : public ColumnExprContext { + public: + ColumnExprCaseContext(ColumnExprContext *ctx); + + HogQLParser::ColumnExprContext *caseExpr = nullptr; + HogQLParser::ColumnExprContext *whenExpr = nullptr; + HogQLParser::ColumnExprContext *thenExpr = nullptr; + HogQLParser::ColumnExprContext *elseExpr = nullptr; + antlr4::tree::TerminalNode *CASE(); + antlr4::tree::TerminalNode *END(); + std::vector WHEN(); + antlr4::tree::TerminalNode* WHEN(size_t i); + std::vector THEN(); + antlr4::tree::TerminalNode* THEN(size_t i); + antlr4::tree::TerminalNode *ELSE(); + std::vector columnExpr(); + ColumnExprContext* columnExpr(size_t i); + + virtual std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprNotContext : public ColumnExprContext { + public: + ColumnExprNotContext(ColumnExprContext *ctx); + + antlr4::tree::TerminalNode *NOT(); + ColumnExprContext *columnExpr(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprWinFunctionContext : public ColumnExprContext { + public: + ColumnExprWinFunctionContext(ColumnExprContext *ctx); + + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *OVER(); + std::vector LPAREN(); + antlr4::tree::TerminalNode* LPAREN(size_t i); + WindowExprContext *windowExpr(); + std::vector RPAREN(); + antlr4::tree::TerminalNode* RPAREN(size_t i); + ColumnExprListContext *columnExprList(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ColumnExprIdentifierContext : public ColumnExprContext { + public: + ColumnExprIdentifierContext(ColumnExprContext *ctx); + + ColumnIdentifierContext *columnIdentifier(); + + virtual std::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 std::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 std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ColumnLambdaExprContext* columnLambdaExpr(); + + class WithExprListContext : public antlr4::ParserRuleContext { + public: + WithExprListContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + std::vector withExpr(); + WithExprContext* withExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + WithExprListContext* withExprList(); + + class WithExprContext : public antlr4::ParserRuleContext { + public: + WithExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + WithExprContext() = default; + void copyFrom(WithExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class WithExprColumnContext : public WithExprContext { + public: + WithExprColumnContext(WithExprContext *ctx); + + ColumnExprContext *columnExpr(); + antlr4::tree::TerminalNode *AS(); + IdentifierContext *identifier(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class WithExprSubqueryContext : public WithExprContext { + public: + WithExprSubqueryContext(WithExprContext *ctx); + + IdentifierContext *identifier(); + antlr4::tree::TerminalNode *AS(); + antlr4::tree::TerminalNode *LPAREN(); + SelectUnionStmtContext *selectUnionStmt(); + antlr4::tree::TerminalNode *RPAREN(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + WithExprContext* withExpr(); + + class ColumnIdentifierContext : public antlr4::ParserRuleContext { + public: + ColumnIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *PLACEHOLDER(); + NestedIdentifierContext *nestedIdentifier(); + TableIdentifierContext *tableIdentifier(); + antlr4::tree::TerminalNode *DOT(); + + + virtual std::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); + std::vector DOT(); + antlr4::tree::TerminalNode* DOT(size_t i); + + + virtual std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableExprPlaceholderContext : public TableExprContext { + public: + TableExprPlaceholderContext(TableExprContext *ctx); + + antlr4::tree::TerminalNode *PLACEHOLDER(); + + virtual std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TableExprFunctionContext : public TableExprContext { + public: + TableExprFunctionContext(TableExprContext *ctx); + + TableFunctionExprContext *tableFunctionExpr(); + + virtual std::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 std::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 std::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 columnExpr(); + ColumnExprContext* columnExpr(size_t i); + std::vector COMMA(); + antlr4::tree::TerminalNode* COMMA(size_t i); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + TableArgListContext* tableArgList(); + + class DatabaseIdentifierContext : public antlr4::ParserRuleContext { + public: + DatabaseIdentifierContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + IdentifierContext *identifier(); + + + virtual std::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 std::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 std::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 std::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 std::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 *CURRENT(); + 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 *FOLLOWING(); + 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 *OVER(); + antlr4::tree::TerminalNode *PARTITION(); + antlr4::tree::TerminalNode *POPULATE(); + antlr4::tree::TerminalNode *PRECEDING(); + 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 *ROW(); + antlr4::tree::TerminalNode *ROWS(); + 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 *UNBOUNDED(); + 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 *WINDOW(); + antlr4::tree::TerminalNode *WITH(); + + + virtual std::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 std::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 std::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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + IdentifierContext* identifier(); + + 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 std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + EnumValueContext* enumValue(); + + + bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override; + + bool joinExprSempred(JoinExprContext *_localctx, size_t predicateIndex); + bool columnExprSempred(ColumnExprContext *_localctx, size_t predicateIndex); + bool tableExprSempred(TableExprContext *_localctx, size_t predicateIndex); + + // By default the static state used to implement the parser is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: +}; + diff --git a/hogql_parser/HogQLParser.interp b/hogql_parser/HogQLParser.interp new file mode 100644 index 0000000000000..321af6e3bd81a --- /dev/null +++ b/hogql_parser/HogQLParser.interp @@ -0,0 +1,554 @@ +token literal names: +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'false' +'true' +null +null +null +null +null +null +null +null +'->' +'*' +'`' +'\\' +':' +',' +'||' +'-' +'$' +'.' +'==' +'=' +'>=' +'>' +'#' +'~*' +'=~*' +'{' +'[' +'(' +'<=' +'<' +null +'!~*' +'!~' +'??' +'%' +'+' +'?' +'"' +'\'' +'~' +'=~' +'}' +']' +')' +';' +'/' +'_' +null +null +null + +token symbolic names: +null +ADD +AFTER +ALIAS +ALL +ALTER +AND +ANTI +ANY +ARRAY +AS +ASCENDING +ASOF +AST +ASYNC +ATTACH +BETWEEN +BOTH +BY +CASE +CAST +CHECK +CLEAR +CLUSTER +CODEC +COHORT +COLLATE +COLUMN +COMMENT +CONSTRAINT +CREATE +CROSS +CUBE +CURRENT +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 +FOLLOWING +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 +OVER +PARTITION +POPULATE +PRECEDING +PREWHERE +PRIMARY +PROJECTION +QUARTER +RANGE +RELOAD +REMOVE +RENAME +REPLACE +REPLICA +REPLICATED +RIGHT +ROLLUP +ROW +ROWS +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 +UNBOUNDED +UNION +UPDATE +USE +USING +UUID +VALUES +VIEW +VOLUME +WATCH +WEEK +WHEN +WHERE +WINDOW +WITH +YEAR +JSON_FALSE +JSON_TRUE +ESCAPE_CHAR +IDENTIFIER +FLOATING_LITERAL +OCTAL_LITERAL +DECIMAL_LITERAL +HEXADECIMAL_LITERAL +STRING_LITERAL +PLACEHOLDER +ARROW +ASTERISK +BACKQUOTE +BACKSLASH +COLON +COMMA +CONCAT +DASH +DOLLAR +DOT +EQ_DOUBLE +EQ_SINGLE +GT_EQ +GT +HASH +IREGEX_SINGLE +IREGEX_DOUBLE +LBRACE +LBRACKET +LPAREN +LT_EQ +LT +NOT_EQ +NOT_IREGEX +NOT_REGEX +NULLISH +PERCENT +PLUS +QUERY +QUOTE_DOUBLE +QUOTE_SINGLE +REGEX_SINGLE +REGEX_DOUBLE +RBRACE +RBRACKET +RPAREN +SEMICOLON +SLASH +UNDERSCORE +MULTI_LINE_COMMENT +SINGLE_LINE_COMMENT +WHITESPACE + +rule names: +select +selectUnionStmt +selectStmtWithParens +selectStmt +withClause +topClause +fromClause +arrayJoinClause +windowClause +prewhereClause +whereClause +groupByClause +havingClause +orderByClause +projectionOrderByClause +limitAndOffsetClause +offsetOnlyClause +settingsClause +joinExpr +joinOp +joinOpCross +joinConstraintClause +sampleClause +orderExprList +orderExpr +ratioExpr +settingExprList +settingExpr +windowExpr +winPartitionByClause +winOrderByClause +winFrameClause +winFrameExtend +winFrameBound +expr +columnTypeExpr +columnExprList +columnExpr +columnArgList +columnArgExpr +columnLambdaExpr +withExprList +withExpr +columnIdentifier +nestedIdentifier +tableExpr +tableFunctionExpr +tableIdentifier +tableArgList +databaseIdentifier +floatingLiteral +numberLiteral +literal +interval +keyword +keywordForAlias +alias +identifier +enumValue + + +atn: +[4, 1, 242, 919, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 1, 0, 1, 0, 3, 0, 121, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 129, 8, 1, 10, 1, 12, 1, 132, 9, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 139, 8, 2, 1, 3, 3, 3, 142, 8, 3, 1, 3, 1, 3, 3, 3, 146, 8, 3, 1, 3, 3, 3, 149, 8, 3, 1, 3, 1, 3, 3, 3, 153, 8, 3, 1, 3, 3, 3, 156, 8, 3, 1, 3, 3, 3, 159, 8, 3, 1, 3, 3, 3, 162, 8, 3, 1, 3, 3, 3, 165, 8, 3, 1, 3, 1, 3, 3, 3, 169, 8, 3, 1, 3, 1, 3, 3, 3, 173, 8, 3, 1, 3, 3, 3, 176, 8, 3, 1, 3, 3, 3, 179, 8, 3, 1, 3, 3, 3, 182, 8, 3, 1, 3, 1, 3, 3, 3, 186, 8, 3, 1, 3, 3, 3, 189, 8, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 198, 8, 5, 1, 6, 1, 6, 1, 6, 1, 7, 3, 7, 204, 8, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 223, 8, 8, 10, 8, 12, 8, 226, 9, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 242, 8, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 259, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 265, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 271, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 282, 8, 15, 3, 15, 284, 8, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 3, 18, 295, 8, 18, 1, 18, 3, 18, 298, 8, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 304, 8, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 312, 8, 18, 1, 18, 1, 18, 1, 18, 1, 18, 5, 18, 318, 8, 18, 10, 18, 12, 18, 321, 9, 18, 1, 19, 3, 19, 324, 8, 19, 1, 19, 1, 19, 1, 19, 3, 19, 329, 8, 19, 1, 19, 3, 19, 332, 8, 19, 1, 19, 3, 19, 335, 8, 19, 1, 19, 1, 19, 3, 19, 339, 8, 19, 1, 19, 1, 19, 3, 19, 343, 8, 19, 1, 19, 3, 19, 346, 8, 19, 3, 19, 348, 8, 19, 1, 19, 3, 19, 351, 8, 19, 1, 19, 1, 19, 3, 19, 355, 8, 19, 1, 19, 1, 19, 3, 19, 359, 8, 19, 1, 19, 3, 19, 362, 8, 19, 3, 19, 364, 8, 19, 3, 19, 366, 8, 19, 1, 20, 1, 20, 1, 20, 3, 20, 371, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 382, 8, 21, 1, 22, 1, 22, 1, 22, 1, 22, 3, 22, 388, 8, 22, 1, 23, 1, 23, 1, 23, 5, 23, 393, 8, 23, 10, 23, 12, 23, 396, 9, 23, 1, 24, 1, 24, 3, 24, 400, 8, 24, 1, 24, 1, 24, 3, 24, 404, 8, 24, 1, 24, 1, 24, 3, 24, 408, 8, 24, 1, 25, 1, 25, 1, 25, 3, 25, 413, 8, 25, 1, 26, 1, 26, 1, 26, 5, 26, 418, 8, 26, 10, 26, 12, 26, 421, 9, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 3, 28, 428, 8, 28, 1, 28, 3, 28, 431, 8, 28, 1, 28, 3, 28, 434, 8, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 453, 8, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 467, 8, 33, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 5, 35, 481, 8, 35, 10, 35, 12, 35, 484, 9, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 5, 35, 493, 8, 35, 10, 35, 12, 35, 496, 9, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 5, 35, 505, 8, 35, 10, 35, 12, 35, 508, 9, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 515, 8, 35, 1, 35, 1, 35, 3, 35, 519, 8, 35, 1, 36, 1, 36, 1, 36, 5, 36, 524, 8, 36, 10, 36, 12, 36, 527, 9, 36, 1, 37, 1, 37, 1, 37, 3, 37, 532, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 4, 37, 539, 8, 37, 11, 37, 12, 37, 540, 1, 37, 1, 37, 3, 37, 545, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 576, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 593, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 605, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 615, 8, 37, 1, 37, 3, 37, 618, 8, 37, 1, 37, 1, 37, 3, 37, 622, 8, 37, 1, 37, 3, 37, 625, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 637, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 654, 8, 37, 1, 37, 1, 37, 3, 37, 658, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 664, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 671, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 683, 8, 37, 1, 37, 1, 37, 3, 37, 687, 8, 37, 1, 37, 3, 37, 690, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 699, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 713, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 740, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 3, 37, 749, 8, 37, 5, 37, 751, 8, 37, 10, 37, 12, 37, 754, 9, 37, 1, 38, 1, 38, 1, 38, 5, 38, 759, 8, 38, 10, 38, 12, 38, 762, 9, 38, 1, 39, 1, 39, 3, 39, 766, 8, 39, 1, 40, 1, 40, 1, 40, 1, 40, 5, 40, 772, 8, 40, 10, 40, 12, 40, 775, 9, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 5, 40, 782, 8, 40, 10, 40, 12, 40, 785, 9, 40, 3, 40, 787, 8, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 5, 41, 795, 8, 41, 10, 41, 12, 41, 798, 9, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 3, 42, 810, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 3, 43, 816, 8, 43, 1, 43, 3, 43, 819, 8, 43, 1, 44, 1, 44, 1, 44, 5, 44, 824, 8, 44, 10, 44, 12, 44, 827, 9, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 837, 8, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 843, 8, 45, 5, 45, 845, 8, 45, 10, 45, 12, 45, 848, 9, 45, 1, 46, 1, 46, 1, 46, 3, 46, 853, 8, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 3, 47, 860, 8, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 5, 48, 867, 8, 48, 10, 48, 12, 48, 870, 9, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 3, 50, 880, 8, 50, 3, 50, 882, 8, 50, 1, 51, 3, 51, 885, 8, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 3, 51, 893, 8, 51, 1, 52, 1, 52, 1, 52, 3, 52, 898, 8, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 3, 56, 908, 8, 56, 1, 57, 1, 57, 1, 57, 3, 57, 913, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 0, 3, 36, 74, 90, 59, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 0, 16, 2, 0, 32, 32, 141, 141, 2, 0, 84, 84, 96, 96, 3, 0, 4, 4, 8, 8, 12, 12, 4, 0, 4, 4, 7, 8, 12, 12, 147, 147, 2, 0, 96, 96, 140, 140, 2, 0, 4, 4, 8, 8, 2, 0, 11, 11, 42, 43, 2, 0, 62, 62, 93, 93, 2, 0, 133, 133, 143, 143, 3, 0, 17, 17, 95, 95, 170, 170, 2, 0, 79, 79, 98, 98, 1, 0, 196, 197, 2, 0, 208, 208, 228, 228, 8, 0, 37, 37, 76, 76, 108, 108, 110, 110, 132, 132, 145, 145, 185, 185, 190, 190, 13, 0, 2, 24, 26, 36, 38, 75, 77, 81, 83, 107, 109, 109, 111, 112, 114, 115, 117, 130, 133, 144, 146, 184, 186, 189, 191, 192, 4, 0, 36, 36, 62, 62, 77, 77, 91, 91, 1039, 0, 120, 1, 0, 0, 0, 2, 124, 1, 0, 0, 0, 4, 138, 1, 0, 0, 0, 6, 141, 1, 0, 0, 0, 8, 190, 1, 0, 0, 0, 10, 193, 1, 0, 0, 0, 12, 199, 1, 0, 0, 0, 14, 203, 1, 0, 0, 0, 16, 209, 1, 0, 0, 0, 18, 227, 1, 0, 0, 0, 20, 230, 1, 0, 0, 0, 22, 233, 1, 0, 0, 0, 24, 243, 1, 0, 0, 0, 26, 246, 1, 0, 0, 0, 28, 250, 1, 0, 0, 0, 30, 283, 1, 0, 0, 0, 32, 285, 1, 0, 0, 0, 34, 288, 1, 0, 0, 0, 36, 303, 1, 0, 0, 0, 38, 365, 1, 0, 0, 0, 40, 370, 1, 0, 0, 0, 42, 381, 1, 0, 0, 0, 44, 383, 1, 0, 0, 0, 46, 389, 1, 0, 0, 0, 48, 397, 1, 0, 0, 0, 50, 409, 1, 0, 0, 0, 52, 414, 1, 0, 0, 0, 54, 422, 1, 0, 0, 0, 56, 427, 1, 0, 0, 0, 58, 435, 1, 0, 0, 0, 60, 439, 1, 0, 0, 0, 62, 443, 1, 0, 0, 0, 64, 452, 1, 0, 0, 0, 66, 466, 1, 0, 0, 0, 68, 468, 1, 0, 0, 0, 70, 518, 1, 0, 0, 0, 72, 520, 1, 0, 0, 0, 74, 657, 1, 0, 0, 0, 76, 755, 1, 0, 0, 0, 78, 765, 1, 0, 0, 0, 80, 786, 1, 0, 0, 0, 82, 791, 1, 0, 0, 0, 84, 809, 1, 0, 0, 0, 86, 818, 1, 0, 0, 0, 88, 820, 1, 0, 0, 0, 90, 836, 1, 0, 0, 0, 92, 849, 1, 0, 0, 0, 94, 859, 1, 0, 0, 0, 96, 863, 1, 0, 0, 0, 98, 871, 1, 0, 0, 0, 100, 881, 1, 0, 0, 0, 102, 884, 1, 0, 0, 0, 104, 897, 1, 0, 0, 0, 106, 899, 1, 0, 0, 0, 108, 901, 1, 0, 0, 0, 110, 903, 1, 0, 0, 0, 112, 907, 1, 0, 0, 0, 114, 912, 1, 0, 0, 0, 116, 914, 1, 0, 0, 0, 118, 121, 3, 2, 1, 0, 119, 121, 3, 6, 3, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 122, 123, 5, 0, 0, 1, 123, 1, 1, 0, 0, 0, 124, 130, 3, 4, 2, 0, 125, 126, 5, 176, 0, 0, 126, 127, 5, 4, 0, 0, 127, 129, 3, 4, 2, 0, 128, 125, 1, 0, 0, 0, 129, 132, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 3, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 133, 139, 3, 6, 3, 0, 134, 135, 5, 220, 0, 0, 135, 136, 3, 2, 1, 0, 136, 137, 5, 236, 0, 0, 137, 139, 1, 0, 0, 0, 138, 133, 1, 0, 0, 0, 138, 134, 1, 0, 0, 0, 139, 5, 1, 0, 0, 0, 140, 142, 3, 8, 4, 0, 141, 140, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 5, 146, 0, 0, 144, 146, 5, 49, 0, 0, 145, 144, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 1, 0, 0, 0, 147, 149, 3, 10, 5, 0, 148, 147, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 152, 3, 72, 36, 0, 151, 153, 3, 12, 6, 0, 152, 151, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 155, 1, 0, 0, 0, 154, 156, 3, 14, 7, 0, 155, 154, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 158, 1, 0, 0, 0, 157, 159, 3, 18, 9, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 161, 1, 0, 0, 0, 160, 162, 3, 20, 10, 0, 161, 160, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 164, 1, 0, 0, 0, 163, 165, 3, 22, 11, 0, 164, 163, 1, 0, 0, 0, 164, 165, 1, 0, 0, 0, 165, 168, 1, 0, 0, 0, 166, 167, 5, 189, 0, 0, 167, 169, 7, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 172, 1, 0, 0, 0, 170, 171, 5, 189, 0, 0, 171, 173, 5, 169, 0, 0, 172, 170, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 175, 1, 0, 0, 0, 174, 176, 3, 24, 12, 0, 175, 174, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 178, 1, 0, 0, 0, 177, 179, 3, 16, 8, 0, 178, 177, 1, 0, 0, 0, 178, 179, 1, 0, 0, 0, 179, 181, 1, 0, 0, 0, 180, 182, 3, 26, 13, 0, 181, 180, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 185, 1, 0, 0, 0, 183, 186, 3, 30, 15, 0, 184, 186, 3, 32, 16, 0, 185, 183, 1, 0, 0, 0, 185, 184, 1, 0, 0, 0, 185, 186, 1, 0, 0, 0, 186, 188, 1, 0, 0, 0, 187, 189, 3, 34, 17, 0, 188, 187, 1, 0, 0, 0, 188, 189, 1, 0, 0, 0, 189, 7, 1, 0, 0, 0, 190, 191, 5, 189, 0, 0, 191, 192, 3, 82, 41, 0, 192, 9, 1, 0, 0, 0, 193, 194, 5, 168, 0, 0, 194, 197, 5, 197, 0, 0, 195, 196, 5, 189, 0, 0, 196, 198, 5, 164, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 11, 1, 0, 0, 0, 199, 200, 5, 68, 0, 0, 200, 201, 3, 36, 18, 0, 201, 13, 1, 0, 0, 0, 202, 204, 7, 1, 0, 0, 203, 202, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 205, 1, 0, 0, 0, 205, 206, 5, 9, 0, 0, 206, 207, 5, 90, 0, 0, 207, 208, 3, 72, 36, 0, 208, 15, 1, 0, 0, 0, 209, 210, 5, 188, 0, 0, 210, 211, 3, 114, 57, 0, 211, 212, 5, 10, 0, 0, 212, 213, 5, 220, 0, 0, 213, 214, 3, 56, 28, 0, 214, 224, 5, 236, 0, 0, 215, 216, 5, 206, 0, 0, 216, 217, 3, 114, 57, 0, 217, 218, 5, 10, 0, 0, 218, 219, 5, 220, 0, 0, 219, 220, 3, 56, 28, 0, 220, 221, 5, 236, 0, 0, 221, 223, 1, 0, 0, 0, 222, 215, 1, 0, 0, 0, 223, 226, 1, 0, 0, 0, 224, 222, 1, 0, 0, 0, 224, 225, 1, 0, 0, 0, 225, 17, 1, 0, 0, 0, 226, 224, 1, 0, 0, 0, 227, 228, 5, 129, 0, 0, 228, 229, 3, 74, 37, 0, 229, 19, 1, 0, 0, 0, 230, 231, 5, 187, 0, 0, 231, 232, 3, 74, 37, 0, 232, 21, 1, 0, 0, 0, 233, 234, 5, 73, 0, 0, 234, 241, 5, 18, 0, 0, 235, 236, 7, 0, 0, 0, 236, 237, 5, 220, 0, 0, 237, 238, 3, 72, 36, 0, 238, 239, 5, 236, 0, 0, 239, 242, 1, 0, 0, 0, 240, 242, 3, 72, 36, 0, 241, 235, 1, 0, 0, 0, 241, 240, 1, 0, 0, 0, 242, 23, 1, 0, 0, 0, 243, 244, 5, 74, 0, 0, 244, 245, 3, 74, 37, 0, 245, 25, 1, 0, 0, 0, 246, 247, 5, 122, 0, 0, 247, 248, 5, 18, 0, 0, 248, 249, 3, 46, 23, 0, 249, 27, 1, 0, 0, 0, 250, 251, 5, 122, 0, 0, 251, 252, 5, 18, 0, 0, 252, 253, 3, 72, 36, 0, 253, 29, 1, 0, 0, 0, 254, 255, 5, 99, 0, 0, 255, 258, 3, 74, 37, 0, 256, 257, 5, 206, 0, 0, 257, 259, 3, 74, 37, 0, 258, 256, 1, 0, 0, 0, 258, 259, 1, 0, 0, 0, 259, 264, 1, 0, 0, 0, 260, 261, 5, 189, 0, 0, 261, 265, 5, 164, 0, 0, 262, 263, 5, 18, 0, 0, 263, 265, 3, 72, 36, 0, 264, 260, 1, 0, 0, 0, 264, 262, 1, 0, 0, 0, 264, 265, 1, 0, 0, 0, 265, 284, 1, 0, 0, 0, 266, 267, 5, 99, 0, 0, 267, 270, 3, 74, 37, 0, 268, 269, 5, 189, 0, 0, 269, 271, 5, 164, 0, 0, 270, 268, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 272, 1, 0, 0, 0, 272, 273, 5, 118, 0, 0, 273, 274, 3, 74, 37, 0, 274, 284, 1, 0, 0, 0, 275, 276, 5, 99, 0, 0, 276, 277, 3, 74, 37, 0, 277, 278, 5, 118, 0, 0, 278, 281, 3, 74, 37, 0, 279, 280, 5, 18, 0, 0, 280, 282, 3, 72, 36, 0, 281, 279, 1, 0, 0, 0, 281, 282, 1, 0, 0, 0, 282, 284, 1, 0, 0, 0, 283, 254, 1, 0, 0, 0, 283, 266, 1, 0, 0, 0, 283, 275, 1, 0, 0, 0, 284, 31, 1, 0, 0, 0, 285, 286, 5, 118, 0, 0, 286, 287, 3, 74, 37, 0, 287, 33, 1, 0, 0, 0, 288, 289, 5, 150, 0, 0, 289, 290, 3, 52, 26, 0, 290, 35, 1, 0, 0, 0, 291, 292, 6, 18, -1, 0, 292, 294, 3, 90, 45, 0, 293, 295, 5, 61, 0, 0, 294, 293, 1, 0, 0, 0, 294, 295, 1, 0, 0, 0, 295, 297, 1, 0, 0, 0, 296, 298, 3, 44, 22, 0, 297, 296, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 304, 1, 0, 0, 0, 299, 300, 5, 220, 0, 0, 300, 301, 3, 36, 18, 0, 301, 302, 5, 236, 0, 0, 302, 304, 1, 0, 0, 0, 303, 291, 1, 0, 0, 0, 303, 299, 1, 0, 0, 0, 304, 319, 1, 0, 0, 0, 305, 306, 10, 3, 0, 0, 306, 307, 3, 40, 20, 0, 307, 308, 3, 36, 18, 4, 308, 318, 1, 0, 0, 0, 309, 311, 10, 4, 0, 0, 310, 312, 3, 38, 19, 0, 311, 310, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, 314, 5, 90, 0, 0, 314, 315, 3, 36, 18, 0, 315, 316, 3, 42, 21, 0, 316, 318, 1, 0, 0, 0, 317, 305, 1, 0, 0, 0, 317, 309, 1, 0, 0, 0, 318, 321, 1, 0, 0, 0, 319, 317, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 37, 1, 0, 0, 0, 321, 319, 1, 0, 0, 0, 322, 324, 7, 2, 0, 0, 323, 322, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 325, 1, 0, 0, 0, 325, 332, 5, 84, 0, 0, 326, 328, 5, 84, 0, 0, 327, 329, 7, 2, 0, 0, 328, 327, 1, 0, 0, 0, 328, 329, 1, 0, 0, 0, 329, 332, 1, 0, 0, 0, 330, 332, 7, 2, 0, 0, 331, 323, 1, 0, 0, 0, 331, 326, 1, 0, 0, 0, 331, 330, 1, 0, 0, 0, 332, 366, 1, 0, 0, 0, 333, 335, 7, 3, 0, 0, 334, 333, 1, 0, 0, 0, 334, 335, 1, 0, 0, 0, 335, 336, 1, 0, 0, 0, 336, 338, 7, 4, 0, 0, 337, 339, 5, 123, 0, 0, 338, 337, 1, 0, 0, 0, 338, 339, 1, 0, 0, 0, 339, 348, 1, 0, 0, 0, 340, 342, 7, 4, 0, 0, 341, 343, 5, 123, 0, 0, 342, 341, 1, 0, 0, 0, 342, 343, 1, 0, 0, 0, 343, 345, 1, 0, 0, 0, 344, 346, 7, 3, 0, 0, 345, 344, 1, 0, 0, 0, 345, 346, 1, 0, 0, 0, 346, 348, 1, 0, 0, 0, 347, 334, 1, 0, 0, 0, 347, 340, 1, 0, 0, 0, 348, 366, 1, 0, 0, 0, 349, 351, 7, 5, 0, 0, 350, 349, 1, 0, 0, 0, 350, 351, 1, 0, 0, 0, 351, 352, 1, 0, 0, 0, 352, 354, 5, 69, 0, 0, 353, 355, 5, 123, 0, 0, 354, 353, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 364, 1, 0, 0, 0, 356, 358, 5, 69, 0, 0, 357, 359, 5, 123, 0, 0, 358, 357, 1, 0, 0, 0, 358, 359, 1, 0, 0, 0, 359, 361, 1, 0, 0, 0, 360, 362, 7, 5, 0, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 364, 1, 0, 0, 0, 363, 350, 1, 0, 0, 0, 363, 356, 1, 0, 0, 0, 364, 366, 1, 0, 0, 0, 365, 331, 1, 0, 0, 0, 365, 347, 1, 0, 0, 0, 365, 363, 1, 0, 0, 0, 366, 39, 1, 0, 0, 0, 367, 368, 5, 31, 0, 0, 368, 371, 5, 90, 0, 0, 369, 371, 5, 206, 0, 0, 370, 367, 1, 0, 0, 0, 370, 369, 1, 0, 0, 0, 371, 41, 1, 0, 0, 0, 372, 373, 5, 119, 0, 0, 373, 382, 3, 72, 36, 0, 374, 375, 5, 179, 0, 0, 375, 376, 5, 220, 0, 0, 376, 377, 3, 72, 36, 0, 377, 378, 5, 236, 0, 0, 378, 382, 1, 0, 0, 0, 379, 380, 5, 179, 0, 0, 380, 382, 3, 72, 36, 0, 381, 372, 1, 0, 0, 0, 381, 374, 1, 0, 0, 0, 381, 379, 1, 0, 0, 0, 382, 43, 1, 0, 0, 0, 383, 384, 5, 144, 0, 0, 384, 387, 3, 50, 25, 0, 385, 386, 5, 118, 0, 0, 386, 388, 3, 50, 25, 0, 387, 385, 1, 0, 0, 0, 387, 388, 1, 0, 0, 0, 388, 45, 1, 0, 0, 0, 389, 394, 3, 48, 24, 0, 390, 391, 5, 206, 0, 0, 391, 393, 3, 48, 24, 0, 392, 390, 1, 0, 0, 0, 393, 396, 1, 0, 0, 0, 394, 392, 1, 0, 0, 0, 394, 395, 1, 0, 0, 0, 395, 47, 1, 0, 0, 0, 396, 394, 1, 0, 0, 0, 397, 399, 3, 74, 37, 0, 398, 400, 7, 6, 0, 0, 399, 398, 1, 0, 0, 0, 399, 400, 1, 0, 0, 0, 400, 403, 1, 0, 0, 0, 401, 402, 5, 117, 0, 0, 402, 404, 7, 7, 0, 0, 403, 401, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 407, 1, 0, 0, 0, 405, 406, 5, 26, 0, 0, 406, 408, 5, 199, 0, 0, 407, 405, 1, 0, 0, 0, 407, 408, 1, 0, 0, 0, 408, 49, 1, 0, 0, 0, 409, 412, 3, 102, 51, 0, 410, 411, 5, 238, 0, 0, 411, 413, 3, 102, 51, 0, 412, 410, 1, 0, 0, 0, 412, 413, 1, 0, 0, 0, 413, 51, 1, 0, 0, 0, 414, 419, 3, 54, 27, 0, 415, 416, 5, 206, 0, 0, 416, 418, 3, 54, 27, 0, 417, 415, 1, 0, 0, 0, 418, 421, 1, 0, 0, 0, 419, 417, 1, 0, 0, 0, 419, 420, 1, 0, 0, 0, 420, 53, 1, 0, 0, 0, 421, 419, 1, 0, 0, 0, 422, 423, 3, 114, 57, 0, 423, 424, 5, 212, 0, 0, 424, 425, 3, 104, 52, 0, 425, 55, 1, 0, 0, 0, 426, 428, 3, 58, 29, 0, 427, 426, 1, 0, 0, 0, 427, 428, 1, 0, 0, 0, 428, 430, 1, 0, 0, 0, 429, 431, 3, 60, 30, 0, 430, 429, 1, 0, 0, 0, 430, 431, 1, 0, 0, 0, 431, 433, 1, 0, 0, 0, 432, 434, 3, 62, 31, 0, 433, 432, 1, 0, 0, 0, 433, 434, 1, 0, 0, 0, 434, 57, 1, 0, 0, 0, 435, 436, 5, 126, 0, 0, 436, 437, 5, 18, 0, 0, 437, 438, 3, 72, 36, 0, 438, 59, 1, 0, 0, 0, 439, 440, 5, 122, 0, 0, 440, 441, 5, 18, 0, 0, 441, 442, 3, 46, 23, 0, 442, 61, 1, 0, 0, 0, 443, 444, 7, 8, 0, 0, 444, 445, 3, 64, 32, 0, 445, 63, 1, 0, 0, 0, 446, 453, 3, 66, 33, 0, 447, 448, 5, 16, 0, 0, 448, 449, 3, 66, 33, 0, 449, 450, 5, 6, 0, 0, 450, 451, 3, 66, 33, 0, 451, 453, 1, 0, 0, 0, 452, 446, 1, 0, 0, 0, 452, 447, 1, 0, 0, 0, 453, 65, 1, 0, 0, 0, 454, 455, 5, 33, 0, 0, 455, 467, 5, 142, 0, 0, 456, 457, 5, 175, 0, 0, 457, 467, 5, 128, 0, 0, 458, 459, 5, 175, 0, 0, 459, 467, 5, 64, 0, 0, 460, 461, 3, 102, 51, 0, 461, 462, 5, 128, 0, 0, 462, 467, 1, 0, 0, 0, 463, 464, 3, 102, 51, 0, 464, 465, 5, 64, 0, 0, 465, 467, 1, 0, 0, 0, 466, 454, 1, 0, 0, 0, 466, 456, 1, 0, 0, 0, 466, 458, 1, 0, 0, 0, 466, 460, 1, 0, 0, 0, 466, 463, 1, 0, 0, 0, 467, 67, 1, 0, 0, 0, 468, 469, 3, 74, 37, 0, 469, 470, 5, 0, 0, 1, 470, 69, 1, 0, 0, 0, 471, 519, 3, 114, 57, 0, 472, 473, 3, 114, 57, 0, 473, 474, 5, 220, 0, 0, 474, 475, 3, 114, 57, 0, 475, 482, 3, 70, 35, 0, 476, 477, 5, 206, 0, 0, 477, 478, 3, 114, 57, 0, 478, 479, 3, 70, 35, 0, 479, 481, 1, 0, 0, 0, 480, 476, 1, 0, 0, 0, 481, 484, 1, 0, 0, 0, 482, 480, 1, 0, 0, 0, 482, 483, 1, 0, 0, 0, 483, 485, 1, 0, 0, 0, 484, 482, 1, 0, 0, 0, 485, 486, 5, 236, 0, 0, 486, 519, 1, 0, 0, 0, 487, 488, 3, 114, 57, 0, 488, 489, 5, 220, 0, 0, 489, 494, 3, 116, 58, 0, 490, 491, 5, 206, 0, 0, 491, 493, 3, 116, 58, 0, 492, 490, 1, 0, 0, 0, 493, 496, 1, 0, 0, 0, 494, 492, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 497, 1, 0, 0, 0, 496, 494, 1, 0, 0, 0, 497, 498, 5, 236, 0, 0, 498, 519, 1, 0, 0, 0, 499, 500, 3, 114, 57, 0, 500, 501, 5, 220, 0, 0, 501, 506, 3, 70, 35, 0, 502, 503, 5, 206, 0, 0, 503, 505, 3, 70, 35, 0, 504, 502, 1, 0, 0, 0, 505, 508, 1, 0, 0, 0, 506, 504, 1, 0, 0, 0, 506, 507, 1, 0, 0, 0, 507, 509, 1, 0, 0, 0, 508, 506, 1, 0, 0, 0, 509, 510, 5, 236, 0, 0, 510, 519, 1, 0, 0, 0, 511, 512, 3, 114, 57, 0, 512, 514, 5, 220, 0, 0, 513, 515, 3, 72, 36, 0, 514, 513, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 516, 1, 0, 0, 0, 516, 517, 5, 236, 0, 0, 517, 519, 1, 0, 0, 0, 518, 471, 1, 0, 0, 0, 518, 472, 1, 0, 0, 0, 518, 487, 1, 0, 0, 0, 518, 499, 1, 0, 0, 0, 518, 511, 1, 0, 0, 0, 519, 71, 1, 0, 0, 0, 520, 525, 3, 74, 37, 0, 521, 522, 5, 206, 0, 0, 522, 524, 3, 74, 37, 0, 523, 521, 1, 0, 0, 0, 524, 527, 1, 0, 0, 0, 525, 523, 1, 0, 0, 0, 525, 526, 1, 0, 0, 0, 526, 73, 1, 0, 0, 0, 527, 525, 1, 0, 0, 0, 528, 529, 6, 37, -1, 0, 529, 531, 5, 19, 0, 0, 530, 532, 3, 74, 37, 0, 531, 530, 1, 0, 0, 0, 531, 532, 1, 0, 0, 0, 532, 538, 1, 0, 0, 0, 533, 534, 5, 186, 0, 0, 534, 535, 3, 74, 37, 0, 535, 536, 5, 163, 0, 0, 536, 537, 3, 74, 37, 0, 537, 539, 1, 0, 0, 0, 538, 533, 1, 0, 0, 0, 539, 540, 1, 0, 0, 0, 540, 538, 1, 0, 0, 0, 540, 541, 1, 0, 0, 0, 541, 544, 1, 0, 0, 0, 542, 543, 5, 52, 0, 0, 543, 545, 3, 74, 37, 0, 544, 542, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 546, 1, 0, 0, 0, 546, 547, 5, 53, 0, 0, 547, 658, 1, 0, 0, 0, 548, 549, 5, 20, 0, 0, 549, 550, 5, 220, 0, 0, 550, 551, 3, 74, 37, 0, 551, 552, 5, 10, 0, 0, 552, 553, 3, 70, 35, 0, 553, 554, 5, 236, 0, 0, 554, 658, 1, 0, 0, 0, 555, 556, 5, 36, 0, 0, 556, 658, 5, 199, 0, 0, 557, 558, 5, 59, 0, 0, 558, 559, 5, 220, 0, 0, 559, 560, 3, 106, 53, 0, 560, 561, 5, 68, 0, 0, 561, 562, 3, 74, 37, 0, 562, 563, 5, 236, 0, 0, 563, 658, 1, 0, 0, 0, 564, 565, 5, 86, 0, 0, 565, 566, 3, 74, 37, 0, 566, 567, 3, 106, 53, 0, 567, 658, 1, 0, 0, 0, 568, 569, 5, 155, 0, 0, 569, 570, 5, 220, 0, 0, 570, 571, 3, 74, 37, 0, 571, 572, 5, 68, 0, 0, 572, 575, 3, 74, 37, 0, 573, 574, 5, 65, 0, 0, 574, 576, 3, 74, 37, 0, 575, 573, 1, 0, 0, 0, 575, 576, 1, 0, 0, 0, 576, 577, 1, 0, 0, 0, 577, 578, 5, 236, 0, 0, 578, 658, 1, 0, 0, 0, 579, 580, 5, 166, 0, 0, 580, 658, 5, 199, 0, 0, 581, 582, 5, 171, 0, 0, 582, 583, 5, 220, 0, 0, 583, 584, 7, 9, 0, 0, 584, 585, 5, 199, 0, 0, 585, 586, 5, 68, 0, 0, 586, 587, 3, 74, 37, 0, 587, 588, 5, 236, 0, 0, 588, 658, 1, 0, 0, 0, 589, 590, 3, 114, 57, 0, 590, 592, 5, 220, 0, 0, 591, 593, 3, 72, 36, 0, 592, 591, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 1, 0, 0, 0, 594, 595, 5, 236, 0, 0, 595, 596, 1, 0, 0, 0, 596, 597, 5, 125, 0, 0, 597, 598, 5, 220, 0, 0, 598, 599, 3, 56, 28, 0, 599, 600, 5, 236, 0, 0, 600, 658, 1, 0, 0, 0, 601, 602, 3, 114, 57, 0, 602, 604, 5, 220, 0, 0, 603, 605, 3, 72, 36, 0, 604, 603, 1, 0, 0, 0, 604, 605, 1, 0, 0, 0, 605, 606, 1, 0, 0, 0, 606, 607, 5, 236, 0, 0, 607, 608, 1, 0, 0, 0, 608, 609, 5, 125, 0, 0, 609, 610, 3, 114, 57, 0, 610, 658, 1, 0, 0, 0, 611, 617, 3, 114, 57, 0, 612, 614, 5, 220, 0, 0, 613, 615, 3, 72, 36, 0, 614, 613, 1, 0, 0, 0, 614, 615, 1, 0, 0, 0, 615, 616, 1, 0, 0, 0, 616, 618, 5, 236, 0, 0, 617, 612, 1, 0, 0, 0, 617, 618, 1, 0, 0, 0, 618, 619, 1, 0, 0, 0, 619, 621, 5, 220, 0, 0, 620, 622, 5, 49, 0, 0, 621, 620, 1, 0, 0, 0, 621, 622, 1, 0, 0, 0, 622, 624, 1, 0, 0, 0, 623, 625, 3, 76, 38, 0, 624, 623, 1, 0, 0, 0, 624, 625, 1, 0, 0, 0, 625, 626, 1, 0, 0, 0, 626, 627, 5, 236, 0, 0, 627, 658, 1, 0, 0, 0, 628, 658, 3, 104, 52, 0, 629, 630, 5, 208, 0, 0, 630, 658, 3, 74, 37, 18, 631, 632, 5, 115, 0, 0, 632, 658, 3, 74, 37, 12, 633, 634, 3, 94, 47, 0, 634, 635, 5, 210, 0, 0, 635, 637, 1, 0, 0, 0, 636, 633, 1, 0, 0, 0, 636, 637, 1, 0, 0, 0, 637, 638, 1, 0, 0, 0, 638, 658, 5, 202, 0, 0, 639, 640, 5, 220, 0, 0, 640, 641, 3, 2, 1, 0, 641, 642, 5, 236, 0, 0, 642, 658, 1, 0, 0, 0, 643, 644, 5, 220, 0, 0, 644, 645, 3, 74, 37, 0, 645, 646, 5, 236, 0, 0, 646, 658, 1, 0, 0, 0, 647, 648, 5, 220, 0, 0, 648, 649, 3, 72, 36, 0, 649, 650, 5, 236, 0, 0, 650, 658, 1, 0, 0, 0, 651, 653, 5, 219, 0, 0, 652, 654, 3, 72, 36, 0, 653, 652, 1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 655, 1, 0, 0, 0, 655, 658, 5, 235, 0, 0, 656, 658, 3, 86, 43, 0, 657, 528, 1, 0, 0, 0, 657, 548, 1, 0, 0, 0, 657, 555, 1, 0, 0, 0, 657, 557, 1, 0, 0, 0, 657, 564, 1, 0, 0, 0, 657, 568, 1, 0, 0, 0, 657, 579, 1, 0, 0, 0, 657, 581, 1, 0, 0, 0, 657, 589, 1, 0, 0, 0, 657, 601, 1, 0, 0, 0, 657, 611, 1, 0, 0, 0, 657, 628, 1, 0, 0, 0, 657, 629, 1, 0, 0, 0, 657, 631, 1, 0, 0, 0, 657, 636, 1, 0, 0, 0, 657, 639, 1, 0, 0, 0, 657, 643, 1, 0, 0, 0, 657, 647, 1, 0, 0, 0, 657, 651, 1, 0, 0, 0, 657, 656, 1, 0, 0, 0, 658, 752, 1, 0, 0, 0, 659, 663, 10, 17, 0, 0, 660, 664, 5, 202, 0, 0, 661, 664, 5, 238, 0, 0, 662, 664, 5, 227, 0, 0, 663, 660, 1, 0, 0, 0, 663, 661, 1, 0, 0, 0, 663, 662, 1, 0, 0, 0, 664, 665, 1, 0, 0, 0, 665, 751, 3, 74, 37, 18, 666, 670, 10, 16, 0, 0, 667, 671, 5, 228, 0, 0, 668, 671, 5, 208, 0, 0, 669, 671, 5, 207, 0, 0, 670, 667, 1, 0, 0, 0, 670, 668, 1, 0, 0, 0, 670, 669, 1, 0, 0, 0, 671, 672, 1, 0, 0, 0, 672, 751, 3, 74, 37, 17, 673, 698, 10, 15, 0, 0, 674, 699, 5, 211, 0, 0, 675, 699, 5, 212, 0, 0, 676, 699, 5, 223, 0, 0, 677, 699, 5, 221, 0, 0, 678, 699, 5, 222, 0, 0, 679, 699, 5, 213, 0, 0, 680, 699, 5, 214, 0, 0, 681, 683, 5, 115, 0, 0, 682, 681, 1, 0, 0, 0, 682, 683, 1, 0, 0, 0, 683, 684, 1, 0, 0, 0, 684, 686, 5, 80, 0, 0, 685, 687, 5, 25, 0, 0, 686, 685, 1, 0, 0, 0, 686, 687, 1, 0, 0, 0, 687, 699, 1, 0, 0, 0, 688, 690, 5, 115, 0, 0, 689, 688, 1, 0, 0, 0, 689, 690, 1, 0, 0, 0, 690, 691, 1, 0, 0, 0, 691, 699, 7, 10, 0, 0, 692, 699, 5, 232, 0, 0, 693, 699, 5, 233, 0, 0, 694, 699, 5, 225, 0, 0, 695, 699, 5, 216, 0, 0, 696, 699, 5, 217, 0, 0, 697, 699, 5, 224, 0, 0, 698, 674, 1, 0, 0, 0, 698, 675, 1, 0, 0, 0, 698, 676, 1, 0, 0, 0, 698, 677, 1, 0, 0, 0, 698, 678, 1, 0, 0, 0, 698, 679, 1, 0, 0, 0, 698, 680, 1, 0, 0, 0, 698, 682, 1, 0, 0, 0, 698, 689, 1, 0, 0, 0, 698, 692, 1, 0, 0, 0, 698, 693, 1, 0, 0, 0, 698, 694, 1, 0, 0, 0, 698, 695, 1, 0, 0, 0, 698, 696, 1, 0, 0, 0, 698, 697, 1, 0, 0, 0, 699, 700, 1, 0, 0, 0, 700, 751, 3, 74, 37, 16, 701, 702, 10, 13, 0, 0, 702, 703, 5, 226, 0, 0, 703, 751, 3, 74, 37, 14, 704, 705, 10, 11, 0, 0, 705, 706, 5, 6, 0, 0, 706, 751, 3, 74, 37, 12, 707, 708, 10, 10, 0, 0, 708, 709, 5, 121, 0, 0, 709, 751, 3, 74, 37, 11, 710, 712, 10, 9, 0, 0, 711, 713, 5, 115, 0, 0, 712, 711, 1, 0, 0, 0, 712, 713, 1, 0, 0, 0, 713, 714, 1, 0, 0, 0, 714, 715, 5, 16, 0, 0, 715, 716, 3, 74, 37, 0, 716, 717, 5, 6, 0, 0, 717, 718, 3, 74, 37, 10, 718, 751, 1, 0, 0, 0, 719, 720, 10, 8, 0, 0, 720, 721, 5, 229, 0, 0, 721, 722, 3, 74, 37, 0, 722, 723, 5, 205, 0, 0, 723, 724, 3, 74, 37, 8, 724, 751, 1, 0, 0, 0, 725, 726, 10, 21, 0, 0, 726, 727, 5, 219, 0, 0, 727, 728, 3, 74, 37, 0, 728, 729, 5, 235, 0, 0, 729, 751, 1, 0, 0, 0, 730, 731, 10, 20, 0, 0, 731, 732, 5, 210, 0, 0, 732, 751, 5, 197, 0, 0, 733, 734, 10, 19, 0, 0, 734, 735, 5, 210, 0, 0, 735, 751, 3, 114, 57, 0, 736, 737, 10, 14, 0, 0, 737, 739, 5, 88, 0, 0, 738, 740, 5, 115, 0, 0, 739, 738, 1, 0, 0, 0, 739, 740, 1, 0, 0, 0, 740, 741, 1, 0, 0, 0, 741, 751, 5, 116, 0, 0, 742, 748, 10, 7, 0, 0, 743, 749, 3, 112, 56, 0, 744, 745, 5, 10, 0, 0, 745, 749, 3, 114, 57, 0, 746, 747, 5, 10, 0, 0, 747, 749, 5, 199, 0, 0, 748, 743, 1, 0, 0, 0, 748, 744, 1, 0, 0, 0, 748, 746, 1, 0, 0, 0, 749, 751, 1, 0, 0, 0, 750, 659, 1, 0, 0, 0, 750, 666, 1, 0, 0, 0, 750, 673, 1, 0, 0, 0, 750, 701, 1, 0, 0, 0, 750, 704, 1, 0, 0, 0, 750, 707, 1, 0, 0, 0, 750, 710, 1, 0, 0, 0, 750, 719, 1, 0, 0, 0, 750, 725, 1, 0, 0, 0, 750, 730, 1, 0, 0, 0, 750, 733, 1, 0, 0, 0, 750, 736, 1, 0, 0, 0, 750, 742, 1, 0, 0, 0, 751, 754, 1, 0, 0, 0, 752, 750, 1, 0, 0, 0, 752, 753, 1, 0, 0, 0, 753, 75, 1, 0, 0, 0, 754, 752, 1, 0, 0, 0, 755, 760, 3, 78, 39, 0, 756, 757, 5, 206, 0, 0, 757, 759, 3, 78, 39, 0, 758, 756, 1, 0, 0, 0, 759, 762, 1, 0, 0, 0, 760, 758, 1, 0, 0, 0, 760, 761, 1, 0, 0, 0, 761, 77, 1, 0, 0, 0, 762, 760, 1, 0, 0, 0, 763, 766, 3, 80, 40, 0, 764, 766, 3, 74, 37, 0, 765, 763, 1, 0, 0, 0, 765, 764, 1, 0, 0, 0, 766, 79, 1, 0, 0, 0, 767, 768, 5, 220, 0, 0, 768, 773, 3, 114, 57, 0, 769, 770, 5, 206, 0, 0, 770, 772, 3, 114, 57, 0, 771, 769, 1, 0, 0, 0, 772, 775, 1, 0, 0, 0, 773, 771, 1, 0, 0, 0, 773, 774, 1, 0, 0, 0, 774, 776, 1, 0, 0, 0, 775, 773, 1, 0, 0, 0, 776, 777, 5, 236, 0, 0, 777, 787, 1, 0, 0, 0, 778, 783, 3, 114, 57, 0, 779, 780, 5, 206, 0, 0, 780, 782, 3, 114, 57, 0, 781, 779, 1, 0, 0, 0, 782, 785, 1, 0, 0, 0, 783, 781, 1, 0, 0, 0, 783, 784, 1, 0, 0, 0, 784, 787, 1, 0, 0, 0, 785, 783, 1, 0, 0, 0, 786, 767, 1, 0, 0, 0, 786, 778, 1, 0, 0, 0, 787, 788, 1, 0, 0, 0, 788, 789, 5, 201, 0, 0, 789, 790, 3, 74, 37, 0, 790, 81, 1, 0, 0, 0, 791, 796, 3, 84, 42, 0, 792, 793, 5, 206, 0, 0, 793, 795, 3, 84, 42, 0, 794, 792, 1, 0, 0, 0, 795, 798, 1, 0, 0, 0, 796, 794, 1, 0, 0, 0, 796, 797, 1, 0, 0, 0, 797, 83, 1, 0, 0, 0, 798, 796, 1, 0, 0, 0, 799, 800, 3, 114, 57, 0, 800, 801, 5, 10, 0, 0, 801, 802, 5, 220, 0, 0, 802, 803, 3, 2, 1, 0, 803, 804, 5, 236, 0, 0, 804, 810, 1, 0, 0, 0, 805, 806, 3, 74, 37, 0, 806, 807, 5, 10, 0, 0, 807, 808, 3, 114, 57, 0, 808, 810, 1, 0, 0, 0, 809, 799, 1, 0, 0, 0, 809, 805, 1, 0, 0, 0, 810, 85, 1, 0, 0, 0, 811, 819, 5, 200, 0, 0, 812, 813, 3, 94, 47, 0, 813, 814, 5, 210, 0, 0, 814, 816, 1, 0, 0, 0, 815, 812, 1, 0, 0, 0, 815, 816, 1, 0, 0, 0, 816, 817, 1, 0, 0, 0, 817, 819, 3, 88, 44, 0, 818, 811, 1, 0, 0, 0, 818, 815, 1, 0, 0, 0, 819, 87, 1, 0, 0, 0, 820, 825, 3, 114, 57, 0, 821, 822, 5, 210, 0, 0, 822, 824, 3, 114, 57, 0, 823, 821, 1, 0, 0, 0, 824, 827, 1, 0, 0, 0, 825, 823, 1, 0, 0, 0, 825, 826, 1, 0, 0, 0, 826, 89, 1, 0, 0, 0, 827, 825, 1, 0, 0, 0, 828, 829, 6, 45, -1, 0, 829, 837, 3, 94, 47, 0, 830, 837, 3, 92, 46, 0, 831, 832, 5, 220, 0, 0, 832, 833, 3, 2, 1, 0, 833, 834, 5, 236, 0, 0, 834, 837, 1, 0, 0, 0, 835, 837, 5, 200, 0, 0, 836, 828, 1, 0, 0, 0, 836, 830, 1, 0, 0, 0, 836, 831, 1, 0, 0, 0, 836, 835, 1, 0, 0, 0, 837, 846, 1, 0, 0, 0, 838, 842, 10, 2, 0, 0, 839, 843, 3, 112, 56, 0, 840, 841, 5, 10, 0, 0, 841, 843, 3, 114, 57, 0, 842, 839, 1, 0, 0, 0, 842, 840, 1, 0, 0, 0, 843, 845, 1, 0, 0, 0, 844, 838, 1, 0, 0, 0, 845, 848, 1, 0, 0, 0, 846, 844, 1, 0, 0, 0, 846, 847, 1, 0, 0, 0, 847, 91, 1, 0, 0, 0, 848, 846, 1, 0, 0, 0, 849, 850, 3, 114, 57, 0, 850, 852, 5, 220, 0, 0, 851, 853, 3, 96, 48, 0, 852, 851, 1, 0, 0, 0, 852, 853, 1, 0, 0, 0, 853, 854, 1, 0, 0, 0, 854, 855, 5, 236, 0, 0, 855, 93, 1, 0, 0, 0, 856, 857, 3, 98, 49, 0, 857, 858, 5, 210, 0, 0, 858, 860, 1, 0, 0, 0, 859, 856, 1, 0, 0, 0, 859, 860, 1, 0, 0, 0, 860, 861, 1, 0, 0, 0, 861, 862, 3, 114, 57, 0, 862, 95, 1, 0, 0, 0, 863, 868, 3, 74, 37, 0, 864, 865, 5, 206, 0, 0, 865, 867, 3, 74, 37, 0, 866, 864, 1, 0, 0, 0, 867, 870, 1, 0, 0, 0, 868, 866, 1, 0, 0, 0, 868, 869, 1, 0, 0, 0, 869, 97, 1, 0, 0, 0, 870, 868, 1, 0, 0, 0, 871, 872, 3, 114, 57, 0, 872, 99, 1, 0, 0, 0, 873, 882, 5, 195, 0, 0, 874, 875, 5, 210, 0, 0, 875, 882, 7, 11, 0, 0, 876, 877, 5, 197, 0, 0, 877, 879, 5, 210, 0, 0, 878, 880, 7, 11, 0, 0, 879, 878, 1, 0, 0, 0, 879, 880, 1, 0, 0, 0, 880, 882, 1, 0, 0, 0, 881, 873, 1, 0, 0, 0, 881, 874, 1, 0, 0, 0, 881, 876, 1, 0, 0, 0, 882, 101, 1, 0, 0, 0, 883, 885, 7, 12, 0, 0, 884, 883, 1, 0, 0, 0, 884, 885, 1, 0, 0, 0, 885, 892, 1, 0, 0, 0, 886, 893, 3, 100, 50, 0, 887, 893, 5, 196, 0, 0, 888, 893, 5, 197, 0, 0, 889, 893, 5, 198, 0, 0, 890, 893, 5, 82, 0, 0, 891, 893, 5, 113, 0, 0, 892, 886, 1, 0, 0, 0, 892, 887, 1, 0, 0, 0, 892, 888, 1, 0, 0, 0, 892, 889, 1, 0, 0, 0, 892, 890, 1, 0, 0, 0, 892, 891, 1, 0, 0, 0, 893, 103, 1, 0, 0, 0, 894, 898, 3, 102, 51, 0, 895, 898, 5, 199, 0, 0, 896, 898, 5, 116, 0, 0, 897, 894, 1, 0, 0, 0, 897, 895, 1, 0, 0, 0, 897, 896, 1, 0, 0, 0, 898, 105, 1, 0, 0, 0, 899, 900, 7, 13, 0, 0, 900, 107, 1, 0, 0, 0, 901, 902, 7, 14, 0, 0, 902, 109, 1, 0, 0, 0, 903, 904, 7, 15, 0, 0, 904, 111, 1, 0, 0, 0, 905, 908, 5, 194, 0, 0, 906, 908, 3, 110, 55, 0, 907, 905, 1, 0, 0, 0, 907, 906, 1, 0, 0, 0, 908, 113, 1, 0, 0, 0, 909, 913, 5, 194, 0, 0, 910, 913, 3, 106, 53, 0, 911, 913, 3, 108, 54, 0, 912, 909, 1, 0, 0, 0, 912, 910, 1, 0, 0, 0, 912, 911, 1, 0, 0, 0, 913, 115, 1, 0, 0, 0, 914, 915, 5, 199, 0, 0, 915, 916, 5, 212, 0, 0, 916, 917, 3, 102, 51, 0, 917, 117, 1, 0, 0, 0, 114, 120, 130, 138, 141, 145, 148, 152, 155, 158, 161, 164, 168, 172, 175, 178, 181, 185, 188, 197, 203, 224, 241, 258, 264, 270, 281, 283, 294, 297, 303, 311, 317, 319, 323, 328, 331, 334, 338, 342, 345, 347, 350, 354, 358, 361, 363, 365, 370, 381, 387, 394, 399, 403, 407, 412, 419, 427, 430, 433, 452, 466, 482, 494, 506, 514, 518, 525, 531, 540, 544, 575, 592, 604, 614, 617, 621, 624, 636, 653, 657, 663, 670, 682, 686, 689, 698, 712, 739, 748, 750, 752, 760, 765, 773, 783, 786, 796, 809, 815, 818, 825, 836, 842, 846, 852, 859, 868, 879, 881, 884, 892, 897, 907, 912] \ No newline at end of file diff --git a/hogql_parser/HogQLParser.tokens b/hogql_parser/HogQLParser.tokens new file mode 100644 index 0000000000000..10fd925b09195 --- /dev/null +++ b/hogql_parser/HogQLParser.tokens @@ -0,0 +1,282 @@ +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 +COHORT=25 +COLLATE=26 +COLUMN=27 +COMMENT=28 +CONSTRAINT=29 +CREATE=30 +CROSS=31 +CUBE=32 +CURRENT=33 +DATABASE=34 +DATABASES=35 +DATE=36 +DAY=37 +DEDUPLICATE=38 +DEFAULT=39 +DELAY=40 +DELETE=41 +DESC=42 +DESCENDING=43 +DESCRIBE=44 +DETACH=45 +DICTIONARIES=46 +DICTIONARY=47 +DISK=48 +DISTINCT=49 +DISTRIBUTED=50 +DROP=51 +ELSE=52 +END=53 +ENGINE=54 +EVENTS=55 +EXISTS=56 +EXPLAIN=57 +EXPRESSION=58 +EXTRACT=59 +FETCHES=60 +FINAL=61 +FIRST=62 +FLUSH=63 +FOLLOWING=64 +FOR=65 +FORMAT=66 +FREEZE=67 +FROM=68 +FULL=69 +FUNCTION=70 +GLOBAL=71 +GRANULARITY=72 +GROUP=73 +HAVING=74 +HIERARCHICAL=75 +HOUR=76 +ID=77 +IF=78 +ILIKE=79 +IN=80 +INDEX=81 +INF=82 +INJECTIVE=83 +INNER=84 +INSERT=85 +INTERVAL=86 +INTO=87 +IS=88 +IS_OBJECT_ID=89 +JOIN=90 +KEY=91 +KILL=92 +LAST=93 +LAYOUT=94 +LEADING=95 +LEFT=96 +LIFETIME=97 +LIKE=98 +LIMIT=99 +LIVE=100 +LOCAL=101 +LOGS=102 +MATERIALIZE=103 +MATERIALIZED=104 +MAX=105 +MERGES=106 +MIN=107 +MINUTE=108 +MODIFY=109 +MONTH=110 +MOVE=111 +MUTATION=112 +NAN_SQL=113 +NO=114 +NOT=115 +NULL_SQL=116 +NULLS=117 +OFFSET=118 +ON=119 +OPTIMIZE=120 +OR=121 +ORDER=122 +OUTER=123 +OUTFILE=124 +OVER=125 +PARTITION=126 +POPULATE=127 +PRECEDING=128 +PREWHERE=129 +PRIMARY=130 +PROJECTION=131 +QUARTER=132 +RANGE=133 +RELOAD=134 +REMOVE=135 +RENAME=136 +REPLACE=137 +REPLICA=138 +REPLICATED=139 +RIGHT=140 +ROLLUP=141 +ROW=142 +ROWS=143 +SAMPLE=144 +SECOND=145 +SELECT=146 +SEMI=147 +SENDS=148 +SET=149 +SETTINGS=150 +SHOW=151 +SOURCE=152 +START=153 +STOP=154 +SUBSTRING=155 +SYNC=156 +SYNTAX=157 +SYSTEM=158 +TABLE=159 +TABLES=160 +TEMPORARY=161 +TEST=162 +THEN=163 +TIES=164 +TIMEOUT=165 +TIMESTAMP=166 +TO=167 +TOP=168 +TOTALS=169 +TRAILING=170 +TRIM=171 +TRUNCATE=172 +TTL=173 +TYPE=174 +UNBOUNDED=175 +UNION=176 +UPDATE=177 +USE=178 +USING=179 +UUID=180 +VALUES=181 +VIEW=182 +VOLUME=183 +WATCH=184 +WEEK=185 +WHEN=186 +WHERE=187 +WINDOW=188 +WITH=189 +YEAR=190 +JSON_FALSE=191 +JSON_TRUE=192 +ESCAPE_CHAR=193 +IDENTIFIER=194 +FLOATING_LITERAL=195 +OCTAL_LITERAL=196 +DECIMAL_LITERAL=197 +HEXADECIMAL_LITERAL=198 +STRING_LITERAL=199 +PLACEHOLDER=200 +ARROW=201 +ASTERISK=202 +BACKQUOTE=203 +BACKSLASH=204 +COLON=205 +COMMA=206 +CONCAT=207 +DASH=208 +DOLLAR=209 +DOT=210 +EQ_DOUBLE=211 +EQ_SINGLE=212 +GT_EQ=213 +GT=214 +HASH=215 +IREGEX_SINGLE=216 +IREGEX_DOUBLE=217 +LBRACE=218 +LBRACKET=219 +LPAREN=220 +LT_EQ=221 +LT=222 +NOT_EQ=223 +NOT_IREGEX=224 +NOT_REGEX=225 +NULLISH=226 +PERCENT=227 +PLUS=228 +QUERY=229 +QUOTE_DOUBLE=230 +QUOTE_SINGLE=231 +REGEX_SINGLE=232 +REGEX_DOUBLE=233 +RBRACE=234 +RBRACKET=235 +RPAREN=236 +SEMICOLON=237 +SLASH=238 +UNDERSCORE=239 +MULTI_LINE_COMMENT=240 +SINGLE_LINE_COMMENT=241 +WHITESPACE=242 +'false'=191 +'true'=192 +'->'=201 +'*'=202 +'`'=203 +'\\'=204 +':'=205 +','=206 +'||'=207 +'-'=208 +'$'=209 +'.'=210 +'=='=211 +'='=212 +'>='=213 +'>'=214 +'#'=215 +'~*'=216 +'=~*'=217 +'{'=218 +'['=219 +'('=220 +'<='=221 +'<'=222 +'!~*'=224 +'!~'=225 +'??'=226 +'%'=227 +'+'=228 +'?'=229 +'"'=230 +'\''=231 +'~'=232 +'=~'=233 +'}'=234 +']'=235 +')'=236 +';'=237 +'/'=238 +'_'=239 diff --git a/hogql_parser/HogQLParserBaseVisitor.cpp b/hogql_parser/HogQLParserBaseVisitor.cpp new file mode 100644 index 0000000000000..2827d134c4419 --- /dev/null +++ b/hogql_parser/HogQLParserBaseVisitor.cpp @@ -0,0 +1,7 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + + +#include "HogQLParserBaseVisitor.h" + + diff --git a/hogql_parser/HogQLParserBaseVisitor.h b/hogql_parser/HogQLParserBaseVisitor.h new file mode 100644 index 0000000000000..99575438db32b --- /dev/null +++ b/hogql_parser/HogQLParserBaseVisitor.h @@ -0,0 +1,444 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + +#pragma once + + +#include "antlr4-runtime.h" +#include "HogQLParserVisitor.h" + + +/** + * This class provides an empty implementation of HogQLParserVisitor, which can be + * extended to create a visitor which only needs to handle a subset of the available methods. + */ +class HogQLParserBaseVisitor : public HogQLParserVisitor { +public: + + virtual std::any visitSelect(HogQLParser::SelectContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSelectUnionStmt(HogQLParser::SelectUnionStmtContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSelectStmtWithParens(HogQLParser::SelectStmtWithParensContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSelectStmt(HogQLParser::SelectStmtContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWithClause(HogQLParser::WithClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTopClause(HogQLParser::TopClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitFromClause(HogQLParser::FromClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitArrayJoinClause(HogQLParser::ArrayJoinClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWindowClause(HogQLParser::WindowClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitPrewhereClause(HogQLParser::PrewhereClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWhereClause(HogQLParser::WhereClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitGroupByClause(HogQLParser::GroupByClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitHavingClause(HogQLParser::HavingClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitOrderByClause(HogQLParser::OrderByClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitProjectionOrderByClause(HogQLParser::ProjectionOrderByClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitLimitAndOffsetClause(HogQLParser::LimitAndOffsetClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitOffsetOnlyClause(HogQLParser::OffsetOnlyClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSettingsClause(HogQLParser::SettingsClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinExprOp(HogQLParser::JoinExprOpContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinExprTable(HogQLParser::JoinExprTableContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinExprParens(HogQLParser::JoinExprParensContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinExprCrossOp(HogQLParser::JoinExprCrossOpContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinOpInner(HogQLParser::JoinOpInnerContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinOpLeftRight(HogQLParser::JoinOpLeftRightContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinOpFull(HogQLParser::JoinOpFullContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinOpCross(HogQLParser::JoinOpCrossContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitJoinConstraintClause(HogQLParser::JoinConstraintClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSampleClause(HogQLParser::SampleClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitOrderExprList(HogQLParser::OrderExprListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitOrderExpr(HogQLParser::OrderExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitRatioExpr(HogQLParser::RatioExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSettingExprList(HogQLParser::SettingExprListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitSettingExpr(HogQLParser::SettingExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWindowExpr(HogQLParser::WindowExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWinPartitionByClause(HogQLParser::WinPartitionByClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWinOrderByClause(HogQLParser::WinOrderByClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWinFrameClause(HogQLParser::WinFrameClauseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitFrameStart(HogQLParser::FrameStartContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitFrameBetween(HogQLParser::FrameBetweenContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWinFrameBound(HogQLParser::WinFrameBoundContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitExpr(HogQLParser::ExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnTypeExprSimple(HogQLParser::ColumnTypeExprSimpleContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnTypeExprNested(HogQLParser::ColumnTypeExprNestedContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnTypeExprEnum(HogQLParser::ColumnTypeExprEnumContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnTypeExprComplex(HogQLParser::ColumnTypeExprComplexContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnTypeExprParam(HogQLParser::ColumnTypeExprParamContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprList(HogQLParser::ColumnExprListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprTernaryOp(HogQLParser::ColumnExprTernaryOpContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprAlias(HogQLParser::ColumnExprAliasContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprExtract(HogQLParser::ColumnExprExtractContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprNegate(HogQLParser::ColumnExprNegateContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprSubquery(HogQLParser::ColumnExprSubqueryContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprLiteral(HogQLParser::ColumnExprLiteralContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprArray(HogQLParser::ColumnExprArrayContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprSubstring(HogQLParser::ColumnExprSubstringContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprCast(HogQLParser::ColumnExprCastContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprOr(HogQLParser::ColumnExprOrContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprPrecedence1(HogQLParser::ColumnExprPrecedence1Context *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprPrecedence2(HogQLParser::ColumnExprPrecedence2Context *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprPrecedence3(HogQLParser::ColumnExprPrecedence3Context *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprInterval(HogQLParser::ColumnExprIntervalContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprIsNull(HogQLParser::ColumnExprIsNullContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprWinFunctionTarget(HogQLParser::ColumnExprWinFunctionTargetContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprTrim(HogQLParser::ColumnExprTrimContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprTuple(HogQLParser::ColumnExprTupleContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprArrayAccess(HogQLParser::ColumnExprArrayAccessContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprBetween(HogQLParser::ColumnExprBetweenContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprPropertyAccess(HogQLParser::ColumnExprPropertyAccessContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprParens(HogQLParser::ColumnExprParensContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprTimestamp(HogQLParser::ColumnExprTimestampContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprNullish(HogQLParser::ColumnExprNullishContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprAnd(HogQLParser::ColumnExprAndContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprTupleAccess(HogQLParser::ColumnExprTupleAccessContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprCase(HogQLParser::ColumnExprCaseContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprDate(HogQLParser::ColumnExprDateContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprNot(HogQLParser::ColumnExprNotContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprWinFunction(HogQLParser::ColumnExprWinFunctionContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprIdentifier(HogQLParser::ColumnExprIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprFunction(HogQLParser::ColumnExprFunctionContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnExprAsterisk(HogQLParser::ColumnExprAsteriskContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnArgList(HogQLParser::ColumnArgListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnArgExpr(HogQLParser::ColumnArgExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnLambdaExpr(HogQLParser::ColumnLambdaExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWithExprList(HogQLParser::WithExprListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWithExprSubquery(HogQLParser::WithExprSubqueryContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitWithExprColumn(HogQLParser::WithExprColumnContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitColumnIdentifier(HogQLParser::ColumnIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitNestedIdentifier(HogQLParser::NestedIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableExprIdentifier(HogQLParser::TableExprIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableExprPlaceholder(HogQLParser::TableExprPlaceholderContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableExprSubquery(HogQLParser::TableExprSubqueryContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableExprAlias(HogQLParser::TableExprAliasContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableExprFunction(HogQLParser::TableExprFunctionContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableFunctionExpr(HogQLParser::TableFunctionExprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableIdentifier(HogQLParser::TableIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTableArgList(HogQLParser::TableArgListContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitDatabaseIdentifier(HogQLParser::DatabaseIdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitFloatingLiteral(HogQLParser::FloatingLiteralContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitNumberLiteral(HogQLParser::NumberLiteralContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitLiteral(HogQLParser::LiteralContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitInterval(HogQLParser::IntervalContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitKeyword(HogQLParser::KeywordContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitKeywordForAlias(HogQLParser::KeywordForAliasContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitAlias(HogQLParser::AliasContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitIdentifier(HogQLParser::IdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitEnumValue(HogQLParser::EnumValueContext *ctx) override { + return visitChildren(ctx); + } + + +}; + diff --git a/hogql_parser/HogQLParserVisitor.cpp b/hogql_parser/HogQLParserVisitor.cpp new file mode 100644 index 0000000000000..3e5f3b1b5f069 --- /dev/null +++ b/hogql_parser/HogQLParserVisitor.cpp @@ -0,0 +1,7 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + + +#include "HogQLParserVisitor.h" + + diff --git a/hogql_parser/HogQLParserVisitor.h b/hogql_parser/HogQLParserVisitor.h new file mode 100644 index 0000000000000..789221ea387d3 --- /dev/null +++ b/hogql_parser/HogQLParserVisitor.h @@ -0,0 +1,236 @@ + +// Generated from HogQLParser.g4 by ANTLR 4.13.0 + +#pragma once + + +#include "antlr4-runtime.h" +#include "HogQLParser.h" + + + +/** + * This class defines an abstract visitor for a parse tree + * produced by HogQLParser. + */ +class HogQLParserVisitor : public antlr4::tree::AbstractParseTreeVisitor { +public: + + /** + * Visit parse trees produced by HogQLParser. + */ + virtual std::any visitSelect(HogQLParser::SelectContext *context) = 0; + + virtual std::any visitSelectUnionStmt(HogQLParser::SelectUnionStmtContext *context) = 0; + + virtual std::any visitSelectStmtWithParens(HogQLParser::SelectStmtWithParensContext *context) = 0; + + virtual std::any visitSelectStmt(HogQLParser::SelectStmtContext *context) = 0; + + virtual std::any visitWithClause(HogQLParser::WithClauseContext *context) = 0; + + virtual std::any visitTopClause(HogQLParser::TopClauseContext *context) = 0; + + virtual std::any visitFromClause(HogQLParser::FromClauseContext *context) = 0; + + virtual std::any visitArrayJoinClause(HogQLParser::ArrayJoinClauseContext *context) = 0; + + virtual std::any visitWindowClause(HogQLParser::WindowClauseContext *context) = 0; + + virtual std::any visitPrewhereClause(HogQLParser::PrewhereClauseContext *context) = 0; + + virtual std::any visitWhereClause(HogQLParser::WhereClauseContext *context) = 0; + + virtual std::any visitGroupByClause(HogQLParser::GroupByClauseContext *context) = 0; + + virtual std::any visitHavingClause(HogQLParser::HavingClauseContext *context) = 0; + + virtual std::any visitOrderByClause(HogQLParser::OrderByClauseContext *context) = 0; + + virtual std::any visitProjectionOrderByClause(HogQLParser::ProjectionOrderByClauseContext *context) = 0; + + virtual std::any visitLimitAndOffsetClause(HogQLParser::LimitAndOffsetClauseContext *context) = 0; + + virtual std::any visitOffsetOnlyClause(HogQLParser::OffsetOnlyClauseContext *context) = 0; + + virtual std::any visitSettingsClause(HogQLParser::SettingsClauseContext *context) = 0; + + virtual std::any visitJoinExprOp(HogQLParser::JoinExprOpContext *context) = 0; + + virtual std::any visitJoinExprTable(HogQLParser::JoinExprTableContext *context) = 0; + + virtual std::any visitJoinExprParens(HogQLParser::JoinExprParensContext *context) = 0; + + virtual std::any visitJoinExprCrossOp(HogQLParser::JoinExprCrossOpContext *context) = 0; + + virtual std::any visitJoinOpInner(HogQLParser::JoinOpInnerContext *context) = 0; + + virtual std::any visitJoinOpLeftRight(HogQLParser::JoinOpLeftRightContext *context) = 0; + + virtual std::any visitJoinOpFull(HogQLParser::JoinOpFullContext *context) = 0; + + virtual std::any visitJoinOpCross(HogQLParser::JoinOpCrossContext *context) = 0; + + virtual std::any visitJoinConstraintClause(HogQLParser::JoinConstraintClauseContext *context) = 0; + + virtual std::any visitSampleClause(HogQLParser::SampleClauseContext *context) = 0; + + virtual std::any visitOrderExprList(HogQLParser::OrderExprListContext *context) = 0; + + virtual std::any visitOrderExpr(HogQLParser::OrderExprContext *context) = 0; + + virtual std::any visitRatioExpr(HogQLParser::RatioExprContext *context) = 0; + + virtual std::any visitSettingExprList(HogQLParser::SettingExprListContext *context) = 0; + + virtual std::any visitSettingExpr(HogQLParser::SettingExprContext *context) = 0; + + virtual std::any visitWindowExpr(HogQLParser::WindowExprContext *context) = 0; + + virtual std::any visitWinPartitionByClause(HogQLParser::WinPartitionByClauseContext *context) = 0; + + virtual std::any visitWinOrderByClause(HogQLParser::WinOrderByClauseContext *context) = 0; + + virtual std::any visitWinFrameClause(HogQLParser::WinFrameClauseContext *context) = 0; + + virtual std::any visitFrameStart(HogQLParser::FrameStartContext *context) = 0; + + virtual std::any visitFrameBetween(HogQLParser::FrameBetweenContext *context) = 0; + + virtual std::any visitWinFrameBound(HogQLParser::WinFrameBoundContext *context) = 0; + + virtual std::any visitExpr(HogQLParser::ExprContext *context) = 0; + + virtual std::any visitColumnTypeExprSimple(HogQLParser::ColumnTypeExprSimpleContext *context) = 0; + + virtual std::any visitColumnTypeExprNested(HogQLParser::ColumnTypeExprNestedContext *context) = 0; + + virtual std::any visitColumnTypeExprEnum(HogQLParser::ColumnTypeExprEnumContext *context) = 0; + + virtual std::any visitColumnTypeExprComplex(HogQLParser::ColumnTypeExprComplexContext *context) = 0; + + virtual std::any visitColumnTypeExprParam(HogQLParser::ColumnTypeExprParamContext *context) = 0; + + virtual std::any visitColumnExprList(HogQLParser::ColumnExprListContext *context) = 0; + + virtual std::any visitColumnExprTernaryOp(HogQLParser::ColumnExprTernaryOpContext *context) = 0; + + virtual std::any visitColumnExprAlias(HogQLParser::ColumnExprAliasContext *context) = 0; + + virtual std::any visitColumnExprExtract(HogQLParser::ColumnExprExtractContext *context) = 0; + + virtual std::any visitColumnExprNegate(HogQLParser::ColumnExprNegateContext *context) = 0; + + virtual std::any visitColumnExprSubquery(HogQLParser::ColumnExprSubqueryContext *context) = 0; + + virtual std::any visitColumnExprLiteral(HogQLParser::ColumnExprLiteralContext *context) = 0; + + virtual std::any visitColumnExprArray(HogQLParser::ColumnExprArrayContext *context) = 0; + + virtual std::any visitColumnExprSubstring(HogQLParser::ColumnExprSubstringContext *context) = 0; + + virtual std::any visitColumnExprCast(HogQLParser::ColumnExprCastContext *context) = 0; + + virtual std::any visitColumnExprOr(HogQLParser::ColumnExprOrContext *context) = 0; + + virtual std::any visitColumnExprPrecedence1(HogQLParser::ColumnExprPrecedence1Context *context) = 0; + + virtual std::any visitColumnExprPrecedence2(HogQLParser::ColumnExprPrecedence2Context *context) = 0; + + virtual std::any visitColumnExprPrecedence3(HogQLParser::ColumnExprPrecedence3Context *context) = 0; + + virtual std::any visitColumnExprInterval(HogQLParser::ColumnExprIntervalContext *context) = 0; + + virtual std::any visitColumnExprIsNull(HogQLParser::ColumnExprIsNullContext *context) = 0; + + virtual std::any visitColumnExprWinFunctionTarget(HogQLParser::ColumnExprWinFunctionTargetContext *context) = 0; + + virtual std::any visitColumnExprTrim(HogQLParser::ColumnExprTrimContext *context) = 0; + + virtual std::any visitColumnExprTuple(HogQLParser::ColumnExprTupleContext *context) = 0; + + virtual std::any visitColumnExprArrayAccess(HogQLParser::ColumnExprArrayAccessContext *context) = 0; + + virtual std::any visitColumnExprBetween(HogQLParser::ColumnExprBetweenContext *context) = 0; + + virtual std::any visitColumnExprPropertyAccess(HogQLParser::ColumnExprPropertyAccessContext *context) = 0; + + virtual std::any visitColumnExprParens(HogQLParser::ColumnExprParensContext *context) = 0; + + virtual std::any visitColumnExprTimestamp(HogQLParser::ColumnExprTimestampContext *context) = 0; + + virtual std::any visitColumnExprNullish(HogQLParser::ColumnExprNullishContext *context) = 0; + + virtual std::any visitColumnExprAnd(HogQLParser::ColumnExprAndContext *context) = 0; + + virtual std::any visitColumnExprTupleAccess(HogQLParser::ColumnExprTupleAccessContext *context) = 0; + + virtual std::any visitColumnExprCase(HogQLParser::ColumnExprCaseContext *context) = 0; + + virtual std::any visitColumnExprDate(HogQLParser::ColumnExprDateContext *context) = 0; + + virtual std::any visitColumnExprNot(HogQLParser::ColumnExprNotContext *context) = 0; + + virtual std::any visitColumnExprWinFunction(HogQLParser::ColumnExprWinFunctionContext *context) = 0; + + virtual std::any visitColumnExprIdentifier(HogQLParser::ColumnExprIdentifierContext *context) = 0; + + virtual std::any visitColumnExprFunction(HogQLParser::ColumnExprFunctionContext *context) = 0; + + virtual std::any visitColumnExprAsterisk(HogQLParser::ColumnExprAsteriskContext *context) = 0; + + virtual std::any visitColumnArgList(HogQLParser::ColumnArgListContext *context) = 0; + + virtual std::any visitColumnArgExpr(HogQLParser::ColumnArgExprContext *context) = 0; + + virtual std::any visitColumnLambdaExpr(HogQLParser::ColumnLambdaExprContext *context) = 0; + + virtual std::any visitWithExprList(HogQLParser::WithExprListContext *context) = 0; + + virtual std::any visitWithExprSubquery(HogQLParser::WithExprSubqueryContext *context) = 0; + + virtual std::any visitWithExprColumn(HogQLParser::WithExprColumnContext *context) = 0; + + virtual std::any visitColumnIdentifier(HogQLParser::ColumnIdentifierContext *context) = 0; + + virtual std::any visitNestedIdentifier(HogQLParser::NestedIdentifierContext *context) = 0; + + virtual std::any visitTableExprIdentifier(HogQLParser::TableExprIdentifierContext *context) = 0; + + virtual std::any visitTableExprPlaceholder(HogQLParser::TableExprPlaceholderContext *context) = 0; + + virtual std::any visitTableExprSubquery(HogQLParser::TableExprSubqueryContext *context) = 0; + + virtual std::any visitTableExprAlias(HogQLParser::TableExprAliasContext *context) = 0; + + virtual std::any visitTableExprFunction(HogQLParser::TableExprFunctionContext *context) = 0; + + virtual std::any visitTableFunctionExpr(HogQLParser::TableFunctionExprContext *context) = 0; + + virtual std::any visitTableIdentifier(HogQLParser::TableIdentifierContext *context) = 0; + + virtual std::any visitTableArgList(HogQLParser::TableArgListContext *context) = 0; + + virtual std::any visitDatabaseIdentifier(HogQLParser::DatabaseIdentifierContext *context) = 0; + + virtual std::any visitFloatingLiteral(HogQLParser::FloatingLiteralContext *context) = 0; + + virtual std::any visitNumberLiteral(HogQLParser::NumberLiteralContext *context) = 0; + + virtual std::any visitLiteral(HogQLParser::LiteralContext *context) = 0; + + virtual std::any visitInterval(HogQLParser::IntervalContext *context) = 0; + + virtual std::any visitKeyword(HogQLParser::KeywordContext *context) = 0; + + virtual std::any visitKeywordForAlias(HogQLParser::KeywordForAliasContext *context) = 0; + + virtual std::any visitAlias(HogQLParser::AliasContext *context) = 0; + + virtual std::any visitIdentifier(HogQLParser::IdentifierContext *context) = 0; + + virtual std::any visitEnumValue(HogQLParser::EnumValueContext *context) = 0; + + +}; + diff --git a/hogql_parser/README.md b/hogql_parser/README.md new file mode 100644 index 0000000000000..c8436358ffc9a --- /dev/null +++ b/hogql_parser/README.md @@ -0,0 +1,3 @@ +# HogQL Parser + +Blazing fast HogQL parsing. This package can only work in the context of the PostHog Django app, as it imports from `posthog.hogql`. diff --git a/hogql_parser/__init__.pyi b/hogql_parser/__init__.pyi new file mode 100644 index 0000000000000..222d1c4442db3 --- /dev/null +++ b/hogql_parser/__init__.pyi @@ -0,0 +1,18 @@ +from posthog.hogql.ast import SelectQuery, SelectUnionQuery +from posthog.hogql.base import AST + +def parse_expr(expr: str, /) -> AST: + """Parse the HogQL expression string into an AST""" + ... + +def parse_order_expr(expr: str, /) -> AST: + """Parse the ORDER BY clause string into an AST""" + ... + +def parse_select(expr: str, /) -> SelectQuery | SelectUnionQuery: + """Parse the HogQL SELECT statement string into an AST""" + ... + +def unquote_string(value: str, /) -> str: + """Unquote the string (an identifier or a string literal)""" + ... diff --git a/hogql_parser/error.cpp b/hogql_parser/error.cpp new file mode 100644 index 0000000000000..cecbdf43f29ed --- /dev/null +++ b/hogql_parser/error.cpp @@ -0,0 +1,15 @@ +#include "error.h" + +using namespace std; + +#define EXCEPTION_CLASS_IMPLEMENTATION(NAME, BASE) \ + NAME::NAME(const string& message, size_t start, size_t end) : BASE(message), start(start), end(end) {} \ + NAME::NAME(const char* message, size_t start, size_t end) : BASE(message), start(start), end(end) {} \ + NAME::NAME(const string& message) : BASE(message), start(0), end(0) {} \ + NAME::NAME(const char* message) : BASE(message), start(0), end(0) {} + +EXCEPTION_CLASS_IMPLEMENTATION(HogQLException, runtime_error) + +EXCEPTION_CLASS_IMPLEMENTATION(HogQLSyntaxException, HogQLException) +EXCEPTION_CLASS_IMPLEMENTATION(HogQLNotImplementedException, HogQLException) +EXCEPTION_CLASS_IMPLEMENTATION(HogQLParsingException, HogQLException) diff --git a/hogql_parser/error.h b/hogql_parser/error.h new file mode 100644 index 0000000000000..1e7be96f0f675 --- /dev/null +++ b/hogql_parser/error.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include + +#define EXCEPTION_CLASS_DEFINITION(NAME, BASE) \ + class NAME : public BASE { \ + public: \ + size_t start; \ + size_t end; \ + explicit NAME(const std::string& message, size_t start, size_t end); \ + explicit NAME(const char* message, size_t start, size_t end); \ + explicit NAME(const std::string& message); \ + explicit NAME(const char* message); \ + }; + +EXCEPTION_CLASS_DEFINITION(HogQLException, std::runtime_error) + +// The input does not conform to HogQL syntax. +EXCEPTION_CLASS_DEFINITION(HogQLSyntaxException, HogQLException) + +// This feature isn't implemented in HogQL (yet). +EXCEPTION_CLASS_DEFINITION(HogQLNotImplementedException, HogQLException) + +// An internal problem in the parser layer. +EXCEPTION_CLASS_DEFINITION(HogQLParsingException, HogQLException) diff --git a/hogql_parser/parser.cpp b/hogql_parser/parser.cpp new file mode 100644 index 0000000000000..8f90b77c6a77d --- /dev/null +++ b/hogql_parser/parser.cpp @@ -0,0 +1,1360 @@ +#define PY_SSIZE_T_CLEAN +#include +#include +#include + +#include "HogQLLexer.h" +#include "HogQLParser.h" +#include "HogQLParserBaseVisitor.h" + +#include "error.h" +#include "parser.h" +#include "string.h" + +#define VISIT(RULE) any visit##RULE(HogQLParser::RULE##Context* ctx) override +#define VISIT_UNSUPPORTED(RULE) \ + VISIT(RULE) { \ + throw HogQLNotImplementedException("Unsupported rule: " #RULE); \ + } +#define HANDLE_HOGQL_EXCEPTION(TYPE) \ + (const HogQL##TYPE& e) { \ + PyObject* error_type = PyObject_GetAttrString(state->errors_module, #TYPE); \ + if (!error_type) { \ + return NULL; \ + } \ + string err_what = e.what(); \ + PyObject* py_err = PyObject_CallObject(error_type, Py_BuildValue("(s#)", err_what.data(), err_what.size())); \ + if (!py_err) { \ + Py_DECREF(error_type); \ + return NULL; \ + } \ + PyObject_SetAttrString(py_err, "start", PyLong_FromSize_t(e.start)); \ + PyObject_SetAttrString(py_err, "end", PyLong_FromSize_t(e.end)); \ + PyErr_SetObject(error_type, py_err); \ + Py_DECREF(error_type); \ + return NULL; \ + } + +using namespace std; + +// PYTHON UTILS (`X_` stands for "extension") + +// Extend `list` with `extension`. In-place. +void X_PyList_Extend(PyObject* list, PyObject* extension) { + Py_ssize_t list_size = PyList_Size(list); + Py_ssize_t extension_size = PyList_Size(extension); + PyList_SetSlice(list, list_size, list_size + extension_size, extension); +} + +// Construct a Python list from a vector of strings. Return value: New reference. +PyObject* X_PyList_FromStrings(const vector& items) { + PyObject* list = PyList_New(items.size()); + if (!list) { + return NULL; + } + for (size_t i = 0; i < items.size(); i++) { + PyObject* value = PyUnicode_FromStringAndSize(items[i].data(), items[i].size()); + if (!value) { + Py_DECREF(list); + return NULL; + } + PyList_SET_ITEM(list, i, value); + } + return list; +} + +// PARSING AND AST CONVERSION + +class HogQLParseTreeConverter : public HogQLParserBaseVisitor { + private: + parser_state* state; + + const vector RESERVED_KEYWORDS = {"true", "false", "null", "team_id"}; + + // Build an AST node of the specified type. Return value: New reference. + template + PyObject* build_ast_node(const char* type_name, const char* kwargs_format, Args... kwargs_items) { + PyObject* node_type = PyObject_GetAttrString(state->ast_module, type_name); + if (!node_type) { + throw HogQLParsingException("AST node type \"" + string(type_name) + "\" does not exist"); + } + PyObject* args = PyTuple_New(0); + PyObject* kwargs = Py_BuildValue(kwargs_format, kwargs_items...); + PyObject* result = PyObject_Call(node_type, args, kwargs); + Py_DECREF(kwargs); + Py_DECREF(args); + Py_DECREF(node_type); + return result; + } + + // Return the specified member of the specified enum. Return value: New reference. + PyObject* get_ast_enum_member(const char* enum_name, const char* enum_member) { + PyObject* enum_type = PyObject_GetAttrString(state->ast_module, enum_name); + PyObject* result = PyObject_GetAttrString(enum_type, enum_member); + Py_DECREF(enum_type); + return result; + } + + // Return whether the passed object is an instance of the specified AST node type. + bool is_ast_node_instance(PyObject* obj, const char* type_name) { + PyObject* node_type = PyObject_GetAttrString(state->ast_module, type_name); + if (!node_type) { + throw HogQLParsingException("AST node type \"" + string(type_name) + "\" does not exist"); + } + bool result = PyObject_IsInstance(obj, node_type); + Py_DECREF(node_type); + return result; + } + + // Return whether the passed object is an instance of _any_ AST node type. + bool is_ast_node_instance(PyObject* obj) { + PyObject* node_type = PyObject_GetAttrString(state->base_module, "AST"); + if (!node_type) { + throw HogQLParsingException("AST base type \"AST\" does not exist"); + } + bool result = PyObject_IsInstance(obj, node_type); + Py_DECREF(node_type); + return result; + } + + public: + HogQLParseTreeConverter(parser_state* state) : state(state) {} + + any visit(antlr4::tree::ParseTree* tree) override { + // Find the start and stop indices of the parse tree node + size_t start; + size_t stop; + auto token = dynamic_cast(tree); + if (token) { + start = token->getStartIndex(); + stop = token->getStopIndex(); + } else { + auto ctx = dynamic_cast(tree); + if (!ctx) { + throw HogQLParsingException("Parse tree node is neither a Token nor a ParserRuleContext"); + } + start = ctx->getStart()->getStartIndex(); + stop = ctx->getStop()->getStopIndex(); + } + // Visit the parse tree node + any node; + try { + node = tree->accept(this); + } catch (const HogQLSyntaxException& e) { + if (e.start == 0 && e.end == 0) { // If start and end are unset, rethrow with the current start and stop + throw HogQLSyntaxException(e.what(), start, stop + 1); + } + throw; + } + if (node.has_value() && node.type() == typeid(PyObject*)) { + PyObject* py_node = any_cast(node); + if (py_node && is_ast_node_instance(py_node)) { + // FIXME: This is leak, because the value argument is not decref'd. Fix for all PyObject_SetAttrString calls. + PyObject_SetAttrString(py_node, "start", PyLong_FromSize_t(start)); + PyObject_SetAttrString(py_node, "end", PyLong_FromSize_t(stop + 1)); + } + } + return node; + } + + // This is the only method that should be called from outside the class. + // Convert the parse tree to an AST node result. If an error has occurred in conversion, handle it gracefully. + PyObject* visitAsPyObjectFinal(antlr4::tree::ParseTree* tree) { + try { + return visitAsPyObject(tree); + } catch HANDLE_HOGQL_EXCEPTION(SyntaxException) catch HANDLE_HOGQL_EXCEPTION(NotImplementedException + ) catch HANDLE_HOGQL_EXCEPTION(ParsingException) catch (const bad_any_cast& e) { + PyObject* error_type = PyObject_GetAttrString(state->errors_module, "ParsingException"); + PyErr_SetString(error_type, "Parsing failed due to bad type casting"); + return NULL; + } + } + + PyObject* visitAsPyObject(antlr4::tree::ParseTree* tree) { + PyObject* cast_result = any_cast(visit(tree)); + if (!cast_result) { + throw runtime_error("Rule resulted in a null PyObject pointer. A Python exception must be set at this point."); + } + return cast_result; + } + + PyObject* visitAsPyObjectOrNone(antlr4::tree::ParseTree* tree) { + if (tree == NULL) { + Py_RETURN_NONE; + } + return visitAsPyObject(tree); + } + + PyObject* visitAsPyObjectOrEmptyList(antlr4::tree::ParseTree* tree) { + if (tree == NULL) { + return PyList_New(0); + } + return visitAsPyObject(tree); + } + + // T has to be used in place of antlr4::tree::ParseTree* here, because there's no conversion from the child class + // to its parent within vectors + template + PyObject* visitPyListOfObjects(vector tree) { + PyObject* result = PyList_New(tree.size()); + for (size_t i = 0; i < tree.size(); i++) { + PyList_SET_ITEM(result, i, visitAsPyObject(tree[i])); + } + return result; + } + + string visitAsString(antlr4::tree::ParseTree* tree) { return any_cast(visit(tree)); } + + template + vector visitAsVectorOfStrings(vector tree) { + vector result; + result.reserve(tree.size()); + for (auto child : tree) { + result.push_back(visitAsString(child)); + } + return result; + } + + VISIT(Select) { + auto select_union_stmt_ctx = ctx->selectUnionStmt(); + if (select_union_stmt_ctx) { + return visit(select_union_stmt_ctx); + } + return visit(ctx->selectStmt()); + } + + VISIT(SelectStmtWithParens) { + auto select_stmt_ctx = ctx->selectStmt(); + if (select_stmt_ctx) { + return visit(select_stmt_ctx); + } + return visit(ctx->selectUnionStmt()); + } + + VISIT(SelectUnionStmt) { + // Using a vector of PyObjects atypically here, because this is a precursor of flattened_queries + vector select_queries; + auto select_stmt_with_parens_ctxs = ctx->selectStmtWithParens(); + select_queries.reserve(select_stmt_with_parens_ctxs.size()); + for (auto select_stmt_with_parens_ctx : select_stmt_with_parens_ctxs) { + select_queries.push_back(visitAsPyObject(select_stmt_with_parens_ctx)); + } + PyObject* flattened_queries = PyList_New(0); + for (auto query : select_queries) { + if (is_ast_node_instance(query, "SelectQuery")) { + PyList_Append(flattened_queries, query); + } else if (is_ast_node_instance(query, "SelectUnionQuery")) { + // Extend flattened_queries with sub_select_queries + PyObject* sub_select_queries = PyObject_GetAttrString(query, "select_queries"); + X_PyList_Extend(flattened_queries, sub_select_queries); + Py_DECREF(sub_select_queries); + } else { + Py_DECREF(flattened_queries); // FIXME: Also decref all select_queries items + throw HogQLParsingException("Unexpected query node type: " + string(Py_TYPE(query)->tp_name)); + } + } // FIXME: Decref all select_queries items + if (PyList_Size(flattened_queries) == 1) { + PyObject* query = PyList_GET_ITEM(flattened_queries, 0); + Py_INCREF(query); + Py_DECREF(flattened_queries); + return query; + } + return build_ast_node("SelectUnionQuery", "{s:N}", "select_queries", flattened_queries); + } + + VISIT(SelectStmt) { + PyObject* select_query = build_ast_node( + "SelectQuery", "{s:N,s:N,s:N,s:N,s:N,s:N,s:N,s:N,s:N}", "ctes", visitAsPyObjectOrNone(ctx->withClause()), + "select", visitAsPyObjectOrEmptyList(ctx->columnExprList()), "distinct", + Py_NewRef(ctx->DISTINCT() ? Py_True : Py_None), "select_from", visitAsPyObjectOrNone(ctx->fromClause()), + "where", visitAsPyObjectOrNone(ctx->whereClause()), "prewhere", visitAsPyObjectOrNone(ctx->prewhereClause()), + "having", visitAsPyObjectOrNone(ctx->havingClause()), "group_by", visitAsPyObjectOrNone(ctx->groupByClause()), + "order_by", visitAsPyObjectOrNone(ctx->orderByClause()) + ); + + auto window_clause_ctx = ctx->windowClause(); + if (window_clause_ctx) { + auto window_expr_ctxs = window_clause_ctx->windowExpr(); + auto identifier_ctxs = window_clause_ctx->identifier(); + if (window_expr_ctxs.size() != identifier_ctxs.size()) { + throw HogQLParsingException("WindowClause must have a matching number of window exprs and identifiers"); + } + PyObject* window_exprs = PyDict_New(); + PyObject_SetAttrString(select_query, "window_exprs", window_exprs); + for (size_t i = 0; i < window_expr_ctxs.size(); i++) { + PyDict_SetItemString( + window_exprs, visitAsString(identifier_ctxs[i]).c_str(), visitAsPyObject(window_expr_ctxs[i]) + ); + } + } + + auto limit_and_offset_clause_ctx = ctx->limitAndOffsetClause(); + if (limit_and_offset_clause_ctx) { + PyObject_SetAttrString(select_query, "limit", visitAsPyObject(limit_and_offset_clause_ctx->columnExpr(0))); + auto offset_ctx = limit_and_offset_clause_ctx->columnExpr(1); + if (offset_ctx) { + PyObject_SetAttrString(select_query, "offset", visitAsPyObject(offset_ctx)); + } + auto limit_by_exprs_ctx = limit_and_offset_clause_ctx->columnExprList(); + if (limit_by_exprs_ctx) { + PyObject_SetAttrString(select_query, "limit_by", visitAsPyObject(limit_by_exprs_ctx)); + } + if (limit_and_offset_clause_ctx->WITH() && limit_and_offset_clause_ctx->TIES()) { + PyObject_SetAttrString(select_query, "limit_with_ties", Py_NewRef(Py_True)); + } + } else { + auto offset_only_clause_ctx = ctx->offsetOnlyClause(); + if (offset_only_clause_ctx) { + PyObject_SetAttrString(select_query, "offset", visitAsPyObject(offset_only_clause_ctx->columnExpr())); + } + } + + auto array_join_clause_ctx = ctx->arrayJoinClause(); + if (array_join_clause_ctx) { + if (Py_IsNone(PyObject_GetAttrString(select_query, "select_from"))) { + Py_DECREF(select_query); + throw HogQLSyntaxException("Using ARRAY JOIN without a FROM clause is not permitted"); + } + PyObject_SetAttrString( + select_query, "array_join_op", + PyUnicode_FromString( + array_join_clause_ctx->LEFT() ? "LEFT ARRAY JOIN" + : array_join_clause_ctx->INNER() ? "INNER ARRAY JOIN" + : "ARRAY JOIN" + ) + ); + + auto array_join_arrays_ctx = array_join_clause_ctx->columnExprList(); + PyObject* array_join_list = visitAsPyObject(array_join_arrays_ctx); + for (Py_ssize_t i = 0; i < PyList_Size(array_join_list); i++) { + PyObject* expr = PyList_GET_ITEM(array_join_list, i); + if (!is_ast_node_instance(expr, "Alias")) { + Py_DECREF(array_join_list); + Py_DECREF(select_query); + auto relevant_column_expr_ctx = array_join_arrays_ctx->columnExpr(i); + throw HogQLSyntaxException( + "ARRAY JOIN arrays must have an alias", relevant_column_expr_ctx->getStart()->getStartIndex(), + relevant_column_expr_ctx->getStop()->getStopIndex() + 1 + ); + } + } + PyObject_SetAttrString(select_query, "array_join_list", array_join_list); + } + + if (ctx->topClause()) { + throw HogQLNotImplementedException("Unsupported: SelectStmt.topClause()"); + } + if (ctx->settingsClause()) { + throw HogQLNotImplementedException("Unsupported: SelectStmt.settingsClause()"); + } + + return select_query; + } + + VISIT(WithClause) { return visit(ctx->withExprList()); } + + VISIT_UNSUPPORTED(TopClause) + + VISIT(FromClause) { return visit(ctx->joinExpr()); } + + VISIT_UNSUPPORTED(ArrayJoinClause) + + VISIT_UNSUPPORTED(WindowClause) + + VISIT(PrewhereClause) { return visit(ctx->columnExpr()); } + + VISIT(WhereClause) { return visit(ctx->columnExpr()); } + + VISIT(GroupByClause) { return visit(ctx->columnExprList()); } + + VISIT(HavingClause) { return visit(ctx->columnExpr()); } + + VISIT(OrderByClause) { return visit(ctx->orderExprList()); } + + VISIT_UNSUPPORTED(ProjectionOrderByClause) + + VISIT_UNSUPPORTED(LimitAndOffsetClause) + + VISIT_UNSUPPORTED(SettingsClause) + + VISIT(JoinExprOp) { + PyObject* join1 = visitAsPyObject(ctx->joinExpr(0)); + PyObject* join2 = visitAsPyObject(ctx->joinExpr(1)); + + auto join_op_ctx = ctx->joinOp(); + if (join_op_ctx) { + string join_op = visitAsString(join_op_ctx); + join_op.append(" JOIN"); + PyObject_SetAttrString(join2, "join_type", PyUnicode_FromStringAndSize(join_op.data(), join_op.size())); + } else { + PyObject_SetAttrString(join2, "join_type", PyUnicode_FromString("JOIN")); + } + PyObject_SetAttrString(join2, "constraint", visitAsPyObject(ctx->joinConstraintClause())); + + PyObject* last_join = join1; + PyObject* next_join = PyObject_GetAttrString(last_join, "next_join"); + while (!Py_IsNone(next_join)) { + last_join = next_join; + next_join = PyObject_GetAttrString(last_join, "next_join"); + } + PyObject_SetAttrString(last_join, "next_join", join2); + + return join1; + } + + VISIT(JoinExprTable) { + PyObject* sample = visitAsPyObjectOrNone(ctx->sampleClause()); + PyObject* table = visitAsPyObject(ctx->tableExpr()); + PyObject* table_final = Py_NewRef(ctx->FINAL() ? Py_True : Py_None); + if (is_ast_node_instance(table, "JoinExpr")) { + // visitTableExprAlias returns a JoinExpr to pass the alias + // visitTableExprFunction returns a JoinExpr to pass the args + PyObject_SetAttrString(table, "table_final", table_final); + PyObject_SetAttrString(table, "sample", sample); + return table; + } + return build_ast_node("JoinExpr", "{s:N,s:N,s:N}", "table", table, "table_final", table_final, "sample", sample); + } + + VISIT(JoinExprParens) { return visit(ctx->joinExpr()); } + + VISIT(JoinExprCrossOp) { + PyObject* join1 = visitAsPyObject(ctx->joinExpr(0)); + PyObject* join2 = visitAsPyObject(ctx->joinExpr(1)); + PyObject_SetAttrString(join2, "join_type", PyUnicode_FromString("CROSS JOIN")); + + PyObject* last_join = join1; + PyObject* next_join = PyObject_GetAttrString(last_join, "next_join"); + while (!Py_IsNone(next_join)) { + last_join = next_join; + next_join = PyObject_GetAttrString(last_join, "next_join"); + } + PyObject_SetAttrString(last_join, "next_join", join2); + + return join1; + } + + VISIT(JoinOpInner) { + vector tokens; + if (ctx->ALL()) { + tokens.push_back("ALL"); + } + if (ctx->ANY()) { + tokens.push_back("ANY"); + } + if (ctx->ASOF()) { + tokens.push_back("ASOF"); + } + tokens.push_back("INNER"); + return boost::algorithm::join(tokens, " "); + } + + VISIT(JoinOpLeftRight) { + vector tokens; + if (ctx->LEFT()) { + tokens.push_back("LEFT"); + } + if (ctx->RIGHT()) { + tokens.push_back("RIGHT"); + } + if (ctx->OUTER()) { + tokens.push_back("OUTER"); + } + if (ctx->SEMI()) { + tokens.push_back("SEMI"); + } + if (ctx->ALL()) { + tokens.push_back("ALL"); + } + if (ctx->ANTI()) { + tokens.push_back("ANTI"); + } + if (ctx->ANY()) { + tokens.push_back("ANY"); + } + if (ctx->ASOF()) { + tokens.push_back("ASOF"); + } + return boost::algorithm::join(tokens, " "); + } + + VISIT(JoinOpFull) { + vector tokens; + if (ctx->FULL()) { + tokens.push_back("FULL"); + } + if (ctx->OUTER()) { + tokens.push_back("OUTER"); + } + if (ctx->ALL()) { + tokens.push_back("ALL"); + } + if (ctx->ANY()) { + tokens.push_back("ANY"); + } + return boost::algorithm::join(tokens, " "); + } + + VISIT_UNSUPPORTED(JoinOpCross) + + VISIT(JoinConstraintClause) { + if (ctx->USING()) { + throw HogQLNotImplementedException("Unsupported: JOIN ... USING"); + } + PyObject* column_expr_list = visitAsPyObject(ctx->columnExprList()); + if (PyList_Size(column_expr_list) != 1) { + Py_DECREF(column_expr_list); + throw HogQLNotImplementedException("Unsupported: JOIN ... ON with multiple expressions"); + } + return build_ast_node("JoinConstraint", "{s:N}", "expr", PyList_GET_ITEM(column_expr_list, 0)); + } + + VISIT(SampleClause) { + PyObject* sample_ratio_expr = visitAsPyObject(ctx->ratioExpr(0)); + PyObject* offset_ratio_expr = ctx->OFFSET() ? visitAsPyObjectOrNone(ctx->ratioExpr(1)) : Py_NewRef(Py_None); + return build_ast_node( + "SampleExpr", "{s:N,s:N}", "sample_value", sample_ratio_expr, "offset_value", offset_ratio_expr + ); + } + + VISIT(OrderExprList) { return visitPyListOfObjects(ctx->orderExpr()); } + + VISIT(OrderExpr) { + const char* order = ctx->DESC() || ctx->DESCENDING() ? "DESC" : "ASC"; + return build_ast_node("OrderExpr", "{s:N,s:s}", "expr", visitAsPyObject(ctx->columnExpr()), "order", order); + } + + VISIT(RatioExpr) { + auto number_literal_ctxs = ctx->numberLiteral(); + + if (number_literal_ctxs.size() > 2) { + throw HogQLParsingException("RatioExpr must have at most two number literals"); + } else if (number_literal_ctxs.size() == 0) { + throw HogQLParsingException("RatioExpr must have at least one number literal"); + } + + auto left_ctx = number_literal_ctxs[0]; + auto right_ctx = ctx->SLASH() && number_literal_ctxs.size() > 1 ? number_literal_ctxs[1] : NULL; + + return build_ast_node( + "RatioExpr", "{s:N,s:N}", "left", visitAsPyObject(left_ctx), "right", visitAsPyObjectOrNone(right_ctx) + ); + } + + VISIT_UNSUPPORTED(SettingExprList) + + VISIT_UNSUPPORTED(SettingExpr) + + VISIT(WindowExpr) { + auto frame_ctx = ctx->winFrameClause(); + PyObject* frame = visitAsPyObjectOrNone(frame_ctx); + PyObject* partition_by = visitAsPyObjectOrNone(ctx->winPartitionByClause()); + PyObject* order_by = visitAsPyObjectOrNone(ctx->winOrderByClause()); + PyObject* frame_method = frame_ctx && frame_ctx->RANGE() ? PyUnicode_FromString("RANGE") + : frame_ctx && frame_ctx->ROWS() ? PyUnicode_FromString("ROWS") + : Py_NewRef(Py_None); + PyObject* frame_start = PyTuple_Check(frame) ? PyTuple_GetItem(frame, 0) : frame; + PyObject* frame_end = PyTuple_Check(frame) ? PyTuple_GetItem(frame, 1) : Py_NewRef(Py_None); + return build_ast_node( + "WindowExpr", "{s:N,s:N,s:N,s:N,s:N}", "partition_by", partition_by, "order_by", order_by, "frame_method", + frame_method, "frame_start", frame_start, "frame_end", frame_end + ); + } + + VISIT(WinPartitionByClause) { return visit(ctx->columnExprList()); } + + VISIT(WinOrderByClause) { return visit(ctx->orderExprList()); } + + VISIT(WinFrameClause) { return visit(ctx->winFrameExtend()); } + + VISIT(FrameStart) { return visit(ctx->winFrameBound()); } + + VISIT(FrameBetween) { + return Py_BuildValue("NN", visitAsPyObject(ctx->winFrameBound(0)), visitAsPyObject(ctx->winFrameBound(1))); + } + + VISIT(WinFrameBound) { + if (ctx->PRECEDING() || ctx->FOLLOWING()) { + PyObject* number; + if (ctx->numberLiteral()) { + number = PyObject_GetAttrString(visitAsPyObject(ctx->numberLiteral()), "value"); + } else { + number = Py_NewRef(Py_None); + } + return build_ast_node( + "WindowFrameExpr", "{s:s,s:N}", "frame_type", ctx->PRECEDING() ? "PRECEDING" : "FOLLOWING", "frame_value", + number + ); + } else { + return build_ast_node("WindowFrameExpr", "{s:s}", "frame_type", "CURRENT ROW"); + } + } + + VISIT(Expr) { return visit(ctx->columnExpr()); } + + VISIT_UNSUPPORTED(ColumnTypeExprSimple) + + VISIT_UNSUPPORTED(ColumnTypeExprNested) + + VISIT_UNSUPPORTED(ColumnTypeExprEnum) + + VISIT_UNSUPPORTED(ColumnTypeExprComplex) + + VISIT_UNSUPPORTED(ColumnTypeExprParam) + + VISIT(ColumnExprList) { return visitPyListOfObjects(ctx->columnExpr()); } + + VISIT(ColumnExprTernaryOp) { + return build_ast_node( + "Call", "{s:s, s:[O,O,O]}", "name", "if", "args", visitAsPyObject(ctx->columnExpr(0)), + visitAsPyObject(ctx->columnExpr(1)), visitAsPyObject(ctx->columnExpr(2)) + ); + } + + VISIT(ColumnExprAlias) { + string alias; + if (ctx->alias()) { + alias = visitAsString(ctx->alias()); + } else if (ctx->identifier()) { + alias = visitAsString(ctx->identifier()); + } else if (ctx->STRING_LITERAL()) { + alias = unquote_string_terminal(ctx->STRING_LITERAL()); + } else { + throw HogQLParsingException("A ColumnExprAlias must have the alias in some form"); + } + PyObject* expr = visitAsPyObject(ctx->columnExpr()); + + if (find(RESERVED_KEYWORDS.begin(), RESERVED_KEYWORDS.end(), boost::algorithm::to_lower_copy(alias)) != + RESERVED_KEYWORDS.end()) { + Py_DECREF(expr); + throw HogQLSyntaxException("\"" + alias + "\" cannot be an alias or identifier, as it's a reserved keyword"); + } + + return build_ast_node("Alias", "{s:N,s:s#}", "expr", expr, "alias", alias.data(), alias.size()); + } + + VISIT_UNSUPPORTED(ColumnExprExtract) + + VISIT(ColumnExprNegate) { + return build_ast_node( + "ArithmeticOperation", "{s:N,s:N,s:N}", "left", build_ast_node("Constant", "{s:i}", "value", 0), "right", + visitAsPyObject(ctx->columnExpr()), "op", get_ast_enum_member("ArithmeticOperationOp", "Sub") + ); + } + + VISIT(ColumnExprSubquery) { return visit(ctx->selectUnionStmt()); } + + VISIT(ColumnExprArray) { + auto column_expr_list_ctx = ctx->columnExprList(); + PyObject* exprs = visitAsPyObjectOrEmptyList(column_expr_list_ctx); + return build_ast_node("Array", "{s:N}", "exprs", exprs); + } + + VISIT_UNSUPPORTED(ColumnExprSubstring) + + VISIT_UNSUPPORTED(ColumnExprCast) + + VISIT(ColumnExprPrecedence1) { + PyObject* op; + if (ctx->SLASH()) { + op = get_ast_enum_member("ArithmeticOperationOp", "Div"); + } else if (ctx->ASTERISK()) { + op = get_ast_enum_member("ArithmeticOperationOp", "Mult"); + } else if (ctx->PERCENT()) { + op = get_ast_enum_member("ArithmeticOperationOp", "Mod"); + } else { + throw HogQLParsingException("Unsupported value of rule ColumnExprPrecedence1"); + } + PyObject* left = visitAsPyObject(ctx->left); + PyObject* right = visitAsPyObject(ctx->right); + return build_ast_node("ArithmeticOperation", "{s:N,s:N,s:N}", "left", left, "right", right, "op", op); + } + + VISIT(ColumnExprPrecedence2) { + PyObject* left = visitAsPyObject(ctx->left); + PyObject* right = visitAsPyObject(ctx->right); + + if (ctx->PLUS()) { + return build_ast_node( + "ArithmeticOperation", "{s:N,s:N,s:N}", "left", left, "right", right, "op", + get_ast_enum_member("ArithmeticOperationOp", "Add") + ); + } else if (ctx->DASH()) { + return build_ast_node( + "ArithmeticOperation", "{s:N,s:N,s:N}", "left", left, "right", right, "op", + get_ast_enum_member("ArithmeticOperationOp", "Sub") + ); + } else if (ctx->CONCAT()) { + PyObject* args; + if (is_ast_node_instance(left, "Call") && + PyObject_RichCompareBool(PyObject_GetAttrString(left, "name"), PyUnicode_FromString("concat"), Py_EQ)) { + args = PyObject_GetAttrString(left, "args"); + } else { + args = PyList_New(1); + PyList_SET_ITEM(args, 0, left); + Py_INCREF(left); // PyList_SET_ITEM doesn't increment refcount, as opposed to PyList_Append + } + + if (is_ast_node_instance(right, "Call") && + PyObject_RichCompareBool(PyObject_GetAttrString(right, "name"), PyUnicode_FromString("concat"), Py_EQ)) { + PyObject* right_args = PyObject_GetAttrString(right, "args"); + X_PyList_Extend(args, right_args); + Py_DECREF(right_args); + } else { + PyList_Append(args, right); + } + Py_DECREF(right); + Py_DECREF(left); + return build_ast_node("Call", "{s:s,s:N}", "name", "concat", "args", args); + } else { + Py_DECREF(right); + Py_DECREF(left); + throw HogQLParsingException("Unsupported value of rule ColumnExprPrecedence2"); + } + } + + VISIT(ColumnExprPrecedence3) { + PyObject* op = NULL; + if (ctx->EQ_SINGLE() || ctx->EQ_DOUBLE()) { + op = get_ast_enum_member("CompareOperationOp", "Eq"); + } else if (ctx->NOT_EQ()) { + op = get_ast_enum_member("CompareOperationOp", "NotEq"); + } else if (ctx->LT()) { + op = get_ast_enum_member("CompareOperationOp", "Lt"); + } else if (ctx->LT_EQ()) { + op = get_ast_enum_member("CompareOperationOp", "LtEq"); + } else if (ctx->GT()) { + op = get_ast_enum_member("CompareOperationOp", "Gt"); + } else if (ctx->GT_EQ()) { + op = get_ast_enum_member("CompareOperationOp", "GtEq"); + } else if (ctx->LIKE()) { + if (ctx->NOT()) { + op = get_ast_enum_member("CompareOperationOp", "NotLike"); + } else { + op = get_ast_enum_member("CompareOperationOp", "Like"); + } + } else if (ctx->ILIKE()) { + if (ctx->NOT()) { + op = get_ast_enum_member("CompareOperationOp", "NotILike"); + } else { + op = get_ast_enum_member("CompareOperationOp", "ILike"); + } + } else if (ctx->REGEX_SINGLE() or ctx->REGEX_DOUBLE()) { + op = get_ast_enum_member("CompareOperationOp", "Regex"); + } else if (ctx->NOT_REGEX()) { + op = get_ast_enum_member("CompareOperationOp", "NotRegex"); + } else if (ctx->IREGEX_SINGLE() or ctx->IREGEX_DOUBLE()) { + op = get_ast_enum_member("CompareOperationOp", "IRegex"); + } else if (ctx->NOT_IREGEX()) { + op = get_ast_enum_member("CompareOperationOp", "NotIRegex"); + } else if (ctx->IN()) { + if (ctx->COHORT()) { + if (ctx->NOT()) { + op = get_ast_enum_member("CompareOperationOp", "NotInCohort"); + } else { + op = get_ast_enum_member("CompareOperationOp", "InCohort"); + } + } else { + if (ctx->NOT()) { + op = get_ast_enum_member("CompareOperationOp", "NotIn"); + } else { + op = get_ast_enum_member("CompareOperationOp", "In"); + } + } + } else { + throw HogQLParsingException("Unsupported value of rule ColumnExprPrecedence3"); + } + + PyObject* left = visitAsPyObject(ctx->left); + PyObject* right = visitAsPyObject(ctx->right); + + return build_ast_node("CompareOperation", "{s:N,s:N,s:N}", "left", left, "right", right, "op", op); + } + + VISIT(ColumnExprInterval) { + auto interval_ctx = ctx->interval(); + const char* name; + if (interval_ctx->SECOND()) { + name = "toIntervalSecond"; + } else if (interval_ctx->MINUTE()) { + name = "toIntervalMinute"; + } else if (interval_ctx->HOUR()) { + name = "toIntervalHour"; + } else if (interval_ctx->DAY()) { + name = "toIntervalDay"; + } else if (interval_ctx->WEEK()) { + name = "toIntervalWeek"; + } else if (interval_ctx->MONTH()) { + name = "toIntervalMonth"; + } else if (interval_ctx->QUARTER()) { + name = "toIntervalQuarter"; + } else if (interval_ctx->YEAR()) { + name = "toIntervalYear"; + } else { + throw HogQLParsingException("Unsupported value of rule ColumnExprInterval"); + } + + PyObject* arg = visitAsPyObject(ctx->columnExpr()); + return build_ast_node("Call", "{s:s,s:[N]}", "name", name, "args", arg); + } + + VISIT(ColumnExprIsNull) { + return build_ast_node( + "CompareOperation", "{s:N,s:N,s:N}", "left", visitAsPyObject(ctx->columnExpr()), "right", + build_ast_node("Constant", "{s:O}", "value", Py_None), "op", + get_ast_enum_member("CompareOperationOp", ctx->NOT() ? "NotEq" : "Eq") + + ); + } + + VISIT_UNSUPPORTED(ColumnExprTrim) + + VISIT(ColumnExprTuple) { + auto column_expr_list_ctx = ctx->columnExprList(); + return build_ast_node("Tuple", "{s:N}", "exprs", visitAsPyObjectOrEmptyList(column_expr_list_ctx)); + } + + VISIT(ColumnExprArrayAccess) { + PyObject* object = visitAsPyObject(ctx->columnExpr(0)); + PyObject* property = visitAsPyObject(ctx->columnExpr(1)); + if (is_ast_node_instance(property, "Constant") && + PyObject_RichCompareBool(PyObject_GetAttrString(property, "value"), PyLong_FromLong(0), Py_EQ)) { + Py_DECREF(property); + Py_DECREF(object); + throw HogQLSyntaxException("SQL indexes start from one, not from zero. E.g: array[1]"); + } + return build_ast_node("ArrayAccess", "{s:N,s:N}", "array", object, "property", property); + } + + VISIT(ColumnExprPropertyAccess) { + PyObject* object = visitAsPyObject(ctx->columnExpr()); + string identifier = visitAsString(ctx->identifier()); + PyObject* property = build_ast_node("Constant", "{s:s#}", "value", identifier.data(), identifier.size()); + return build_ast_node("ArrayAccess", "{s:N,s:N}", "array", object, "property", property); + } + + VISIT_UNSUPPORTED(ColumnExprBetween) + + VISIT(ColumnExprParens) { return visit(ctx->columnExpr()); } + + VISIT_UNSUPPORTED(ColumnExprTimestamp) + + VISIT(ColumnExprAnd) { + PyObject* left = visitAsPyObject(ctx->columnExpr(0)); + PyObject* right = visitAsPyObject(ctx->columnExpr(1)); + PyObject* exprs; + if (is_ast_node_instance(left, "And")) { + exprs = PyObject_GetAttrString(left, "exprs"); + } else { + exprs = PyList_New(1); + PyList_SET_ITEM(exprs, 0, left); + Py_INCREF(left); + } + if (is_ast_node_instance(right, "And")) { + PyObject* right_exprs = PyObject_GetAttrString(right, "exprs"); + X_PyList_Extend(exprs, right_exprs); + Py_DECREF(right_exprs); + } else { + PyList_Append(exprs, right); + } + + return build_ast_node("And", "{s:N}", "exprs", exprs); + } + + VISIT(ColumnExprOr) { + PyObject* left = visitAsPyObject(ctx->columnExpr(0)); + PyObject* right = visitAsPyObject(ctx->columnExpr(1)); + PyObject* exprs; + if (is_ast_node_instance(left, "Or")) { + exprs = PyObject_GetAttrString(left, "exprs"); + } else { + exprs = PyList_New(1); + PyList_SET_ITEM(exprs, 0, left); + Py_INCREF(left); + } + if (is_ast_node_instance(right, "Or")) { + PyObject* right_exprs = PyObject_GetAttrString(right, "exprs"); + X_PyList_Extend(exprs, right_exprs); + Py_DECREF(right_exprs); + } else { + PyList_Append(exprs, right); + } + + return build_ast_node("Or", "{s:N}", "exprs", exprs); + } + + VISIT(ColumnExprTupleAccess) { + PyObject* tuple = visitAsPyObject(ctx->columnExpr()); + PyObject* index = PyLong_FromString(ctx->DECIMAL_LITERAL()->getText().c_str(), NULL, 10); + if (PyObject_RichCompareBool(index, PyLong_FromLong(0), Py_EQ)) { + Py_DECREF(index); + Py_DECREF(tuple); + throw HogQLSyntaxException("SQL indexes start from one, not from zero. E.g: array[1]"); + } + return build_ast_node("TupleAccess", "{s:N,s:N}", "tuple", tuple, "index", index); + } + + VISIT(ColumnExprCase) { + auto column_expr_ctx = ctx->columnExpr(); + size_t columns_size = column_expr_ctx.size(); + PyObject* columns = visitPyListOfObjects(column_expr_ctx); + if (ctx->caseExpr) { + PyObject* args = PyList_New(4); + PyObject* arg_0 = Py_NewRef(PyList_GetItem(columns, 0)); + PyObject* arg_1 = build_ast_node("Array", "{s:[]}", "exprs"); + PyObject* arg_2 = build_ast_node("Array", "{s:[]}", "exprs"); + PyObject* arg_3 = Py_NewRef(PyList_GetItem(columns, columns_size - 1)); + PyList_SET_ITEM(args, 0, arg_0); + PyList_SET_ITEM(args, 1, arg_1); + PyList_SET_ITEM(args, 2, arg_2); + PyList_SET_ITEM(args, 3, arg_3); + PyObject* expr_lists[2] = {PyObject_GetAttrString(arg_1, "exprs"), PyObject_GetAttrString(arg_2, "exprs")}; + for (size_t index = 1; index < columns_size - 1; index++) { + PyList_Append(expr_lists[(index - 1) % 2], PyList_GetItem(columns, index)); + } + Py_DECREF(expr_lists[0]); + Py_DECREF(expr_lists[1]); + Py_DECREF(columns); + return build_ast_node("Call", "{s:s,s:N}", "name", "transform", "args", args); + } else { + return build_ast_node("Call", "{s:s,s:N}", "name", columns_size == 3 ? "if" : "multiIf", "args", columns); + } + } + + VISIT_UNSUPPORTED(ColumnExprDate) + + VISIT(ColumnExprNot) { return build_ast_node("Not", "{s:N}", "expr", visitAsPyObject(ctx->columnExpr())); } + + VISIT(ColumnExprWinFunctionTarget) { + auto column_expr_list_ctx = ctx->columnExprList(); + string name = visitAsString(ctx->identifier(0)); + string over_identifier = visitAsString(ctx->identifier(1)); + PyObject* args = visitAsPyObjectOrEmptyList(column_expr_list_ctx); + return build_ast_node( + "WindowFunction", "{s:s#,s:N,s:s#}", "name", name.data(), name.size(), "args", args, "over_identifier", + over_identifier.data(), over_identifier.size() + + ); + } + + VISIT(ColumnExprWinFunction) { + string identifier = visitAsString(ctx->identifier()); + auto column_expr_list_ctx = ctx->columnExprList(); + PyObject* args = visitAsPyObjectOrEmptyList(column_expr_list_ctx); + PyObject* over_expr = visitAsPyObjectOrNone(ctx->windowExpr()); + return build_ast_node( + "WindowFunction", "{s:s#,s:N,s:N}", "name", identifier.data(), identifier.size(), "args", args, "over_expr", + over_expr + ); + } + + VISIT(ColumnExprIdentifier) { return visit(ctx->columnIdentifier()); } + + VISIT(ColumnExprFunction) { + string name = visitAsString(ctx->identifier()); + PyObject* parameters = visitAsPyObjectOrNone(ctx->columnExprList()); + auto column_arg_list_ctx = ctx->columnArgList(); + PyObject* args = visitAsPyObjectOrEmptyList(column_arg_list_ctx); + PyObject* distinct = ctx->DISTINCT() ? Py_True : Py_False; + return build_ast_node( + "Call", "{s:s#,s:N,s:N,s:O}", "name", name.data(), name.size(), "params", parameters, "args", args, "distinct", + distinct + ); + } + + VISIT(ColumnExprAsterisk) { + auto table_identifier_ctx = ctx->tableIdentifier(); + if (table_identifier_ctx) { + vector table = any_cast>(visit(table_identifier_ctx)); + table.push_back("*"); + return build_ast_node("Field", "{s:N}", "chain", X_PyList_FromStrings(table)); + } + return build_ast_node("Field", "{s:[s]}", "chain", "*"); + } + + VISIT(ColumnArgList) { return visitPyListOfObjects(ctx->columnArgExpr()); } + + VISIT(ColumnLambdaExpr) { + vector args = visitAsVectorOfStrings(ctx->identifier()); + return build_ast_node( + "Lambda", "{s:N,s:N}", "args", X_PyList_FromStrings(args), "expr", visitAsPyObject(ctx->columnExpr()) + ); + } + + VISIT(WithExprList) { + PyObject* ctes = PyDict_New(); + for (auto with_expr_ctx : ctx->withExpr()) { + PyObject* cte = visitAsPyObject(with_expr_ctx); + PyObject* name = PyObject_GetAttrString(cte, "name"); + PyDict_SetItem(ctes, name, cte); + Py_DECREF(cte); + } + return ctes; + } + + VISIT(WithExprSubquery) { + PyObject* subquery = visitAsPyObject(ctx->selectUnionStmt()); + string name = visitAsString(ctx->identifier()); + return build_ast_node( + "CTE", "{s:s#,s:N,s:s}", "name", name.data(), name.size(), "expr", subquery, "cte_type", "subquery" + ); + } + + VISIT(WithExprColumn) { + PyObject* expr = visitAsPyObject(ctx->columnExpr()); + string name = visitAsString(ctx->identifier()); + return build_ast_node( + "CTE", "{s:s#,s:N,s:s}", "name", name.data(), name.size(), "expr", expr, "cte_type", "column" + ); + } + + VISIT(ColumnIdentifier) { + auto placeholder_ctx = ctx->PLACEHOLDER(); + if (placeholder_ctx) { + string placeholder = unquote_string_terminal(placeholder_ctx); + return build_ast_node("Placeholder", "{s:s#}", "field", placeholder.data(), placeholder.size()); + } + + auto table_identifier_ctx = ctx->tableIdentifier(); + auto nested_identifier_ctx = ctx->nestedIdentifier(); + vector table = + table_identifier_ctx ? any_cast>(visit(table_identifier_ctx)) : vector(); + vector nested = + nested_identifier_ctx ? any_cast>(visit(nested_identifier_ctx)) : vector(); + + if (table.size() == 0 && nested.size() > 0) { + string text = ctx->getText(); + boost::algorithm::to_lower(text); + if (!text.compare("true")) { + return build_ast_node("Constant", "{s:O}", "value", Py_True); + } + if (!text.compare("false")) { + return build_ast_node("Constant", "{s:O}", "value", Py_False); + } + return build_ast_node("Field", "{s:N}", "chain", X_PyList_FromStrings(nested)); + } + vector table_plus_nested = table; + table_plus_nested.insert(table_plus_nested.end(), nested.begin(), nested.end()); + return build_ast_node("Field", "{s:N}", "chain", X_PyList_FromStrings(table_plus_nested)); + } + + VISIT(NestedIdentifier) { return visitAsVectorOfStrings(ctx->identifier()); } + + VISIT(TableExprIdentifier) { + vector chain = any_cast>(visit(ctx->tableIdentifier())); + return build_ast_node("Field", "{s:N}", "chain", X_PyList_FromStrings(chain)); + } + + VISIT(TableExprSubquery) { return visit(ctx->selectUnionStmt()); } + + VISIT(TableExprPlaceholder) { + string placeholder = unquote_string_terminal(ctx->PLACEHOLDER()); + return build_ast_node("Placeholder", "{s:s#}", "field", placeholder.data(), placeholder.size()); + } + + VISIT(TableExprAlias) { + auto alias_ctx = ctx->alias(); + string alias = any_cast(alias_ctx ? visit(alias_ctx) : visit(ctx->identifier())); + if (find(RESERVED_KEYWORDS.begin(), RESERVED_KEYWORDS.end(), boost::algorithm::to_lower_copy(alias)) != + RESERVED_KEYWORDS.end()) { + throw HogQLSyntaxException("ALIAS is a reserved keyword"); + } + PyObject* table = visitAsPyObject(ctx->tableExpr()); + PyObject* py_alias = PyUnicode_FromStringAndSize(alias.data(), alias.size()); + if (is_ast_node_instance(table, "JoinExpr")) { + PyObject_SetAttrString(table, "alias", py_alias); + return table; + } + return build_ast_node("JoinExpr", "{s:N,s:N}", "table", table, "alias", py_alias); + } + + VISIT(TableExprFunction) { return visit(ctx->tableFunctionExpr()); } + + VISIT(TableFunctionExpr) { + string name = visitAsString(ctx->identifier()); + PyObject* table_args; + auto table_args_ctx = ctx->tableArgList(); + if (table_args_ctx) { + table_args = visitAsPyObject(table_args_ctx); + } else { + table_args = Py_NewRef(Py_None); + } + return build_ast_node( + "JoinExpr", "{s:N,s:N}", "table", build_ast_node("Field", "{s:[s#]}", "chain", name.data(), name.size()), + "table_args", table_args + ); + } + + VISIT(TableIdentifier) { + string text = visitAsString(ctx->identifier()); + auto database_identifier_ctx = ctx->databaseIdentifier(); + if (database_identifier_ctx) { + return vector{visitAsString(database_identifier_ctx), text}; + } + return vector{text}; + } + + VISIT(TableArgList) { return visitPyListOfObjects(ctx->columnExpr()); } + + VISIT(DatabaseIdentifier) { return visit(ctx->identifier()); } + + VISIT_UNSUPPORTED(FloatingLiteral) + + VISIT(NumberLiteral) { + string text = ctx->getText(); + boost::algorithm::to_lower(text); + PyObject* value; + PyObject* result; + if (text.find(".") != string::npos || text.find("e") != string::npos || !text.compare("-inf") || + !text.compare("inf") || !text.compare("nan")) { + PyObject* pyText = PyUnicode_FromStringAndSize(text.data(), text.size()); + value = PyFloat_FromString(pyText); + result = build_ast_node("Constant", "{s:N}", "value", value); + Py_DECREF(pyText); + } else { + value = PyLong_FromString(text.c_str(), NULL, 10); + result = build_ast_node("Constant", "{s:N}", "value", value); + } + + return result; + } + + VISIT(Literal) { + if (ctx->NULL_SQL()) { + return build_ast_node("Constant", "{s:O}", "value", Py_None); + } + auto string_literal_terminal = ctx->STRING_LITERAL(); + if (string_literal_terminal) { + string text = unquote_string_terminal(string_literal_terminal); + return build_ast_node("Constant", "{s:s#}", "value", text.data(), text.size()); + } + return visitChildren(ctx); + } + + VISIT_UNSUPPORTED(Interval) + + VISIT_UNSUPPORTED(Keyword) + + VISIT_UNSUPPORTED(KeywordForAlias) + + VISIT(Alias) { + string text = ctx->getText(); + if (text.size() >= 2) { + char first_char = text.front(); + char last_char = text.back(); + if ((first_char == '`' && last_char == '`') || (first_char == '"' && last_char == '"')) { + return unquote_string(text); + } + } + return text; + } + + VISIT(Identifier) { + string text = ctx->getText(); + if (text.size() >= 2) { + char first_char = text.front(); + char last_char = text.back(); + if ((first_char == '`' && last_char == '`') || (first_char == '"' && last_char == '"')) { + return unquote_string(text); + } + } + return text; + } + + VISIT_UNSUPPORTED(EnumValue) + + VISIT(ColumnExprNullish) { + return build_ast_node( + "Call", "{s:s, s:[O,O]}", "name", "ifNull", "args", visitAsPyObject(ctx->columnExpr(0)), + visitAsPyObject(ctx->columnExpr(1)) + ); + } +}; + +class HogQLErrorListener : public antlr4::BaseErrorListener { + public: + string input; + + HogQLErrorListener(string input) : input(input) {} + + void syntaxError( + antlr4::Recognizer* recognizer, + antlr4::Token* offendingSymbol, + size_t line, + size_t charPositionInLine, + const string& msg, + exception_ptr e + ) override { + size_t start = getPosition(line, charPositionInLine); + if (start == string::npos) { + start = 0; + } + throw HogQLSyntaxException(msg, start, input.size()); + } + + private: + size_t getPosition(size_t line, size_t column) { + size_t linePosition = 0; + for (size_t i = 0; i < line - 1; i++) { + size_t increment = input.find("\n", linePosition) + 1; + if (increment == string::npos) { + return string::npos; + } + linePosition += increment; + } + return linePosition + column; + } +}; + +HogQLParser get_parser(const char* statement) { + auto input_stream = new antlr4::ANTLRInputStream(statement, strnlen(statement, 65536)); + auto lexer = new HogQLLexer(input_stream); + auto stream = new antlr4::CommonTokenStream(lexer); + return HogQLParser(stream); +} + +// MODULE STATE + +parser_state* get_module_state(PyObject* module) { + return static_cast(PyModule_GetState(module)); +} + +// MODULE METHODS + +static PyObject* method_parse_expr(PyObject* self, PyObject* args) { + parser_state* state = get_module_state(self); + const char* str; + if (!PyArg_ParseTuple(args, "s", &str)) { + return NULL; + } + HogQLParser parser = get_parser(str); + parser.removeErrorListeners(); + parser.addErrorListener(new HogQLErrorListener(str)); + HogQLParser::ExprContext* parse_tree; + try { + parse_tree = parser.expr(); + } catch HANDLE_HOGQL_EXCEPTION(SyntaxException); + HogQLParseTreeConverter converter = HogQLParseTreeConverter(state); + return converter.visitAsPyObjectFinal(parse_tree); +} + +static PyObject* method_parse_order_expr(PyObject* self, PyObject* args) { + parser_state* state = get_module_state(self); + const char* str; + if (!PyArg_ParseTuple(args, "s", &str)) { + return NULL; + } + HogQLParser parser = get_parser(str); + parser.removeErrorListeners(); + parser.addErrorListener(new HogQLErrorListener(str)); + HogQLParser::OrderExprContext* parse_tree; + try { + parse_tree = parser.orderExpr(); + } catch HANDLE_HOGQL_EXCEPTION(SyntaxException); + HogQLParseTreeConverter converter = HogQLParseTreeConverter(state); + return converter.visitAsPyObjectFinal(parse_tree); +} + +static PyObject* method_parse_select(PyObject* self, PyObject* args) { + parser_state* state = get_module_state(self); + const char* str; + if (!PyArg_ParseTuple(args, "s", &str)) { + return NULL; + } + HogQLParser parser = get_parser(str); + parser.removeErrorListeners(); + parser.addErrorListener(new HogQLErrorListener(str)); + HogQLParser::SelectContext* parse_tree; + try { + parse_tree = parser.select(); + } catch HANDLE_HOGQL_EXCEPTION(SyntaxException); + HogQLParseTreeConverter converter = HogQLParseTreeConverter(state); + return converter.visitAsPyObjectFinal(parse_tree); +} + +static PyObject* method_unquote_string(PyObject* self, PyObject* args) { + parser_state* state = get_module_state(self); + const char* str; + if (!PyArg_ParseTuple(args, "s", &str)) { + return NULL; + } + string unquoted_string; + try { + unquoted_string = unquote_string(str); + } catch HANDLE_HOGQL_EXCEPTION(SyntaxException); + return PyUnicode_FromStringAndSize(unquoted_string.data(), unquoted_string.size()); +} + +// MODULE SETUP + +static PyMethodDef parser_methods[] = { + {.ml_name = "parse_expr", + .ml_meth = method_parse_expr, + .ml_flags = METH_VARARGS, + .ml_doc = "Parse the HogQL expression string into an AST"}, + {.ml_name = "parse_order_expr", + .ml_meth = method_parse_order_expr, + .ml_flags = METH_VARARGS, + .ml_doc = "Parse the ORDER BY clause string into an AST"}, + {.ml_name = "parse_select", + .ml_meth = method_parse_select, + .ml_flags = METH_VARARGS, + .ml_doc = "Parse the HogQL SELECT statement string into an AST"}, + {.ml_name = "unquote_string", + .ml_meth = method_unquote_string, + .ml_flags = METH_VARARGS, + .ml_doc = "Unquote the string (an identifier or a string literal))"}, + {NULL, NULL, 0, NULL}}; + +static int parser_modexec(PyObject* module) { + parser_state* state = get_module_state(module); + state->ast_module = PyImport_ImportModule("posthog.hogql.ast"); + if (!state->ast_module) { + return -1; + } + state->base_module = PyImport_ImportModule("posthog.hogql.base"); + if (!state->base_module) { + return -1; + } + state->errors_module = PyImport_ImportModule("posthog.hogql.errors"); + if (!state->errors_module) { + return -1; + } + return 0; +} + +static PyModuleDef_Slot parser_slots[] = { + {Py_mod_exec, (void*)parser_modexec}, // If Python were written in C++, then Py_mod_exec would be typed better, but + // because it's in C, it expects a void pointer + {0, NULL}}; + +static int parser_traverse(PyObject* module, visitproc visit, void* arg) { + parser_state* state = get_module_state(module); + Py_VISIT(state->ast_module); + Py_VISIT(state->base_module); + Py_VISIT(state->errors_module); + return 0; +} + +static int parser_clear(PyObject* module) { + parser_state* state = get_module_state(module); + Py_CLEAR(state->ast_module); + Py_CLEAR(state->base_module); + Py_CLEAR(state->errors_module); + return 0; +} + +static struct PyModuleDef parser = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "hogql_parser", + .m_doc = "HogQL parsing", + .m_size = sizeof(parser_state), + .m_methods = parser_methods, + .m_slots = parser_slots, + .m_traverse = parser_traverse, + .m_clear = parser_clear, +}; + +PyMODINIT_FUNC PyInit_hogql_parser(void) { + return PyModuleDef_Init(&parser); +} diff --git a/hogql_parser/parser.h b/hogql_parser/parser.h new file mode 100644 index 0000000000000..020f0dae7a8dd --- /dev/null +++ b/hogql_parser/parser.h @@ -0,0 +1,11 @@ +#define PY_SSIZE_T_CLEAN +#include + +// MODULE STATE + +// Module state, primarily for storing references to Python objects used throughout the parser (such as imports) +typedef struct { + PyObject* ast_module; + PyObject* base_module; + PyObject* errors_module; +} parser_state; diff --git a/hogql_parser/py.typed b/hogql_parser/py.typed new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/hogql_parser/pyproject.toml b/hogql_parser/pyproject.toml new file mode 100644 index 0000000000000..f3405ff64ec59 --- /dev/null +++ b/hogql_parser/pyproject.toml @@ -0,0 +1,45 @@ +[tool.black] +line-length = 120 +target-version = ['py310'] + +[tool.cibuildwheel] +build = [ # Build CPython wheels on Linux and macOS, for x86 as well as ARM + "cp3*-macosx_x86_64", + "cp3*-macosx_arm64", + "cp3*-manylinux_x86_64", + "cp3*-manylinux_aarch64", +] +build-frontend = "build" # This is successor to building with pip + +[tool.cibuildwheel.macos] +archs = [ # We could also build a universal wheel, but separate ones are lighter individually + "x86_64", + "arm64", +] +before-build = [ # We need to install the libraries for each architecture separately + "brew uninstall --force boost antlr4-cpp-runtime", + "brew fetch --force --bottle-tag=${ARCHFLAGS##'-arch '}_monterey boost antlr4-cpp-runtime", + "brew install $(brew --cache --bottle-tag=${ARCHFLAGS##'-arch '}_monterey boost antlr4-cpp-runtime)", +] + +[tool.cibuildwheel.linux] +before-all = [ + # manylinux_2_28 is based on AlmaLinux 8, which uses Fedora's dnf as its package manager + "dnf install -y boost-devel unzip cmake curl uuid pkg-config", + "curl https://www.antlr.org/download/antlr4-cpp-runtime-4.13.0-source.zip --output antlr4-source.zip", + # Check that the downloaded archive is the expected runtime - a security measure + "anltr_known_md5sum=\"ff214b65fb02e150b4f515d7983bca92\"", + "antlr_found_ms5sum=\"$(md5sum antlr4-source.zip | cut -d' ' -f1)\"", + 'if [[ "$anltr_known_md5sum" != "$antlr_found_ms5sum" ]]; then exit 64; fi', + "unzip antlr4-source.zip -d antlr4-source && cd antlr4-source", + "cmake .", + "DESTDIR=out make install", + "cp -r out/usr/local/include/antlr4-runtime /usr/include/", + "cp out/usr/local/lib64/libantlr4-runtime.so* /usr/lib64/", + "ldconfig", +] +archs = [ + "native", # We run x86_64 and aarch64 as separate CI jobs, and we want native in each case as emulation is slow +] +manylinux-x86_64-image = "manylinux_2_28" +manylinux-aarch64-image = "manylinux_2_28" diff --git a/hogql_parser/setup.py b/hogql_parser/setup.py new file mode 100644 index 0000000000000..6e9ee91b7475a --- /dev/null +++ b/hogql_parser/setup.py @@ -0,0 +1,57 @@ +from setuptools import setup, Extension +import platform + +system = platform.system() +if system not in ("Darwin", "Linux"): + raise Exception("Only Linux and macOS are supported by hogql_parser") + +is_macos = system == "Darwin" +homebrew_location = "/opt/homebrew" if platform.machine() == "arm64" else "/usr/local" + +module = Extension( + "hogql_parser", + sources=[ + "HogQLLexer.cpp", + "HogQLParser.cpp", + "HogQLParserBaseVisitor.cpp", + "HogQLParserVisitor.cpp", + "error.cpp", + "string.cpp", + "parser.cpp", + ], + include_dirs=[ + f"{homebrew_location}/include/", + f"{homebrew_location}/include/antlr4-runtime/", + ] + if is_macos + else ["/usr/include/", "/usr/include/antlr4-runtime/"], + library_dirs=[f"{homebrew_location}/lib/"] if is_macos else ["/usr/lib/", "/usr/lib64/"], + libraries=["antlr4-runtime"], + extra_compile_args=["-std=c++20"], +) + +setup( + name="hogql_parser", + version="0.1.7", + url="https://github.com/PostHog/posthog/tree/master/hogql_parser", + author="PostHog Inc.", + author_email="hey@posthog.com", + maintainer="PostHog Inc.", + maintainer_email="hey@posthog.com", + description="HogQL parser for internal PostHog use", + long_description=open("README.md").read(), + long_description_content_type="text/markdown", + package_data={"hogql_parser": ["__init__.pyi", "py.typed"]}, + ext_modules=[module], + python_requires=">=3.10", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + ], +) diff --git a/hogql_parser/string.cpp b/hogql_parser/string.cpp new file mode 100644 index 0000000000000..fb1b9593ed1e3 --- /dev/null +++ b/hogql_parser/string.cpp @@ -0,0 +1,56 @@ +#include + +#include "error.h" +#include "string.h" + +using namespace std; + +string unquote_string(string text) { + size_t original_text_size = text.size(); + if (original_text_size == 0) { + throw HogQLParsingException("Encountered an unexpected empty string input"); + } + const char first_char = text.front(); + const char last_char = text.back(); + if (first_char == '\'' && last_char == '\'') { + text = text.substr(1, original_text_size - 2); + boost::replace_all(text, "''", "'"); + boost::replace_all(text, "\\'", "'"); + } else if (first_char == '"' && last_char == '"') { + text = text.substr(1, original_text_size - 2); + boost::replace_all(text, "\"\"", "\""); + boost::replace_all(text, "\\\"", "\""); + } else if (first_char == '`' && last_char == '`') { + text = text.substr(1, original_text_size - 2); + boost::replace_all(text, "``", "`"); + boost::replace_all(text, "\\`", "`"); + } else if (first_char == '{' && last_char == '}') { + text = text.substr(1, original_text_size - 2); + boost::replace_all(text, "{{", "{"); + boost::replace_all(text, "\\{", "{"); + } else { + throw HogQLSyntaxException("Invalid string literal, must start and end with the same quote type: " + text); + } + + // Copied from clickhouse_driver/util/escape.py + boost::replace_all(text, "\\a", "\a"); + boost::replace_all(text, "\\b", "\b"); + boost::replace_all(text, "\\f", "\f"); + boost::replace_all(text, "\\n", "\n"); + boost::replace_all(text, "\\r", "\r"); + boost::replace_all(text, "\\t", "\t"); + boost::replace_all(text, "\\v", "\v"); + boost::replace_all(text, "\\0", ""); // NUL characters are ignored + boost::replace_all(text, "\\\\", "\\"); + + return text; +} + +string unquote_string_terminal(antlr4::tree::TerminalNode* node) { + string text = node->getText(); + try { + return unquote_string(text); + } catch (HogQLException& e) { + throw HogQLSyntaxException(e.what(), node->getSymbol()->getStartIndex(), node->getSymbol()->getStopIndex() + 1); + } +} diff --git a/hogql_parser/string.h b/hogql_parser/string.h new file mode 100644 index 0000000000000..b2ffc7699fd98 --- /dev/null +++ b/hogql_parser/string.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +#include "antlr4-runtime.h" + +std::string unquote_string(std::string text); + +std::string unquote_string_terminal(antlr4::tree::TerminalNode* node); diff --git a/package.json b/package.json index 7910b06f33045..7307b98745837 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,9 @@ "schema:build": "pnpm run schema:build:json && pnpm run schema:build:python", "schema:build:json": "ts-json-schema-generator -f tsconfig.json --path 'frontend/src/*.ts' --type 'QuerySchema' --no-type-check > frontend/src/queries/schema.json && prettier --write frontend/src/queries/schema.json", "schema:build:python": "datamodel-codegen --collapse-root-models --disable-timestamp --use-one-literal-as-default --use-default-kwarg --use-subclass-enum --input frontend/src/queries/schema.json --input-file-type jsonschema --output posthog/schema.py --output-model-type pydantic_v2.BaseModel && black posthog/schema.py", - "grammar:build": "cd posthog/hogql/grammar && antlr -Dlanguage=Python3 HogQLLexer.g4 && antlr -visitor -no-listener -Dlanguage=Python3 HogQLParser.g4", + "grammar:build": "npm run grammar:build:python && npm run grammar:build:cpp", + "grammar:build:python": "cd posthog/hogql/grammar && antlr -Dlanguage=Python3 HogQLLexer.g4 && antlr -visitor -no-listener -Dlanguage=Python3 HogQLParser.g4", + "grammar:build:cpp": "cd posthog/hogql/grammar && antlr -o ../../../hogql_parser -Dlanguage=Cpp HogQLLexer.g4 && antlr -o ../../../hogql_parser -visitor -no-listener -Dlanguage=Cpp HogQLParser.g4", "packages:build": "pnpm packages:build:apps-common && pnpm packages:build:lemon-ui", "packages:build:apps-common": "cd frontend/@posthog/apps-common && pnpm i && pnpm build", "packages:build:lemon-ui": "cd frontend/@posthog/lemon-ui && pnpm i && pnpm build", diff --git a/plugin-server/.editorconfig b/plugin-server/.editorconfig index b0b709a63cc2d..bb602f22e57fc 100644 --- a/plugin-server/.editorconfig +++ b/plugin-server/.editorconfig @@ -12,3 +12,6 @@ max_line_length = 120 [*.md] trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 diff --git a/posthog/hogql/errors.py b/posthog/hogql/errors.py index 320abead4f85c..5dd36c2bf7143 100644 --- a/posthog/hogql/errors.py +++ b/posthog/hogql/errors.py @@ -23,7 +23,7 @@ def __init__( class SyntaxException(HogQLException): - """Invalid HogQL syntax.""" + """The input does not conform to HogQL syntax.""" pass @@ -40,6 +40,12 @@ class NotImplementedException(HogQLException): pass +class ParsingException(HogQLException): + """An internal problem in the parser layer.""" + + pass + + class ResolverException(HogQLException): """An internal problem in the resolver layer.""" diff --git a/posthog/hogql/parse_string.py b/posthog/hogql/parse_string.py index feeed23045eaf..8e814ce36650c 100644 --- a/posthog/hogql/parse_string.py +++ b/posthog/hogql/parse_string.py @@ -1,6 +1,6 @@ from antlr4 import ParserRuleContext -from posthog.hogql.errors import HogQLException +from posthog.hogql.errors import SyntaxException def parse_string(text: str) -> str: @@ -22,7 +22,7 @@ def parse_string(text: str) -> str: text = text.replace("{{", "{") text = text.replace("\\{", "{") else: - raise HogQLException(f"Invalid string literal, must start and end with the same quote type: {text}") + raise SyntaxException(f"Invalid string literal, must start and end with the same quote type: {text}") # copied from clickhouse_driver/util/escape.py text = text.replace("\\b", "\b") @@ -30,7 +30,7 @@ def parse_string(text: str) -> str: text = text.replace("\\r", "\r") text = text.replace("\\n", "\n") text = text.replace("\\t", "\t") - text = text.replace("\\0", "\0") + text = text.replace("\\0", "") # NUL characters are ignored text = text.replace("\\a", "\a") text = text.replace("\\v", "\v") text = text.replace("\\\\", "\\") diff --git a/posthog/hogql/parser.py b/posthog/hogql/parser.py index 4d7bfee94f740..deb5799620937 100644 --- a/posthog/hogql/parser.py +++ b/posthog/hogql/parser.py @@ -12,6 +12,24 @@ from posthog.hogql.parse_string import parse_string, parse_string_literal from posthog.hogql.placeholders import replace_placeholders from posthog.hogql.timings import HogQLTimings +from hogql_parser import ( + parse_expr as _parse_expr_cpp, + parse_order_expr as _parse_order_expr_cpp, + parse_select as _parse_select_cpp, +) + +RULE_TO_PARSE_FUNCTION = { + "python": { + "expr": lambda string, start: HogQLParseTreeConverter(start=start).visit(get_parser(string).expr()), + "order_expr": lambda string: HogQLParseTreeConverter().visit(get_parser(string).orderExpr()), + "select": lambda string: HogQLParseTreeConverter().visit(get_parser(string).select()), + }, + "cpp": { + "expr": lambda string, _: _parse_expr_cpp(string), # The start arg is ignored in the C++ version + "order_expr": lambda string: _parse_order_expr_cpp(string), + "select": lambda string: _parse_select_cpp(string), + }, +} def parse_expr( @@ -19,12 +37,13 @@ def parse_expr( placeholders: Optional[Dict[str, ast.Expr]] = None, start: Optional[int] = 0, timings: Optional[HogQLTimings] = None, + *, + backend: Literal["python", "cpp"] = "python", ) -> ast.Expr: if timings is None: timings = HogQLTimings() - with timings.measure("parse_expr"): - parse_tree = get_parser(expr).expr() - node = HogQLParseTreeConverter(start=start).visit(parse_tree) + with timings.measure(f"parse_expr_{backend}"): + node = RULE_TO_PARSE_FUNCTION[backend]["expr"](expr, start) if placeholders: with timings.measure("replace_placeholders"): return replace_placeholders(node, placeholders) @@ -32,13 +51,16 @@ def parse_expr( def parse_order_expr( - order_expr: str, placeholders: Optional[Dict[str, ast.Expr]] = None, timings: Optional[HogQLTimings] = None + order_expr: str, + placeholders: Optional[Dict[str, ast.Expr]] = None, + timings: Optional[HogQLTimings] = None, + *, + backend: Literal["python", "cpp"] = "python", ) -> ast.Expr: if timings is None: timings = HogQLTimings() - with timings.measure("parse_order_expr"): - parse_tree = get_parser(order_expr).orderExpr() - node = HogQLParseTreeConverter().visit(parse_tree) + with timings.measure(f"parse_order_expr_{backend}"): + node = RULE_TO_PARSE_FUNCTION[backend]["order_expr"](order_expr) if placeholders: with timings.measure("replace_placeholders"): return replace_placeholders(node, placeholders) @@ -46,13 +68,16 @@ def parse_order_expr( def parse_select( - statement: str, placeholders: Optional[Dict[str, ast.Expr]] = None, timings: Optional[HogQLTimings] = None + statement: str, + placeholders: Optional[Dict[str, ast.Expr]] = None, + timings: Optional[HogQLTimings] = None, + *, + backend: Literal["python", "cpp"] = "python", ) -> ast.SelectQuery | ast.SelectUnionQuery: if timings is None: timings = HogQLTimings() - with timings.measure("parse_select"): - parse_tree = get_parser(statement).select() - node = HogQLParseTreeConverter().visit(parse_tree) + with timings.measure(f"parse_select_{backend}"): + node = RULE_TO_PARSE_FUNCTION[backend]["select"](statement) if placeholders: with timings.measure("replace_placeholders"): node = replace_placeholders(node, placeholders) @@ -166,7 +191,7 @@ def visitSelectStmt(self, ctx: HogQLParser.SelectStmtContext): if ctx.arrayJoinClause(): array_join_clause = ctx.arrayJoinClause() if select_query.select_from is None: - raise HogQLException("Using ARRAY JOIN without a FROM clause is not permitted") + raise SyntaxException("Using ARRAY JOIN without a FROM clause is not permitted") if array_join_clause.LEFT(): select_query.array_join_op = "LEFT ARRAY JOIN" elif array_join_clause.INNER(): @@ -176,7 +201,7 @@ def visitSelectStmt(self, ctx: HogQLParser.SelectStmtContext): select_query.array_join_list = self.visit(array_join_clause.columnExprList()) for expr in select_query.array_join_list: if not isinstance(expr, ast.Alias): - raise HogQLException("ARRAY JOIN arrays must have an alias", start=expr.start, end=expr.end) + raise SyntaxException("ARRAY JOIN arrays must have an alias", start=expr.start, end=expr.end) if ctx.topClause(): raise NotImplementedException(f"Unsupported: SelectStmt.topClause()") @@ -301,7 +326,7 @@ def visitJoinOpLeftRight(self, ctx: HogQLParser.JoinOpLeftRightContext): def visitJoinOpFull(self, ctx: HogQLParser.JoinOpFullContext): tokens = [] - if ctx.LEFT(): + if ctx.FULL(): tokens.append("FULL") if ctx.OUTER(): tokens.append("OUTER") @@ -421,6 +446,7 @@ def visitColumnExprTernaryOp(self, ctx: HogQLParser.ColumnExprTernaryOpContext): ) def visitColumnExprAlias(self, ctx: HogQLParser.ColumnExprAliasContext): + alias: str if ctx.alias(): alias = self.visit(ctx.alias()) elif ctx.identifier(): @@ -431,8 +457,8 @@ def visitColumnExprAlias(self, ctx: HogQLParser.ColumnExprAliasContext): raise NotImplementedException(f"Must specify an alias") expr = self.visit(ctx.columnExpr()) - if alias in RESERVED_KEYWORDS: - raise HogQLException(f"Alias '{alias}' is a reserved keyword") + if alias.lower() in RESERVED_KEYWORDS: + raise SyntaxException(f'"{alias}" cannot be an alias or identifier, as it\'s a reserved keyword') return ast.Alias(expr=expr, alias=alias) @@ -749,9 +775,9 @@ def visitTableExprPlaceholder(self, ctx: HogQLParser.TableExprPlaceholderContext return ast.Placeholder(field=parse_string_literal(ctx.PLACEHOLDER())) def visitTableExprAlias(self, ctx: HogQLParser.TableExprAliasContext): - alias = self.visit(ctx.alias() or ctx.identifier()) - if alias in RESERVED_KEYWORDS: - raise HogQLException(f"Alias '{alias}' is a reserved keyword") + alias: str = self.visit(ctx.alias() or ctx.identifier()) + if alias.lower() in RESERVED_KEYWORDS: + raise SyntaxException(f'"{alias}" cannot be an alias or identifier, as it\'s a reserved keyword') table = self.visit(ctx.tableExpr()) if isinstance(table, ast.JoinExpr): table.alias = alias diff --git a/posthog/hogql/test/__init__.py b/posthog/hogql/test/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/posthog/hogql/test/_test_parse_string.py b/posthog/hogql/test/_test_parse_string.py new file mode 100644 index 0000000000000..c37c9d2ee8f1e --- /dev/null +++ b/posthog/hogql/test/_test_parse_string.py @@ -0,0 +1,61 @@ +from typing import Literal +from posthog.hogql.errors import SyntaxException +from posthog.hogql.parse_string import parse_string as parse_string_py +from hogql_parser import unquote_string as unquote_string_cpp +from posthog.test.base import BaseTest + + +def parse_string_test_factory(backend: Literal["python", "cpp"]): + parse_string = parse_string_py if backend == "python" else unquote_string_cpp + + class TestParseString(BaseTest): + def test_quote_types(self): + self.assertEqual(parse_string("`asd`"), "asd") + self.assertEqual(parse_string("'asd'"), "asd") + self.assertEqual(parse_string('"asd"'), "asd") + self.assertEqual(parse_string("{asd}"), "asd") + + def test_escaped_quotes(self): + self.assertEqual(parse_string("`a``sd`"), "a`sd") + self.assertEqual(parse_string("'a''sd'"), "a'sd") + self.assertEqual(parse_string('"a""sd"'), 'a"sd') + self.assertEqual(parse_string("{a{{sd}"), "a{sd") + self.assertEqual(parse_string("{a}sd}"), "a}sd") + + def test_escaped_quotes_slash(self): + self.assertEqual(parse_string("`a\\`sd`"), "a`sd") + self.assertEqual(parse_string("'a\\'sd'"), "a'sd") + self.assertEqual(parse_string('"a\\"sd"'), 'a"sd') + self.assertEqual(parse_string("{a\\{sd}"), "a{sd") + + def test_slash_escape(self): + self.assertEqual(parse_string("`a\nsd`"), "a\nsd") + self.assertEqual(parse_string("`a\\bsd`"), "a\bsd") + self.assertEqual(parse_string("`a\\fsd`"), "a\fsd") + self.assertEqual(parse_string("`a\\rsd`"), "a\rsd") + self.assertEqual(parse_string("`a\\nsd`"), "a\nsd") + self.assertEqual(parse_string("`a\\tsd`"), "a\tsd") + self.assertEqual(parse_string("`a\\asd`"), "a\asd") + self.assertEqual(parse_string("`a\\vsd`"), "a\vsd") + self.assertEqual(parse_string("`a\\\\sd`"), "a\\sd") + self.assertEqual(parse_string("`a\\0sd`"), "asd") + + def test_slash_escape_not_escaped(self): + self.assertEqual(parse_string("`a\\xsd`"), "a\\xsd") + self.assertEqual(parse_string("`a\\ysd`"), "a\\ysd") + self.assertEqual(parse_string("`a\\osd`"), "a\\osd") + + def test_slash_escape_slash_multiple(self): + self.assertEqual(parse_string("`a\\\\nsd`"), "a\\\nsd") + self.assertEqual(parse_string("`a\\\\n\\sd`"), "a\\\n\\sd") + self.assertEqual(parse_string("`a\\\\n\\\\tsd`"), "a\\\n\\\tsd") + + def test_raises_on_mismatched_quotes(self): + self.assertRaisesMessage( + SyntaxException, + "Invalid string literal, must start and end with the same quote type: `asd'", + parse_string, + "`asd'", + ) + + return TestParseString diff --git a/posthog/hogql/test/_test_parser.py b/posthog/hogql/test/_test_parser.py new file mode 100644 index 0000000000000..fdd5dd946a2d1 --- /dev/null +++ b/posthog/hogql/test/_test_parser.py @@ -0,0 +1,1286 @@ +from typing import Literal, cast, Optional, Dict + +import math + +from posthog.hogql import ast +from posthog.hogql.errors import HogQLException, SyntaxException +from posthog.hogql.parser import parse_expr, parse_order_expr, parse_select +from posthog.hogql.visitor import clear_locations +from posthog.test.base import BaseTest + + +def parser_test_factory(backend: Literal["python", "cpp"]): + class TestParser(BaseTest): + maxDiff = None + + def _expr(self, expr: str, placeholders: Optional[Dict[str, ast.Expr]] = None) -> ast.Expr: + return clear_locations(parse_expr(expr, placeholders=placeholders, backend=backend)) + + def _select(self, query: str, placeholders: Optional[Dict[str, ast.Expr]] = None) -> ast.Expr: + return clear_locations(parse_select(query, placeholders=placeholders, backend=backend)) + + def test_numbers(self): + self.assertEqual(self._expr("1"), ast.Constant(value=1)) + self.assertEqual(self._expr("1.2"), ast.Constant(value=1.2)) + self.assertEqual(self._expr("-1"), ast.Constant(value=-1)) + self.assertEqual(self._expr("-1.1"), ast.Constant(value=-1.1)) + self.assertEqual(self._expr("0"), ast.Constant(value=0)) + self.assertEqual(self._expr("0.0"), ast.Constant(value=0)) + self.assertEqual(self._expr("-inf"), ast.Constant(value=float("-inf"))) + self.assertEqual(self._expr("inf"), ast.Constant(value=float("inf"))) + # nan-s don't like to be compared + parsed_nan = self._expr("nan") + self.assertTrue(isinstance(parsed_nan, ast.Constant)) + self.assertTrue(math.isnan(cast(ast.Constant, parsed_nan).value)) + self.assertEqual(self._expr("1e-18"), ast.Constant(value=1e-18)) + self.assertEqual(self._expr("2.34e+20"), ast.Constant(value=2.34e20)) + + def test_booleans(self): + self.assertEqual(self._expr("true"), ast.Constant(value=True)) + self.assertEqual(self._expr("TRUE"), ast.Constant(value=True)) + self.assertEqual(self._expr("false"), ast.Constant(value=False)) + + def test_null(self): + self.assertEqual(self._expr("null"), ast.Constant(value=None)) + + def test_conditional(self): + self.assertEqual( + self._expr("1 > 2 ? 1 : 2"), + ast.Call( + name="if", + args=[ + ast.CompareOperation( + op=ast.CompareOperationOp.Gt, left=ast.Constant(value=1), right=ast.Constant(value=2) + ), + ast.Constant(value=1), + ast.Constant(value=2), + ], + ), + ) + + def test_arrays(self): + self.assertEqual(self._expr("[]"), ast.Array(exprs=[])) + self.assertEqual(self._expr("[1]"), ast.Array(exprs=[ast.Constant(value=1)])) + self.assertEqual( + self._expr("[1, avg()]"), ast.Array(exprs=[ast.Constant(value=1), ast.Call(name="avg", args=[])]) + ) + self.assertEqual( + self._expr("properties['value']"), + ast.ArrayAccess(array=ast.Field(chain=["properties"]), property=ast.Constant(value="value")), + ) + self.assertEqual( + self._expr("properties[(select 'value')]"), + ast.ArrayAccess( + array=ast.Field(chain=["properties"]), + property=ast.SelectQuery(select=[ast.Constant(value="value")]), + ), + ) + self.assertEqual( + self._expr("[1,2,3][1]"), + ast.ArrayAccess( + array=ast.Array( + exprs=[ + ast.Constant(value=1), + ast.Constant(value=2), + ast.Constant(value=3), + ] + ), + property=ast.Constant(value=1), + ), + ) + + def test_tuples(self): + self.assertEqual( + self._expr("(1, avg())"), ast.Tuple(exprs=[ast.Constant(value=1), ast.Call(name="avg", args=[])]) + ) + # needs at least two values to be a tuple + self.assertEqual(self._expr("(1)"), ast.Constant(value=1)) + + def test_lambdas(self): + self.assertEqual( + self._expr("arrayMap(x -> x * 2)"), + ast.Call( + name="arrayMap", + args=[ + ast.Lambda( + args=["x"], + expr=ast.ArithmeticOperation( + op=ast.ArithmeticOperationOp.Mult, + left=ast.Field(chain=["x"]), + right=ast.Constant(value=2), + ), + ) + ], + ), + ) + self.assertEqual( + self._expr("arrayMap((x) -> x * 2)"), + ast.Call( + name="arrayMap", + args=[ + ast.Lambda( + args=["x"], + expr=ast.ArithmeticOperation( + op=ast.ArithmeticOperationOp.Mult, + left=ast.Field(chain=["x"]), + right=ast.Constant(value=2), + ), + ) + ], + ), + ) + self.assertEqual( + self._expr("arrayMap((x, y) -> x * y)"), + ast.Call( + name="arrayMap", + args=[ + ast.Lambda( + args=["x", "y"], + expr=ast.ArithmeticOperation( + op=ast.ArithmeticOperationOp.Mult, + left=ast.Field(chain=["x"]), + right=ast.Field(chain=["y"]), + ), + ) + ], + ), + ) + + def test_strings(self): + self.assertEqual(self._expr("'null'"), ast.Constant(value="null")) + self.assertEqual(self._expr("'n''ull'"), ast.Constant(value="n'ull")) + self.assertEqual(self._expr("'n''''ull'"), ast.Constant(value="n''ull")) + self.assertEqual(self._expr("'n\null'"), ast.Constant(value="n\null")) # newline passed into string + self.assertEqual(self._expr("'n\\null'"), ast.Constant(value="n\null")) # slash and 'n' passed into string + self.assertEqual(self._expr("'n\\\\ull'"), ast.Constant(value="n\\ull")) # slash and 'n' passed into string + + def test_arithmetic_operations(self): + self.assertEqual( + self._expr("1 + 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Add + ), + ) + self.assertEqual( + self._expr("1 + -2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=-2), op=ast.ArithmeticOperationOp.Add + ), + ) + self.assertEqual( + self._expr("1 - 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Sub + ), + ) + self.assertEqual( + self._expr("1 * 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mult + ), + ) + self.assertEqual( + self._expr("1 / 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Div + ), + ) + self.assertEqual( + self._expr("1 % 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mod + ), + ) + self.assertEqual( + self._expr("1 + 2 + 2"), + ast.ArithmeticOperation( + left=ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Add + ), + right=ast.Constant(value=2), + op=ast.ArithmeticOperationOp.Add, + ), + ) + self.assertEqual( + self._expr("1 * 1 * 2"), + ast.ArithmeticOperation( + left=ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Mult + ), + right=ast.Constant(value=2), + op=ast.ArithmeticOperationOp.Mult, + ), + ) + self.assertEqual( + self._expr("1 + 1 * 2"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), + right=ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mult + ), + op=ast.ArithmeticOperationOp.Add, + ), + ) + self.assertEqual( + self._expr("1 * 1 + 2"), + ast.ArithmeticOperation( + left=ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Mult + ), + right=ast.Constant(value=2), + op=ast.ArithmeticOperationOp.Add, + ), + ) + + def test_math_comparison_operations(self): + self.assertEqual( + self._expr("1 = 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Eq + ), + ) + self.assertEqual( + self._expr("1 == 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Eq + ), + ) + self.assertEqual( + self._expr("1 != 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.NotEq + ), + ) + self.assertEqual( + self._expr("1 < 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Lt + ), + ) + self.assertEqual( + self._expr("1 <= 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.LtEq + ), + ) + self.assertEqual( + self._expr("1 > 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Gt + ), + ) + self.assertEqual( + self._expr("1 >= 2"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.GtEq + ), + ) + + def test_null_comparison_operations(self): + self.assertEqual( + self._expr("1 is null"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=None), op=ast.CompareOperationOp.Eq + ), + ) + self.assertEqual( + self._expr("1 is not null"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value=None), op=ast.CompareOperationOp.NotEq + ), + ) + + def test_like_comparison_operations(self): + self.assertEqual( + self._expr("1 like 'a%sd'"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.Like + ), + ) + self.assertEqual( + self._expr("1 not like 'a%sd'"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.NotLike + ), + ) + self.assertEqual( + self._expr("1 ilike 'a%sd'"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.ILike + ), + ) + self.assertEqual( + self._expr("1 not ilike 'a%sd'"), + ast.CompareOperation( + left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.NotILike + ), + ) + + def test_and_or(self): + self.assertEqual( + self._expr("true or false"), + ast.Or(exprs=[ast.Constant(value=True), ast.Constant(value=False)]), + ) + self.assertEqual( + self._expr("true and false"), + ast.And(exprs=[ast.Constant(value=True), ast.Constant(value=False)]), + ) + self.assertEqual( + self._expr("true and not false"), + ast.And( + exprs=[ast.Constant(value=True), ast.Not(expr=ast.Constant(value=False))], + ), + ) + self.assertEqual( + self._expr("true or false or not true or 2"), + ast.Or( + exprs=[ + ast.Constant(value=True), + ast.Constant(value=False), + ast.Not(expr=ast.Constant(value=True)), + ast.Constant(value=2), + ], + ), + ) + self.assertEqual( + self._expr("true or false and not true or 2"), + ast.Or( + exprs=[ + ast.Constant(value=True), + ast.And( + exprs=[ast.Constant(value=False), ast.Not(expr=ast.Constant(value=True))], + ), + ast.Constant(value=2), + ], + ), + ) + + def test_unary_operations(self): + self.assertEqual( + self._expr("not true"), + ast.Not(expr=ast.Constant(value=True)), + ) + + def test_parens(self): + self.assertEqual( + self._expr("(1)"), + ast.Constant(value=1), + ) + self.assertEqual( + self._expr("(1 + 1)"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Add + ), + ) + self.assertEqual( + self._expr("1 + (1 + 1)"), + ast.ArithmeticOperation( + left=ast.Constant(value=1), + right=ast.ArithmeticOperation( + left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Add + ), + op=ast.ArithmeticOperationOp.Add, + ), + ) + + def test_field_access(self): + self.assertEqual( + self._expr("event"), + ast.Field(chain=["event"]), + ) + self.assertEqual( + self._expr("event like '$%'"), + ast.CompareOperation( + left=ast.Field(chain=["event"]), right=ast.Constant(value="$%"), op=ast.CompareOperationOp.Like + ), + ) + + def test_property_access(self): + self.assertEqual( + self._expr("properties.something == 1"), + ast.CompareOperation( + left=ast.Field(chain=["properties", "something"]), + right=ast.Constant(value=1), + op=ast.CompareOperationOp.Eq, + ), + ) + self.assertEqual( + self._expr("properties.something"), + ast.Field(chain=["properties", "something"]), + ) + self.assertEqual( + self._expr("properties.$something"), + ast.Field(chain=["properties", "$something"]), + ) + self.assertEqual( + self._expr("person.properties.something"), + ast.Field(chain=["person", "properties", "something"]), + ) + self.assertEqual( + self._expr("this.can.go.on.for.miles"), + ast.Field(chain=["this", "can", "go", "on", "for", "miles"]), + ) + + def test_calls(self): + self.assertEqual( + self._expr("avg()"), + ast.Call(name="avg", args=[]), + ) + self.assertEqual( + self._expr("avg(1,2,3)"), + ast.Call(name="avg", args=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), + ) + + def test_calls_with_params(self): + self.assertEqual( + self._expr("quantile(0.95)(foo)"), + ast.Call(name="quantile", args=[ast.Field(chain=["foo"])], params=[ast.Constant(value=0.95)]), + ) + + def test_alias(self): + self.assertEqual( + self._expr("1 as asd"), + ast.Alias(alias="asd", expr=ast.Constant(value=1)), + ) + self.assertEqual( + self._expr("1 as `asd`"), + ast.Alias(alias="asd", expr=ast.Constant(value=1)), + ) + self.assertEqual( + self._expr("1 as `πŸ„`"), + ast.Alias(alias="πŸ„", expr=ast.Constant(value=1)), + ) + self.assertEqual( + self._expr("(1 as b) as `πŸ„`"), + ast.Alias(alias="πŸ„", expr=ast.Alias(alias="b", expr=ast.Constant(value=1))), + ) + + def test_expr_with_ignored_sql_comment(self): + self.assertEqual( + self._expr("1 -- asd"), + ast.Constant(value=1), + ) + self.assertEqual( + self._expr("1 -- 'asd'"), + ast.Constant(value=1), + ) + self.assertEqual( + self._expr("1 -- 'πŸ„'"), + ast.Constant(value=1), + ) + + def test_placeholders(self): + self.assertEqual( + self._expr("{foo}"), + ast.Placeholder(field="foo"), + ) + self.assertEqual( + self._expr("{foo}", {"foo": ast.Constant(value="bar")}), + ast.Constant(value="bar"), + ) + self.assertEqual( + self._expr("timestamp < {timestamp}", {"timestamp": ast.Constant(value=123)}), + ast.CompareOperation( + op=ast.CompareOperationOp.Lt, + left=ast.Field(chain=["timestamp"]), + right=ast.Constant(value=123), + ), + ) + + def test_intervals(self): + self.assertEqual( + self._expr("interval 1 month"), + ast.Call(name="toIntervalMonth", args=[ast.Constant(value=1)]), + ) + self.assertEqual( + self._expr("now() - interval 1 week"), + ast.ArithmeticOperation( + op=ast.ArithmeticOperationOp.Sub, + left=ast.Call(name="now", args=[]), + right=ast.Call(name="toIntervalWeek", args=[ast.Constant(value=1)]), + ), + ) + self.assertEqual( + self._expr("interval event year"), + ast.Call(name="toIntervalYear", args=[ast.Field(chain=["event"])]), + ) + + def test_select_columns(self): + self.assertEqual(self._select("select 1"), ast.SelectQuery(select=[ast.Constant(value=1)])) + self.assertEqual( + self._select("select 1, 4, 'string'"), + ast.SelectQuery(select=[ast.Constant(value=1), ast.Constant(value=4), ast.Constant(value="string")]), + ) + + def test_select_columns_distinct(self): + self.assertEqual( + self._select("select distinct 1"), ast.SelectQuery(select=[ast.Constant(value=1)], distinct=True) + ) + + def test_select_where(self): + self.assertEqual( + self._select("select 1 where true"), + ast.SelectQuery(select=[ast.Constant(value=1)], where=ast.Constant(value=True)), + ) + self.assertEqual( + self._select("select 1 where 1 == 2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + where=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) + ), + ), + ) + + def test_select_prewhere(self): + self.assertEqual( + self._select("select 1 prewhere true"), + ast.SelectQuery(select=[ast.Constant(value=1)], prewhere=ast.Constant(value=True)), + ) + self.assertEqual( + self._select("select 1 prewhere 1 == 2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + prewhere=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) + ), + ), + ) + + def test_select_having(self): + self.assertEqual( + self._select("select 1 having true"), + ast.SelectQuery(select=[ast.Constant(value=1)], having=ast.Constant(value=True)), + ) + self.assertEqual( + self._select("select 1 having 1 == 2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + having=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) + ), + ), + ) + + def test_select_complex_wheres(self): + self.assertEqual( + self._select("select 1 prewhere 2 != 3 where 1 == 2 having 'string' like '%a%'"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + where=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) + ), + prewhere=ast.CompareOperation( + op=ast.CompareOperationOp.NotEq, left=ast.Constant(value=2), right=ast.Constant(value=3) + ), + having=ast.CompareOperation( + op=ast.CompareOperationOp.Like, + left=ast.Constant(value="string"), + right=ast.Constant(value="%a%"), + ), + ), + ) + + def test_select_from(self): + self.assertEqual( + self._select("select 1 from events"), + ast.SelectQuery( + select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) + ), + ) + self.assertEqual( + self._select("select 1 from events as e"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"]), alias="e"), + ), + ) + self.assertEqual( + self._select("select 1 from events e"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"]), alias="e"), + ), + ) + self.assertEqual( + self._select("select 1 from complex.table"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"])), + ), + ) + self.assertEqual( + self._select("select 1 from complex.table as a"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"]), alias="a"), + ), + ) + self.assertEqual( + self._select("select 1 from complex.table a"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"]), alias="a"), + ), + ) + self.assertEqual( + self._select("select 1 from (select 1 from events)"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.SelectQuery( + select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) + ) + ), + ), + ) + self.assertEqual( + self._select("select 1 from (select 1 from events) as sq"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.SelectQuery( + select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) + ), + alias="sq", + ), + ), + ) + + def test_select_from_placeholder(self): + self.assertEqual( + self._select("select 1 from {placeholder}"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Placeholder(field="placeholder")), + ), + ) + self.assertEqual( + self._select("select 1 from {placeholder}", {"placeholder": ast.Field(chain=["events"])}), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + ) + + def test_select_from_join(self): + self.assertEqual( + self._select("select 1 from events JOIN events2 ON 1"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="JOIN", + table=ast.Field(chain=["events2"]), + constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), + ), + ), + ), + ) + self.assertEqual( + self._select("select * from events LEFT OUTER JOIN events2 ON 1"), + ast.SelectQuery( + select=[ast.Field(chain=["*"])], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="LEFT OUTER JOIN", + table=ast.Field(chain=["events2"]), + constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), + ), + ), + ), + ) + self.assertEqual( + self._select("select 1 from events LEFT OUTER JOIN events2 ON 1 ANY RIGHT JOIN events3 ON 2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="LEFT OUTER JOIN", + table=ast.Field(chain=["events2"]), + constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), + next_join=ast.JoinExpr( + join_type="RIGHT ANY JOIN", + table=ast.Field(chain=["events3"]), + constraint=ast.JoinConstraint(expr=ast.Constant(value=2)), + ), + ), + ), + ), + ) + + def test_select_from_join_multiple(self): + node = self._select( + """ + SELECT event, timestamp, e.distinct_id, p.id, p.properties.email + FROM events e + LEFT JOIN person_distinct_id pdi + ON pdi.distinct_id = e.distinct_id + LEFT JOIN persons p + ON p.id = pdi.person_id + """, + self.team, + ) + self.assertEqual( + node, + ast.SelectQuery( + select=[ + ast.Field(chain=["event"]), + ast.Field(chain=["timestamp"]), + ast.Field(chain=["e", "distinct_id"]), + ast.Field(chain=["p", "id"]), + ast.Field(chain=["p", "properties", "email"]), + ], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + alias="e", + next_join=ast.JoinExpr( + join_type="LEFT JOIN", + table=ast.Field(chain=["person_distinct_id"]), + alias="pdi", + constraint=ast.JoinConstraint( + expr=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, + left=ast.Field(chain=["pdi", "distinct_id"]), + right=ast.Field(chain=["e", "distinct_id"]), + ) + ), + next_join=ast.JoinExpr( + join_type="LEFT JOIN", + table=ast.Field(chain=["persons"]), + alias="p", + constraint=ast.JoinConstraint( + expr=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, + left=ast.Field(chain=["p", "id"]), + right=ast.Field(chain=["pdi", "person_id"]), + ) + ), + ), + ), + ), + ), + ) + + def test_select_from_cross_join(self): + self.assertEqual( + self._select("select 1 from events CROSS JOIN events2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="CROSS JOIN", + table=ast.Field(chain=["events2"]), + ), + ), + ), + ) + self.assertEqual( + self._select("select 1 from events CROSS JOIN events2 CROSS JOIN events3"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="CROSS JOIN", + table=ast.Field(chain=["events2"]), + next_join=ast.JoinExpr( + join_type="CROSS JOIN", + table=ast.Field(chain=["events3"]), + ), + ), + ), + ), + ) + self.assertEqual( + self._select("select 1 from events, events2 CROSS JOIN events3"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + next_join=ast.JoinExpr( + join_type="CROSS JOIN", + table=ast.Field(chain=["events2"]), + next_join=ast.JoinExpr( + join_type="CROSS JOIN", + table=ast.Field(chain=["events3"]), + ), + ), + ), + ), + ) + + def test_select_array_join(self): + self.assertEqual( + self._select("select a from events ARRAY JOIN [1,2,3] a"), + ast.SelectQuery( + select=[ast.Field(chain=["a"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + array_join_op="ARRAY JOIN", + array_join_list=[ + ast.Alias( + expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), + alias="a", + ) + ], + ), + ) + self.assertEqual( + self._select("select a from events INNER ARRAY JOIN [1,2,3] a"), + ast.SelectQuery( + select=[ast.Field(chain=["a"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + array_join_op="INNER ARRAY JOIN", + array_join_list=[ + ast.Alias( + expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), + alias="a", + ) + ], + ), + ) + self.assertEqual( + self._select("select 1, b from events LEFT ARRAY JOIN [1,2,3] a, [4,5,6] AS b"), + ast.SelectQuery( + select=[ast.Constant(value=1), ast.Field(chain=["b"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + array_join_op="LEFT ARRAY JOIN", + array_join_list=[ + ast.Alias( + expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), + alias="a", + ), + ast.Alias( + expr=ast.Array(exprs=[ast.Constant(value=4), ast.Constant(value=5), ast.Constant(value=6)]), + alias="b", + ), + ], + ), + ) + + def test_select_array_join_errors(self): + with self.assertRaises(HogQLException) as e: + self._select("select a from events ARRAY JOIN [1,2,3]") + self.assertEqual(str(e.exception), "ARRAY JOIN arrays must have an alias") + self.assertEqual(e.exception.start, 32) + self.assertEqual(e.exception.end, 39) + + with self.assertRaises(HogQLException) as e: + self._select("select a ARRAY JOIN [1,2,3]") + self.assertEqual(str(e.exception), "Using ARRAY JOIN without a FROM clause is not permitted") + self.assertEqual(e.exception.start, 0) + self.assertEqual(e.exception.end, 27) + + def test_select_group_by(self): + self.assertEqual( + self._select("select 1 from events GROUP BY 1, event"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + group_by=[ast.Constant(value=1), ast.Field(chain=["event"])], + ), + ) + + def test_order_by(self): + self.assertEqual( + parse_order_expr("1 ASC"), + ast.OrderExpr(expr=ast.Constant(value=1, start=0, end=1), order="ASC", start=0, end=5), + ) + self.assertEqual( + parse_order_expr("event"), + ast.OrderExpr(expr=ast.Field(chain=["event"], start=0, end=5), order="ASC", start=0, end=5), + ) + self.assertEqual( + parse_order_expr("timestamp DESC"), + ast.OrderExpr(expr=ast.Field(chain=["timestamp"], start=0, end=9), order="DESC", start=0, end=14), + ) + + def test_select_order_by(self): + self.assertEqual( + self._select("select 1 from events ORDER BY 1 ASC, event, timestamp DESC"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + order_by=[ + ast.OrderExpr(expr=ast.Constant(value=1), order="ASC"), + ast.OrderExpr(expr=ast.Field(chain=["event"]), order="ASC"), + ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC"), + ], + ), + ) + + def test_select_limit_offset(self): + self.assertEqual( + self._select("select 1 from events LIMIT 1"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + limit=ast.Constant(value=1), + ), + ) + self.assertEqual( + self._select("select 1 from events LIMIT 1 OFFSET 3"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + limit=ast.Constant(value=1), + offset=ast.Constant(value=3), + ), + ) + self.assertEqual( + self._select("select 1 from events OFFSET 3"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + limit=None, + offset=ast.Constant(value=3), + ), + ) + self.assertEqual( + self._select("select 1 from events ORDER BY 1 LIMIT 1 WITH TIES"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + order_by=[ast.OrderExpr(expr=ast.Constant(value=1), order="ASC")], + limit=ast.Constant(value=1), + limit_with_ties=True, + offset=None, + ), + ) + self.assertEqual( + self._select("select 1 from events ORDER BY 1 LIMIT 1, 3 WITH TIES"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + order_by=[ast.OrderExpr(expr=ast.Constant(value=1), order="ASC")], + limit=ast.Constant(value=1), + limit_with_ties=True, + offset=ast.Constant(value=3), + ), + ) + self.assertEqual( + self._select("select 1 from events LIMIT 1 OFFSET 3 BY 1, event"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + limit=ast.Constant(value=1), + offset=ast.Constant(value=3), + limit_by=[ast.Constant(value=1), ast.Field(chain=["event"])], + ), + ) + + def test_select_placeholders(self): + self.assertEqual( + self._select("select 1 where 1 == {hogql_val_1}"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + where=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, + left=ast.Constant(value=1), + right=ast.Placeholder(field="hogql_val_1"), + ), + ), + ) + self.assertEqual( + self._select("select 1 where 1 == {hogql_val_1}", {"hogql_val_1": ast.Constant(value="bar")}), + ast.SelectQuery( + select=[ast.Constant(value=1)], + where=ast.CompareOperation( + op=ast.CompareOperationOp.Eq, + left=ast.Constant(value=1), + right=ast.Constant(value="bar"), + ), + ), + ) + + def test_select_union_all(self): + self.assertEqual( + self._select("select 1 union all select 2 union all select 3"), + ast.SelectUnionQuery( + select_queries=[ + ast.SelectQuery(select=[ast.Constant(value=1)]), + ast.SelectQuery(select=[ast.Constant(value=2)]), + ast.SelectQuery(select=[ast.Constant(value=3)]), + ] + ), + ) + + def test_sample_clause(self): + self.assertEqual( + self._select("select 1 from events sample 1/10 offset 999"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + sample=ast.SampleExpr( + offset_value=ast.RatioExpr(left=ast.Constant(value=999)), + sample_value=ast.RatioExpr(left=ast.Constant(value=1), right=ast.Constant(value=10)), + ), + ), + ), + ) + + self.assertEqual( + self._select("select 1 from events sample 0.1 offset 999"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + sample=ast.SampleExpr( + offset_value=ast.RatioExpr(left=ast.Constant(value=999)), + sample_value=ast.RatioExpr( + left=ast.Constant(value=0.1), + ), + ), + ), + ), + ) + + self.assertEqual( + self._select("select 1 from events sample 10 offset 1/2"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + sample=ast.SampleExpr( + offset_value=ast.RatioExpr(left=ast.Constant(value=1), right=ast.Constant(value=2)), + sample_value=ast.RatioExpr( + left=ast.Constant(value=10), + ), + ), + ), + ), + ) + + self.assertEqual( + self._select("select 1 from events sample 10"), + ast.SelectQuery( + select=[ast.Constant(value=1)], + select_from=ast.JoinExpr( + table=ast.Field(chain=["events"]), + sample=ast.SampleExpr( + sample_value=ast.RatioExpr( + left=ast.Constant(value=10), + ), + ), + ), + ), + ) + + def test_select_with_columns(self): + self.assertEqual( + self._select("with event as boo select boo from events"), + ast.SelectQuery( + ctes={"boo": ast.CTE(name="boo", expr=ast.Field(chain=["event"]), cte_type="column")}, + select=[ast.Field(chain=["boo"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + ) + self.assertEqual( + self._select("with count() as kokku select kokku from events"), + ast.SelectQuery( + ctes={"kokku": ast.CTE(name="kokku", expr=ast.Call(name="count", args=[]), cte_type="column")}, + select=[ast.Field(chain=["kokku"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + ) + + def test_select_with_subqueries(self): + self.assertEqual( + self._select("with customers as (select 'yes' from events) select * from customers"), + ast.SelectQuery( + ctes={ + "customers": ast.CTE( + name="customers", + expr=ast.SelectQuery( + select=[ast.Constant(value="yes")], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + cte_type="subquery", + ) + }, + select=[ast.Field(chain=["*"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["customers"])), + ), + ) + + def test_select_with_mixed(self): + self.assertEqual( + self._select("with happy as (select 'yes' from events), ':(' as sad select sad from happy"), + ast.SelectQuery( + ctes={ + "happy": ast.CTE( + name="happy", + expr=ast.SelectQuery( + select=[ast.Constant(value="yes")], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + cte_type="subquery", + ), + "sad": ast.CTE(name="sad", expr=ast.Constant(value=":("), cte_type="column"), + }, + select=[ast.Field(chain=["sad"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["happy"])), + ), + ) + + def test_ctes_subquery_recursion(self): + query = "with users as (select event, timestamp as tt from events ), final as ( select tt from users ) select * from final" + self.assertEqual( + self._select(query), + ast.SelectQuery( + ctes={ + "users": ast.CTE( + name="users", + expr=ast.SelectQuery( + select=[ + ast.Field(chain=["event"]), + ast.Alias(alias="tt", expr=ast.Field(chain=["timestamp"])), + ], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ), + cte_type="subquery", + ), + "final": ast.CTE( + name="final", + expr=ast.SelectQuery( + select=[ast.Field(chain=["tt"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["users"])), + ), + cte_type="subquery", + ), + }, + select=[ast.Field(chain=["*"])], + select_from=ast.JoinExpr(table=ast.Field(chain=["final"])), + ), + ) + + def test_case_when(self): + self.assertEqual( + self._expr("case when 1 then 2 else 3 end"), + ast.Call(name="if", args=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), + ) + + def test_case_when_many(self): + self.assertEqual( + self._expr("case when 1 then 2 when 3 then 4 else 5 end"), + ast.Call( + name="multiIf", + args=[ + ast.Constant(value=1), + ast.Constant(value=2), + ast.Constant(value=3), + ast.Constant(value=4), + ast.Constant(value=5), + ], + ), + ) + + def test_case_when_case(self): + self.assertEqual( + self._expr("case 0 when 1 then 2 when 3 then 4 else 5 end"), + ast.Call( + name="transform", + args=[ + ast.Constant(value=0), + ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=3)]), + ast.Array(exprs=[ast.Constant(value=2), ast.Constant(value=4)]), + ast.Constant(value=5), + ], + ), + ) + + def test_window_functions(self): + query = "SELECT person.id, min(timestamp) over (PARTITION by person.id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS timestamp FROM events" + expr = self._select(query) + expected = ast.SelectQuery( + select=[ + ast.Field(chain=["person", "id"]), + ast.Alias( + alias="timestamp", + expr=ast.WindowFunction( + name="min", + args=[ast.Field(chain=["timestamp"])], + over_expr=ast.WindowExpr( + partition_by=[ast.Field(chain=["person", "id"])], + order_by=[ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC")], + frame_method="ROWS", + frame_start=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=None), + frame_end=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=1), + ), + ), + ), + ], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + ) + self.assertEqual(expr, expected) + + def test_window_functions_with_window(self): + query = "SELECT person.id, min(timestamp) over win1 AS timestamp FROM events WINDOW win1 as (PARTITION by person.id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)" + expr = self._select(query) + expected = ast.SelectQuery( + select=[ + ast.Field(chain=["person", "id"]), + ast.Alias( + alias="timestamp", + expr=ast.WindowFunction( + name="min", + args=[ast.Field(chain=["timestamp"])], + over_identifier="win1", + ), + ), + ], + select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), + window_exprs={ + "win1": ast.WindowExpr( + partition_by=[ast.Field(chain=["person", "id"])], + order_by=[ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC")], + frame_method="ROWS", + frame_start=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=None), + frame_end=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=1), + ) + }, + ) + self.assertEqual(expr, expected) + + def test_property_access_with_arrays_zero_index_error(self): + query = f"SELECT properties.something[0] FROM events" + with self.assertRaisesMessage( + SyntaxException, "SQL indexes start from one, not from zero. E.g: array[1]" + ) as e: + self._select(query) + self.assertEqual(e.exception.start, 7) + self.assertEqual(e.exception.end, 30) + + def test_property_access_with_tuples_zero_index_error(self): + query = f"SELECT properties.something.0 FROM events" + with self.assertRaisesMessage( + SyntaxException, "SQL indexes start from one, not from zero. E.g: array[1]" + ) as e: + self._select(query) + self.assertEqual(e.exception.start, 7) + self.assertEqual(e.exception.end, 29) + + def test_reserved_keyword_alias_error(self): + query = f"SELECT 0 AS trUE FROM events" + with self.assertRaisesMessage( + SyntaxException, '"trUE" cannot be an alias or identifier, as it\'s a reserved keyword' + ) as e: + self._select(query) + self.assertEqual(e.exception.start, 7) + self.assertEqual(e.exception.end, 16) + + def test_malformed_sql(self): + query = "SELEC 2" + with self.assertRaisesMessage( + SyntaxException, "mismatched input 'SELEC' expecting {SELECT, WITH, '('}" + ) as e: + self._select(query) + self.assertEqual(e.exception.start, 0) + self.assertEqual(e.exception.end, 7) + + return TestParser diff --git a/posthog/hogql/test/test_metadata.py b/posthog/hogql/test/test_metadata.py index f833cc39ef290..46f9e13cc04f3 100644 --- a/posthog/hogql/test/test_metadata.py +++ b/posthog/hogql/test/test_metadata.py @@ -84,7 +84,7 @@ def test_metadata_expr_parse_error(self): "inputSelect": None, "errors": [ { - "message": "Alias 'true' is a reserved keyword", + "message": '"true" cannot be an alias or identifier, as it\'s a reserved keyword', "start": 0, "end": 9, "fix": None, diff --git a/posthog/hogql/test/test_parse_string.py b/posthog/hogql/test/test_parse_string.py deleted file mode 100644 index 2cac2ac827900..0000000000000 --- a/posthog/hogql/test/test_parse_string.py +++ /dev/null @@ -1,45 +0,0 @@ -from posthog.hogql.parse_string import parse_string -from posthog.test.base import BaseTest - - -class TestParseString(BaseTest): - def test_quote_types(self): - self.assertEqual(parse_string("`asd`"), "asd") - self.assertEqual(parse_string("'asd'"), "asd") - self.assertEqual(parse_string('"asd"'), "asd") - self.assertEqual(parse_string("{asd}"), "asd") - - def test_escaped_quotes(self): - self.assertEqual(parse_string("`a``sd`"), "a`sd") - self.assertEqual(parse_string("'a''sd'"), "a'sd") - self.assertEqual(parse_string('"a""sd"'), 'a"sd') - self.assertEqual(parse_string("{a{{sd}"), "a{sd") - self.assertEqual(parse_string("{a}sd}"), "a}sd") - - def test_escaped_quotes_slash(self): - self.assertEqual(parse_string("`a\\`sd`"), "a`sd") - self.assertEqual(parse_string("'a\\'sd'"), "a'sd") - self.assertEqual(parse_string('"a\\"sd"'), 'a"sd') - self.assertEqual(parse_string("{a\\{sd}"), "a{sd") - - def test_slash_escape(self): - self.assertEqual(parse_string("`a\nsd`"), "a\nsd") - self.assertEqual(parse_string("`a\\bsd`"), "a\bsd") - self.assertEqual(parse_string("`a\\fsd`"), "a\fsd") - self.assertEqual(parse_string("`a\\rsd`"), "a\rsd") - self.assertEqual(parse_string("`a\\nsd`"), "a\nsd") - self.assertEqual(parse_string("`a\\tsd`"), "a\tsd") - self.assertEqual(parse_string("`a\\0sd`"), "a\0sd") - self.assertEqual(parse_string("`a\\asd`"), "a\asd") - self.assertEqual(parse_string("`a\\vsd`"), "a\vsd") - self.assertEqual(parse_string("`a\\\\sd`"), "a\\sd") - - def test_slash_escape_not_escaped(self): - self.assertEqual(parse_string("`a\\xsd`"), "a\\xsd") - self.assertEqual(parse_string("`a\\ysd`"), "a\\ysd") - self.assertEqual(parse_string("`a\\osd`"), "a\\osd") - - def test_slash_escape_slash_multiple(self): - self.assertEqual(parse_string("`a\\\\nsd`"), "a\\\nsd") - self.assertEqual(parse_string("`a\\\\n\\sd`"), "a\\\n\\sd") - self.assertEqual(parse_string("`a\\\\n\\\\tsd`"), "a\\\n\\\tsd") diff --git a/posthog/hogql/test/test_parse_string_cpp.py b/posthog/hogql/test/test_parse_string_cpp.py new file mode 100644 index 0000000000000..3faf87c845a88 --- /dev/null +++ b/posthog/hogql/test/test_parse_string_cpp.py @@ -0,0 +1,5 @@ +from ._test_parse_string import parse_string_test_factory + + +class TestParseStringPython(parse_string_test_factory("cpp")): + pass diff --git a/posthog/hogql/test/test_parse_string_python.py b/posthog/hogql/test/test_parse_string_python.py new file mode 100644 index 0000000000000..0ad514f7e7575 --- /dev/null +++ b/posthog/hogql/test/test_parse_string_python.py @@ -0,0 +1,5 @@ +from ._test_parse_string import parse_string_test_factory + + +class TestParseStringPython(parse_string_test_factory("python")): + pass diff --git a/posthog/hogql/test/test_parser.py b/posthog/hogql/test/test_parser.py deleted file mode 100644 index 660f3ff8bf915..0000000000000 --- a/posthog/hogql/test/test_parser.py +++ /dev/null @@ -1,1235 +0,0 @@ -from typing import cast, Optional, Dict - -import math - -from posthog.hogql import ast -from posthog.hogql.errors import HogQLException -from posthog.hogql.parser import parse_expr, parse_order_expr, parse_select -from posthog.hogql.visitor import clear_locations -from posthog.test.base import BaseTest - - -class TestParser(BaseTest): - maxDiff = None - - def _expr(self, expr: str, placeholders: Optional[Dict[str, ast.Expr]] = None) -> ast.Expr: - return clear_locations(parse_expr(expr, placeholders=placeholders)) - - def _select(self, query: str, placeholders: Optional[Dict[str, ast.Expr]] = None) -> ast.Expr: - return clear_locations(parse_select(query, placeholders=placeholders)) - - def test_numbers(self): - self.assertEqual(self._expr("1"), ast.Constant(value=1)) - self.assertEqual(self._expr("1.2"), ast.Constant(value=1.2)) - self.assertEqual(self._expr("-1"), ast.Constant(value=-1)) - self.assertEqual(self._expr("-1.1"), ast.Constant(value=-1.1)) - self.assertEqual(self._expr("0"), ast.Constant(value=0)) - self.assertEqual(self._expr("0.0"), ast.Constant(value=0)) - self.assertEqual(self._expr("-inf"), ast.Constant(value=float("-inf"))) - self.assertEqual(self._expr("inf"), ast.Constant(value=float("inf"))) - # nan-s don't like to be compared - parsed_nan = self._expr("nan") - self.assertTrue(isinstance(parsed_nan, ast.Constant)) - self.assertTrue(math.isnan(cast(ast.Constant, parsed_nan).value)) - self.assertEqual(self._expr("1e-18"), ast.Constant(value=1e-18)) - self.assertEqual(self._expr("2.34e+20"), ast.Constant(value=2.34e20)) - - def test_booleans(self): - self.assertEqual(self._expr("true"), ast.Constant(value=True)) - self.assertEqual(self._expr("TRUE"), ast.Constant(value=True)) - self.assertEqual(self._expr("false"), ast.Constant(value=False)) - - def test_null(self): - self.assertEqual(self._expr("null"), ast.Constant(value=None)) - - def test_conditional(self): - self.assertEqual( - self._expr("1 > 2 ? 1 : 2"), - ast.Call( - name="if", - args=[ - ast.CompareOperation( - op=ast.CompareOperationOp.Gt, left=ast.Constant(value=1), right=ast.Constant(value=2) - ), - ast.Constant(value=1), - ast.Constant(value=2), - ], - ), - ) - - def test_arrays(self): - self.assertEqual(self._expr("[]"), ast.Array(exprs=[])) - self.assertEqual(self._expr("[1]"), ast.Array(exprs=[ast.Constant(value=1)])) - self.assertEqual( - self._expr("[1, avg()]"), ast.Array(exprs=[ast.Constant(value=1), ast.Call(name="avg", args=[])]) - ) - self.assertEqual( - self._expr("properties['value']"), - ast.ArrayAccess(array=ast.Field(chain=["properties"]), property=ast.Constant(value="value")), - ) - self.assertEqual( - self._expr("properties[(select 'value')]"), - ast.ArrayAccess( - array=ast.Field(chain=["properties"]), property=ast.SelectQuery(select=[ast.Constant(value="value")]) - ), - ) - self.assertEqual( - self._expr("[1,2,3][1]"), - ast.ArrayAccess( - array=ast.Array( - exprs=[ - ast.Constant(value=1), - ast.Constant(value=2), - ast.Constant(value=3), - ] - ), - property=ast.Constant(value=1), - ), - ) - - def test_tuples(self): - self.assertEqual( - self._expr("(1, avg())"), ast.Tuple(exprs=[ast.Constant(value=1), ast.Call(name="avg", args=[])]) - ) - # needs at least two values to be a tuple - self.assertEqual(self._expr("(1)"), ast.Constant(value=1)) - - def test_lambdas(self): - self.assertEqual( - self._expr("arrayMap(x -> x * 2)"), - ast.Call( - name="arrayMap", - args=[ - ast.Lambda( - args=["x"], - expr=ast.ArithmeticOperation( - op=ast.ArithmeticOperationOp.Mult, left=ast.Field(chain=["x"]), right=ast.Constant(value=2) - ), - ) - ], - ), - ) - self.assertEqual( - self._expr("arrayMap((x) -> x * 2)"), - ast.Call( - name="arrayMap", - args=[ - ast.Lambda( - args=["x"], - expr=ast.ArithmeticOperation( - op=ast.ArithmeticOperationOp.Mult, left=ast.Field(chain=["x"]), right=ast.Constant(value=2) - ), - ) - ], - ), - ) - self.assertEqual( - self._expr("arrayMap((x, y) -> x * y)"), - ast.Call( - name="arrayMap", - args=[ - ast.Lambda( - args=["x", "y"], - expr=ast.ArithmeticOperation( - op=ast.ArithmeticOperationOp.Mult, left=ast.Field(chain=["x"]), right=ast.Field(chain=["y"]) - ), - ) - ], - ), - ) - - def test_strings(self): - self.assertEqual(self._expr("'null'"), ast.Constant(value="null")) - self.assertEqual(self._expr("'n''ull'"), ast.Constant(value="n'ull")) - self.assertEqual(self._expr("'n''''ull'"), ast.Constant(value="n''ull")) - self.assertEqual(self._expr("'n\null'"), ast.Constant(value="n\null")) # newline passed into string - self.assertEqual(self._expr("'n\\null'"), ast.Constant(value="n\null")) # slash and 'n' passed into string - self.assertEqual(self._expr("'n\\\\ull'"), ast.Constant(value="n\\ull")) # slash and 'n' passed into string - - def test_arithmetic_operations(self): - self.assertEqual( - self._expr("1 + 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Add - ), - ) - self.assertEqual( - self._expr("1 + -2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=-2), op=ast.ArithmeticOperationOp.Add - ), - ) - self.assertEqual( - self._expr("1 - 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Sub - ), - ) - self.assertEqual( - self._expr("1 * 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mult - ), - ) - self.assertEqual( - self._expr("1 / 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Div - ), - ) - self.assertEqual( - self._expr("1 % 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mod - ), - ) - self.assertEqual( - self._expr("1 + 2 + 2"), - ast.ArithmeticOperation( - left=ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Add - ), - right=ast.Constant(value=2), - op=ast.ArithmeticOperationOp.Add, - ), - ) - self.assertEqual( - self._expr("1 * 1 * 2"), - ast.ArithmeticOperation( - left=ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Mult - ), - right=ast.Constant(value=2), - op=ast.ArithmeticOperationOp.Mult, - ), - ) - self.assertEqual( - self._expr("1 + 1 * 2"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), - right=ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.ArithmeticOperationOp.Mult - ), - op=ast.ArithmeticOperationOp.Add, - ), - ) - self.assertEqual( - self._expr("1 * 1 + 2"), - ast.ArithmeticOperation( - left=ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Mult - ), - right=ast.Constant(value=2), - op=ast.ArithmeticOperationOp.Add, - ), - ) - - def test_math_comparison_operations(self): - self.assertEqual( - self._expr("1 = 2"), - ast.CompareOperation(left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Eq), - ) - self.assertEqual( - self._expr("1 == 2"), - ast.CompareOperation(left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Eq), - ) - self.assertEqual( - self._expr("1 != 2"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.NotEq - ), - ) - self.assertEqual( - self._expr("1 < 2"), - ast.CompareOperation(left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Lt), - ) - self.assertEqual( - self._expr("1 <= 2"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.LtEq - ), - ) - self.assertEqual( - self._expr("1 > 2"), - ast.CompareOperation(left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.Gt), - ) - self.assertEqual( - self._expr("1 >= 2"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value=2), op=ast.CompareOperationOp.GtEq - ), - ) - - def test_null_comparison_operations(self): - self.assertEqual( - self._expr("1 is null"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value=None), op=ast.CompareOperationOp.Eq - ), - ) - self.assertEqual( - self._expr("1 is not null"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value=None), op=ast.CompareOperationOp.NotEq - ), - ) - - def test_like_comparison_operations(self): - self.assertEqual( - self._expr("1 like 'a%sd'"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.Like - ), - ) - self.assertEqual( - self._expr("1 not like 'a%sd'"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.NotLike - ), - ) - self.assertEqual( - self._expr("1 ilike 'a%sd'"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.ILike - ), - ) - self.assertEqual( - self._expr("1 not ilike 'a%sd'"), - ast.CompareOperation( - left=ast.Constant(value=1), right=ast.Constant(value="a%sd"), op=ast.CompareOperationOp.NotILike - ), - ) - - def test_and_or(self): - self.assertEqual( - self._expr("true or false"), - ast.Or(exprs=[ast.Constant(value=True), ast.Constant(value=False)]), - ) - self.assertEqual( - self._expr("true and false"), - ast.And(exprs=[ast.Constant(value=True), ast.Constant(value=False)]), - ) - self.assertEqual( - self._expr("true and not false"), - ast.And( - exprs=[ast.Constant(value=True), ast.Not(expr=ast.Constant(value=False))], - ), - ) - self.assertEqual( - self._expr("true or false or not true or 2"), - ast.Or( - exprs=[ - ast.Constant(value=True), - ast.Constant(value=False), - ast.Not(expr=ast.Constant(value=True)), - ast.Constant(value=2), - ], - ), - ) - self.assertEqual( - self._expr("true or false and not true or 2"), - ast.Or( - exprs=[ - ast.Constant(value=True), - ast.And( - exprs=[ast.Constant(value=False), ast.Not(expr=ast.Constant(value=True))], - ), - ast.Constant(value=2), - ], - ), - ) - - def test_unary_operations(self): - self.assertEqual( - self._expr("not true"), - ast.Not(expr=ast.Constant(value=True)), - ) - - def test_parens(self): - self.assertEqual( - self._expr("(1)"), - ast.Constant(value=1), - ) - self.assertEqual( - self._expr("(1 + 1)"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Add - ), - ) - self.assertEqual( - self._expr("1 + (1 + 1)"), - ast.ArithmeticOperation( - left=ast.Constant(value=1), - right=ast.ArithmeticOperation( - left=ast.Constant(value=1), right=ast.Constant(value=1), op=ast.ArithmeticOperationOp.Add - ), - op=ast.ArithmeticOperationOp.Add, - ), - ) - - def test_field_access(self): - self.assertEqual( - self._expr("event"), - ast.Field(chain=["event"]), - ) - self.assertEqual( - self._expr("event like '$%'"), - ast.CompareOperation( - left=ast.Field(chain=["event"]), right=ast.Constant(value="$%"), op=ast.CompareOperationOp.Like - ), - ) - - def test_property_access(self): - self.assertEqual( - self._expr("properties.something == 1"), - ast.CompareOperation( - left=ast.Field(chain=["properties", "something"]), - right=ast.Constant(value=1), - op=ast.CompareOperationOp.Eq, - ), - ) - self.assertEqual( - self._expr("properties.something"), - ast.Field(chain=["properties", "something"]), - ) - self.assertEqual( - self._expr("properties.$something"), - ast.Field(chain=["properties", "$something"]), - ) - self.assertEqual( - self._expr("person.properties.something"), - ast.Field(chain=["person", "properties", "something"]), - ) - self.assertEqual( - self._expr("this.can.go.on.for.miles"), - ast.Field(chain=["this", "can", "go", "on", "for", "miles"]), - ) - - def test_calls(self): - self.assertEqual( - self._expr("avg()"), - ast.Call(name="avg", args=[]), - ) - self.assertEqual( - self._expr("avg(1,2,3)"), - ast.Call(name="avg", args=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), - ) - - def test_calls_with_params(self): - self.assertEqual( - self._expr("quantile(0.95)(foo)"), - ast.Call(name="quantile", args=[ast.Field(chain=["foo"])], params=[ast.Constant(value=0.95)]), - ) - - def test_alias(self): - self.assertEqual( - self._expr("1 as asd"), - ast.Alias(alias="asd", expr=ast.Constant(value=1)), - ) - self.assertEqual( - self._expr("1 as `asd`"), - ast.Alias(alias="asd", expr=ast.Constant(value=1)), - ) - self.assertEqual( - self._expr("1 as `πŸ„`"), - ast.Alias(alias="πŸ„", expr=ast.Constant(value=1)), - ) - self.assertEqual( - self._expr("(1 as b) as `πŸ„`"), - ast.Alias(alias="πŸ„", expr=ast.Alias(alias="b", expr=ast.Constant(value=1))), - ) - - def test_expr_with_ignored_sql_comment(self): - self.assertEqual( - self._expr("1 -- asd"), - ast.Constant(value=1), - ) - self.assertEqual( - self._expr("1 -- 'asd'"), - ast.Constant(value=1), - ) - self.assertEqual( - self._expr("1 -- 'πŸ„'"), - ast.Constant(value=1), - ) - - def test_placeholders(self): - self.assertEqual( - self._expr("{foo}"), - ast.Placeholder(field="foo"), - ) - self.assertEqual( - self._expr("{foo}", {"foo": ast.Constant(value="bar")}), - ast.Constant(value="bar"), - ) - self.assertEqual( - self._expr("timestamp < {timestamp}", {"timestamp": ast.Constant(value=123)}), - ast.CompareOperation( - op=ast.CompareOperationOp.Lt, - left=ast.Field(chain=["timestamp"]), - right=ast.Constant(value=123), - ), - ) - - def test_intervals(self): - self.assertEqual( - self._expr("interval 1 month"), - ast.Call(name="toIntervalMonth", args=[ast.Constant(value=1)]), - ) - self.assertEqual( - self._expr("now() - interval 1 week"), - ast.ArithmeticOperation( - op=ast.ArithmeticOperationOp.Sub, - left=ast.Call(name="now", args=[]), - right=ast.Call(name="toIntervalWeek", args=[ast.Constant(value=1)]), - ), - ) - self.assertEqual( - self._expr("interval event year"), - ast.Call(name="toIntervalYear", args=[ast.Field(chain=["event"])]), - ) - - def test_select_columns(self): - self.assertEqual(self._select("select 1"), ast.SelectQuery(select=[ast.Constant(value=1)])) - self.assertEqual( - self._select("select 1, 4, 'string'"), - ast.SelectQuery(select=[ast.Constant(value=1), ast.Constant(value=4), ast.Constant(value="string")]), - ) - - def test_select_columns_distinct(self): - self.assertEqual( - self._select("select distinct 1"), ast.SelectQuery(select=[ast.Constant(value=1)], distinct=True) - ) - - def test_select_where(self): - self.assertEqual( - self._select("select 1 where true"), - ast.SelectQuery(select=[ast.Constant(value=1)], where=ast.Constant(value=True)), - ) - self.assertEqual( - self._select("select 1 where 1 == 2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - where=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) - ), - ), - ) - - def test_select_prewhere(self): - self.assertEqual( - self._select("select 1 prewhere true"), - ast.SelectQuery(select=[ast.Constant(value=1)], prewhere=ast.Constant(value=True)), - ) - self.assertEqual( - self._select("select 1 prewhere 1 == 2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - prewhere=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) - ), - ), - ) - - def test_select_having(self): - self.assertEqual( - self._select("select 1 having true"), - ast.SelectQuery(select=[ast.Constant(value=1)], having=ast.Constant(value=True)), - ) - self.assertEqual( - self._select("select 1 having 1 == 2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - having=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) - ), - ), - ) - - def test_select_complex_wheres(self): - self.assertEqual( - self._select("select 1 prewhere 2 != 3 where 1 == 2 having 'string' like '%a%'"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - where=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, left=ast.Constant(value=1), right=ast.Constant(value=2) - ), - prewhere=ast.CompareOperation( - op=ast.CompareOperationOp.NotEq, left=ast.Constant(value=2), right=ast.Constant(value=3) - ), - having=ast.CompareOperation( - op=ast.CompareOperationOp.Like, left=ast.Constant(value="string"), right=ast.Constant(value="%a%") - ), - ), - ) - - def test_select_from(self): - self.assertEqual( - self._select("select 1 from events"), - ast.SelectQuery( - select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) - ), - ) - self.assertEqual( - self._select("select 1 from events as e"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"]), alias="e"), - ), - ) - self.assertEqual( - self._select("select 1 from events e"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"]), alias="e"), - ), - ) - self.assertEqual( - self._select("select 1 from complex.table"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"])), - ), - ) - self.assertEqual( - self._select("select 1 from complex.table as a"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"]), alias="a"), - ), - ) - self.assertEqual( - self._select("select 1 from complex.table a"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["complex", "table"]), alias="a"), - ), - ) - self.assertEqual( - self._select("select 1 from (select 1 from events)"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.SelectQuery( - select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) - ) - ), - ), - ) - self.assertEqual( - self._select("select 1 from (select 1 from events) as sq"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.SelectQuery( - select=[ast.Constant(value=1)], select_from=ast.JoinExpr(table=ast.Field(chain=["events"])) - ), - alias="sq", - ), - ), - ) - - def test_select_from_placeholder(self): - self.assertEqual( - self._select("select 1 from {placeholder}"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Placeholder(field="placeholder")), - ), - ) - self.assertEqual( - self._select("select 1 from {placeholder}", {"placeholder": ast.Field(chain=["events"])}), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - ) - - def test_select_from_join(self): - self.assertEqual( - self._select("select 1 from events JOIN events2 ON 1"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="JOIN", - table=ast.Field(chain=["events2"]), - constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), - ), - ), - ), - ) - self.assertEqual( - self._select("select * from events LEFT OUTER JOIN events2 ON 1"), - ast.SelectQuery( - select=[ast.Field(chain=["*"])], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="LEFT OUTER JOIN", - table=ast.Field(chain=["events2"]), - constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), - ), - ), - ), - ) - self.assertEqual( - self._select("select 1 from events LEFT OUTER JOIN events2 ON 1 ANY RIGHT JOIN events3 ON 2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="LEFT OUTER JOIN", - table=ast.Field(chain=["events2"]), - constraint=ast.JoinConstraint(expr=ast.Constant(value=1)), - next_join=ast.JoinExpr( - join_type="RIGHT ANY JOIN", - table=ast.Field(chain=["events3"]), - constraint=ast.JoinConstraint(expr=ast.Constant(value=2)), - ), - ), - ), - ), - ) - - def test_select_from_join_multiple(self): - node = self._select( - """ - SELECT event, timestamp, e.distinct_id, p.id, p.properties.email - FROM events e - LEFT JOIN person_distinct_id pdi - ON pdi.distinct_id = e.distinct_id - LEFT JOIN persons p - ON p.id = pdi.person_id - """, - self.team, - ) - self.assertEqual( - node, - ast.SelectQuery( - select=[ - ast.Field(chain=["event"]), - ast.Field(chain=["timestamp"]), - ast.Field(chain=["e", "distinct_id"]), - ast.Field(chain=["p", "id"]), - ast.Field(chain=["p", "properties", "email"]), - ], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - alias="e", - next_join=ast.JoinExpr( - join_type="LEFT JOIN", - table=ast.Field(chain=["person_distinct_id"]), - alias="pdi", - constraint=ast.JoinConstraint( - expr=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, - left=ast.Field(chain=["pdi", "distinct_id"]), - right=ast.Field(chain=["e", "distinct_id"]), - ) - ), - next_join=ast.JoinExpr( - join_type="LEFT JOIN", - table=ast.Field(chain=["persons"]), - alias="p", - constraint=ast.JoinConstraint( - expr=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, - left=ast.Field(chain=["p", "id"]), - right=ast.Field(chain=["pdi", "person_id"]), - ) - ), - ), - ), - ), - ), - ) - - def test_select_from_cross_join(self): - self.assertEqual( - self._select("select 1 from events CROSS JOIN events2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="CROSS JOIN", - table=ast.Field(chain=["events2"]), - ), - ), - ), - ) - self.assertEqual( - self._select("select 1 from events CROSS JOIN events2 CROSS JOIN events3"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="CROSS JOIN", - table=ast.Field(chain=["events2"]), - next_join=ast.JoinExpr( - join_type="CROSS JOIN", - table=ast.Field(chain=["events3"]), - ), - ), - ), - ), - ) - self.assertEqual( - self._select("select 1 from events, events2 CROSS JOIN events3"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - next_join=ast.JoinExpr( - join_type="CROSS JOIN", - table=ast.Field(chain=["events2"]), - next_join=ast.JoinExpr( - join_type="CROSS JOIN", - table=ast.Field(chain=["events3"]), - ), - ), - ), - ), - ) - - def test_select_array_join(self): - self.assertEqual( - self._select("select a from events ARRAY JOIN [1,2,3] a"), - ast.SelectQuery( - select=[ast.Field(chain=["a"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - array_join_op="ARRAY JOIN", - array_join_list=[ - ast.Alias( - expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), - alias="a", - ) - ], - ), - ) - self.assertEqual( - self._select("select a from events INNER ARRAY JOIN [1,2,3] a"), - ast.SelectQuery( - select=[ast.Field(chain=["a"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - array_join_op="INNER ARRAY JOIN", - array_join_list=[ - ast.Alias( - expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), - alias="a", - ) - ], - ), - ) - self.assertEqual( - self._select("select 1, b from events LEFT ARRAY JOIN [1,2,3] a, [4,5,6] AS b"), - ast.SelectQuery( - select=[ast.Constant(value=1), ast.Field(chain=["b"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - array_join_op="LEFT ARRAY JOIN", - array_join_list=[ - ast.Alias( - expr=ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), - alias="a", - ), - ast.Alias( - expr=ast.Array(exprs=[ast.Constant(value=4), ast.Constant(value=5), ast.Constant(value=6)]), - alias="b", - ), - ], - ), - ) - - def test_select_array_join_errors(self): - with self.assertRaises(HogQLException) as e: - self._select("select a from events ARRAY JOIN [1,2,3]") - self.assertEqual(e.exception.start, 32) - self.assertEqual(e.exception.end, 39) - self.assertEqual(str(e.exception), "ARRAY JOIN arrays must have an alias") - - with self.assertRaises(HogQLException) as e: - self._select("select a ARRAY JOIN [1,2,3]") - self.assertEqual(str(e.exception), "Using ARRAY JOIN without a FROM clause is not permitted") - - def test_select_group_by(self): - self.assertEqual( - self._select("select 1 from events GROUP BY 1, event"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - group_by=[ast.Constant(value=1), ast.Field(chain=["event"])], - ), - ) - - def test_order_by(self): - self.assertEqual( - parse_order_expr("1 ASC"), - ast.OrderExpr(expr=ast.Constant(value=1, start=0, end=1), order="ASC", start=0, end=5), - ) - self.assertEqual( - parse_order_expr("event"), - ast.OrderExpr(expr=ast.Field(chain=["event"], start=0, end=5), order="ASC", start=0, end=5), - ) - self.assertEqual( - parse_order_expr("timestamp DESC"), - ast.OrderExpr(expr=ast.Field(chain=["timestamp"], start=0, end=9), order="DESC", start=0, end=14), - ) - - def test_select_order_by(self): - self.assertEqual( - self._select("select 1 from events ORDER BY 1 ASC, event, timestamp DESC"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - order_by=[ - ast.OrderExpr(expr=ast.Constant(value=1), order="ASC"), - ast.OrderExpr(expr=ast.Field(chain=["event"]), order="ASC"), - ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC"), - ], - ), - ) - - def test_select_limit_offset(self): - self.assertEqual( - self._select("select 1 from events LIMIT 1"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - limit=ast.Constant(value=1), - ), - ) - self.assertEqual( - self._select("select 1 from events LIMIT 1 OFFSET 3"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - limit=ast.Constant(value=1), - offset=ast.Constant(value=3), - ), - ) - self.assertEqual( - self._select("select 1 from events OFFSET 3"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - limit=None, - offset=ast.Constant(value=3), - ), - ) - self.assertEqual( - self._select("select 1 from events ORDER BY 1 LIMIT 1 WITH TIES"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - order_by=[ast.OrderExpr(expr=ast.Constant(value=1), order="ASC")], - limit=ast.Constant(value=1), - limit_with_ties=True, - offset=None, - ), - ) - self.assertEqual( - self._select("select 1 from events ORDER BY 1 LIMIT 1, 3 WITH TIES"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - order_by=[ast.OrderExpr(expr=ast.Constant(value=1), order="ASC")], - limit=ast.Constant(value=1), - limit_with_ties=True, - offset=ast.Constant(value=3), - ), - ) - self.assertEqual( - self._select("select 1 from events LIMIT 1 OFFSET 3 BY 1, event"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - limit=ast.Constant(value=1), - offset=ast.Constant(value=3), - limit_by=[ast.Constant(value=1), ast.Field(chain=["event"])], - ), - ) - - def test_select_placeholders(self): - self.assertEqual( - self._select("select 1 where 1 == {hogql_val_1}"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - where=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, - left=ast.Constant(value=1), - right=ast.Placeholder(field="hogql_val_1"), - ), - ), - ) - self.assertEqual( - self._select("select 1 where 1 == {hogql_val_1}", {"hogql_val_1": ast.Constant(value="bar")}), - ast.SelectQuery( - select=[ast.Constant(value=1)], - where=ast.CompareOperation( - op=ast.CompareOperationOp.Eq, - left=ast.Constant(value=1), - right=ast.Constant(value="bar"), - ), - ), - ) - - def test_select_union_all(self): - self.assertEqual( - self._select("select 1 union all select 2 union all select 3"), - ast.SelectUnionQuery( - select_queries=[ - ast.SelectQuery(select=[ast.Constant(value=1)]), - ast.SelectQuery(select=[ast.Constant(value=2)]), - ast.SelectQuery(select=[ast.Constant(value=3)]), - ] - ), - ) - - def test_sample_clause(self): - self.assertEqual( - self._select("select 1 from events sample 1/10 offset 999"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - sample=ast.SampleExpr( - offset_value=ast.RatioExpr(left=ast.Constant(value=999)), - sample_value=ast.RatioExpr(left=ast.Constant(value=1), right=ast.Constant(value=10)), - ), - ), - ), - ) - - self.assertEqual( - self._select("select 1 from events sample 0.1 offset 999"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - sample=ast.SampleExpr( - offset_value=ast.RatioExpr(left=ast.Constant(value=999)), - sample_value=ast.RatioExpr( - left=ast.Constant(value=0.1), - ), - ), - ), - ), - ) - - self.assertEqual( - self._select("select 1 from events sample 10 offset 1/2"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - sample=ast.SampleExpr( - offset_value=ast.RatioExpr(left=ast.Constant(value=1), right=ast.Constant(value=2)), - sample_value=ast.RatioExpr( - left=ast.Constant(value=10), - ), - ), - ), - ), - ) - - self.assertEqual( - self._select("select 1 from events sample 10"), - ast.SelectQuery( - select=[ast.Constant(value=1)], - select_from=ast.JoinExpr( - table=ast.Field(chain=["events"]), - sample=ast.SampleExpr( - sample_value=ast.RatioExpr( - left=ast.Constant(value=10), - ), - ), - ), - ), - ) - - def test_select_with_columns(self): - self.assertEqual( - self._select("with event as boo select boo from events"), - ast.SelectQuery( - ctes={"boo": ast.CTE(name="boo", expr=ast.Field(chain=["event"]), cte_type="column")}, - select=[ast.Field(chain=["boo"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - ) - self.assertEqual( - self._select("with count() as kokku select kokku from events"), - ast.SelectQuery( - ctes={"kokku": ast.CTE(name="kokku", expr=ast.Call(name="count", args=[]), cte_type="column")}, - select=[ast.Field(chain=["kokku"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - ) - - def test_select_with_subqueries(self): - self.assertEqual( - self._select("with customers as (select 'yes' from events) select * from customers"), - ast.SelectQuery( - ctes={ - "customers": ast.CTE( - name="customers", - expr=ast.SelectQuery( - select=[ast.Constant(value="yes")], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - cte_type="subquery", - ) - }, - select=[ast.Field(chain=["*"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["customers"])), - ), - ) - - def test_select_with_mixed(self): - self.assertEqual( - self._select("with happy as (select 'yes' from events), ':(' as sad select sad from happy"), - ast.SelectQuery( - ctes={ - "happy": ast.CTE( - name="happy", - expr=ast.SelectQuery( - select=[ast.Constant(value="yes")], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - cte_type="subquery", - ), - "sad": ast.CTE(name="sad", expr=ast.Constant(value=":("), cte_type="column"), - }, - select=[ast.Field(chain=["sad"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["happy"])), - ), - ) - - def test_ctes_subquery_recursion(self): - query = "with users as (select event, timestamp as tt from events ), final as ( select tt from users ) select * from final" - self.assertEqual( - self._select(query), - ast.SelectQuery( - ctes={ - "users": ast.CTE( - name="users", - expr=ast.SelectQuery( - select=[ - ast.Field(chain=["event"]), - ast.Alias(alias="tt", expr=ast.Field(chain=["timestamp"])), - ], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ), - cte_type="subquery", - ), - "final": ast.CTE( - name="final", - expr=ast.SelectQuery( - select=[ast.Field(chain=["tt"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["users"])), - ), - cte_type="subquery", - ), - }, - select=[ast.Field(chain=["*"])], - select_from=ast.JoinExpr(table=ast.Field(chain=["final"])), - ), - ) - - def test_case_when(self): - self.assertEqual( - self._expr("case when 1 then 2 else 3 end"), - ast.Call(name="if", args=[ast.Constant(value=1), ast.Constant(value=2), ast.Constant(value=3)]), - ) - - def test_case_when_many(self): - self.assertEqual( - self._expr("case when 1 then 2 when 3 then 4 else 5 end"), - ast.Call( - name="multiIf", - args=[ - ast.Constant(value=1), - ast.Constant(value=2), - ast.Constant(value=3), - ast.Constant(value=4), - ast.Constant(value=5), - ], - ), - ) - - def test_case_when_case(self): - self.assertEqual( - self._expr("case 0 when 1 then 2 when 3 then 4 else 5 end"), - ast.Call( - name="transform", - args=[ - ast.Constant(value=0), - ast.Array(exprs=[ast.Constant(value=1), ast.Constant(value=3)]), - ast.Array(exprs=[ast.Constant(value=2), ast.Constant(value=4)]), - ast.Constant(value=5), - ], - ), - ) - - def test_window_functions(self): - query = "SELECT person.id, min(timestamp) over (PARTITION by person.id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS timestamp FROM events" - expr = self._select(query) - expected = ast.SelectQuery( - select=[ - ast.Field(chain=["person", "id"]), - ast.Alias( - alias="timestamp", - expr=ast.WindowFunction( - name="min", - args=[ast.Field(chain=["timestamp"])], - over_expr=ast.WindowExpr( - partition_by=[ast.Field(chain=["person", "id"])], - order_by=[ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC")], - frame_method="ROWS", - frame_start=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=None), - frame_end=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=1), - ), - ), - ), - ], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - ) - self.assertEqual(expr, expected) - - def test_window_functions_with_window(self): - query = "SELECT person.id, min(timestamp) over win1 AS timestamp FROM events WINDOW win1 as (PARTITION by person.id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)" - expr = self._select(query) - expected = ast.SelectQuery( - select=[ - ast.Field(chain=["person", "id"]), - ast.Alias( - alias="timestamp", - expr=ast.WindowFunction( - name="min", - args=[ast.Field(chain=["timestamp"])], - over_identifier="win1", - ), - ), - ], - select_from=ast.JoinExpr(table=ast.Field(chain=["events"])), - window_exprs={ - "win1": ast.WindowExpr( - partition_by=[ast.Field(chain=["person", "id"])], - order_by=[ast.OrderExpr(expr=ast.Field(chain=["timestamp"]), order="DESC")], - frame_method="ROWS", - frame_start=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=None), - frame_end=ast.WindowFrameExpr(frame_type="PRECEDING", frame_value=1), - ) - }, - ) - self.assertEqual(expr, expected) - - def test_parser_error_start_end(self): - query = "SELECT person.id as true FROM events" - with self.assertRaises(HogQLException) as e: - self._select(query) - self.assertEqual(e.exception.start, 7) - self.assertEqual(e.exception.end, 24) diff --git a/posthog/hogql/test/test_parser_cpp.py b/posthog/hogql/test/test_parser_cpp.py new file mode 100644 index 0000000000000..0047f70cb00c5 --- /dev/null +++ b/posthog/hogql/test/test_parser_cpp.py @@ -0,0 +1,5 @@ +from ._test_parser import parser_test_factory + + +class TestParserCpp(parser_test_factory("cpp")): + pass diff --git a/posthog/hogql/test/test_parser_python.py b/posthog/hogql/test/test_parser_python.py new file mode 100644 index 0000000000000..ca713640add0b --- /dev/null +++ b/posthog/hogql/test/test_parser_python.py @@ -0,0 +1,5 @@ +from ._test_parser import parser_test_factory + + +class TestParserPython(parser_test_factory("python")): + pass diff --git a/posthog/hogql/test/test_printer.py b/posthog/hogql/test/test_printer.py index 4b523860aab15..23a387a52a098 100644 --- a/posthog/hogql/test/test_printer.py +++ b/posthog/hogql/test/test_printer.py @@ -352,9 +352,13 @@ def test_values(self): self.assertEqual(context.values, {"hogql_val_0": "E", "hogql_val_1": "lol", "hogql_val_2": "hoo"}) def test_alias_keywords(self): - self._assert_expr_error("1 as team_id", "Alias 'team_id' is a reserved keyword") - self._assert_expr_error("1 as true", "Alias 'true' is a reserved keyword") - self._assert_select_error("select 1 as team_id from events", "Alias 'team_id' is a reserved keyword") + self._assert_expr_error( + "1 as team_id", '"team_id" cannot be an alias or identifier, as it\'s a reserved keyword' + ) + self._assert_expr_error("1 as true", '"true" cannot be an alias or identifier, as it\'s a reserved keyword') + self._assert_select_error( + "select 1 as team_id from events", '"team_id" cannot be an alias or identifier, as it\'s a reserved keyword' + ) self.assertEqual( self._select("select 1 as `-- select team_id` from events"), f"SELECT 1 AS `-- select team_id` FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", diff --git a/posthog/management/commands/__init__.py b/posthog/management/commands/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/requirements.in b/requirements.in index 4a9ae60543c5a..ef24be343f467 100644 --- a/requirements.in +++ b/requirements.in @@ -86,4 +86,5 @@ more-itertools==9.0.0 django-two-factor-auth==1.14.0 phonenumberslite==8.13.6 openai==0.27.8 -nh3==0.2.14 \ No newline at end of file +nh3==0.2.14 +hogql-parser==0.1.7 diff --git a/requirements.txt b/requirements.txt index f434d336aa905..6f118bcb411a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -248,6 +248,8 @@ gunicorn==20.1.0 # via -r requirements.in h11==0.13.0 # via wsproto +hogql-parser==0.1.7 + # via -r requirements.in idna==2.8 # via # -r requirements.in