Extract the creation of TsdbQuery objects into a QueryBuilder

Here you can get a Nullpointer if there is no aggregator in sub)