TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

TiFlash Compatibility Notes

TiFlash is incompatible with TiDB in the following situations:

  • In the TiFlash computation layer:

    • Checking overflowed numerical values is not supported. For example, adding two maximum values of the BIGINT type 9223372036854775807 + 9223372036854775807. The expected behavior of this calculation in TiDB is to return the ERROR 1690 (22003): BIGINT value is out of range error. However, if this calculation is performed in TiFlash, an overflow value of -2 is returned without any error.

    • The window function is not supported.

    • Reading data from TiKV is not supported.

    • Currently, the sum function in TiFlash does not support the string-type argument. But TiDB cannot identify whether any string-type argument has been passed into the sum function during the compiling. Therefore, when you execute statements similar to select sum(string_col) from t, TiFlash returns the [FLASH:Coprocessor:Unimplemented] CastStringAsReal is not supported. error. To avoid such an error in this case, you need to modify this SQL statement to select sum(cast(string_col as double)) from t.

    • Currently, TiFlash's decimal division calculation is incompatible with that of TiDB. For example, when dividing decimal, TiFlash performs the calculation always using the type inferred from the compiling. However, TiDB performs this calculation using a type that is more precise than that inferred from the compiling. Therefore, some SQL statements involving the decimal division return different execution results when executed in TiDB + TiKV and in TiDB + TiFlash. For example:

      mysql> create table t (a decimal(3,0), b decimal(10, 0)); Query OK, 0 rows affected (0.07 sec) mysql> insert into t values (43, 1044774912); Query OK, 1 row affected (0.03 sec) mysql> alter table t set tiflash replica 1; Query OK, 0 rows affected (0.07 sec) mysql> set session tidb_isolation_read_engines='tikv'; Query OK, 0 rows affected (0.00 sec) mysql> select a/b, a/b + 0.0000000000001 from t where a/b; +--------+-----------------------+ | a/b | a/b + 0.0000000000001 | +--------+-----------------------+ | 0.0000 | 0.0000000410001 | +--------+-----------------------+ 1 row in set (0.00 sec) mysql> set session tidb_isolation_read_engines='tiflash'; Query OK, 0 rows affected (0.00 sec) mysql> select a/b, a/b + 0.0000000000001 from t where a/b; Empty set (0.01 sec)

      In the example above, a/b's inferred type from the compiling is Decimal(7,4) both in TiDB and in TiFlash. Constrained by Decimal(7,4), a/b's returned type should be 0.0000. In TiDB, a/b's runtime precision is higher than Decimal(7,4), so the original table data is not filtered by the where a/b condition. However, in TiFlash, the calculation of a/b uses Decimal(7,4) as the result type, so the original table data is filtered by the where a/b condition.

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.