TiFlash may throw Cannot convert NULL value to non-Nullable type error when enable tidb_opt_agg_push_down
Open
Nobody has claimed this yet.
affects-5.4
affects-6.1
affects-6.5
affects-7.1
affects-7.5
affects-8.1
affects-8.5
component/compute
report/community
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)
CREATE TABLE `customer` (
`C_CUSTKEY` bigint(20) NOT NULL,
`C_NAME` varchar(25) NOT NULL,
`C_ADDRESS` varchar(40) NOT NULL,
`C_NATIONKEY` bigint(20) NOT NULL,
`C_PHONE` char(15) NOT NULL,
`C_ACCTBAL` decimal(15,2) NOT NULL,
`C_MKTSEGMENT` char(10) NOT NULL,
`C_COMMENT` varchar(117) NOT NULL,
PRIMARY KEY (`C_CUSTKEY`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
CREATE TABLE `orders` (
`O_ORDERKEY` bigint(20) NOT NULL,
`O_CUSTKEY` bigint(20) NOT NULL,
`O_ORDERSTATUS` char(1) NOT NULL,
`O_TOTALPRICE` decimal(15,2) NOT NULL,
`O_ORDERDATE` date NOT NULL,
`O_ORDERPRIORITY` char(15) NOT NULL,
`O_CLERK` char(15) NOT NULL,
`O_SHIPPRIORITY` bigint(20) NOT NULL,
`O_COMMENT` varchar(79) NOT NULL,
PRIMARY KEY (`O_ORDERKEY`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
insert into customer values (6, "a", "a", 2, "12345", 3, "Z", "haha");
alter table customer set tiflash replica 1;
alter table orders set tiflash replica 1;
set tidb_opt_agg_push_down=1;
select c_custkey,count(o_orderkey) as c_count from customer left outer join orders on c_custkey = o_custkey group by c_custkey;
2. What did you expect to see? (Required)
query sucess
3. What did you see instead (Required)
query return error
mysql> select c_custkey,count(o_orderkey) as c_count from customer left outer join orders on c_custkey = o_custkey group by c_custkey;
ERROR 1105 (HY000): other error for mpp stream: From MPP<query:456410370056650754,task:4>: Code: 349, e.displayText() = DB::Exception: Cannot convert NULL value to non-Nullable type, e.what() = DB::Exception,
4. What is your TiFlash version? (Required)
v8.5.1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided CREATE TABLE, TiFlash replica, aggregation-pushdown, and LEFT JOIN query sequence against TiFlash v8.5.1 to reproduce the NULL conversion error. Trace the aggregation pushdown path and its handling of NULL counts, then verify that the query succeeds and add a regression test covering this reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100