xianyinxin commented on a change in pull request #25626: [SPARK-28892][SQL] Add 
UPDATE support for DataSource V2
URL: https://github.com/apache/spark/pull/25626#discussion_r320712137
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryTable.scala
 ##########
 @@ -158,6 +158,42 @@ class InMemoryTable(
   override def deleteWhere(filters: Array[Filter]): Unit = 
dataMap.synchronized {
     dataMap --= InMemoryTable.filtersToKeys(dataMap.keys, partFieldNames, 
filters)
   }
+
+
+  // NOTE: this only support updating data with a literal, i.e., it cannot 
update
+  // a date `d` to `date_add(d, 1)`, which is an function.
+  override def updateWhere(sets: util.Map[String, Expression],
+      filters: Array[Filter]): Unit = dataMap.synchronized {
+    val keys = InMemoryTable.filtersToKeys(dataMap.keys, partFieldNames, 
filters)
+
+    val newData = keys.map {
+      key =>
+        val newRows = new BufferedRows
+        dataMap.get(key) match {
+          case Some(rows) =>
+            rows.rows.foreach {
+              row =>
+                val values = mutable.Buffer[Any]()
+                row.toSeq(schema).copyToBuffer(values)
 
 Review comment:
   Sorry, my mistake. Updated.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to