A Sampling Algebra for Scalable Approximate Query Processing