You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/10 09:08:37 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #34861: [SPARK-37606][SQL] ALTER NAMESPACE ... SET PROPERTIES v2 command should use existing properties in addition to new properties

cloud-fan commented on a change in pull request #34861:
URL: https://github.com/apache/spark/pull/34861#discussion_r766495402



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AlterNamespaceSetPropertiesExec.scala
##########
@@ -29,7 +31,8 @@ case class AlterNamespaceSetPropertiesExec(
     namespace: Seq[String],
     props: Map[String, String]) extends LeafV2CommandExec {
   override protected def run(): Seq[InternalRow] = {
-    val changes = props.map{ case (k, v) =>
+    val existingProps = catalog.loadNamespaceMetadata(namespace.toArray).asScala.toMap
+    val changes = (existingProps ++ props).map { case (k, v) =>
       NamespaceChange.setProperty(k, v)

Review comment:
       Sorry I was wrong. The v2 API takes a list of `NamespaceChange`, which is kind of the "diff", not the entire namespace properties. That said, the previous behavior is correct: Spark just passes the "new properties need to be set/update" to the v2 catalog implementations.
   
   This is a better API design than v1, as passing "diff" is cheaper than getting the existing properties and passing the full properties.




-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org