You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parametrized view - Is it possible to use parameter in subquery (maybe there is an issue with array)? #68041
@PedroTadim acknowledged. I'll reproduce both cases from the fiddle on current master (the subquery-valued parameter giving UNKNOWN_QUERY_PARAMETER, and array(1,2,3) giving SYNTAX_ERROR), root-cause them, and follow up here with a fix PR for your review.
Root cause: when a parameterized view is called with a subquery-valued argument of type Array/Tuple/LowCardinality, scalar subquery optimization keeps the value as a __getScalar reference instead of a literal, so the analyzer's parameterized-view arg collection (which only accepts a ConstantNode) drops it and the query fails with UNKNOWN_QUERY_PARAMETER. Scalar types (e.g. Int32) fold to a literal and always worked.
The array(1, 2, 3) function form from the report already works on current master; the remaining failure was the subquery form. The fix folds the scalar subquery to a literal only while resolving a parameterized-view argument.
Activity
PedroTadim commentedon Jul 24, 2026
Got this today: https://fiddle.clickhouse.com/a3d178f5-5a5d-41c5-a386-2d8a0d00a7d @groeneai can you fix it and I try to review it?
groeneai commentedon Jul 24, 2026
@PedroTadim acknowledged. I'll reproduce both cases from the fiddle on current master (the subquery-valued parameter giving
UNKNOWN_QUERY_PARAMETER, andarray(1,2,3)givingSYNTAX_ERROR), root-cause them, and follow up here with a fix PR for your review.groeneai commentedon Jul 24, 2026
@PedroTadim opened #111790 for this.
Root cause: when a parameterized view is called with a subquery-valued argument of type
Array/Tuple/LowCardinality, scalar subquery optimization keeps the value as a__getScalarreference instead of a literal, so the analyzer's parameterized-view arg collection (which only accepts aConstantNode) drops it and the query fails withUNKNOWN_QUERY_PARAMETER. Scalar types (e.g.Int32) fold to a literal and always worked.The
array(1, 2, 3)function form from the report already works on current master; the remaining failure was the subquery form. The fix folds the scalar subquery to a literal only while resolving a parameterized-view argument.Fix parameterized view with a subquery-valued Array/Tuple parameter