From 4f21740094a644db27fd9b491d6f397b1dbb7520 Mon Sep 17 00:00:00 2001 From: xudong963 Date: Fri, 15 Dec 2023 12:26:43 +0800 Subject: [PATCH] fix sqllogic test --- .../operations/read/runtime_filter_prunner.rs | 19 +++++++++++++------ .../01_system/01_0002_system_query_log.test | 13 +++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/query/storages/fuse/src/operations/read/runtime_filter_prunner.rs b/src/query/storages/fuse/src/operations/read/runtime_filter_prunner.rs index 58f479961206..7b3ac6adc08d 100644 --- a/src/query/storages/fuse/src/operations/read/runtime_filter_prunner.rs +++ b/src/query/storages/fuse/src/operations/read/runtime_filter_prunner.rs @@ -15,7 +15,9 @@ 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; @@ -23,17 +25,19 @@ 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, + table_index: IndexType, table_schema: Arc, part: &PartInfoPtr, - filters: &Vec>, func_ctx: &FunctionContext, ) -> Result { + let filters = ctx.get_runtime_filter_with_id(table_index); if filters.is_empty() { return Ok(false); } @@ -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); } diff --git a/tests/sqllogictests/suites/base/01_system/01_0002_system_query_log.test b/tests/sqllogictests/suites/base/01_system/01_0002_system_query_log.test index 8dc10d135848..a7e735afc258 100644 --- a/tests/sqllogictests/suites/base/01_system/01_0002_system_query_log.test +++ b/tests/sqllogictests/suites/base/01_system/01_0002_system_query_log.test @@ -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