Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] fix partial update column name sensitive issue #55430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fe/fe-core/src/main/java/com/starrocks/load/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,9 @@ public static void initColumns(Table tbl, List<ImportColumnDesc> columnExprs,

public static List<Column> getPartialUpateColumns(Table tbl, List<ImportColumnDesc> columnExprs,
List<Boolean> missAutoIncrementColumn) throws StarRocksException {
Set<String> specified = columnExprs.stream().map(desc -> desc.getColumnName()).collect(Collectors.toSet());
Set<String> specified = columnExprs.stream()
.map(desc -> desc.getColumnName())
.collect(Collectors.toCollection(() -> Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER)));
List<Column> ret = new ArrayList<>();
for (Column col : tbl.getBaseSchema()) {
if (specified.contains(col.getName())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1,"xx"
51 changes: 51 additions & 0 deletions test/sql/test_stream_load/R/test_partial_update_case_sensitive
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-- name: test_partial_update_case_sensitive
create database test_partial_update_case_sensitive;
-- result:
-- !result
use test_partial_update_case_sensitive;
-- result:
-- !result
CREATE TABLE test1 (
`id` bigint(20) NOT NULL COMMENT "",
`name` char(16) NULL DEFAULT "" COMMENT "",
`city` char(16) NULL DEFAULT "" COMMENT "",
`age` char(24) NULL DEFAULT "" COMMENT ""
) ENGINE=OLAP
PRIMARY KEY(`id`)
DISTRIBUTED BY HASH(`id`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "DEFAULT",
"enable_persistent_index" = "true",
"compression" = "LZ4"
);
-- result:
-- !result
insert into test_partial_update_case_sensitive.test1 values(1,'name1','SD',5),(2,'name2','SH',25),(3,'name3','BJ',50);
-- result:
-- !result
shell: curl --location-trusted -u root: -X PUT -H "Expect:100-continue" -H "format: csv" -H "partial_update: true" -H "columns: ID, city" -H column_separator:, -T ${root_path}/lib/../common/data/stream_load/test_partial_update_case_sensitive.csv ${url}/api/test_partial_update_case_sensitive/test1/_stream_load
-- result:
0
{
"Status": "Success",
"Message": "OK"
}
-- !result
sync;
-- result:
-- !result
select * from test_partial_update_case_sensitive.test1;
-- result:
2 name2 SH 25
1 name1 "xx" 5
3 name3 BJ 50
-- !result
select * from test_partial_update_case_sensitive.test1 where name = "name1";
-- result:
1 name1 "xx" 5
-- !result
drop database test_partial_update_case_sensitive force;
-- result:
-- !result
27 changes: 27 additions & 0 deletions test/sql/test_stream_load/T/test_partial_update_case_sensitive
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- name: test_partial_update_case_sensitive
create database test_partial_update_case_sensitive;
use test_partial_update_case_sensitive;
CREATE TABLE test1 (
`id` bigint(20) NOT NULL COMMENT "",
`name` char(16) NULL DEFAULT "" COMMENT "",
`city` char(16) NULL DEFAULT "" COMMENT "",
`age` char(24) NULL DEFAULT "" COMMENT ""
) ENGINE=OLAP
PRIMARY KEY(`id`)
DISTRIBUTED BY HASH(`id`)
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "DEFAULT",
"enable_persistent_index" = "true",
"compression" = "LZ4"
);

insert into test_partial_update_case_sensitive.test1 values(1,'name1','SD',5),(2,'name2','SH',25),(3,'name3','BJ',50);
shell: curl --location-trusted -u root: -X PUT -H "Expect:100-continue" -H "format: csv" -H "partial_update: true" -H "columns: ID, city" -H column_separator:, -T ${root_path}/lib/../common/data/stream_load/test_partial_update_case_sensitive.csv ${url}/api/test_partial_update_case_sensitive/test1/_stream_load
sync;

select * from test_partial_update_case_sensitive.test1;
select * from test_partial_update_case_sensitive.test1 where name = "name1";

drop database test_partial_update_case_sensitive force;
Loading