davidm-db commented on code in PR #46665:
URL: https://github.com/apache/spark/pull/46665#discussion_r1606580840


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AbstractSqlParser.scala:
##########
@@ -91,6 +91,20 @@ abstract class AbstractSqlParser extends AbstractParser with 
ParserInterface {
     }
   }
 
+  /** Creates BatchBody for a given SQL string. */
+  override def parseBatch(sqlText: String): BatchBody = parse(sqlText) { 
parser =>
+    val ctx = parser.batchOrSingleStatement()
+    withErrorHandling(ctx, Some(sqlText)) {
+      astBuilder.visitBatchOrSingleStatement(ctx) match {
+        case batch: BatchBody => batch
+        case _ =>
+          // TODO: Figure out the error reporting - this is just copy paste of 
parsePlan logic.

Review Comment:
   Not sure what to do about this?
   We would be throwing exceptions from `SqlBatchLangErrors` for anything 
related to our parsing, interpreting, debugging, etc.
   So maybe create/reuse some generic exception saying like "Unable to 
parse..." or "Internal error" type of exception?



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