pingcap / pingcap/tiflash

CAST function without valid field type when using bit_and function

Open
#1,794 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects-6.0 affects-6.1 component/compute component/expression severity/minor type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Minireproduce:

create table t(a int,primary key);
alter table t set tiflash replica 1;
insert into t values(1),(2);
select count(*) from t group by a having if(null,1,bit_and(2)); -- should successfully; but got 
-- ERROR 1105 (HY000): [FLASH:Coprocessor:BadRequest] CAST function without valid field type

TiFlash
Release Version: v5.0.0-nightly-53-g37740f794
Edition: Community
Git Commit Hash: 37740f794cb6b9e34c953f87330693295149dc01
Git Branch: master
UTC Build Time: 2021-04-15 10:16:48
Profile: RELWITHDEBINFO

Raft Proxy
Git Commit Hash: 3bb85b07bb9d9a5da2a3595457c3587183ff36d9
Git Commit Branch: HEAD
UTC Build Time: 2021-04-15 09:56:37
Rust Version: rustc 1.51.0-nightly (bc39d4d9c 2021-01-15)
Storage Engine: tiflash
Prometheus Prefix: tiflash_proxy_
Profile: release

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 by running the provided SQL minireproduce against TiFlash and inspect the handling of HAVING, IF, and bit_and expressions that leads to the CAST error. No source file or test is named in the issue, so trace the failing expression through the TiFlash execution path. Done means the query succeeds without the invalid-field-type error and the regression is covered by a test.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.