github-actions[bot] commented on code in PR #62575:
URL: https://github.com/apache/doris/pull/62575#discussion_r3122692920


##########
be/src/format/csv/csv_reader.cpp:
##########
@@ -473,15 +474,30 @@ Status 
CsvReader::get_parsed_schema(std::vector<std::string>* col_names,
     return Status::OK();
 }
 
-Status CsvReader::_deserialize_nullable_string(IColumn& column, Slice& slice) {
-    auto& null_column = assert_cast<ColumnNullable&>(column);
-    if (_empty_field_as_null) {
-        if (slice.size == 0) {
-            null_column.insert_data(nullptr, 0);
-            return Status::OK();
+bool CsvReader::is_enclosed_csv_field(const Slice& line, size_t 
value_start_offset,
+                                      size_t value_len, char enclose, bool 
trim_tailing_spaces) {
+    if (trim_tailing_spaces) {
+        while (value_len > 0 && line.data[value_start_offset + value_len - 1] 
== ' ') {
+            --value_len;
         }
     }
-    if (_options.null_len > 0 && !(_options.converted_from_string && 
slice.trim_double_quotes())) {
+    return value_len > 1 && line.data[value_start_offset] == enclose &&
+           line.data[value_start_offset + value_len - 1] == enclose;
+}
+
+Status CsvReader::_deserialize_nullable_string(IColumn& column, Slice& slice, 
bool was_enclosed) {
+    auto& null_column = assert_cast<ColumnNullable&>(column);
+
+    bool is_quoted_string = was_enclosed;

Review Comment:
   `was_enclosed` should not replace the old `trim_double_quotes()` 
normalization. When `enclose` is a custom character, the splitter removes that 
outer wrapper before this method runs, so a field like `A"\N"A` reaches this 
branch as `"\N"` with `was_enclosed == true`. Before this patch, 
`trim_double_quotes=true` still stripped the inner `"..."` and produced `\N`; 
after this change we skip `slice.trim_double_quotes()` entirely and store the 
literal `"\N"` instead. The same happens for `A""A`, which used to deserialize 
to an empty string. Please keep the existing `slice.trim_double_quotes()` call 
for payload normalization and use `was_enclosed` only to decide whether the 
null/empty checks should fire.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to