gengliangwang commented on a change in pull request #35936:
URL: https://github.com/apache/spark/pull/35936#discussion_r832136166



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala
##########
@@ -80,11 +81,14 @@ abstract class AbstractSqlParser extends ParserInterface 
with SQLConfHelper with
 
   /** Creates LogicalPlan for a given SQL string. */
   override def parsePlan(sqlText: String): LogicalPlan = parse(sqlText) { 
parser =>
-    astBuilder.visitSingleStatement(parser.singleStatement()) match {
-      case plan: LogicalPlan => plan
-      case _ =>
-        val position = Origin(None, None)
-        throw QueryParsingErrors.sqlStatementUnsupportedError(sqlText, 
position)
+    val ctx = parser.singleStatement()
+    withOrigin(ctx, Some(sqlText)) {

Review comment:
       Different from https://github.com/apache/spark/pull/35926, here it 
passes the original SQL command to all the `Origin`s in the LogicalPlan. This 
can save memory usage, especially when the query is long.




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