morningman commented on code in PR #17369:
URL: https://github.com/apache/doris/pull/17369#discussion_r1126215691


##########
be/src/vec/exec/format/csv/csv_reader.cpp:
##########
@@ -462,8 +462,22 @@ void 
CsvReader::_split_line_for_single_char_delimiter(const Slice& line) {
         size_t cur_pos = 0;
         size_t start_field = 0;
         const size_t size = line.size;
+        bool quoted = false;
+
         for (; cur_pos < size; ++cur_pos) {
-            if (*(value + cur_pos) == _value_separator[0]) {
+            if (_trim_double_quotes && *(value + cur_pos) == '\"') {
+                if (cur_pos == start_field) {
+                    // start_field is ", mark quoted true
+                    quoted = true;
+                } else if (*(value + cur_pos - 1) != '\\' && quoted) {
+                    // cur_pos is ", mark quoted finished
+                    quoted = !quoted;
+                }
+                continue;
+            } else if (_trim_double_quotes && quoted) {

Review Comment:
   Better leave `_split_line_for_single_char_delimiter` fast enough to not 
handle this complex situation.
   Maybe we should be a new parameter to specify the `escape` explicitly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to