This is an automated email from the ASF dual-hosted git repository.
dongjoon-hyun pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new 090930a59bb7 Revert "[SPARK-57262][SQL][WEBUI] Job description derived
from a query should respect `spark.sql.redaction.string.regex`"
090930a59bb7 is described below
commit 090930a59bb7e8da459131664f3cf88a7aecf09a
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Sat Jun 6 16:49:01 2026 -0700
Revert "[SPARK-57262][SQL][WEBUI] Job description derived from a query
should respect `spark.sql.redaction.string.regex`"
This reverts commit ab3ec61a0353944544437c5b0008758a956fd00f.
---
.../apache/spark/sql/execution/SQLExecution.scala | 4 +-
.../sql/hive/thriftserver/SparkSQLDriver.scala | 4 +-
.../hive/thriftserver/SparkSQLDriverSuite.scala | 51 ----------------------
3 files changed, 4 insertions(+), 55 deletions(-)
diff --git
a/sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
b/sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
index a5144bfd1195..f25e908a9cdb 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
@@ -170,7 +170,9 @@ object SQLExecution extends Logging {
val desc = Option(sc.getLocalProperty(SPARK_JOB_DESCRIPTION))
.filter(_ => truncateLength > 0)
.map { sqlStr =>
- sqlStr.substring(0, Math.min(truncateLength, sqlStr.length))
+ val redactedStr = Utils
+ .redact(sparkSession.sessionState.conf.stringRedactionPattern,
sqlStr)
+ redactedStr.substring(0, Math.min(truncateLength,
redactedStr.length))
}.getOrElse(callSite.shortForm)
val globalConfigs = sparkSession.sharedState.conf.getAll.toMap
diff --git
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala
index f6f88cf8a012..2040f8f565a2 100644
---
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala
+++
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala
@@ -66,9 +66,7 @@ private[hive] class SparkSQLDriver(val sparkSession:
SparkSession = SparkSQLEnv.
val substitutorCommand =
SQLConf.withExistingConf(sparkSession.sessionState.conf) {
new VariableSubstitution().substitute(command)
}
- val redactedCommand =
- Utils.redact(sparkSession.sessionState.conf.stringRedactionPattern,
substitutorCommand)
- sparkSession.sparkContext.setJobDescription(redactedCommand)
+ sparkSession.sparkContext.setJobDescription(substitutorCommand)
// Parse with an empty parameter context to enable pre-parsing phase
that scans for
// parameter markers. If any parameter markers (:name or ?) are found in
the SQL,
diff --git
a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriverSuite.scala
b/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriverSuite.scala
deleted file mode 100644
index a0a36ea1e796..000000000000
---
a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriverSuite.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.spark.sql.hive.thriftserver
-
-import org.apache.spark.SparkContext
-import org.apache.spark.scheduler.{SparkListener, SparkListenerJobStart}
-import org.apache.spark.sql.internal.SQLConf
-import org.apache.spark.sql.test.SharedSparkSession
-import org.apache.spark.util.Utils.REDACTION_REPLACEMENT_TEXT
-
-class SparkSQLDriverSuite extends SharedSparkSession {
-
- test("SPARK-57262: job description should be redacted by
spark.sql.redaction.string.regex") {
- withSQLConf(SQLConf.SQL_STRING_REDACTION_PATTERN.key ->
"password=([^\\s]+)") {
- var jobDescription: String = null
- spark.sparkContext.addSparkListener(new SparkListener {
- override def onJobStart(jobStart: SparkListenerJobStart): Unit = {
- jobDescription =
- jobStart.properties.getProperty(SparkContext.SPARK_JOB_DESCRIPTION)
- }
- })
-
- val driver = new SparkSQLDriver(spark)
- try {
- driver.run("SELECT 'password=secret123'")
- } finally {
- driver.close()
- }
-
- spark.sparkContext.listenerBus.waitUntilEmpty()
- assert(jobDescription != null)
- assert(!jobDescription.contains("secret123"))
- assert(jobDescription.contains(REDACTION_REPLACEMENT_TEXT))
- }
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]