Adding support for clustering queries and SSE computation