We are currently in the process of writing quite complex spark jobs that contain multiple joins and a filters across multiple tables.
We'd like to unit test these jobs with actual data but the real data lives in the cloud (S3 buckets) spreads over dozens of tables (orc files), millions of rows each.
The inherent problem is that sampling from multiple tables can cause joins on the samples to produce no results since there is a possibility that certain IDs don't exist in both sampled tables. Is there a way (a heuristic or a tool) to sample data (for example 1000 rows) from each tables in such a way that joins on foreign keys still provide a useful amount of rows?
That way we can use the sampled data offline to unit test the jobs.