You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by we...@apache.org on 2026/06/09 19:03:25 UTC
(spark) branch master updated: [SPARK-57148][SQL] Rename splitSemiColonWithIndex to splitSemiColon
This is an automated email from the ASF dual-hosted git repository.
cloud-fan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 05b4635eb0d7 [SPARK-57148][SQL] Rename splitSemiColonWithIndex to splitSemiColon
05b4635eb0d7 is described below
commit 05b4635eb0d77677c70dc2bf008142c9abb9d4ee
Author: Anupam Yadav <an...@amazon.com>
AuthorDate: Tue Jun 9 12:03:09 2026 -0700
[SPARK-57148][SQL] Rename splitSemiColonWithIndex to splitSemiColon
### What changes were proposed in this pull request?
Rename `splitSemiColonWithIndex` to `splitSemiColon` in `StringUtils`. The method no longer returns indices (it returns `List[String]`), so the name is misleading.
Follow-up to #55466 as suggested by cloud-fan.
### Why are the changes needed?
The method was originally named `splitSemiColonWithIndex` when it returned index information. After the structural scanner refactor in SPARK-54876, it returns `List[String]` with no index information. The name should match the return type.
### Does this PR introduce _any_ user-facing change?
No. This is an internal API rename (package-private method).
### How was this patch tested?
Existing tests pass. No behavioral change.
### Was this patch authored or co-authored using generative AI tooling?
Yes.
Closes #56386 from yadavay-amzn/fix/SPARK-57148-rename-splitSemiColon.
Authored-by: Anupam Yadav <an...@amazon.com>
Signed-off-by: Wenchen Fan <we...@databricks.com>
---
.../spark/sql/catalyst/util/StringUtils.scala | 2 +-
.../spark/sql/catalyst/util/StringUtilsSuite.scala | 26 +++++++++++-----------
.../sql/hive/thriftserver/SparkSQLCLIDriver.scala | 4 ++--
.../graph/SqlGraphRegistrationContext.scala | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
index 87c55aaf1eaa..52ad2b8d96f6 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
@@ -283,7 +283,7 @@ object StringUtils extends Logging {
// Handles quoted strings with escapes, line comments (--), and nested block comments (/* */).
// Semicolons inside strings or comments are not treated as delimiters.
// Note: [SPARK-31595], [SPARK-33100], [SPARK-54876]
- def splitSemiColonWithIndex(line: String, enableSqlScripting: Boolean): List[String] = {
+ def splitSemiColon(line: String, enableSqlScripting: Boolean): List[String] = {
lazy val insideSqlScript: Boolean = isSqlScript(line)
if (enableSqlScripting && insideSqlScript) return List(line)
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/StringUtilsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/StringUtilsSuite.scala
index 470ace2bcdcd..ee31acf9aa83 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/StringUtilsSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/StringUtilsSuite.scala
@@ -232,7 +232,7 @@ class StringUtilsSuite extends SparkFunSuite with SQLHelper {
test("SQL string splitter") {
// semicolon shouldn't delimit if in quotes
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"""
|SELECT "string;with;semicolons";
|USE DATABASE db""".stripMargin,
@@ -244,7 +244,7 @@ class StringUtilsSuite extends SparkFunSuite with SQLHelper {
// semicolon shouldn't delimit if in backticks
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"""
|SELECT `escaped;sequence;with;semicolons`;
|USE DATABASE db""".stripMargin,
@@ -256,7 +256,7 @@ class StringUtilsSuite extends SparkFunSuite with SQLHelper {
// white space around command is included in split string
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
s"""
|-- comment 1
|-- comment 2
@@ -274,7 +274,7 @@ class StringUtilsSuite extends SparkFunSuite with SQLHelper {
// SQL procedures are respected and not split, if configured
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"""CREATE PROCEDURE p() BEGIN
| SELECT 1;
| SELECT 2;
@@ -290,63 +290,63 @@ class StringUtilsSuite extends SparkFunSuite with SQLHelper {
// SPARK-54876: statement after semicolon ending with block comment should not be dropped
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"SELECT 1; SELECT 2 /* comment */",
enableSqlScripting = false) == Seq("SELECT 1", " SELECT 2 /* comment */")
)
// SPARK-54876: line comment followed by block comment should produce empty result
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"-- foo\n/* bar */",
enableSqlScripting = false) == Seq()
)
// SPARK-54876: line comment before block comment after semicolon
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"SELECT 1; -- foo\n /* bar */",
enableSqlScripting = false) == Seq("SELECT 1")
)
// SPARK-54876: nested block comments
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"SELECT 1; /* outer /* inner */ */",
enableSqlScripting = false) == Seq("SELECT 1")
)
// SPARK-54876: preceding closed block comment + line comment (no SQL statement)
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"/* a */ -- foo\n/* b */",
enableSqlScripting = false) == Seq()
)
// SPARK-54876: unterminated block comment at EOF
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"SELECT 1; /* unterminated",
enableSqlScripting = false) == Seq("SELECT 1", " /* unterminated")
)
// SPARK-54876: unterminated string literal (single input, no semicolon)
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"'unterminated",
enableSqlScripting = false) == Seq("'unterminated")
)
// SPARK-54876: unterminated string literal after semicolon
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"SELECT 1; 'unterminated string",
enableSqlScripting = false) == Seq("SELECT 1", " 'unterminated string")
)
// SPARK-54876: unterminated block comment (single input, no semicolon)
assert(
- splitSemiColonWithIndex(
+ splitSemiColon(
"/* only a comment that never closes",
enableSqlScripting = false) == Seq("/* only a comment that never closes")
)
diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
index ebe5fca9f1c4..f34ac25ef78f 100644
--- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
+++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
@@ -614,8 +614,8 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
}
// Splits SQL into individual statements by top-level semicolons. See
- // [[StringUtils.splitSemiColonWithIndex]] for the implementation.
+ // [[StringUtils.splitSemiColon]] for the implementation.
// Note: [SPARK-31595], [SPARK-33100], [SPARK-54876]
private[hive] def splitSemiColon(line: String): JList[String] =
- StringUtils.splitSemiColonWithIndex(line, enableSqlScripting = false).asJava
+ StringUtils.splitSemiColon(line, enableSqlScripting = false).asJava
}
diff --git a/sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/SqlGraphRegistrationContext.scala b/sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/SqlGraphRegistrationContext.scala
index 4dfd09693578..625844de74cb 100644
--- a/sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/SqlGraphRegistrationContext.scala
+++ b/sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/graph/SqlGraphRegistrationContext.scala
@@ -609,7 +609,7 @@ object SqlGraphRegistrationContext {
* terminated statement is not returned.
*/
private def splitSqlTextBySemicolon(sqlText: String): List[String] = StringUtils
- .splitSemiColonWithIndex(line = sqlText, enableSqlScripting = false)
+ .splitSemiColon(line = sqlText, enableSqlScripting = false)
/** Class that holds the logical plan and query origin parsed from a SQL statement. */
case class SqlQueryPlanWithOrigin(plan: LogicalPlan, queryOrigin: QueryOrigin)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org