compile query_sample