Skip to content
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

CastTimeAsReal was pushed down to tiflash by mistake #28753

Closed
wshwsh12 opened this issue Oct 12, 2021 · 3 comments · Fixed by #36271
Closed

CastTimeAsReal was pushed down to tiflash by mistake #28753

wshwsh12 opened this issue Oct 12, 2021 · 3 comments · Fixed by #36271
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. component/tiflash severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@wshwsh12
Copy link
Contributor

wshwsh12 commented Oct 12, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CastTimeAsReal shouldn't push down to tiflash, because CastTimeAsReal is not supported in tiflash.

use test;
drop table t;
create table t(a timestamp);
insert into t values("2020-10-10 10:10:10");
alter table t set tiflash replica 1;

[tidb]> desc select avg(a) from t;
+--------------------------------+----------+-------------------+---------------+------------------------------------------------------------------+
| id                             | estRows  | task              | access object | operator info                                                    |
+--------------------------------+----------+-------------------+---------------+------------------------------------------------------------------+
| HashAgg_20                     | 1.00     | root              |               | funcs:avg(Column#6, Column#7)->Column#3                          |
| └─TableReader_22               | 1.00     | root              |               | data:ExchangeSender_21                                           |
|   └─ExchangeSender_21          | 1.00     | batchCop[tiflash] |               | ExchangeType: PassThrough                                        |
|     └─HashAgg_8                | 1.00     | batchCop[tiflash] |               | funcs:count(Column#10)->Column#6, funcs:sum(Column#11)->Column#7 |
|       └─Projection_31          | 10000.00 | batchCop[tiflash] |               | test.t2.a, cast(test.t2.a, double(23,4) BINARY)->Column#11       |
|         └─TableFullScan_19     | 10000.00 | batchCop[tiflash] | table:t2      | keep order:false, stats:pseudo                                   |
+--------------------------------+----------+-------------------+---------------+------------------------------------------------------------------+
6 rows in set (0.001 sec)
[tidb]>  select avg(a) from t;
ERROR 1105 (HY000): other error for mpp stream: DB::TiFlashException: CastTimeAsReal is not supported.

But, we can see the push down list in tidb.

tidb/expression/expression.go

Lines 1057 to 1060 in 5cc6b81

case tipb.ScalarFuncSig_CastIntAsReal, tipb.ScalarFuncSig_CastRealAsReal, tipb.ScalarFuncSig_CastStringAsReal: /*, tipb.ScalarFuncSig_CastDecimalAsReal,
tipb.ScalarFuncSig_CastDurationAsReal, tipb.ScalarFuncSig_CastTimeAsReal, tipb.ScalarFuncSig_CastJsonAsReal*/
// TiFlash cast only support cast to Float64 or the source type is the same as the target type
return sourceType.Tp == retType.Tp || retType.Tp == mysql.TypeDouble

CastTimeAsReal is commented out.

2. What did you expect to see? (Required)

Run successfully.

3. What did you see instead (Required)

Failed.

4. What is your TiDB version? (Required)

master(e8f4e47)

@wshwsh12 wshwsh12 added the type/bug The issue is confirmed as a bug. label Oct 12, 2021
@fuzhe1989
Copy link
Contributor

/assign @wshwsh12

@wshwsh12
Copy link
Contributor Author

Fixed by #29274

@fuzhe1989
Copy link
Contributor

@wshwsh12 guess we still need to fix the issue since the plan is unexpected.

@jebter jebter added affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. labels Jan 11, 2022
@VelocityLight VelocityLight added the affects-6.1 This bug affects the 6.1.x(LTS) versions. label May 20, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. labels Jun 10, 2022
@wshwsh12 wshwsh12 added affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. labels Jul 18, 2022
@ti-chi-bot ti-chi-bot removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. labels Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. component/tiflash severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
7 participants