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


##########
be/src/format/csv/hive_csv_parser.h:
##########
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <cstddef>
+#include <string>
+#include <vector>
+
+#include "util/slice.h"
+
+namespace doris {
+
+// OpenCSVSerde runs one OpenCSV 2.3 reader per Hadoop TextInputFormat record.
+// Returned slices reference this parser's decoded buffer until the next 
parse().
+// The field limit bounds delimiter metadata by the requested column prefix.
+class HiveCsvParser {
+public:
+    HiveCsvParser(std::string separator, char quote, char escape, size_t 
field_limit);
+    void parse(const Slice& line, std::vector<Slice>* fields);
+
+private:
+    std::string _separator;
+    char _quote;
+    char _escape;
+    size_t _field_limit;
+    std::string _decoded;

Review Comment:
   [P1] Run allocator checks before growing decoded-row scratch
   
   `_decoded` can grow to the size of a whole record, but `std::string` growth 
bypasses Doris `Allocator::memory_check()` and `clear()` retains the largest 
capacity until this range reader is destroyed. The line reader simultaneously 
holds the raw record (with a 4 GiB configured ceiling), then the output column 
copies the decoded bytes, so one valid wide row can materialize this entire 
extra copy before the query limit is enforced and keep it resident for the 
range. Please use allocator-aware/pre-reserved scratch (or decode in place) and 
release outlier capacity so this fails under the query memory limit instead of 
producing a process-level spike.



-- 
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