This is an automated email from the ASF dual-hosted git repository. dongjoon 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 8ad85f8 [SPARK-38299][SQL] Clean up deprecated usage of `StringBuilder.newBuilder` 8ad85f8 is described below commit 8ad85f84db528e7d91b19e1efe165300e7405945 Author: yangjie01 <yangji...@baidu.com> AuthorDate: Wed Feb 23 10:46:31 2022 -0800 [SPARK-38299][SQL] Clean up deprecated usage of `StringBuilder.newBuilder` ### What changes were proposed in this pull request? `StringBuilder.newBuilder` has deprecated since Scala 2.13.0: https://github.com/scala/scala/blob/de73fdb0a8552f0b2444334bb7b31c0a95a79474/src/library/scala/collection/mutable/StringBuilder.scala#L479-L482 this pr change to use `new StringBuilder()` instead of it. ### Why are the changes needed? Clean up deprecated API usage. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GA Closes #35621 from LuciferYang/stringbuilder. Authored-by: yangjie01 <yangji...@baidu.com> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- .../src/main/scala/org/apache/spark/sql/catalyst/util/package.scala | 2 +- .../main/scala/org/apache/spark/sql/execution/command/tables.scala | 6 +++--- .../spark/sql/execution/datasources/v2/ShowCreateTableExec.scala | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala index ed9dc03..d8e895b 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala @@ -159,7 +159,7 @@ package object util extends Logging { def toPrettySQL(e: Expression): String = usePrettyExpression(e).sql def escapeSingleQuotedString(str: String): String = { - val builder = StringBuilder.newBuilder + val builder = new StringBuilder str.foreach { case '\'' => builder ++= s"\\\'" diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index 5c33080..ac4bb83 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -1125,7 +1125,7 @@ case class ShowCreateTableCommand( } } - val builder = StringBuilder.newBuilder + val builder = new StringBuilder val stmt = if (tableMetadata.tableType == VIEW) { builder ++= s"CREATE VIEW ${table.quoted} " @@ -1153,7 +1153,7 @@ case class ShowCreateTableCommand( // TODO: some Hive fileformat + row serde might be mapped to Spark data source, e.g. CSV. val source = HiveSerDe.serdeToSource(hiveSerde) if (source.isEmpty) { - val builder = StringBuilder.newBuilder + val builder = new StringBuilder hiveSerde.serde.foreach { serde => builder ++= s" SERDE: $serde" } @@ -1260,7 +1260,7 @@ case class ShowCreateTableAsSerdeCommand( reportUnsupportedError(metadata.unsupportedFeatures) } - val builder = StringBuilder.newBuilder + val builder = new StringBuilder val tableTypeString = metadata.tableType match { case EXTERNAL => " EXTERNAL TABLE" diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala index abe8d67..06f5a08 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala @@ -36,7 +36,7 @@ case class ShowCreateTableExec( output: Seq[Attribute], table: Table) extends V2CommandExec with LeafExecNode { override protected def run(): Seq[InternalRow] = { - val builder = StringBuilder.newBuilder + val builder = new StringBuilder showCreateTable(table, builder) Seq(InternalRow(UTF8String.fromString(builder.toString))) } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org