Skip to content

Commit 5a4fb59

Browse files
committed
fix be ut
1 parent bd9c592 commit 5a4fb59

File tree

2 files changed

+39
-47
lines changed

2 files changed

+39
-47
lines changed

be/test/olap/block_column_predicate_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ void single_column_predicate_test_func(const segment_v2::BloomFilter* bf,
13251325
bool expect_match) {
13261326
int col_idx = 0;
13271327
std::shared_ptr<ColumnPredicate> pred(new ComparisonPredicateBase<T, PT>(col_idx, check_value));
1328-
SingleColumnBlockPredicate single_column_block_pred(pred);
1328+
SingleColumnBlockPredicate single_column_block_pred(pred.get());
13291329

13301330
bool matched = single_column_block_pred.evaluate_and(bf);
13311331
EXPECT_EQ(matched, expect_match);

be/test/pipeline/operator/scan_normalize_predicate_test.cpp

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
14581458
for (auto const_v : test_tz_values) {
14591459
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
14601460
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1461-
local_state->_slot_id_to_value_range[SlotId] = range;
1462-
local_state->_slot_id_to_predicates[SlotId] =
1463-
std::vector<std::shared_ptr<ColumnPredicate>>();
1461+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
14641462
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
14651463

14661464
auto slot_ref =
@@ -1482,12 +1480,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
14821480

14831481
vectorized::VExprSPtr new_root;
14841482
auto conjunct_expr_root = ctx;
1485-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1483+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1484+
conjunct_expr_root.get(), new_root);
14861485
EXPECT_TRUE(st.ok());
14871486
EXPECT_EQ(new_root, nullptr);
14881487

14891488
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
1490-
const auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1489+
const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
14911490
std::visit(
14921491
[&](auto&& arg) {
14931492
using T = std::decay_t<decltype(arg)>;
@@ -1505,9 +1504,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
15051504
{
15061505
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
15071506
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1508-
local_state->_slot_id_to_value_range[SlotId] = range;
1509-
local_state->_slot_id_to_predicates[SlotId] =
1510-
std::vector<std::shared_ptr<ColumnPredicate>>();
1507+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
15111508
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
15121509
auto slot_ref =
15131510
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1524,12 +1521,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
15241521

15251522
vectorized::VExprSPtr new_root;
15261523
auto conjunct_expr_root = ctx;
1527-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1524+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1525+
conjunct_expr_root.get(), new_root);
15281526
EXPECT_TRUE(st.ok());
15291527
EXPECT_EQ(new_root, nullptr);
15301528
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
15311529

1532-
auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1530+
auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
15331531
std::visit(
15341532
[&](auto&& arg) {
15351533
using T = std::decay_t<decltype(arg)>;
@@ -1545,9 +1543,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
15451543
for (auto const_v : test_tz_values) {
15461544
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
15471545
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1548-
local_state->_slot_id_to_value_range[SlotId] = range;
1549-
local_state->_slot_id_to_predicates[SlotId] =
1550-
std::vector<std::shared_ptr<ColumnPredicate>>();
1546+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
15511547
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
15521548
auto slot_ref =
15531549
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1568,17 +1564,16 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
15681564

15691565
vectorized::VExprSPtr new_root;
15701566
auto conjunct_expr_root = ctx;
1571-
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root));
1567+
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root->root(),
1568+
conjunct_expr_root.get(), new_root));
15721569
EXPECT_EQ(new_root, nullptr);
15731570
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
15741571
}
15751572
// test not in
15761573
{
15771574
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
15781575
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1579-
local_state->_slot_id_to_value_range[SlotId] = range;
1580-
local_state->_slot_id_to_predicates[SlotId] =
1581-
std::vector<std::shared_ptr<ColumnPredicate>>();
1576+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
15821577
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
15831578
auto slot_ref =
15841579
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1595,7 +1590,8 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
15951590

15961591
vectorized::VExprSPtr new_root;
15971592
auto conjunct_expr_root = ctx;
1598-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1593+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1594+
conjunct_expr_root.get(), new_root);
15991595
EXPECT_TRUE(st.ok());
16001596
EXPECT_EQ(new_root, nullptr);
16011597
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
@@ -1604,7 +1600,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
16041600
{
16051601
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
16061602
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", true, 0, test_scale);
1607-
local_state->_slot_id_to_value_range[SlotId] = range;
1603+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&nullable_slot_desc, range);
16081604
// local_state->_slot_id_to_predicates[SlotId] =
16091605
// std::vector<std::shared_ptr<ColumnPredicate>>();
16101606
// op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
@@ -1624,8 +1620,9 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
16241620

16251621
vectorized::VExprSPtr new_root;
16261622
auto conjunct_expr_root = ctx;
1627-
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root));
1628-
auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1623+
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root->root(),
1624+
conjunct_expr_root.get(), new_root));
1625+
auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
16291626
std::visit(
16301627
[](auto&& arg) {
16311628
using T = std::decay_t<decltype(arg)>;
@@ -1643,9 +1640,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
16431640
{
16441641
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
16451642
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", true, 0, test_scale);
1646-
local_state->_slot_id_to_value_range[SlotId] = range;
1647-
local_state->_slot_id_to_predicates[SlotId] =
1648-
std::vector<std::shared_ptr<ColumnPredicate>>();
1643+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
16491644
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
16501645
auto slot_ref = std::make_shared<MockSlotRef>(
16511646
0, std::make_shared<DataTypeNullable>(
@@ -1663,8 +1658,9 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
16631658

16641659
vectorized::VExprSPtr new_root;
16651660
auto conjunct_expr_root = ctx;
1666-
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root.get(), new_root));
1667-
auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1661+
EXPECT_TRUE(local_state->_normalize_predicate(conjunct_expr_root->root(),
1662+
conjunct_expr_root.get(), new_root));
1663+
auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
16681664
std::visit(
16691665
[](auto&& arg) {
16701666
using T = std::decay_t<decltype(arg)>;
@@ -1682,9 +1678,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
16821678
// std::cout << "test less const_v=" << const_v << std::endl;
16831679
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
16841680
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1685-
local_state->_slot_id_to_value_range[SlotId] = range;
1686-
local_state->_slot_id_to_predicates[SlotId] =
1687-
std::vector<std::shared_ptr<ColumnPredicate>>();
1681+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
16881682
op->_slot_id_to_slot_desc[SlotId] = &slot_desc;
16891683

16901684
auto slot_ref =
@@ -1706,12 +1700,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
17061700

17071701
vectorized::VExprSPtr new_root;
17081702
auto conjunct_expr_root = ctx;
1709-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1703+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1704+
conjunct_expr_root.get(), new_root);
17101705
EXPECT_TRUE(st.ok());
17111706
EXPECT_EQ(new_root, nullptr);
17121707

17131708
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
1714-
const auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1709+
const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
17151710
/*
17161711
_low_value = -inf,
17171712
_high_value = 90,
@@ -1743,9 +1738,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
17431738
// std::cout << "test less or equal const_v=" << const_v << std::endl;
17441739
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
17451740
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1746-
local_state->_slot_id_to_value_range[SlotId] = range;
1747-
local_state->_slot_id_to_predicates[SlotId] =
1748-
std::vector<std::shared_ptr<ColumnPredicate>>();
1741+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
17491742

17501743
auto slot_ref =
17511744
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1766,12 +1759,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
17661759

17671760
vectorized::VExprSPtr new_root;
17681761
auto conjunct_expr_root = ctx;
1769-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1762+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1763+
conjunct_expr_root.get(), new_root);
17701764
EXPECT_TRUE(st.ok());
17711765
EXPECT_EQ(new_root, nullptr);
17721766

17731767
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
1774-
const auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1768+
const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
17751769
std::visit(
17761770
[&](auto&& arg) {
17771771
using T = std::decay_t<decltype(arg)>;
@@ -1800,9 +1794,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
18001794
// std::cout << "test greater const_v=" << const_v << std::endl;
18011795
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
18021796
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1803-
local_state->_slot_id_to_value_range[SlotId] = range;
1804-
local_state->_slot_id_to_predicates[SlotId] =
1805-
std::vector<std::shared_ptr<ColumnPredicate>>();
1797+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
18061798

18071799
auto slot_ref =
18081800
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1823,12 +1815,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
18231815

18241816
vectorized::VExprSPtr new_root;
18251817
auto conjunct_expr_root = ctx;
1826-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1818+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1819+
conjunct_expr_root.get(), new_root);
18271820
EXPECT_TRUE(st.ok());
18281821
EXPECT_EQ(new_root, nullptr);
18291822

18301823
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
1831-
const auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1824+
const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
18321825
/*
18331826
_low_value = 90,
18341827
_high_value = nan,
@@ -1860,9 +1853,7 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
18601853
// std::cout << "test greater or equal const_v=" << const_v << std::endl;
18611854
auto local_state = std::make_shared<MockScanLocalState>(state.get(), op.get());
18621855
ColumnValueRange<TYPE_TIMESTAMPTZ> range("mock", false, 0, test_scale);
1863-
local_state->_slot_id_to_value_range[SlotId] = range;
1864-
local_state->_slot_id_to_predicates[SlotId] =
1865-
std::vector<std::shared_ptr<ColumnPredicate>>();
1856+
local_state->_slot_id_to_value_range[SlotId] = std::make_pair(&slot_desc, range);
18661857

18671858
auto slot_ref =
18681859
std::make_shared<MockSlotRef>(0, std::make_shared<DataTypeTimeStampTz>(test_scale));
@@ -1883,12 +1874,13 @@ TEST_F(ScanNormalizePredicate, test_timestamptz_predicate) {
18831874

18841875
vectorized::VExprSPtr new_root;
18851876
auto conjunct_expr_root = ctx;
1886-
auto st = local_state->_normalize_predicate(conjunct_expr_root.get(), new_root);
1877+
auto st = local_state->_normalize_predicate(conjunct_expr_root->root(),
1878+
conjunct_expr_root.get(), new_root);
18871879
EXPECT_TRUE(st.ok());
18881880
EXPECT_EQ(new_root, nullptr);
18891881

18901882
EXPECT_TRUE(local_state->_slot_id_to_value_range.contains(SlotId));
1891-
const auto& output_range = local_state->_slot_id_to_value_range[SlotId];
1883+
const auto& output_range = local_state->_slot_id_to_value_range[SlotId].second;
18921884
std::visit(
18931885
[&](auto&& arg) {
18941886
using T = std::decay_t<decltype(arg)>;

0 commit comments

Comments
 (0)