So. Basically this is my problem.
I've set up a Spark SQL Structured data
val hiveQ = filteredDF.writeStream
.trigger(Trigger.ProcessingTime(5, TimeUnit.SECONDS))
.outputMode("append")
.format("csv")
.option("header", "false")
.option(
"path",
conf.getString("dest.hdfs.prefix") + msgType + "/" + tableName)
.option("checkpointLocation",
conf.getString("dest.hdfs.temp.prefix") + tableName)
.start()
What I'm trying to achieve somehow is that file written in hdfs should be "atomic", I mean, since there is another job on server that read from same directory and move files from this folder to another, I encounter errors because Spark is appending data to same files.
Is there a way to have something like .tmp files and just when it finalise them, let change extensions to .csv?
Honestly I have no idea how to move, could be partitionBy somehow help me? adding like some currentTimestamp column and use it as partition?