Skip to content

Mark support for KQL and PRQL as experimental - #74224

Merged
rschu1ze merged 1 commit into
ClickHouse:masterfrom
rschu1ze:experimental-alternative-dialects
Jan 7, 2025
Merged

rschu1ze merged 1 commit into
ClickHouse:masterfrom
rschu1ze:experimental-alternative-dialects

Conversation

@rschu1ze

@rschu1ze rschu1ze commented Jan 6, 2025 •

Copy link
Copy Markdown
Member

ClickHouse supports PRQL and Kusto Query Language (KQL) as alternative query languages but they each have their own problems:

The docs also recognize these issues.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Support for the alternative query languages PRQL and KQL was marked experimental. To use them, specify settings allow_experimental_prql_dialect = 1 and allow_experimental_kusto_dialect = 1.

@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-improvement Pull request with some product improvements label Jan 6, 2025
@robot-clickhouse-ci-2

robot-clickhouse-ci-2 commented Jan 6, 2025 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit 29d71c5 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns ClickBench with instant-attach table✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success

@rschu1ze
rschu1ze force-pushed the experimental-alternative-dialects branch from f5e6200 to 29d71c5 Compare January 6, 2025 19:47
@yakov-olkhovskiy yakov-olkhovskiy self-assigned this Jan 6, 2025
@rschu1ze
rschu1ze added this pull request to the merge queue Jan 7, 2025
Merged via the queue into ClickHouse:master with commit ff4ccdd Jan 7, 2025
@rschu1ze
rschu1ze deleted the experimental-alternative-dialects branch January 7, 2025 13:13
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jan 7, 2025
@clickgapai

Copy link
Copy Markdown
Contributor

Hi @rschu1ze @yakov-olkhovskiy — this PR appears to contain a backward incompatible change but is categorized as Improvement.

Why: SettingsChangesHistory.cpp line 568-569 shows old_value=true, new_value=false for both settings. Users who were using KQL or PRQL dialects before version 25.1 will find their queries fail with SUPPORT_IS_DISABLED after upgrading, unless they explicitly set the experimental flags. This is a clear behavioral change that breaks existing workflows.

Suggested category: Backward Incompatible Change

Could you check if the changelog category should be updated? This helps users know what to expect when upgrading. Ignore this if the change is intentionally non-breaking.

@rschu1ze

rschu1ze commented Apr 2, 2026

Copy link
Copy Markdown
Member Author

@clickgapai 25.1 is no longer officially supported, such subtleties don't matter anymore.

pull Bot pushed a commit to Mu-L/ClickHouse that referenced this pull request Aug 29, 2026
The dialect was contributed in 2022 and abandoned by its authors; the
rewrite they promised in ClickHouse#62668 was closed unmerged.  Since then it has
been emergency-disabled once (ClickHouse#59305) and gated behind
`allow_experimental_kusto_dialect` (ClickHouse#74224), and issue ClickHouse#61742 ("Remove
KQL support if this code will not be fixed") has stayed open.

The implementation translated a KQL token stream directly into
ClickHouse SQL *text* and re-parsed it.  Everything below follows from
that:

  - KQL string literals were spliced into generated SQL unescaped, so
    `T | where s contains "x') OR 1 = 1 OR ilike(s, 'y"` injected
    arbitrary expressions -- and `contains '50%'` matched `'50x'`
    because LIKE metacharacters passed through.
  - No types were available while translating, so 14 sites emitted
    runtime `toTypeName()` dispatch and datetimes were modelled as
    strings truncated to 27 characters.
  - Arguments were SQL text, so a dozen sites called `std::stoi` on it;
    `format_timespan(col, 'hh:mm')` failed with "stoi: no conversion".
  - 28 of the 237 registered functions were stubs that returned the raw
    KQL name into the generated SQL, including every `series_*`.
  - `let` bindings lived in a `static thread_local` map that, by its own
    comment, leaked between unrelated queries.

This commit removes the implementation and every trace of it: the
parser, the `kusto` dialect and its experimental setting, the `kusto`
value of `interval_output_format` and the interval serialization it
drove, the client/server call sites, the fuzzer and style-check
carve-outs, and the tests.  A correct implementation is added next.

Two notes on what was deliberately kept.  `ASTSelectQuery::normalize
ChildrenOrder` stays -- several other parsers use it -- with its comment
generalized.  `04305_parser_error_message_oob_101143.sh` stays as a
regression test for the error-formatter buffer overflow; its rationale
is rewritten, since the parser it originally exercised is now gone.

Release history in CHANGELOG.md, docs/changelogs/ and
SettingsChangesHistory.cpp is left untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants