Fix limit push down.

This commit is contained in:
Nikolai Kochetov 2021-02-12 13:12:31 +03:00
parent 7e75965af8
commit 443a3e7e6f
2 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ size_t tryMergeExpressions(QueryPlan::Node * parent_node, QueryPlan::Nodes &);
/// Move FilterStep down if possible.
/// May split FilterStep and push down only part of it.
size_t tryPushDownLimit(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes);
size_t tryPushDownFilter(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes);
inline const auto & getOptimizations()
{
@ -50,7 +50,7 @@ inline const auto & getOptimizations()
{tryPushDownLimit, "pushDownLimit"},
{trySplitFilter, "splitFilter"},
{tryMergeExpressions, "mergeExpressions"},
{tryPushDownLimit, "pushDownFilter"},
{tryPushDownFilter, "pushDownFilter"},
}};
return optimizations;

View File

@ -42,11 +42,11 @@ size_t tryPushDownLimit(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes)
for (auto pos : params.keys)
keys.push_back(params.src_header.getByPosition(pos).name);
// std::cerr << "Filter: \n" << expression->dumpDAG() << std::endl;
std::cerr << "Filter: \n" << expression->dumpDAG() << std::endl;
if (auto split_filter = expression->splitActionsForFilter(filter_column_name, removes_filter, keys))
{
// std::cerr << "===============\n" << expression->dumpDAG() << std::endl;
// std::cerr << "---------------\n" << split_filter->dumpDAG() << std::endl;
std::cerr << "===============\n" << expression->dumpDAG() << std::endl;
std::cerr << "---------------\n" << split_filter->dumpDAG() << std::endl;
auto it = expression->getIndex().find(filter_column_name);
if (it == expression->getIndex().end())