szehon-ho commented on code in PR #47233: URL: https://github.com/apache/spark/pull/47233#discussion_r1709979274
########## sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala: ########## @@ -4136,6 +4136,29 @@ class Dataset[T] private[sql]( new MergeIntoWriter[T](table, this, condition) } + /** + * Update rows in a table that match a condition. + * + * Scala Example: + * {{{ + * spark.table("source").update(Map("salary" -> lit(200))) + * .where($"salary" === 100) + * .execute() + * + * }}} + * @param assignments A Map of column names to Column expressions representing the updates + * to be applied. + * @since 4.0.0 + */ + def update(assignments: Map[String, Column]): UpdateWriter[T] = { Review Comment: @cloud-fan that also works, but what about possibility to add write options ? Originally that was my thought to add a dedicated writer. ########## sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala: ########## @@ -4136,6 +4136,29 @@ class Dataset[T] private[sql]( new MergeIntoWriter[T](table, this, condition) } + /** + * Update rows in a table that match a condition. + * + * Scala Example: + * {{{ + * spark.table("source").update(Map("salary" -> lit(200))) + * .where($"salary" === 100) + * .execute() + * + * }}} + * @param assignments A Map of column names to Column expressions representing the updates + * to be applied. + * @since 4.0.0 + */ + def update(assignments: Map[String, Column]): UpdateWriter[T] = { Review Comment: @cloud-fan that also works, but what about possibility to add write options ? Originally that was my thought to add a dedicated writer class -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org