mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Remove wrong logical error
When using ranges such as `(0 BETWEEN 1 AND 2)` the AST is something like `(0 >= 1 AND 0 <= 2)`. In the TemplateStructure we sort the tokens by the begin of them, where both 0s share the original same token position. Thus, we shouldn't ensure that the token position is monotonically increasing.
This commit is contained in:
parent
9c83eb95de
commit
e0d05bbadc
@ -331,9 +331,6 @@ ConstantExpressionTemplate::TemplateStructure::TemplateStructure(LiteralsInfo &
|
||||
for (size_t i = 0; i < replaced_literals.size(); ++i)
|
||||
{
|
||||
const LiteralInfo & info = replaced_literals[i];
|
||||
if (info.literal->begin.value() < prev_end)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot replace literals");
|
||||
|
||||
while (prev_end < info.literal->begin.value())
|
||||
{
|
||||
tokens.emplace_back(prev_end->begin, prev_end->size());
|
||||
|
@ -0,0 +1 @@
|
||||
ok
|
@ -0,0 +1,13 @@
|
||||
CREATE TABLE my_table (
|
||||
str String,
|
||||
) ORDER BY str;
|
||||
|
||||
INSERT INTO my_table VALUES
|
||||
(
|
||||
CASE WHEN
|
||||
(0 BETWEEN 0 AND 2) THEN 'ok' ELSE
|
||||
'wat'
|
||||
END
|
||||
);
|
||||
|
||||
SELECT * FROM my_table;
|
Loading…
Reference in New Issue
Block a user