Skip to content

[Bug] When using Uniq model, we can't update a part of columns, i.e. replace_if_not_null is invalid. #9210

@lide-reed

Description

@lide-reed

Search before asking

  • I had searched in the issues and found no similar issues.

Version

dev-1.0.1

What's Wrong?

Step 1:
CREATE TABLE test1 (
goods_id bigint(20) ,
goods_name varchar(200),
day_sale int(11) ,
date date
)
UNIQUE KEY(goods_id)
DISTRIBUTED BY HASH(goods_id) BUCKETS 10
PROPERTIES
(
"replace_if_not_null" = "true"
);

Step 2:
INSERT INTO test1 ( goods_id, goods_name, day_sale, date )
VALUES
( 1, "good1", 10, '2022-04-20' ),
(2, "good2",12,'2022-04-20');

MySQL [test]> select * from test1;
+----------+------------+----------+------------+
| goods_id | goods_name | day_sale | date |
+----------+------------+----------+------------+
| 2 | good2 | 12 | 2022-04-20 |
| 1 | good1 | 10 | 2022-04-20 |
+----------+------------+----------+------------+
2 rows in set (0.01 sec)

Step 3:
INSERT INTO test1 ( goods_id, goods_name, day_sale, date )
VALUES
( 1, NULL, 11, '2022-04-20' ),
(2,NULL,13,'2022-04-20');

MySQL [test]> select * from test1;+----------+------------+----------+------------+
| goods_id | goods_name | day_sale | date |
+----------+------------+----------+------------+
| 2 | NULL | 13 | 2022-04-20 |
| 1 | NULL | 11 | 2022-04-20 |
+----------+------------+----------+------------+
2 rows in set (0.01 sec)

Expect:
MySQL [test]> select * from test1;
+----------+------------+----------+------------+
| goods_id | goods_name | day_sale | date |
+----------+------------+----------+------------+
| 2 | good2 | 13 | 2022-04-20 |
| 1 | good1 | 11 | 2022-04-20 |
+----------+------------+----------+------------+
2 rows in set (0.01 sec)

What You Expected?

MySQL [test]> select * from test1;
+----------+------------+----------+------------+
| goods_id | goods_name | day_sale | date |
+----------+------------+----------+------------+
| 2 | good2 | 13 | 2022-04-20 |
| 1 | good1 | 11 | 2022-04-20 |
+----------+------------+----------+------------+
2 rows in set (0.01 sec)

Expect it could implement part columns updating.

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleusercaseImportant user case type label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions