This is an automated email from the ASF dual-hosted git repository.
cambyzju pushed a commit to branch struct-type
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/struct-type by this push:
new b5a048b4ce [fix](struct-type) support to remove double or single quote
(#15977)
b5a048b4ce is described below
commit b5a048b4cefb61391f10640c79d74e505590c700
Author: carlvinhust2012 <[email protected]>
AuthorDate: Mon Jan 16 18:01:16 2023 +0800
[fix](struct-type) support to remove double or single quote (#15977)
---
be/src/vec/data_types/data_type_struct.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/be/src/vec/data_types/data_type_struct.cpp
b/be/src/vec/data_types/data_type_struct.cpp
index 87b5c4f110..a3a54966b0 100644
--- a/be/src/vec/data_types/data_type_struct.cpp
+++ b/be/src/vec/data_types/data_type_struct.cpp
@@ -114,6 +114,7 @@ Status DataTypeStruct::from_string(ReadBuffer& rb, IColumn*
column) const {
return Status::InvalidArgument("Invalid Length");
}
ReadBuffer field_rb(rb.position(), field_len);
+
size_t len = 0;
auto start_rb = field_rb.position();
while (!field_rb.eof() && *start_rb != ':') {
@@ -122,11 +123,12 @@ Status DataTypeStruct::from_string(ReadBuffer& rb,
IColumn* column) const {
}
ReadBuffer field(field_rb.position() + len + 1, field_rb.count() - len
- 1);
- if (field.count() < 2 || *field.position() != '"' || *field.end() !=
'"') {
- field_rbs.push_back(field);
+ if (field.count() >= 2 && ((*field.position() == '"' && *(field.end()
- 1) == '"') ||
+ (*field.position() == '\'' && *(field.end()
- 1) == '\''))) {
+ ReadBuffer field_no_quote(field.position() + 1, field.count() - 2);
+ field_rbs.push_back(field_no_quote);
} else {
- ReadBuffer field_has_quote(field.position() + 1, field.count() -
2);
- field_rbs.push_back(field_has_quote);
+ field_rbs.push_back(field);
}
rb.position() += field_len + 1;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]