Skip to content

Commit b065507

Browse files
committed
fix test
1 parent 7fb95b6 commit b065507

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

src/query/storages/fuse/src/io/write/stream/column_statistics_state.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ impl ColumnStatisticsState {
102102
} else if let Some(estimator) = self.distinct_columns.get(&id) {
103103
col_stats.distinct_of_values = Some(estimator.finalize());
104104
} else {
105-
assert_eq!(col_stats.min, col_stats.max);
106-
if col_stats.min.is_null() {
107-
col_stats.distinct_of_values = Some(0);
108-
} else {
109-
col_stats.distinct_of_values = Some(1);
105+
if col_stats.min == col_stats.max {
106+
if col_stats.min.is_null() {
107+
col_stats.distinct_of_values = Some(0);
108+
} else {
109+
col_stats.distinct_of_values = Some(1);
110+
}
110111
}
111112
}
112113
statistics.insert(id, col_stats);

src/query/storages/fuse/src/operations/common/processors/transform_block_writer.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub struct TransformBlockBuilder {
6363
input_data_size: usize,
6464
input_num_rows: usize,
6565

66-
input_data: VecDeque<DataBlock>,
66+
input_data: VecDeque<(usize, DataBlock)>,
6767
output_data: Option<DataBlock>,
6868
}
6969

@@ -97,14 +97,15 @@ impl TransformBlockBuilder {
9797
}
9898

9999
fn split_input(&self, input: DataBlock) -> Vec<DataBlock> {
100-
let min_bytes_per_block = self.properties.block_thresholds.min_bytes_per_block;
101100
let block_size = input.estimate_block_size();
102-
if block_size <= min_bytes_per_block {
103-
return vec![input];
104-
}
105101
let num_rows = input.num_rows();
106102
let average_row_size = block_size.div_ceil(num_rows);
107-
let max_rows = min_bytes_per_block.div_ceil(average_row_size);
103+
let max_rows = self
104+
.properties
105+
.block_thresholds
106+
.min_bytes_per_block
107+
.div_ceil(average_row_size)
108+
.min(self.properties.block_thresholds.max_rows_per_block);
108109
input.split_by_rows_no_tail(max_rows)
109110
}
110111
}
@@ -181,14 +182,16 @@ impl Processor for TransformBlockBuilder {
181182
State::Collect(block) => {
182183
// Check if the datablock is valid, this is needed to ensure data is correct
183184
block.check_valid()?;
184-
self.input_data_size += block.estimate_block_size();
185185
self.input_num_rows += block.num_rows();
186-
let blocks = self.split_input(block);
187-
self.input_data.extend(blocks);
186+
for block in self.split_input(block) {
187+
let block_size = block.estimate_block_size();
188+
self.input_data_size += block_size;
189+
self.input_data.push_back((block_size, block));
190+
}
188191
}
189192
State::Serialize => {
190-
while let Some(b) = self.input_data.pop_front() {
191-
self.input_data_size -= b.estimate_block_size();
193+
while let Some((block_size, b)) = self.input_data.pop_front() {
194+
self.input_data_size -= block_size;
192195
self.input_num_rows -= b.num_rows();
193196

194197
let builder = self.get_or_create_builder()?;
@@ -201,7 +204,7 @@ impl Processor for TransformBlockBuilder {
201204
}
202205
}
203206
State::Finalize => {
204-
while let Some(b) = self.input_data.pop_front() {
207+
while let Some((_, b)) = self.input_data.pop_front() {
205208
let builder = self.get_or_create_builder()?;
206209
builder.write(b)?;
207210
}

tests/sqllogictests/suites/base/09_fuse_engine/09_0004_remote_insert_into_select.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ CREATE DATABASE db_09_004
77
statement ok
88
USE db_09_004
99

10-
statement ok
11-
set enable_block_stream_write = 1
12-
1310
statement ok
1411
CREATE TABLE IF NOT EXISTS t1(a UInt8 not null, b UInt64 not null, c Int8 not null, d Int64 not null, e Date not null, f Date not null, g DateTime not null, h String not null) Engine = Fuse
1512

tests/sqllogictests/suites/base/09_fuse_engine/09_0008_fuse_optimize_table.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ CREATE DATABASE db_09_0008
77
statement ok
88
USE db_09_0008
99

10-
statement ok
11-
set enable_block_stream_write = 1
12-
1310
statement ok
1411
create table t(a uint64 not null)
1512

tests/sqllogictests/suites/base/issues/issue_18275.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ CREATE OR REPLACE TABLE product_test (
1414
stock INT
1515
);
1616

17-
statement ok
18-
set enable_block_stream_write = 1;
19-
2017
statement ok
2118
INSERT INTO product_test (id, name, category, price, stock)
2219
VALUES(6, 'Keyboard', 'Electronics', 79.99, 25),

0 commit comments

Comments
 (0)