1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

chore(build): fixes to satisfy clang19 warnings

This commit is contained in:
Leonid Fedorov
2025-05-08 15:26:36 +00:00
committed by Leonid Fedorov
parent 9fd7f342a7
commit a0bee173f6
334 changed files with 3062 additions and 3323 deletions

View File

@ -31,17 +31,19 @@ bool treeEqual(execplan::ParseTree* fst, execplan::ParseTree* snd, int depth = 0
auto comp = execplan::NodeSemanticComparator();
if (comp(fst, snd) || comp(fst, snd))
{
std::cerr << "Data " << fst->data()->data() << " differs from " << snd->data()->data() << " at level " << depth << '\n';
std::cerr << "Data " << fst->data()->data() << " differs from " << snd->data()->data() << " at level "
<< depth << '\n';
return false;
}
return (treeEqual(fst->left(), snd->left(), depth + 1) && treeEqual(fst->right(), snd->right(), depth + 1)) ||
return (treeEqual(fst->left(), snd->left(), depth + 1) &&
treeEqual(fst->right(), snd->right(), depth + 1)) ||
(treeEqual(fst->left(), snd->right(), depth + 1) && treeEqual(fst->right(), snd->left(), depth + 1));
}
#define REWRITE_TREE_TEST_DEBUG false
void printTree(const std::string& queryName, execplan::ParseTree* tree, const std::string& treeName)
void printTree([[maybe_unused]] const std::string& queryName, [[maybe_unused]] execplan::ParseTree* tree,
[[maybe_unused]] const std::string& treeName)
{
#if REWRITE_TREE_TEST_DEBUG
std::string dotPath = std::string("/tmp/") + queryName;
@ -68,7 +70,9 @@ struct ParseTreeTestParam
}
};
class ParseTreeTest : public testing::TestWithParam<::ParseTreeTestParam> {};
class ParseTreeTest : public testing::TestWithParam<::ParseTreeTestParam>
{
};
TEST_P(ParseTreeTest, Rewrite)
{
@ -96,466 +100,460 @@ TEST_P(ParseTreeTest, Rewrite)
}
}
INSTANTIATE_TEST_SUITE_P(TreeRewrites, ParseTreeTest, testing::Values(
/*
select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.id
and t1.pos + t2.pos < 1000
)
or
(
t1.id = t2.id
and t1.pos + t2.pos > 15000
);
*/
INSTANTIATE_TEST_SUITE_P(
TreeRewrites, ParseTreeTest,
testing::Values(
/*
select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.id
and t1.pos + t2.pos < 1000
)
or
(
t1.id = t2.id
and t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_1", execplan::initial_Query_1, execplan::reference_Query_1},
ParseTreeTestParam{"Query_1", execplan::initial_Query_1, execplan::reference_Query_1},
/*
select t1.posname, t2.posname
from t1,t2
where
t1.id = t2.id
and (t1.pos + t2.pos < 1000);
*/
ParseTreeTestParam{"Query_2", execplan::initial_Query_2},
/*
select t1.posname, t2.posname
from t1,t2
where
t1.id = t2.id
and (t1.pos + t2.pos < 1000);
*/
ParseTreeTestParam{"Query_2", execplan::initial_Query_2},
/*
select t1.posname, t2.posname
from t1,t2
where
(t1.pos + t2.pos < 1000)
or
(t1.pos + t2.pos > 16000)
or
(t1.posname < dcba);
/*
select t1.posname, t2.posname
from t1,t2
where
(t1.pos + t2.pos < 1000)
or
(t1.pos + t2.pos > 16000)
or
(t1.posname < dcba);
*/
ParseTreeTestParam{"Query_3", execplan::initial_Query_3},
*/
ParseTreeTestParam{"Query_3", execplan::initial_Query_3},
/*
select t1.posname, t2.posname
from t1,t2
where
(t1.pos > 20)
or
(t2.posname in (select t1.posname from t1 where t1.pos > 20));
*/
/*
select t1.posname, t2.posname
from t1,t2
where
(t1.pos > 20)
or
(t2.posname in (select t1.posname from t1 where t1.pos > 20));
*/
ParseTreeTestParam{"Query_4", execplan::initial_Query_4},
ParseTreeTestParam{"Query_4", execplan::initial_Query_4},
/*select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.id
or t1.pos + t2.pos < 1000
)
and
(
t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_5", execplan::initial_Query_5},
/*select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.id
or t1.pos + t2.pos < 1000
)
and
(
t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_5", execplan::initial_Query_5},
/*select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.rid
or t1.pos + t2.pos < 1000
)
and
(
t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_6", execplan::initial_Query_6},
/*select t1.posname, t2.posname from t1,t2
where
(
t1.id = t2.rid
or t1.pos + t2.pos < 1000
)
and
(
t1.id = t2.id
or t1.pos + t2.pos > 15000
);
*/
ParseTreeTestParam{"Query_6", execplan::initial_Query_6},
/*
select t1.posname
from t1
where
t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and
id < 30
);
/*
select t1.posname
from t1
where
t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and
id < 30
);
*/
ParseTreeTestParam{"Query_7", execplan::initial_Query_7},
*/
ParseTreeTestParam{"Query_7", execplan::initial_Query_7},
/*select t1.posname, t2.posname
from t1,t2
where t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and id < 30
)
and t1.id = t2.id;
*/
ParseTreeTestParam{"Query_8", execplan::initial_Query_8},
/*select t1.posname, t2.posname
from t1,t2
where t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and id < 30
)
and t1.id = t2.id;
*/
ParseTreeTestParam{"Query_8", execplan::initial_Query_8},
/*select t1.posname, t2.posname
from t1,t2
where t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and id < 30
) and
(
t1.id = t2.id
and t1.id = t2.rid
);
*/
ParseTreeTestParam{"Query_9", execplan::initial_Query_9},
/*select t1.posname, t2.posname
from t1,t2
where t1.posname in
(
select t1.posname
from t1
where posname > 'qwer'
and id < 30
) and
(
t1.id = t2.id
and t1.id = t2.rid
);
*/
ParseTreeTestParam{"Query_9", execplan::initial_Query_9},
/*select * from t1
where
(
posname > 'qwer'
and id < 30
)
or
(
pos > 5000
and place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_10", execplan::initial_Query_10},
/*select * from t1
where
(
posname > 'qwer'
and id < 30
)
or
(
pos > 5000
and place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_10", execplan::initial_Query_10},
/*select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_11", execplan::initial_Query_11, execplan::reference_Query_11},
/*select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_11", execplan::initial_Query_11, execplan::reference_Query_11},
/*select *
from t1
where
(
pos > 5000
and id < 30
)
and
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_12", execplan::initial_Query_12},
/*select *
from t1
where
(
pos > 5000
and id < 30
)
and
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_12", execplan::initial_Query_12},
/*select *
from t1
where
(
pos > 5000
or id < 30
)
or
(
pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_13", execplan::initial_Query_13},
/*select *
from t1
where
(
pos > 5000
or id < 30
)
or
(
pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_13", execplan::initial_Query_13},
/*select *
from t1
where
(
id in
(
select id
from t2
where posname > 'qwer'
and rid > 10
)
)
and
(
pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_14", execplan::initial_Query_14},
/*select *
from t1
where
(
id in
(
select id
from t2
where posname > 'qwer'
and rid > 10
)
)
and
(
pos > 5000
or id < 30
);
*/
ParseTreeTestParam{"Query_14", execplan::initial_Query_14},
/*select *
from t1
where
(
id in
(
select id
from t2
where
(
posname > 'qwer'
and rid < 10
)
or
(
posname > 'qwer'
and rid > 40
)
)
)
and
(
pos > 5000
or id < 30);
*/
ParseTreeTestParam{"Query_15", execplan::initial_Query_15, execplan::reference_Query_15},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_16", execplan::initial_Query_16, execplan::reference_Query_16},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_17", execplan::initial_Query_17, execplan::reference_Query_17},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_18", execplan::initial_Query_18, execplan::reference_Query_18},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
/*select *
from t1
where
(
id in
(
select id
from t2
where
(
posname > 'qwer'
and rid < 10
)
or
(
posname > 'qwer'
and rid > 40
)
)
)
and
(
pos > 5000
or id < 30);
*/
ParseTreeTestParam{"Query_15", execplan::initial_Query_15, execplan::reference_Query_15},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_16", execplan::initial_Query_16, execplan::reference_Query_16},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_17", execplan::initial_Query_17, execplan::reference_Query_17},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_18", execplan::initial_Query_18, execplan::reference_Query_18},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
)
or
(
pos > 5000
and id < 30
);
*/
ParseTreeTestParam{"Query_19", execplan::initial_Query_19, execplan::reference_Query_19},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
posname > 'qwer'
and
id < 30
and
place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_19", execplan::initial_Query_19, execplan::reference_Query_19},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
posname > 'qwer'
and
id < 30
and
place > 'abcdefghij'
);
*/
ParseTreeTestParam{"Query_20", execplan::initial_Query_20, execplan::reference_Query_20},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
posname > 'qwer'
and
id < 30
and
place > 'abcdefghij'
)
or
(
id < 30
and
place < 'zyxqwertyu'
);
*/
ParseTreeTestParam{"Query_20", execplan::initial_Query_20, execplan::reference_Query_20},
/*
select *
from t1
where
(
pos > 5000
and id < 30
)
or
(
posname > 'qwer'
and
id < 30
and
place > 'abcdefghij'
)
or
(
id < 30
and
place < 'zyxqwertyu'
);
*/
ParseTreeTestParam{"Query_21", execplan::initial_Query_21, execplan::reference_Query_21},
/*
select *
from t1
where
(pos > 5000 and id < 30)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and pos > 5000)
or
(id < 30 and place < 'zyxqwertyu' and pos > 5000)
or
(pos > 5000 and id < 30);
*/
ParseTreeTestParam{"Query_21", execplan::initial_Query_21, execplan::reference_Query_21},
/*
select *
from t1
where
(pos > 5000 and id < 30)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and pos > 5000)
or
(id < 30 and place < 'zyxqwertyu' and pos > 5000)
or
(pos > 5000 and id < 30);
*/
ParseTreeTestParam{"Query_22", execplan::initial_Query_22, execplan::reference_Query_22},
*/
ParseTreeTestParam{"Query_22", execplan::initial_Query_22, execplan::reference_Query_22},
/*
select *
from t1
where
(5000 < pos and id < 30)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and 5000 < pos)
or
(30 > id and place < 'zyxqwertyu' and pos > 5000)
or
(pos > 5000 and id < 30);
*/
/*
select *
from t1
where
(5000 < pos and id < 30)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and 5000 < pos)
or
(30 > id and place < 'zyxqwertyu' and pos > 5000)
or
(pos > 5000 and id < 30);
*/
ParseTreeTestParam{"Query_23", execplan::initial_Query_23, execplan::reference_Query_23},
/*
select *
from t1
where
(pos > 5000 and id < 30 and rid > 20)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and pos > 5000 and rid > 20)
or
(id < 30 and place < 'zyxqwertyu' and pos > 5000 and rid > 20)
or
(pos > 5000 and id < 30 and rid > 20)
or
(pos > 5000 and id < 30 and place < 'zyxqwertyu' and rid > 20);
*/
ParseTreeTestParam{"Query_23", execplan::initial_Query_23, execplan::reference_Query_23},
/*
select *
from t1
where
(pos > 5000 and id < 30 and rid > 20)
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and pos > 5000 and rid > 20)
or
(id < 30 and place < 'zyxqwertyu' and pos > 5000 and rid > 20)
or
(pos > 5000 and id < 30 and rid > 20)
or
(pos > 5000 and id < 30 and place < 'zyxqwertyu' and rid > 20);
*/
ParseTreeTestParam{"Query_27", execplan::initial_Query_27, execplan::reference_Query_27},
/*
select *
from t1
where
(pos > 5000 and id < 30 and rid > 20 and place < 'zyxqwertyu')
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and place < 'zyxqwertyu' and pos > 5000 and rid > 20)
or
(id < 30 and place < 'zyxqwertyu' and pos > 5000 and rid > 20)
or
(pos > 5000 and id < 30 and rid > 20 and place < 'zyxqwertyu' and place < 'zyxqwertyu');
*/
ParseTreeTestParam{"Query_28", execplan::initial_Query_28, execplan::reference_Query_28},
ParseTreeTestParam{"TPCH_19", execplan::initial_TPCH_19, execplan::reference_TPCH_19}
),
[](const ::testing::TestParamInfo<ParseTreeTest::ParamType>& info) {
return info.param.queryName;
}
);
ParseTreeTestParam{"Query_27", execplan::initial_Query_27, execplan::reference_Query_27},
/*
select *
from t1
where
(pos > 5000 and id < 30 and rid > 20 and place < 'zyxqwertyu')
or
(posname > 'qwer' and id < 30 and place > 'abcdefghij' and place < 'zyxqwertyu' and pos > 5000 and rid
> 20) or (id < 30 and place < 'zyxqwertyu' and pos > 5000 and rid > 20) or (pos > 5000 and id < 30 and
rid > 20 and place < 'zyxqwertyu' and place < 'zyxqwertyu');
*/
ParseTreeTestParam{"Query_28", execplan::initial_Query_28, execplan::reference_Query_28},
ParseTreeTestParam{"TPCH_19", execplan::initial_TPCH_19, execplan::reference_TPCH_19}),
[](const ::testing::TestParamInfo<ParseTreeTest::ParamType>& info) { return info.param.queryName; });
struct ComparatorTestParam
{
@ -564,14 +562,15 @@ struct ComparatorTestParam
std::vector<std::string> existingFilters;
bool contains;
friend std::ostream& operator<<(std::ostream& os, const ComparatorTestParam& bar)
friend std::ostream& operator<<(std::ostream& os, const ComparatorTestParam& bar)
{
return os << bar.queryName;
}
};
class ParseTreeComparatorTest : public testing::TestWithParam<ComparatorTestParam> {};
class ParseTreeComparatorTest : public testing::TestWithParam<ComparatorTestParam>
{
};
struct TestComparator
{
@ -588,12 +587,13 @@ TEST_P(ParseTreeComparatorTest, CompareContains)
std::set<std::unique_ptr<execplan::ParseTree>, TestComparator> container;
for (auto const& f : GetParam().existingFilters)
{
container.insert(std::make_unique<execplan::ParseTree>(new execplan::SimpleFilter(f, execplan::SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})));
container.insert(std::make_unique<execplan::ParseTree>(
new execplan::SimpleFilter(f, execplan::SimpleFilter::ForTestPurposesWithoutColumnsOIDS{})));
}
auto filter = std::make_unique<execplan::ParseTree>(new execplan::SimpleFilter(
GetParam().filter, execplan::SimpleFilter::ForTestPurposesWithoutColumnsOIDS{}));
ASSERT_EQ(GetParam().contains, container.count(filter)!=0);
ASSERT_EQ(GetParam().contains, container.count(filter) != 0);
}
INSTANTIATE_TEST_SUITE_P(