Added clustered by and fixed bug with partition by