Skip to content

chore(query): reduce-functions-code-expand #17114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
408 changes: 2 additions & 406 deletions src/query/codegen/src/writes/register.rs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/query/expression/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ impl DataBlock {
DataBlock::new(vec![], 0)
}

#[inline]
pub fn empty_with_rows(rows: usize) -> Self {
DataBlock::new(vec![], rows)
}

#[inline]
pub fn empty_with_schema(schema: DataSchemaRef) -> Self {
let columns = schema
Expand Down
8 changes: 4 additions & 4 deletions src/query/expression/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> {
};

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

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

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

if all_args_is_scalar {
let block = DataBlock::empty();
let block = DataBlock::empty_with_rows(1);
let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry);
// Since we know the expression is constant, it'll be safe to change its column index type.
let func_expr = func_expr.project_column_ref(|_| unreachable!());
Expand Down
5 changes: 4 additions & 1 deletion src/query/expression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ mod kernels;
mod property;
mod register;
mod register_comparison;
#[allow(dead_code)]
mod register_vectorize;

pub mod row;
pub mod sampler;
pub mod schema;
Expand All @@ -75,8 +78,8 @@ pub use crate::hilbert::*;
pub use crate::input_columns::*;
pub use crate::kernels::*;
pub use crate::property::*;
pub use crate::register::*;
pub use crate::register_comparison::*;
pub use crate::register_vectorize::*;
pub use crate::row::*;
pub use crate::schema::*;
pub use crate::utils::block_thresholds::BlockThresholds;
Expand Down
Loading
Loading