pingcap / pingcap/tiflash

Decimal overflow misbehavior in BinaryArithmeticFunctions.

Open
#3,667 3 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)
use test;
CREATE TABLE t
(pk INTEGER PRIMARY KEY,
 dc1 DECIMAL(12, 4),
 dc2 DECIMAL(30, 30),
 dc3 DECIMAL(65, 0),
 dc4 DECIMAL(65, 30));
INSERT INTO t VALUES
(0, -99999999.9999, -.999999999999999999999999999999,
    -99999999999999999999999999999999999999999999999999999999999999999,
    -99999999999999999999999999999999999.999999999999999999999999999999),
(1, 0, 0, 0, 0),
(2, 99999999.9999, .999999999999999999999999999999,
    99999999999999999999999999999999999999999999999999999999999999999,
    99999999999999999999999999999999999.999999999999999999999999999999);

ALTER TABLE t SET TIFLASH REPLICA 1;
set @@session.tidb_isolation_read_engines="tiflash";
set tidb_enforce_mpp=1;
select dc1 + dc3 from t;
select dc1 - dc3 from t;
2. What did you expect to see? (Required)

561a7b6bd31fd775845df974a3fe0cf

1639718879(1)

3. What did you see instead (Required)

1639718972(1)

4. What is your TiFlash version? (Required)

tiflash-v5.3.0

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 CREATE TABLE, INSERT, TiFlash replica, and dc1 +/- dc3 queries against TiFlash v5.3.0, then compare the results with the expected and observed screenshots. Done means decimal addition and subtraction no longer misbehave or overflow for the reproduced DECIMAL combinations.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.