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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogV2Util.scala:
##########
@@ -598,10 +598,28 @@ private[sql] object CatalogV2Util {
       //       data unchanged and let the data reader to return "exist 
default" for missing
       //       columns.
       val existingDefault = Literal(default.getValue.value(), 
default.getValue.dataType()).sql
-      
f.withExistenceDefaultValue(existingDefault).withCurrentDefaultValue(default.getSql)
+      
f.withExistenceDefaultValue(existingDefault).withCurrentDefaultValue(toSql(defaultValue))
     }.getOrElse(f)
   }
 
+  private def toSql(defaultValue: DefaultValue): String = {
+    if (defaultValue.getExpression != null) {

Review Comment:
   Ah, I misinterpreted the promise behind `.sql`. It was my understanding it 
is actually reliable. Let me think more about this tomorrow. If `.sql` is not 
reliable, then it does change things a bit, I guess. The problem that if we 
prefer the string over the expression it kind of breaks the promise behind 
`DefaultValue`, which states the expression takes precedence.



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