I'm trying to upload large data.table's into Spark using sparklyr as follows:
copy_to(sc, obj, "name_of_object")
where sc is a Spark connection and obj my object. After some digging, I found that writing tables to Spark is done as follows (in spark_data_copy()): a csv file is created on disk using the serializer spark_serialize_csv_scala which uses base R write.table(). After writing the file, R instructs Spark to read the csv.
I found this to be not very efficient for my use R seems to hang and there is only so much tuning one could do on the csv writing part of the task. Does an efficient way exist to put data already in R memory into Spark?