I have a set of parquet files which I want to load onto a database which is an unsupported sink in spark. The object to communicate with the database, cannot be used within a spark function such as foreach as it fails to serialize. I also cannot use collect() as the data does not fit in memory.
Is there a functionality in spark to iterate through the RDD in memory of the driver instance?