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 ba85b25e3867 [SPARK-53100][SQL] Use Java `String.substring` instead of `StringUtils.substring` ba85b25e3867 is described below commit ba85b25e386716d38106fd682158b0ec989cc8e7 Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Mon Aug 4 10:48:53 2025 -0700 [SPARK-53100][SQL] Use Java `String.substring` instead of `StringUtils.substring` ### What changes were proposed in this pull request? This PR aims to use Java `String.substring` instead of `StringUtils.substring`. ### Why are the changes needed? We had better use Java's built-in method for code simplification if there is no benefit of 3rd party libraries. ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51814 from dongjoon-hyun/SPARK-53100. Authored-by: Dongjoon Hyun <dongj...@apache.org> Signed-off-by: Dongjoon Hyun <dongj...@apache.org> --- scalastyle-config.xml | 5 +++++ .../main/scala/org/apache/spark/sql/catalyst/csv/CSVExprUtils.scala | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scalastyle-config.xml b/scalastyle-config.xml index 0a1e48551554..67455f3d3ef2 100644 --- a/scalastyle-config.xml +++ b/scalastyle-config.xml @@ -414,6 +414,11 @@ This file is divided into 3 sections: <customMessage>Use Utils.abbreviate method instead</customMessage> </check> + <check customId="commonslang3substring" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> + <parameters><parameter name="regex">\bStringUtils\.substring\b</parameter></parameters> + <customMessage>Use Java String.substring instead.</customMessage> + </check> + <check customId="uribuilder" level="error" class="org.scalastyle.file.RegexChecker" enabled="true"> <parameters><parameter name="regex">\bUriBuilder\.fromUri\b</parameter></parameters> <customMessage>Use Utils.getUriBuilder instead.</customMessage> diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVExprUtils.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVExprUtils.scala index 7b6664a4117a..5f1f0bff6df4 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVExprUtils.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVExprUtils.scala @@ -17,8 +17,6 @@ package org.apache.spark.sql.catalyst.csv -import org.apache.commons.lang3.StringUtils - import org.apache.spark.SparkIllegalArgumentException object CSVExprUtils { @@ -134,7 +132,7 @@ object CSVExprUtils { // in order to use existing escape logic val readAhead = if (str(idx) == '\\') 2 else 1 // get the chunk of 1 or 2 input characters to convert to a single delimiter char - val chunk = StringUtils.substring(str, idx, idx + readAhead) + val chunk = str.substring(idx, idx + readAhead) delimiter += toChar(chunk) // advance the counter by the length of input chunk processed idx += chunk.length() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org