CompileExpressions comparison function constant case fix#24023
Conversation
src/Interpreters/ExpressionJIT.cpp
Outdated
|
SQLancer found more: |
|
Why |
src/Interpreters/ExpressionJIT.cpp
Outdated
There was a problem hiding this comment.
This should be done by the expression analyzer at about the same stage where it evaluates constants.
1f48e58 to
af8e0d7
Compare
There was a problem hiding this comment.
Ok, but maybe we can replace the whole function to literal 1 or literal 0
There was a problem hiding this comment.
@KochetovNicolai right now seems easier to understand what is going on.
src/Interpreters/TreeRewriter.cpp
Outdated
There was a problem hiding this comment.
pls remove debug output
c2b324f to
6c33480
Compare
| SELECT count() FROM system.numbers WHERE number != number; | ||
| SELECT count() FROM system.numbers WHERE number < number; | ||
| SELECT count() FROM system.numbers WHERE number > number; | ||
| -- SELECT count() FROM system.numbers WHERE number != number; |
There was a problem hiding this comment.
It is not so easy to do.
It's actually not so clear why reading from infinite table must return at all.
We can go farter and want a query SELECT count() FROM system.numbers WHERE number < 10 return 10. But is it necessary?
This optimizations is implemented in a not obvious way for now. We expected that a function != for two same non-constant arguments will return constant 0, and assume that constant will remain. It could have been ok if we had some meta info that columns are really same. But we just compare two ptrs. I don't think there is a guarantee that it is true for all other blocks. (However, I could not find counterexample. Queries like where x != if(blockNumber() == 0, x, y) work correctly only because blockNumber does not return constant.)
|
Stress test: addr2line: |
|
Wait for perf tests and merge. |
Flap? |
|
I'll retry the task. |
|
|
This will avoid possible std::terminate, like in [1]: [1]: ClickHouse#24023 (comment)
|
@kitaisreal looks like this should be backported? |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Fixes #24020.
Changelog category (leave one):