1. A method comprising: receiving a query statement specifying a count distinct; generating a data flow graph comprising a plurality of nodes for executing the query, the nodes providing for aggregation operations, sorting of results on join attributes and vertically appending columns of count distinct results with intermediate results from at least one of the aggregation operations; and initiating executing of the query using the data flow graph.