cloud-fan commented on code in PR #52638:
URL: https://github.com/apache/spark/pull/52638#discussion_r2444087642
##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/parser/DataTypeAstBuilder.scala:
##########
@@ -45,18 +46,190 @@ class DataTypeAstBuilder extends
SqlBaseParserBaseVisitor[AnyRef] {
withOrigin(ctx)(StructType(visitColTypeList(ctx.colTypeList)))
}
- override def visitStringLiteralValue(ctx: StringLiteralValueContext): Token =
- Option(ctx).map(_.STRING_LITERAL.getSymbol).orNull
+ /**
+ * Visits a stringLit context that may contain multiple
singleStringLitWithoutMarker or
+ * parameterMarker children. When multiple children are present, they are
coalesced into a
+ * single token.
+ */
+ override def visitStringLit(ctx: StringLitContext): Token = {
+ if (ctx == null) {
+ return null
+ }
+
+ import scala.jdk.CollectionConverters._
+
+ // Collect tokens from singleStringLitWithoutMarker and parameterMarker
children
+ val singleLits = Option(ctx.singleStringLitWithoutMarker())
+ .map(_.asScala.map(visit(_).asInstanceOf[Token]).toSeq)
+ .getOrElse(Seq.empty)
+
+ val paramMarkers = Option(ctx.parameterMarker())
+ .map(_.asScala.map(visit(_).asInstanceOf[Token]).toSeq)
+ .getOrElse(Seq.empty)
+
+ // Combine and sort by position in source
Review Comment:
can we follow https://github.com/apache/spark/pull/52638/files#r2444085780
and avoid sorting by index?
--
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]