Skip to content

[SPARK-52800]Remove several deprecated commons-lang3 methods #51495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package org.apache.spark.deploy.k8s.integrationtest.backend.cloud

import io.fabric8.kubernetes.client.{Config, KubernetesClient, KubernetesClientBuilder}
import io.fabric8.kubernetes.client.utils.Utils
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.{Strings, StringUtils}

import org.apache.spark.deploy.k8s.integrationtest.TestConstants
import org.apache.spark.deploy.k8s.integrationtest.backend.IntegrationTestBackend
Expand Down Expand Up @@ -48,7 +48,7 @@ private[spark] class KubeConfigBackend(var context: String)
// Clean up master URL which would have been specified in Spark format into a normal
// K8S master URL
masterUrl = checkAndGetK8sMasterUrl(masterUrl).replaceFirst("k8s://", "")
if (!StringUtils.equals(config.getMasterUrl, masterUrl)) {
if (!Strings.CS.equals(config.getMasterUrl, masterUrl)) {
logInfo(s"Overriding K8S master URL ${config.getMasterUrl} from K8S config file " +
s"with user specified master URL ${masterUrl}")
config.setMasterUrl(masterUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.spark.sql.connector.expressions

import org.apache.commons.codec.binary.Hex
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.Strings

import org.apache.spark.SparkException
import org.apache.spark.sql.catalyst
Expand Down Expand Up @@ -390,7 +390,7 @@ private[sql] object HoursTransform {

private[sql] final case class LiteralValue[T](value: T, dataType: DataType) extends Literal[T] {
override def toString: String = dataType match {
case StringType => s"'${StringUtils.replace(s"$value", "'", "''")}'"
case StringType => s"'${Strings.CS.replace(s"$value", "'", "''")}'"
case BinaryType =>
assert(value.isInstanceOf[Array[Byte]])
val bytes = value.asInstanceOf[Array[Byte]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit
import scala.collection.mutable.ArrayBuilder
import scala.util.control.NonFatal

import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.Strings

import org.apache.spark.{SparkRuntimeException, SparkThrowable, SparkUnsupportedOperationException}
import org.apache.spark.annotation.{DeveloperApi, Since}
Expand Down Expand Up @@ -352,7 +352,7 @@ abstract class JdbcDialect extends Serializable with Logging {
*/
@Since("2.3.0")
protected[jdbc] def escapeSql(value: String): String =
if (value == null) null else StringUtils.replace(value, "'", "''")
if (value == null) null else Strings.CS.replace(value, "'", "''")

/**
* Converts value to SQL expression.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.security.sasl.AuthenticationException;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.ServiceUtils;

Expand Down Expand Up @@ -70,7 +71,7 @@ public void Authenticate(String user, String password) throws AuthenticationExce
} else {
String[] patterns = userDNPattern.split(":");
for (String pattern : patterns) {
if (StringUtils.contains(pattern, ",") && StringUtils.contains(pattern, "=")) {
if (Strings.CS.contains(pattern, ",") && Strings.CS.contains(pattern, "=")) {
candidatePrincipals.add(pattern.replaceAll("%s", user));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.jdk.CollectionConverters._
import jline.console.ConsoleReader
import jline.console.completer.{ArgumentCompleter, Completer, StringsCompleter}
import jline.console.history.FileHistory
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.{Strings, StringUtils}
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.hive.cli.{CliDriver, CliSessionState, OptionsProcessor}
import org.apache.hadoop.hive.common.HiveInterruptUtils
Expand Down Expand Up @@ -572,7 +572,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
val commands = splitSemiColon(line).asScala
var command: String = ""
for (oneCmd <- commands) {
if (StringUtils.endsWith(oneCmd, "\\")) {
if (Strings.CS.endsWith(oneCmd, "\\")) {
command += StringUtils.chop(oneCmd) + ";"
} else {
command += oneCmd
Expand Down