aokolnychyi commented on code in PR #51002:
URL: https://github.com/apache/spark/pull/51002#discussion_r2114433807


##########
sql/api/src/main/scala/org/apache/spark/sql/types/Metadata.scala:
##########
@@ -120,6 +122,12 @@ sealed class Metadata private[types] (private[types] val 
map: Map[String, Any])
     map(key).asInstanceOf[T]
   }
 
+  private[sql] def getExpression[E](key: String): (String, Option[E]) = {

Review Comment:
   I went back and forth on this. In theory, yes, we can expose a method that 
will pass a "serializable" and a "runtime" version of the value but it gets 
tricky. 
   
   ```
   private[sql] def putExpression[E](key: String, sql: String, expr: 
Option[E]): this.type = {
     map.put(key, sql)
     expr.foreach(runtimeMap.put(key, _))
     this
   }
   ```
   
   Will become 
   
   ```
   private[sql] def putAny[V, RV](key: String, value: R, runtimeValue: 
Option[RV]): this.type = {
     map.put(key, value)
     runtimeValue.foreach(runtimeMap.put(key, _))
     this
   }
   ```
   
   I am not necessarily against it but it is more than what we need. The new 
APIs are private to `sql`, so I'd probably keep it specific to expressions and 
change if we ever need to open it up.



-- 
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

Reply via email to