How to sample data with unknown size into a limited number of subset?

Viewed 8

my question is the following, let's assume that we do not know the size of full data set ahead(it could be 100m or just 10,000), and I want to sample it based on an "ID" column, for example we hash "ID" values into "abcd", and we could easily sample 1/26 of it by selecting hash values starting with "a"(or 1/26 * 1/26 when selecting values starting with "aa", etc). The question is that I want to have a limited number of subset say 100,000 max. Is it possible to apply some hash trick to the origin dataset to achieve such result?

Thanks.

0 Answers
Related