pingcap / pingcap/tiflash

cast real as string is not compatible with tidb/mysql

Open
#3,823 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/compute component/expression 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 test.t(a float, b double);
insert into test.t values (3.4028234e38, 1.7976931348623157e308);
insert into test.t values (1.1754944e-38, 2.2250738585072014e-308);

// tiflash
set tidb_enforce_mpp=1; set tidb_isolation_read_engines='tiflash';
select cast(a as char), cast(b as char) from t;

// tidb
set tidb_enforce_mpp=0; set tidb_isolation_read_engines='tikv';
select cast(a as char), cast(b as char) from t;

// mysql
// execute in mysql
select cast(a as char), cast(b as char) from t;
2. What did you expect to see? (Required)
// tidb
+-----------------+-------------------------+
| cast(a as char) | cast(b as char)         |
+-----------------+-------------------------+
| 3.40282e38      | 1.7976931348623157e308  |
| 1.17549e-38     | 2.2250738585072014e-308 |
+-----------------+-------------------------+

// tiflash
+-----------------+-------------------------+
| cast(a as char) | cast(b as char)         |
+-----------------+-------------------------+
| 3.40282e38      | 1.7976931348623157e308  |
| 1.17549e-38     | 2.2250738585072014e-308 |
+-----------------+-------------------------+

// mysql
+-----------------+-------------------------+
| cast(a as char) | cast(b as char)         |
+-----------------+-------------------------+
| 3.40282e38      | 1.7976931348623157e308  |
| 1.17549e-38     | 2.2250738585072014e-308 |
+-----------------+-------------------------+
3. What did you see instead (Required)
// tidb
+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| cast(a as char)                                 | cast(b as char)                                                                                                                                                                                                                                                                                                                        |
+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 340282350000000000000000000000000000000         | 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                  |
| 0.000000000000000000000000000000000000011754944 | 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014 |
+-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

// tiflash
+-----------------+-------------------------+
| cast(a as char) | cast(b as char)         |
+-----------------+-------------------------+
| 3.4028235e38    | 1.7976931348623157e308  |
| 1.1754944e-38   | 2.2250738585072014e-308 |
+-----------------+-------------------------+

// mysql
+-----------------+-------------------------+
| cast(a as char) | cast(b as char)         |
+-----------------+-------------------------+
| 3.40282e38      | 1.7976931348623157e308  |
| 1.17549e-38     | 2.2250738585072014e-308 |
+-----------------+-------------------------+
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

The issue names no source file, test, or entry point. Start by running the SQL reproduction and compare TiFlash and TiDB output with MySQL; done means casting FLOAT and DOUBLE to CHAR produces the expected compatible formatting for the listed boundary values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, mysql, 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.