when remove_from is true (or removed entirely) it is possible to have an
aggregate in the filter, which should not be pushed to table scan.
Find the LogcAgg which has the same tableref as the aggregate and push
the filter to it.
Add the first table in the scope as tableref of count() instead of all
because adding all of them would make the containg expression to appear to
require more than one table when that is really not the case.
This will let count() to be pushed to the correct node and side.
Propagate this tableref to the expression containing count(*) so that
that expression can be pushed to the correct node.
when remove_from is true (or removed entirely) it is possible to have an aggregate in the filter, which should not be pushed to table scan. Find the LogcAgg which has the same tableref as the aggregate and push the filter to it.
Add the first table in the scope as tableref of count() instead of all because adding all of them would make the containg expression to appear to require more than one table when that is really not the case. This will let count() to be pushed to the correct node and side. Propagate this tableref to the expression containing count(*) so that that expression can be pushed to the correct node.