pingcap / pingcap/tiflash

CastDecimalAsReal blocks pushing down agg

Open
#3,086 1 comment 0 reactions 1 assignee View on GitHub

@fzhedu is already working on this.

Since Sep 14, 2021.

component/compute component/expression component/mpp type/feature-request
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

mysql> desc select max(a) from (select id, zxjq * (sum(fzsl)-zqsl) a from t group by id, zqsl,zxjq)tb group by id;
+------------------------------------------+----------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id                                       | estRows  | task              | access object | operator info                                                                                                                                                                        |
+------------------------------------------+----------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| HashAgg_8                                | 8000.00  | root              |               | group by:Column#31, funcs:max(Column#30)->Column#8                                                                                                                                   |
| └─Projection_40                          | 8000.00  | root              |               | mul(zq.t.zxjq, cast(minus(Column#6, cast(zq.t.zqsl, decimal(20,0) BINARY)), double BINARY))->Column#30, zq.t.id                                                                      |
|   └─TableReader_32                       | 8000.00  | root              |               | data:ExchangeSender_31                                                                                                                                                               |
|     └─ExchangeSender_31                  | 8000.00  | batchCop[tiflash] |               | ExchangeType: PassThrough                                                                                                                                                            |
|       └─Projection_27                    | 8000.00  | batchCop[tiflash] |               | Column#6, zq.t.zqsl, zq.t.zxjq, zq.t.id                                                                                                                                              |
|         └─HashAgg_28                     | 8000.00  | batchCop[tiflash] |               | group by:zq.t.id, zq.t.zqsl, zq.t.zxjq, funcs:sum(Column#14)->Column#6, funcs:firstrow(zq.t.zqsl)->zq.t.zqsl, funcs:firstrow(zq.t.zxjq)->zq.t.zxjq, funcs:firstrow(zq.t.id)->zq.t.id |
|           └─ExchangeReceiver_30          | 8000.00  | batchCop[tiflash] |               |                                                                                                                                                                                      |
|             └─ExchangeSender_29          | 8000.00  | batchCop[tiflash] |               | ExchangeType: HashPartition, Hash Cols: [name: zq.t.id, collate: N/A], [name: zq.t.zqsl, collate: N/A], [name: zq.t.zxjq, collate: N/A]                                              |
|               └─HashAgg_13               | 8000.00  | batchCop[tiflash] |               | group by:Column#27, Column#28, Column#29, funcs:sum(Column#26)->Column#14                                                                                                            |
|                 └─Projection_39          | 10000.00 | batchCop[tiflash] |               | cast(zq.t.fzsl, decimal(32,0) BINARY)->Column#26, zq.t.id, zq.t.zqsl, zq.t.zxjq                                                                                                      |
|                   └─TableFullScan_26     | 10000.00 | batchCop[tiflash] | table:t       | keep order:false, stats:pseudo                                                                                                                                                       |
+------------------------------------------+----------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
11 rows in set, 4 warnings (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                |
+---------+------+--------------------------------------------------------------------------------------------------------+
| Warning | 1105 | Scalar function 'cast'(signature: CastDecimalAsReal) can not be pushed to tiflash                      |
| Warning | 1105 | Aggregation can not be pushed to tiflash because arguments of AggFunc `max` contains unsupported exprs |
| Warning | 1105 | Scalar function 'cast'(signature: CastDecimalAsReal) can not be pushed to tiflash                      |
| Warning | 1105 | Aggregation can not be pushed to tiflash because arguments of AggFunc `max` contains unsupported exprs |
+---------+------+--------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

mysql> desc t;
+-------+---------+------+------+---------+-------+
| Field | Type    | Null | Key  | Default | Extra |
+-------+---------+------+------+---------+-------+
| fzsl  | int(11) | YES  |      | NULL    |       |
| zqsl  | int(11) | YES  |      | NULL    |       |
| zxjq  | double  | YES  |      | NULL    |       |
| id    | int(11) | YES  |      | NULL    |       |
+-------+---------+------+------+---------+-------+
4 rows in set (0.00 sec)
CREATE TABLE `t` (
  `fzsl` int(11) DEFAULT NULL,
  `zqsl` int(11) DEFAULT NULL,
  `zxjq` double DEFAULT NULL,
  `id` int(11) DEFAULT NULL
)
alter table t set tiflash replica 1;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.