Skip to content

Commit ae0effb

Browse files
authored
Merge pull request #10715 from sundy-li/finish-empty_builder
chore(query): make flush returns empty builder
2 parents d7023eb + 05fbccd commit ae0effb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/query/expression/src/types/string.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,11 @@ impl StringColumnBuilder {
330330
let bytes_per_row = self.data.len() / 64 + 1;
331331
let bytes_estimate = bytes_per_row * self.offsets.capacity();
332332

333+
const MAX_HINT_SIZE: usize = 1000000000;
333334
// if we are more than 10% over the capacity, we reserve more
334-
if bytes_estimate as f64 > self.data.capacity() as f64 * 1.10f64 {
335+
if bytes_estimate < MAX_HINT_SIZE
336+
&& bytes_estimate as f64 > self.data.capacity() as f64 * 1.10f64
337+
{
335338
self.data.reserve(bytes_estimate - self.data.capacity());
336339
}
337340
}

src/query/pipeline/sources/src/input_formats/input_format_text.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,7 @@ impl<T: InputFormatTextBase> BlockBuilder<T> {
463463
.mutable_columns
464464
.iter_mut()
465465
.map(|col| {
466-
let empty_builder = ColumnBuilder::with_capacity(
467-
&col.data_type(),
468-
self.ctx.block_compact_thresholds.min_rows_per_block,
469-
);
466+
let empty_builder = ColumnBuilder::with_capacity(&col.data_type(), 0);
470467
std::mem::replace(col, empty_builder).build()
471468
})
472469
.collect();

0 commit comments

Comments
 (0)