cloud-fan commented on code in PR #52638:
URL: https://github.com/apache/spark/pull/52638#discussion_r2472910012


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/parser/DataTypeAstBuilder.scala:
##########
@@ -45,40 +74,94 @@ class DataTypeAstBuilder extends 
SqlBaseParserBaseVisitor[AnyRef] {
     withOrigin(ctx)(StructType(visitColTypeList(ctx.colTypeList)))
   }
 
-  override def visitStringLiteralValue(ctx: StringLiteralValueContext): Token =
+  /**
+   * Visits a stringLit context and returns a single token from the first 
singleStringLit child.
+   *
+   * Note: This base implementation does not coalesce multiple string 
literals. Coalescing is
+   * handled in AstBuilder where SQL configuration is available to determine 
the correct escape
+   * processing mode.
+   */
+  override def visitStringLit(ctx: StringLitContext): Token = {
+    if (ctx == null) {
+      return null
+    }
+
+    import scala.jdk.CollectionConverters._
+
+    // Just return the first token. Coalescing happens in AstBuilder.
+    val singleStringLits = ctx.singleStringLit().asScala
+    if (singleStringLits.isEmpty) {
+      null
+    } else {
+      visit(singleStringLits.head).asInstanceOf[Token]
+    }
+  }
+
+  /**
+   * Visits a stringLitWithoutMarker context and returns a single token from 
the first
+   * singleStringLitWithoutMarker child.
+   *
+   * Note: This base implementation does not coalesce multiple string 
literals. Coalescing is
+   * handled in AstBuilder where SQL configuration is available.
+   */
+  override def visitStringLitWithoutMarker(ctx: 
StringLitWithoutMarkerContext): Token = {

Review Comment:
   This parser rule is only used by `literalType singleStringLitWithoutMarker   
        #typeConstructor`, which is not available in `DataTypeAstBuilder`. We 
don't need to override it here.



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