Skip to content

Commit 1f9a4eb

Browse files
authored
chore(query): reduce-functions-code-expand (#17114)
* chore(query): reduce-functions-code-expand * chore(query): reduce-functions-code-expand * chore(query): update * chore(query): fix
1 parent f11e4b3 commit 1f9a4eb

File tree

11 files changed

+630
-6744
lines changed

11 files changed

+630
-6744
lines changed

src/query/codegen/src/writes/register.rs

Lines changed: 2 additions & 406 deletions
Large diffs are not rendered by default.

src/query/expression/src/block.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ impl DataBlock {
175175
DataBlock::new(vec![], 0)
176176
}
177177

178+
#[inline]
179+
pub fn empty_with_rows(rows: usize) -> Self {
180+
DataBlock::new(vec![], rows)
181+
}
182+
178183
#[inline]
179184
pub fn empty_with_schema(schema: DataSchemaRef) -> Self {
180185
let columns = schema

src/query/expression/src/evaluator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,7 +1910,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
19101910
};
19111911

19121912
if inner_expr.as_constant().is_some() {
1913-
let block = DataBlock::empty();
1913+
let block = DataBlock::empty_with_rows(1);
19141914
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
19151915
// Since we know the expression is constant, it'll be safe to change its column index type.
19161916
let cast_expr = cast_expr.project_column_ref(|_| unreachable!());
@@ -2041,7 +2041,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
20412041
};
20422042

20432043
if all_args_is_scalar {
2044-
let block = DataBlock::empty();
2044+
let block = DataBlock::empty_with_rows(1);
20452045
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
20462046
// Since we know the expression is constant, it'll be safe to change its column index type.
20472047
let func_expr = func_expr.project_column_ref(|_| unreachable!());
@@ -2120,7 +2120,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
21202120
}
21212121

21222122
if all_args_is_scalar {
2123-
let block = DataBlock::empty();
2123+
let block = DataBlock::empty_with_rows(1);
21242124
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
21252125
// Since we know the expression is constant, it'll be safe to change its column index type.
21262126
let func_expr = func_expr.project_column_ref(|_| unreachable!());
@@ -2167,7 +2167,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
21672167
};
21682168

21692169
if all_args_is_scalar {
2170-
let block = DataBlock::empty();
2170+
let block = DataBlock::empty_with_rows(1);
21712171
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
21722172
// Since we know the expression is constant, it'll be safe to change its column index type.
21732173
let func_expr = func_expr.project_column_ref(|_| unreachable!());

src/query/expression/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ mod kernels;
5555
mod property;
5656
mod register;
5757
mod register_comparison;
58+
#[allow(dead_code)]
59+
mod register_vectorize;
60+
5861
pub mod row;
5962
pub mod sampler;
6063
pub mod schema;
@@ -75,8 +78,8 @@ pub use crate::hilbert::*;
7578
pub use crate::input_columns::*;
7679
pub use crate::kernels::*;
7780
pub use crate::property::*;
78-
pub use crate::register::*;
7981
pub use crate::register_comparison::*;
82+
pub use crate::register_vectorize::*;
8083
pub use crate::row::*;
8184
pub use crate::schema::*;
8285
pub use crate::utils::block_thresholds::BlockThresholds;

0 commit comments

Comments
 (0)