[FEAT MERGE] Support monotonic filter to accelerate queries.

Co-authored-by: jingtaoye35 <1255153887@qq.com>
Co-authored-by: qingzhu521 <q15000557748@gmail.com>
This commit is contained in:
XIAO-HOU
2024-06-18 01:26:00 +00:00
committed by ob-robot
parent 3baaf656a8
commit d5629a2b36
34 changed files with 1105 additions and 172 deletions

View File

@ -317,6 +317,7 @@ int TestSkipIndexFilter::test_skip_index_filter_pushdown (
sql::ObPushdownExprSpec expr_spec(allocator_);
sql::ObPushdownOperator op(eval_ctx, expr_spec);
sql::ObWhiteFilterExecutor filter(allocator_, filter_node, op);
eval_ctx.batch_size_ = 256;
filter.col_offsets_.init(COLUMN_CNT);
filter.col_params_.init(COLUMN_CNT);
const ObColumnParam *col_param = nullptr;
@ -381,9 +382,10 @@ int TestSkipIndexFilter::test_skip_index_filter_pushdown (
index_info.agg_row_buf_ = buf;
index_info.agg_buf_size_ = buf_size;
index_info.row_header_ = &row_header;
EXPECT_EQ(OB_SUCCESS, skip_index_filter.init(op.get_eval_ctx().get_batch_size(), &allocator_));
ret = skip_index_filter.falsifiable_pushdown_filter(col_idx, filter.filter_.expr_->args_[0]->obj_meta_,
ObSkipIndexType::MIN_MAX, index_info, filter, allocator_);
ObSkipIndexType::MIN_MAX, index_info, filter, allocator_, true);
fal_desc = filter.get_filter_bool_mask();

View File

@ -81,10 +81,15 @@ void TestSSTableIndexFilter::TearDown() {}
void TestSSTableIndexFilter::init()
{
ObIAllocator* allocator_ptr = &allocator_;
exec_ctx_ = OB_NEWx(ObExecContext, allocator_ptr, allocator_);
eval_ctx_ = OB_NEWx(ObEvalCtx, allocator_ptr, *exec_ctx_);
expr_spec_ = OB_NEWx(ObPushdownExprSpec, allocator_ptr, allocator_);
pushdown_operator_ = OB_NEWx(ObPushdownOperator, allocator_ptr, *eval_ctx_, *expr_spec_);
ASSERT_NE(nullptr, exec_ctx_);
ASSERT_NE(nullptr, eval_ctx_);
ASSERT_NE(nullptr, expr_spec_);
ASSERT_NE(nullptr, pushdown_operator_);
eval_ctx_->batch_size_ = 256;
row_header_.row_count_ = TEST_ROW_CNT;
read_info_.cols_index_.array_.init(1, allocator_);
read_info_.cols_index_.array_.push_back(TEST_COLUMN_INDEX);
@ -187,7 +192,7 @@ void TestSSTableIndexFilter::test_sstable_index_filter_check_range_1()
ObObj min_obj;
min_obj.set_uint64(100);
init_micro_index_info(max_obj, min_obj, index_info);
OK(index_filter.check_range(&read_info_, index_info, allocator_));
OK(index_filter.check_range(&read_info_, index_info, allocator_, true));
ASSERT_TRUE(index_info.is_filter_always_false());
ObMicroIndexInfo index_info2;
@ -196,7 +201,7 @@ void TestSSTableIndexFilter::test_sstable_index_filter_check_range_1()
ObObj min_obj2;
min_obj2.set_uint64(40);
init_micro_index_info(max_obj2, min_obj2, index_info2);
OK(index_filter.check_range(&read_info_, index_info2, allocator_));
OK(index_filter.check_range(&read_info_, index_info2, allocator_, true));
ASSERT_TRUE(index_info2.is_filter_uncertain());
childs[2] = create_lt_white_filter(100);
@ -210,7 +215,7 @@ void TestSSTableIndexFilter::test_sstable_index_filter_check_range_1()
ObObj min_obj3;
min_obj3.set_uint64(0);
init_micro_index_info(max_obj3, min_obj3, index_info3);
OK(index_filter2.check_range(&read_info_, index_info3, allocator_));
OK(index_filter2.check_range(&read_info_, index_info3, allocator_, true));
ASSERT_TRUE(index_info3.is_filter_always_true());
}
@ -382,8 +387,8 @@ TEST_F(TestSSTableIndexFilter, test_bool_mask)
TEST_F(TestSSTableIndexFilter, test_sstable_index_filter_extracter)
{
ObPushdownFilterExecutor *white_filter = create_physical_filter(true);
ObPushdownFilterExecutor *black_filter = create_physical_filter(false);
ObPhysicalFilterExecutor *white_filter = static_cast<ObPhysicalFilterExecutor *>(create_physical_filter(true));
ObPhysicalFilterExecutor *black_filter = static_cast<ObPhysicalFilterExecutor *>(create_physical_filter(false));
ASSERT_TRUE(nullptr != white_filter);
ASSERT_TRUE(nullptr != black_filter);
ObSkippingFilterNode node1;
@ -392,7 +397,7 @@ TEST_F(TestSSTableIndexFilter, test_sstable_index_filter_extracter)
OK(ObSSTableIndexFilterExtracter::extract_skipping_filter(*white_filter, skip_index_type, node1));
OK(ObSSTableIndexFilterExtracter::extract_skipping_filter(*black_filter, skip_index_type, node2));
ASSERT_TRUE(node1.is_useful());
ASSERT_FALSE(node2.is_useful());
ASSERT_TRUE(node2.is_useful());
}
TEST_F(TestSSTableIndexFilter, test_skipping_filter_nodes_builder)