Skip to content

[Bug] Wrong query result of min/max for string type col #5188

@morningman

Description

@morningman

Describe the bug

mysql> create table tbl5 (k1 int, v1 varchar(32) max, v2 varchar(32) min) distributed by hash(k1) buckets 1 properties("replication_num" = "1");
Query OK, 0 rows affected (0.04 sec)

mysql> insert into tbl5 values(1, null, null);
Query OK, 1 row affected (0.05 sec)
{'label':'insert_5546aa85dcd14f74-997b253c2c5a09f6', 'status':'VISIBLE', 'txnId':'400533955'}

mysql> insert into tbl5 values(1, "a", "b");
Query OK, 1 row affected (0.06 sec)
{'label':'insert_3b74d1d635084cf8-bc7ad886b3beff82', 'status':'VISIBLE', 'txnId':'400533956'}

mysql> select max(v1), min(v2) from tbl5;
+-----------+-----------+
| max(`v1`) | min(`v2`) |
+-----------+-----------+
| NULL      | NULL      |
+-----------+-----------+

Expected behavior

mysql> select max(v1), min(v2) from tbl5;
+-----------+-----------+
| max(`v1`) | min(`v2`) |
+-----------+-----------+
| a         | b         |
+-----------+-----------+
  • Version [0.13.12]

Metadata

Metadata

Assignees

Labels

area/sql/functionIssues or PRs related to the SQL functionskind/fixCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions