[WIP] Initial work on moving split_having to compile stage

The idea is to split the where and having parts in compiler stage. This should be faster on those queries that do not use aggregates, and the logic is easier to implement in compiler.