pingcap / pingcap/tiflash

The result of comparison between cast VARBINARY to binary and binary is not correct

Open
#4,634 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/compute severity/moderate 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 t(a varbinary(10),b binary(10));
insert into t values(31,31);
select a,b,cast(a as binary(10))=b from t; 
2. What did you expect to see? (Required)
+------------+------------------------+-------------------------+
| a          | b                      | cast(a as binary(10))=b |
+------------+------------------------+-------------------------+
| 0x3331     | 0x33310000000000000000 |                       1 |
+------------+------------------------+-------------------------+
3. What did you see instead (Required)
+------------+------------------------+-------------------------+
| a          | b                      | cast(a as binary(10))=b |
+------------+------------------------+-------------------------+
| 0x3331     | 0x33310000000000000000 |                       0 |
+------------+------------------------+-------------------------+
4. What is your TiFlash version? (Required)

Release Version: v6.1.0-nightly
Edition: Community
Git Commit Hash: 32b9c14779c2a7dd73003667d81bb42f67a33385
Git Branch: heads/refs/tags/v6.1.0-nightly
UTC Build Time: 2022-04-11 11:02:23
GoVersion: go1.18
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

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 supplied CREATE TABLE, INSERT, and SELECT reproduction against TiFlash and compare the result with the expected output. Trace the handling of VARBINARY-to-BINARY casts and binary equality, then add a regression test for this query. Done means the comparison returns 1 while preserving the shown binary values.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.