Skip to content

Commit

Permalink
fix sqllogic test
Browse files Browse the repository at this point in the history
  • Loading branch information
xudong963 committed Dec 18, 2023
1 parent 0fca56c commit 4f21740
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@
use std::collections::HashMap;
use std::sync::Arc;

use databend_common_base::base::ProgressValues;
use databend_common_catalog::plan::PartInfoPtr;
use databend_common_catalog::table_context::TableContext;
use databend_common_exception::Result;
use databend_common_expression::ConstantFolder;
use databend_common_expression::Expr;
use databend_common_expression::FunctionContext;
use databend_common_expression::Scalar;
use databend_common_expression::TableSchema;
use databend_common_functions::BUILTIN_FUNCTIONS;
use databend_common_sql::IndexType;
use databend_storages_common_index::statistics_to_domain;
use log::info;

use crate::FusePartInfo;

pub fn runtime_filter_pruner(
ctx: Arc<dyn TableContext>,
table_index: IndexType,
table_schema: Arc<TableSchema>,
part: &PartInfoPtr,
filters: &Vec<Expr<String>>,
func_ctx: &FunctionContext,
) -> Result<bool> {
let filters = ctx.get_runtime_filter_with_id(table_index);
if filters.is_empty() {
return Ok(false);
}
Expand Down Expand Up @@ -73,10 +77,13 @@ pub fn runtime_filter_pruner(
});

if pruned {
info!(
"Pruned partition with {:?} rows by runtime filter",
part.nums_rows
);
// Only collect how many rows are pruned.(bytes is dummy value, its difficult to calculate)
let progress_val = ProgressValues {
rows: part.nums_rows,
// Dummy value
bytes: 0,
};
ctx.get_runtime_filter_prune_process().incr(&progress_val);
return Ok(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ select count() from t1, t2 where t1.a = t2.a;
----
100

# check if runtime filter prune rows > 0. If so, runtime filter prune works
query I
select runtime_filter_prune_rows from system.query_log where runtime_filter_prune_rows = 900000 limit 1;
SELECT
CASE
WHEN COUNT(*) > 0 THEN 1
ELSE 0
END
FROM
system.query_log
WHERE
runtime_filter_prune_rows > 0;
----
900000
1

statement ok
drop table t1
Expand Down

0 comments on commit 4f21740

Please sign in to comment.