You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/07 15:53:56 UTC
(superset) branch master updated: test(sql): prove ClickHouse parametric aggregates parse cleanly (#37285) (#41836)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7b0969131ff test(sql): prove ClickHouse parametric aggregates parse cleanly (#37285) (#41836)
7b0969131ff is described below
commit 7b0969131ffaab94c9b9c41ca4c6f333c0719005
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Tue Jul 7 08:53:49 2026 -0700
test(sql): prove ClickHouse parametric aggregates parse cleanly (#37285) (#41836)
Co-authored-by: Claude Code <no...@anthropic.com>
---
tests/unit_tests/sql/parse_tests.py | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tests/unit_tests/sql/parse_tests.py b/tests/unit_tests/sql/parse_tests.py
index 47efd53db80..3fd929a2b4f 100644
--- a/tests/unit_tests/sql/parse_tests.py
+++ b/tests/unit_tests/sql/parse_tests.py
@@ -1342,6 +1342,33 @@ def test_with_clause_containing_union_all_is_not_mutating_oracle() -> None:
assert not SQLScript(sql, "oracle").has_mutation()
+@pytest.mark.parametrize("engine", ["clickhouse", "clickhousedb"])
+def test_clickhouse_parametric_aggregate_parses_and_is_read_only(engine: str) -> None:
+ """
+ Regression for #37285: ClickHouse parametric aggregate functions use a
+ double pair of parentheses — ``groupConcat(', ')(part_name)`` — where the
+ first list holds the aggregate's parameters and the second its arguments.
+
+ Older sqlglot versions choked on the second parenthesized list, so SQL
+ Lab either mangled the query sent to the database or, with DDL/DML
+ disallowed, refused to run it because it "could not be parsed to confirm
+ it is a read-only query". The sqlglot bump to >=30 fixed the parsing;
+ pinning the reporter's verbatim query guards against a future
+ dialect-specific regression. Both ClickHouse engine specs are exercised
+ since each resolves the sqlglot dialect independently.
+ """
+ sql = """
+ select
+ groupConcat(', ')(part_name) as concatenated
+ from system.parts
+ """
+ script = SQLScript(sql, engine) # Must not raise.
+ assert not script.has_mutation(), (
+ f"Parametric aggregate misclassified as mutating on {engine!r}; "
+ "this would block the query on connections without DDL/DML allowed."
+ )
+
+
def test_get_settings() -> None:
"""
Test `get_settings` in some edge cases.