Skip to content

Commit 3d378ee

Browse files
authored
feat(query): bloom index support prune expr with simple casts (#17533)
* try_eliminate_cast * fold_for_prune * fix * domain * refine test * visit_expr_column_eq_constant * filter_index_field * x * ControlFlow * test * update * RewriteVisitor * clean * fix * refine
1 parent b02aa15 commit 3d378ee

File tree

11 files changed

+1223
-414
lines changed

11 files changed

+1223
-414
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/query/functions/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ bstr = { workspace = true }
1717
bumpalo = { workspace = true }
1818
crc32fast = { workspace = true }
1919
ctor = { workspace = true }
20+
databend-common-ast = { workspace = true }
2021
databend-common-base = { workspace = true }
2122
databend-common-column = { workspace = true }
2223
databend-common-exception = { workspace = true }

src/query/functions/benches/bench.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
#[macro_use]
1616
extern crate criterion;
1717

18-
#[path = "../tests/it/scalars/parser.rs"]
19-
mod parser;
20-
2118
use criterion::Criterion;
2219
use databend_common_expression::type_check;
2320
use databend_common_expression::DataBlock;
2421
use databend_common_expression::Evaluator;
2522
use databend_common_expression::FunctionContext;
23+
use databend_common_functions::test_utils as parser;
2624
use databend_common_functions::BUILTIN_FUNCTIONS;
2725

2826
fn bench(c: &mut Criterion) {

src/query/functions/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub mod aggregates;
3333
mod cast_rules;
3434
pub mod scalars;
3535
pub mod srfs;
36+
pub mod test_utils;
3637

3738
pub fn is_builtin_function(name: &str) -> bool {
3839
let name = Ascii::new(name);

src/query/functions/tests/it/scalars/parser.rs renamed to src/query/functions/src/test_utils.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Datafuse Labs.
1+
// Copyright 2021 Datafuse Labs
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -37,7 +37,8 @@ use databend_common_expression::ConstantFolder;
3737
use databend_common_expression::FunctionContext;
3838
use databend_common_expression::RawExpr;
3939
use databend_common_expression::Scalar;
40-
use databend_common_functions::BUILTIN_FUNCTIONS;
40+
41+
use crate::BUILTIN_FUNCTIONS;
4142

4243
pub fn parse_raw_expr(text: &str, columns: &[(&str, DataType)]) -> RawExpr {
4344
let tokens = tokenize_sql(text).unwrap();
@@ -107,7 +108,7 @@ macro_rules! transform_interval_add_sub {
107108
};
108109
}
109110

110-
pub fn transform_expr(ast: AExpr, columns: &[(&str, DataType)]) -> RawExpr {
111+
fn transform_expr(ast: AExpr, columns: &[(&str, DataType)]) -> RawExpr {
111112
match ast {
112113
AExpr::Literal { span, value } => RawExpr::Constant {
113114
span,
@@ -631,7 +632,7 @@ fn transform_data_type(target_type: databend_common_ast::ast::TypeName) -> DataT
631632
}
632633
}
633634

634-
pub fn transform_literal(lit: ASTLiteral) -> Scalar {
635+
fn transform_literal(lit: ASTLiteral) -> Scalar {
635636
let scalar = match lit {
636637
ASTLiteral::UInt64(u) => Scalar::Number(NumberScalar::UInt64(u)),
637638
ASTLiteral::Decimal256 {

src/query/functions/tests/it/scalars/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ mod math;
5151
mod misc;
5252
mod obfuscator;
5353
mod other;
54-
pub(crate) mod parser;
5554
mod regexp;
5655
mod string;
5756
mod tuple;
5857
mod variant;
5958
mod vector;
6059

60+
pub use databend_common_functions::test_utils as parser;
61+
6162
pub fn run_ast(file: &mut impl Write, text: impl AsRef<str>, columns: &[(&str, Column)]) {
6263
let text = text.as_ref();
6364
let result: Result<_> = try {

src/query/storages/common/index/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ databend-common-expression = { workspace = true }
2323
databend-common-functions = { workspace = true }
2424
databend-storages-common-table-meta = { workspace = true }
2525
fastrace = { workspace = true }
26+
goldenfile = { workspace = true }
2627
jsonb = { workspace = true }
2728
levenshtein_automata = { workspace = true }
2829
log = { workspace = true }

0 commit comments

Comments
 (0)