yiguolei commented on code in PR #62835:
URL: https://github.com/apache/doris/pull/62835#discussion_r3142881818
##########
be/src/format/csv/csv_reader.cpp:
##########
@@ -377,26 +380,29 @@ Status CsvReader::_do_init_reader(ReaderInitContext*
base_ctx) {
return Status::OK();
}
+void CsvReader::set_batch_size(size_t batch_size) {
+ // 0 means "not set" / "use default" for the row-based readers; we must
+ // never let _batch_size be 0 because _do_get_next_block uses it as the
+ // upper bound of a `while (rows < _batch_size)` loop and a 0 would make
+ // the reader return empty blocks and incorrectly signal EOF.
+ _batch_size = std::max(_MIN_BATCH_SIZE, batch_size);
+}
+
// !FIXME: Here we should use MutableBlock
Status CsvReader::_do_get_next_block(Block* block, size_t* read_rows, bool*
eof) {
if (_line_reader_eof) {
*eof = true;
return Status::OK();
}
- const int batch_size = std::max(_state->batch_size(),
(int)_MIN_BATCH_SIZE);
- const int64_t max_block_bytes =
- (_state->query_type() == TQueryType::LOAD &&
config::load_reader_max_block_bytes > 0)
- ? config::load_reader_max_block_bytes
- : 0;
+ const size_t batch_size = _batch_size;
+ const auto max_block_bytes = _state->preferred_block_size_bytes();
size_t rows = 0;
- size_t block_bytes = 0;
bool success = false;
bool is_remove_bom = false;
if (_push_down_agg_type == TPushAggOp::type::COUNT) {
- while (rows < batch_size && !_line_reader_eof &&
- (max_block_bytes <= 0 || (int64_t)block_bytes <
max_block_bytes)) {
Review Comment:
之前这里没意义吗?
--
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]