Fix logical error in evaluate constant expression#47685
Conversation
|
|
||
| std::pair<Field, std::shared_ptr<const IDataType>> evaluateConstantExpression(const ASTPtr & node, const ContextPtr & context) | ||
| { | ||
| if (!node->hasColumnName()) |
There was a problem hiding this comment.
Sorry, I do not fully understand the original problem. My question might be incorrect.
In scope of this 2 lines. Why if the is no column name then it is not not a constant expression. Is the reverse statement valid: node with column names is a constant expression?
There was a problem hiding this comment.
Usually, all expressions passed here have column names, but in some weird cases like mysql('127.0.0.1:9004', currentDatabase(), 'foo', 'default', '', SETTINGS connection_pool_size = 1) we may have unexpected AST type (ASTSet in the example). The table function can't be constant.
Another solution is to check the table function name and throw an error for mysql and others. Like here
ClickHouse/src/Parsers/ASTFunction.cpp
Lines 474 to 475 in a1397d7
It may be less generic, though. So need to realize if there're any other cases.
There was a problem hiding this comment.
Thanks for clarification.
I understand now that we expect a constant expression as an argument. But encounter a function call.
But still I see some unclear statement: why presents of column names say anything about is expression constant or not? Furthermore my intuition says me an opposite thing, it is might be non constant if it has column name.
b3720dc to
68da4f7
Compare
05ff6ec to
9e2590b
Compare
9e2590b to
d96ab41
Compare
|
I attempted to check the function type in |
d96ab41 to
19fb88c
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...
Close #47533
Documentation entry for user-facing changes