Add experimental support for approximate queries

Note, the first 11 commits are from my sample weight PR