-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Tikv conv function inconsistent results with tidb #51877
Comments
/assign @yibin87 |
Checked that tidb is consistent with mysql. |
/label sig/execution |
@aytrack: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/severity major |
In latest tidb version, the predicate pushdown logic seems changed, and a little strange:
|
For conv function implementation, it handles the case that its argument is cast(hybrid_type as string) function specially: tidb/pkg/expression/builtin_math.go Lines 1194 to 1206 in 6ed747b
It first converts hybrid_type to bit string literal like: b'01010101, then use internal conv(bit_literal_string, 2, from_base) to get temporary result, and finally conv(tem_result, from_base, to_base) For TiKV, its expression calculation mechanism doesn't support this "trick", thus we'd better disallow such case to be pushed down to TiKV. For TiFlash, hybrid_type within Functions are not allowed to be pushed down, thus, nothing to be worried. |
/label affects-7.5 |
/label affects-7.1 |
/label affects-6.5 |
/label affects-6.1 |
/label affects-5.4 |
Currently, the cost model v2 estimated the pushdown and not-pushdown plan's cost, and choose the not-pushdown plan. The main difference between the two plans is: the network traffic, pushdown-plan will occupy more network bandwith. |
…hed down to TiKV (pingcap#53502) close pingcap#51877
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
set tidb_opt_projection_push_down = 'on';
create table bug15583(b BIT(8), n INT);
insert into bug15583 values(128, 128);
insert into bug15583 values(null, null);
insert into bug15583 values(0, 0);
insert into bug15583 values(255, 255);
select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
2. What did you expect to see? (Required)
conv(b, 10, 2) conv(b + 0, 10, 2)
10000000 10000000
NULL NULL
0 0
11111111 11111111
3. What did you see instead (Required)
conv(b, 10, 2) conv(b + 0, 10, 2)
0 10000000
NULL NULL
0 0
0 11111111
4. What is your TiDB version? (Required)
| Release Version: v7.4.0-alpha-2012-gfe01d11df6-dirty
Edition: Community
Git Commit Hash: fe01d11
Git Branch: div_increase_prec
UTC Build Time: 2024-03-15 08:10:07
The text was updated successfully, but these errors were encountered: