-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query wrong result 18.14.8(9) (CH cashes ? subquery result) #3410
Comments
Workaround: move all other conditions to prewhere and leave the condition with subquery in where section. select count(*) from testx |
select count(*) from dw.testx where not a and t < (select tkey from dt); set compile_expressions = 0; select count(*) from dw.testx where not a and t < (select tkey from dt); |
In our system we don't drop/create dt. |
Den, I can't reproduce the problem from your example:
In last select query you use About expressions compilation:
Maybe you can provide more complex example? |
select name, value from system.settings where changed; ┌─name──────────────────────────────────────┬─value────────────┐ |
Can you provide |
|
yes, reproduced with:
|
yes, I think optimize_move_to_prewhere 1 |
Yes. This problem seems to be very special case. Сondition |
t.me/clickhouse_ru/71285 ch0 :) select eventDate, count() from Events where eventDate = today()-1 group by eventDate settings compile_expressions = 0; ┌──eventDate─┬──count()─┐ 1 rows in set. Elapsed: 0.069 sec. Processed 70.06 million rows, 140.12 MB (1.02 billion rows/s., 2.04 GB/s.) ch0 :) select eventDate, count() from Events where eventDate = today()-1 group by eventDate settings compile_expressions = 1; ┌──eventDate─┬─count()─┐ 1 rows in set. Elapsed: 0.017 sec. Processed 70.06 million rows, 140.12 MB (4.13 billion rows/s., 8.27 GB/s.) |
We disable compile expressions by default in 14.10. |
Seems to be fixed in master #3457. But we will test this feature more carefully. |
Preparing:
CREATE TABLE dt(tkey Int32) ENGINE = MergeTree order by tuple();
insert into dt values (300000);
CREATE TABLE testx(t Int32, a UInt8) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO testx VALUES (100000, 0);
select count(*) from testx where not a and t < (select tkey from dt);
1
drop table dt;
CREATE TABLE dt(tkey Int32) ENGINE = MergeTree order by tuple();
insert into dt values (0);
BUG:
select count(*) from dw.testx where not a and t < (select tkey from dt);
1
select tkey from dt
0
select count(*) from dw.testx where not a and t < 0
0
So CH does not see that value in the table dt has changed from 300000 to 0.
optimize_move_to_prewhere 0
enable_optimize_predicate_expression 0
The text was updated successfully, but these errors were encountered: