Added resevoir sampling to query api