gengliangwang commented on code in PR #36091:
URL: https://github.com/apache/spark/pull/36091#discussion_r847048998


##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala:
##########
@@ -592,7 +592,18 @@ class ResolveSessionCatalog(val catalogManager: 
CatalogManager)
   private def convertToStructField(col: QualifiedColType): StructField = {
     val builder = new MetadataBuilder
     col.comment.foreach(builder.putString("comment", _))
-    StructField(col.name.head, col.dataType, nullable = true, builder.build())
+    col.default.foreach{ value: String =>
+      builder.putString(DefaultCols.CURRENT_DEFAULT_COLUMN_METADATA_KEY, value)
+    }
+    val result = StructField(col.name.head, col.dataType, nullable = true, 
builder.build())
+    if (col.default.isDefined) {
+      lazy val analyzer = new Analyzer(catalogManager)

Review Comment:
   Shall we perform the constant folding in `AlterTableAddColumnsCommand`?
   So that we can avoid creating a new Analyzer within `ResolveSessionCatalog`, 
which is actually part of the Analyzer.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to