szehon-ho commented on code in PR #59820:
URL: https://github.com/apache/spark/pull/59820#discussion_r4395176666


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ResolveDefaultColumnsUtil.scala:
##########
@@ -324,15 +324,23 @@ object ResolveDefaultColumns extends QueryErrorsBase
     coerceDefaultValue(analyzed, dataType, statementType, colName, defaultSQL)
   }
 
+  // Literal.sql always escapes strings, independently of the session's parser 
configuration.
+  // Override only that policy so other settings, such as the time zone, 
remain session-dependent.
+  private lazy val existenceDefaultParser = new CatalystSqlParser {
+    override val astBuilder: AstBuilder = new AstBuilder {
+      override protected def escapedStringLiterals: Boolean = false
+    }
+  }
+
   /**
    * Analyze EXISTS_DEFAULT value.  EXISTS_DEFAULT value was created from 
CURRENT_DEFAQULT
    * via [[analyze]] and thus this can skip most of those steps.
    */
   private def analyzeExistenceDefaultValue(field: StructField): Expression = {
     val defaultSQL = 
field.metadata.getString(EXISTS_DEFAULT_COLUMN_METADATA_KEY)
 
-    // Parse the expression.
-    val resolvedExpr = Try(Literal.fromSQL(defaultSQL)) match {
+    val parsedExpr = Try(Literal.fromSQL(defaultSQL, existenceDefaultParser))

Review Comment:
   can we put a method on Literal to do this generically?  (encapsulate the 
parser).  I think generated colulmn have this issue too, maybe I can fix it too 
by calling the same method



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