You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
Add a limit (as runtime value) for long in queries
This commit is contained in:
@ -9,7 +9,9 @@
|
||||
*/
|
||||
|
||||
#include "rewrites.h"
|
||||
#include <cstdint>
|
||||
#include <typeinfo>
|
||||
#include "constantfilter.h"
|
||||
#include "objectreader.h"
|
||||
#include "installdir.h"
|
||||
#include "parsetree.h"
|
||||
@ -482,4 +484,19 @@ bool NodeSemanticComparator::operator()(execplan::ParseTree* left, execplan::Par
|
||||
return left->data()->data() < right->data()->data();
|
||||
}
|
||||
|
||||
|
||||
bool checkFiltersLimit(execplan::ParseTree* tree, uint64_t limit)
|
||||
{
|
||||
uint64_t maxLimit = 0;
|
||||
auto walker = [](const execplan::ParseTree* node, void* maxLimit){
|
||||
auto maybe_cf = dynamic_cast<ConstantFilter*>(node->data());
|
||||
if (maybe_cf != nullptr && (maybe_cf->op()->op() == OpType::OP_OR || maybe_cf->op()->op() == OpType::OP_IN))
|
||||
{
|
||||
*((uint64_t*)maxLimit) = std::max(maybe_cf->filterList().size(), *((uint64_t*)maxLimit));
|
||||
}
|
||||
};
|
||||
tree->walk(walker, &maxLimit);
|
||||
return maxLimit <= limit;
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
|
Reference in New Issue
Block a user