github-actions[bot] commented on code in PR #68027: URL: https://github.com/apache/doris/pull/68027#discussion_r4027385314
########## be/src/format_v2/delimited_text/hive_csv_line_reader.cpp: ########## @@ -0,0 +1,40 @@ +// 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. + +#include "format_v2/delimited_text/hive_csv_line_reader.h" + +namespace doris::format::csv { + +const uint8_t* HiveCsvLineReaderCtx::read_line(const uint8_t* start, size_t len) { + for (size_t i = 0; i < len; ++i) { Review Comment: [P1] Resume delimiter search after compressed refills. `NewPlainTextLineReader` calls this context repeatedly with the entire accumulated output buffer until a delimiter appears, but this loop restarts at byte 0 each time. Compressed input is refilled in 2 MiB chunks, so a valid incompressible N-byte physical record is searched over prefixes of roughly 2 MiB, 4 MiB, ... N (about 256 GiB of byte checks for a 1 GiB record) before the CSV parser scans it again. The previous enclosure-aware context retained `_idx`, and the added tests are all uncompressed. Please retain a per-record search offset, rechecking only a terminal CR for CRLF lookahead, and reset it in `refresh()`. ########## fe/fe-core/src/main/java/org/apache/doris/datasource/scan/PluginDrivenScanNode.java: ########## @@ -1102,6 +1102,14 @@ protected TFileAttributes getFileAttributes() throws UserException { attrs.setTrimDoubleQuotes(true); } + if ("true".equals(props.get(ScanNodePropertyKeys.TEXT_HIVE_OPEN_CSV))) { + // The optional wire field alone cannot fence old readers during a rolling upgrade. + if (Config.be_exec_version < Config.HIVE_OPEN_CSV_MIN_BE_EXEC_VERSION) { + throw new UserException("Hive OpenCSVSerde requires backend execution version " + + Config.HIVE_OPEN_CSV_MIN_BE_EXEC_VERSION + " or newer during rolling upgrade"); + } + attrs.setHiveOpenCsv(true); Review Comment: [P1] Require FileScannerV2 for this semantic flag. This is distinct from the old-BE fence and earlier parser-state threads: a current version-15 BE receives `hive_open_csv`, but `FileScanLocalState::should_use_file_scanner_v2()` still honors `enable_file_scanner_v2=false` and routes the scan through legacy `FileScanner`, whose CSV reader never consumes the flag. That is a silent correctness fallback: with the default `read_csv_empty_line_as_null=false`, a blank physical record is skipped by V1, while Hive/OpenCSVSerde (and this V2 implementation) returns an all-NULL row. The regression's `checkV2` helper forces V2 on, so it cannot catch this. Please force V2 for OpenCSV scans (as the ADBC path does) or reject planning when V2 is disabled. -- 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]
