pingcap / pingcap/tiflash

Union all pushdown unsupported scalar function CastJsonAsJson

Open
#3,561 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects-5.4 affects-6.0 affects-6.1 affects-6.2 affects-6.3 affects-6.4 affects-6.5 affects-6.6 affects-7.0 affects-7.1 affects-7.5 affects-8.1 affects-8.5 component/compute severity/major type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)
use test;
drop table if exists t;
drop table if exists t1;
create table t (a json not null, b json, c varchar(20));
create table t1 (a json, b json not null, c double);
alter table t set tiflash replica 1;
alter table t1 set tiflash replica 1;
set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash';
select count(*) from (select a , b from t union all select a , b from t1) tt;
2. What did you expect to see? (Required)
3. What did you see instead (Required)

ERROR 1105 (HY000): other error for mpp stream: DB::TiFlashException: CastJsonAsJson is not supported.

[tidb]> desc select count(*) from (select a , b from t union all select a , b from t1) tt;
+------------------------------------+----------+--------------+---------------+----------------------------------------------------+
| id                                 | estRows  | task         | access object | operator info                                      |
+------------------------------------+----------+--------------+---------------+----------------------------------------------------+
| HashAgg_37                         | 1.00     | root         |               | funcs:count(Column#12)->Column#11                  |
| └─TableReader_39                   | 1.00     | root         |               | data:ExchangeSender_38                             |
|   └─ExchangeSender_38              | 1.00     | cop[tiflash] |               | ExchangeType: PassThrough                          |
|     └─HashAgg_14                   | 1.00     | cop[tiflash] |               | funcs:count(1)->Column#12                          |
|       └─Union_36                   | 20000.00 | cop[tiflash] |               |                                                    |
|         ├─Projection_64            | 10000.00 | cop[tiflash] |               | cast(test.t.a, json BINARY)->Column#9, test.t.b    |
|         │ └─TableFullScan_22       | 10000.00 | cop[tiflash] | table:t       | keep order:false, stats:pseudo                     |
|         └─Projection_65            | 10000.00 | cop[tiflash] |               | test.t1.a, cast(test.t1.b, json BINARY)->Column#10 |
|           └─TableFullScan_29       | 10000.00 | cop[tiflash] | table:t1      | keep order:false, stats:pseudo                     |
+------------------------------------+----------+--------------+---------------+----------------------------------------------------+
9 rows in set (0.001 sec)
4. What is your TiFlash version? (Required)

master

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.

Research direction

Start with the supplied SQL reproduction and its DESC output, focusing on the Union All projections that produce CastJsonAsJson under TiFlash MPP. Trace where this scalar function is handled for pushdown, then verify that the query completes without the unsupported-function error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.