title: spark Dataframe execute UPDATE statement
body: <p>Hy guys,</p>
  
  <p>I need to perform jdbc operation using Apache Spark DataFrame.
  Basically I have an historical jdbc table called Measures where I have to do two operations:</p>
  
  <p><strong>1. Set endTime  validity  attribute of the old measure record to the current time</strong></p>
  
  <p><strong>2. Insert a new measure record setting endTime to 9999-12-31</strong></p>
  
  <p>Can someone tell me how to perform (if we can) update statement for the first operation and insert for the second operation?</p>
  
  <p>I tried to use this statement for the first operation:</p>
  
  <pre><code>val dfWriter = df.write.mode(SaveMode.Overwrite)
  dfWriter.jdbc("jdbc:postgresql:postgres", tableName, prop)
  </code></pre>
  
  <p>But it doesn't work because there is a duplicate key violation. If we can do update, how we can do delete statement?</p>
  
  <p>Thanks in advance.</p>