This is an automated email from the ASF dual-hosted git repository.

xuyang pushed a commit to branch struct-type
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 1f360b6a09d75cb8490a85904bafcdfd45607a3e
Author: carlvinhust2012 <huchengha...@126.com>
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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to