The helper functions introduced in https://github.com/pingcap/tidb/pull/14975 have a bug, where I can't easily use them in the MySQL CLI because they print as hex.
mysql -P4000 -uroot --column-type-info=1 -e 'SELECT FORMAT_BYTES(1024), CAST(FORMAT_BYTES(1024) as CHAR)'
Field 1: `FORMAT_BYTES(1024)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: VAR_STRING
Collation: binary (63)
Length: 0
Max_length: 8
Decimals: 31
Flags: UNSIGNED
Field 2: `CAST(FORMAT_BYTES(1024) as CHAR)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: VAR_STRING
Collation: utf8mb4_bin (46)
Length: 0
Max_length: 8
Decimals: 31
Flags:
+----------------------------------------+----------------------------------+
| FORMAT_BYTES(1024) | CAST(FORMAT_BYTES(1024) as CHAR) |
+----------------------------------------+----------------------------------+
| 0x312E3030204B6942 | 1.00 KiB |
+----------------------------------------+----------------------------------+
Here is the behavior of MySQL:
./use --column-type-info=1 -e 'SELECT FORMAT_BYTES(1024), CAST(FORMAT_BYTES(1024) as CHAR)'
Field 1: `FORMAT_BYTES(1024)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: VAR_STRING
Collation: utf8mb4_0900_ai_ci (255)
Length: 44
Max_length: 8
Decimals: 31
Flags:
Field 2: `CAST(FORMAT_BYTES(1024) as CHAR)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: VAR_STRING
Collation: utf8mb4_0900_ai_ci (255)
Length: 44
Max_length: 8
Decimals: 31
Flags:
+--------------------+----------------------------------+
| FORMAT_BYTES(1024) | CAST(FORMAT_BYTES(1024) as CHAR) |
+--------------------+----------------------------------+
| 1.00 KiB | 1.00 KiB |
+--------------------+----------------------------------+
This applies to both format_bytes and format_nano_time. They need to be wrapped in a cast function to return printable characters for the mysql cli.
tidb-server -V or run select tidb_version(); on TiDB)?mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta-385-g107b071e0
Git Commit Hash: 107b071e0c1d8c5678911ccb2808e42db0abf63c
Git Branch: master
UTC Build Time: 2020-03-11 03:54:18
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
PTAL @gauss1314
Let me fix it.
Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: https://github.com/pingcap/tidb/issues/20100
Most helpful comment
Let me fix it.