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
An error is reported when both constants and fields exist in a"casewhen/multiIf" #59101
CREATE TABLE users (name String, age Int16) ENGINE=Memory;
INSERT INTO users VALUES ('John', 33);
INSERT INTO users VALUES ('Ksenia', 48);
INSERT INTO users VALUES ('Alice', 50);
Queries to run that lead to unexpected result
SELECT
multiIf((age > 30) or (true), '1', '2') AS a,
max(name)
FROM users
GROUP BY a
Expected behavior
return "1 Ksenia"
Error message
Exception: Column age is not under aggregate function and not in GROUP BY. Have columns: ['max(name)']: While processing if((age > 30) OR true, '1', '2') AS a, max(name). (NOT_AN_AGGREGATE)
:) SELECT If(age > 30 or true, '1', '2') AS a, max(name) FROM users GROUP BY a settings allow_experimental_analyzer=1
┌─a─┬─max(name)─┐
│ 1 │ Ksenia │
└───┴───────────┘
Not sure if we want to fix it in current infrastracture as we are working on enabling new analyzer by default. Possible workaround:
Use materialized(true):
:) SELECT If(age > 30 or materialize(true), '1', '2') AS a, max(name) FROM users GROUP BY a
┌─a─┬─max(name)─┐
│ 1 │ Ksenia │
└───┴───────────┘
:) SELECT If(age > 30 or true, '1', '2') AS a, max(name) FROM users GROUP BY a settings allow_experimental_analyzer=1
┌─a─┬─max(name)─┐
│ 1 │ Ksenia │
└───┴───────────┘
Not sure if we want to fix it in current infrastracture as we are working on enabling new analyzer by default. Possible workaround: Use materialized(true):
:) SELECT If(age > 30 or materialize(true), '1', '2') AS a, max(name) FROM users GROUP BY a
┌─a─┬─max(name)─┐
│ 1 │ Ksenia │
└───┴───────────┘
Thank you for your answer.
Are there any side effects of this configuration allow_experimental_analyzer? Can I configure globally and use it in a production environment? Where can I find documentation for these optimization parameters?
Are there any side effects of this configuration allow_experimental_analyzer? Can I configure globally and use it in a production environment?
New analyzer is not ready for production right now, so some queries might not work or work incorrectly, so I don't recommend using it in production. As I said, we are working on making it production ready.
Where can I find documentation for these optimization parameters?
What do you mean by optimization parameters? Setting allow_experimental_analyzer is not an optimization, it just enables new infrastructure for query analysis and planning that we will use in future, it's a complitely internal change, so we don't have documentation for it.
Are there any side effects of this configuration allow_experimental_analyzer? Can I configure globally and use it in a production environment?
New analyzer is not ready for production right now, so some queries might not work or work incorrectly, so I don't recommend using it in production. As I said, we are working on making it production ready.
I see,Thanks again
Where can I find documentation for these optimization parameters?
What do you mean by optimization parameters? Setting allow_experimental_analyzer is not an optimization, it just enables new infrastructure for query analysis and planning that we will use in future, it's a complitely internal change, so we don't have documentation for it.
I'm not sure if this is a known problem or if there is a workaround, as I've had a lot of unexpected problems in clickhouse, such as # #58500 and #56005 , and it might have been helpful to have a documentation
Activity
Avogar commentedon Jan 23, 2024
This query works with new analyzer:
Not sure if we want to fix it in current infrastracture as we are working on enabling new analyzer by default. Possible workaround:
Use
materialized(true):h1k commentedon Jan 23, 2024
Thank you for your answer.
Are there any side effects of this configuration allow_experimental_analyzer? Can I configure globally and use it in a production environment? Where can I find documentation for these optimization parameters?
Avogar commentedon Jan 23, 2024
New analyzer is not ready for production right now, so some queries might not work or work incorrectly, so I don't recommend using it in production. As I said, we are working on making it production ready.
What do you mean by
optimization parameters? Settingallow_experimental_analyzeris not an optimization, it just enables new infrastructure for query analysis and planning that we will use in future, it's a complitely internal change, so we don't have documentation for it.h1k commentedon Jan 23, 2024
Close: #59101