Skip to content

Commit

Permalink
[fix](stream_load)streamload with double quotes #27942 (#39634)
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan authored Sep 23, 2024
1 parent 61aa9cb commit d3f9f9b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 25 deletions.
4 changes: 2 additions & 2 deletions be/src/util/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ struct Slice {
bool trim_quote() {
int32_t begin = 0;
bool change = false;
if (size > 2 && ((data[begin] == '"' && data[size - 1] == '"') ||
(data[begin] == '\'' && data[size - 1] == '\''))) {
if (size >= 2 && ((data[begin] == '"' && data[size - 1] == '"') ||
(data[begin] == '\'' && data[size - 1] == '\''))) {
data += 1;
size -= 2;
change = true;
Expand Down
4 changes: 2 additions & 2 deletions be/test/vec/data_types/serde/data_type_serde_text_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ TEST(TextSerde, ComplexTypeSerdeTextTest) {
"{\"hello "
"world\":0.2222222,\"hello2\":null,null:1111.1,\"NULL\":null,\"null\":"
"null,\"null\":0.1}"},
{"{ ,.amory:111.2343, \"\":112, dggs:13.14, NULL:12.2222222, :NULL}",
"{\"\":NULL, NULL:12.44}", "{}", "{}", "NULL", "{}", "NULL",
{"{ ,.amory:111.2343, :112, dggs:13.14, NULL:12.2222222, :NULL}",
"{:NULL, NULL:12.44}", "{}", "{}", "NULL", "{}", "NULL",
"{NULL:NULL, null:NULL}",
"{hello world:0.2222222, hello2:NULL, NULL:1111.1, NULL:NULL, null:NULL, "
"null:0.1}"}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
"6","7","3","abc","2022-12-01","2022-12-01:09:30:31"
"7","8","3","abc","2022-12-01","2022-12-01:09:30:31"
"8","9","3","abc","2022-12-01","2022-12-01:09:30:31"
"2","","","",2023-07-15,"2023-07-20:05:48:31"
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
\N \N \N "" 2023-07-15 \N
\N \N \N "abc" \N \N
\N \N \N "abc" \N \N
\N \N \N "abc" \N \N
Expand All @@ -11,6 +12,7 @@

-- !sql --
1 2 3 abc 2022-12-01 2022-12-01T09:30:31
2 \N \N 2023-07-15 2023-07-20T05:48:31
2 3 3 abc 2022-12-01 2022-12-01T09:30:31
3 4 3 abc 2022-12-01 2022-12-01T09:30:31
4 5 3 abc 2022-12-01 2022-12-01T09:30:31
Expand Down
Loading

0 comments on commit d3f9f9b

Please sign in to comment.