estimate_u_using_random_sampling spark seed #2605
|
Hi, I am converting my code from using DuckDB to Spark. I've been able to get everything to work except pretty much the same except the 'estimate_u_using_random_sampling' function. When using DuckDB I use the seed like:
But, when I convert to Spark this results in the following error:
I've tried it several times and the "key" number changes each time. LLMs were not helpful in identifying the problem. I have also not been successful in finding another discussion on this topic. However, I've figured out I can remove the seed and it will run, like:
Is it not possible or does it require different something different to set a seed for reproducibility with spark? I am using splink version 4.0.1. Appreciate any help. Thank you, |
Replies: 2 comments 7 replies
|
I've seen this before when people are doing several spark transforms such as monotonically increasing id prior to bringing the data into Splink. The solution has been to save the data out to e.g. parquet before importing to Splink i.e the data frame coming into splijk should be loaded directly from disk. (I'm not sure this will fix your problem but it's a good place to start) |
|
Thank you for the quick response, Robin. I do have a lot of data transformations being done in spark so I was hopeful. However, I've written the data to a table on disk and then re-read it back into spark and get the same error. Any other ideas/suggestions? |
Ah - sorry those docs are out of date. It's moved to the database API i.e where you do
db_api = SparkAPI(spark_session=spark, break_lineage_method="parquet")