This is an automated email from the ASF dual-hosted git repository. yumwang 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 645ed16f92b0 [SPARK-53173][SQL][TESTS] Improve `Owner` regex pattern in the replaceNotIncludedMsg method 645ed16f92b0 is described below commit 645ed16f92b013c739655001e591bea5229b114d Author: Yuming Wang <yumw...@ebay.com> AuthorDate: Wed Aug 13 11:49:29 2025 +0800 [SPARK-53173][SQL][TESTS] Improve `Owner` regex pattern in the replaceNotIncludedMsg method ### What changes were proposed in this pull request? This PR improves the regex pattern in the `replaceNotIncludedMsg` method. Replace `Owner\t.*` with `Owner[\t ]+(.*)` to match the owner info. ### Why are the changes needed? Improve the test. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Set current user and run test: ```diff Subject: [PATCH] Verify [SPARK-53173][SQL][TESTS] Improve Owner regex pattern in the replaceNotIncludedMsg method --- Index: sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala --- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala (revision 2868e606092104b54035be683332466e17c87694) +++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala (revision 06a72d61a5d3ab76c0a0ac6a4cf07eb6611ee5ed) -28,7 +28,7 import org.apache.spark.SparkThrowableHelper.getMessage import org.apache.spark.internal.Logging import org.apache.spark.sql.IntegratedUDFTestUtils.{TestUDF, TestUDTFSet} -import org.apache.spark.sql.catalyst.SQLConfHelper +import org.apache.spark.sql.catalyst.{CurrentUserContext, SQLConfHelper} import org.apache.spark.sql.catalyst.expressions.{CurrentDate, CurrentTime, CurrentTimestampLike, CurrentUser, Literal} import org.apache.spark.sql.catalyst.planning.PhysicalOperation import org.apache.spark.sql.catalyst.plans.logical._ -41,6 +41,8 trait SQLQueryTestHelper extends SQLConfHelper with Logging { + CurrentUserContext.CURRENT_USER.set("test_user") + private val notIncludedMsg = "[not included in comparison]" private val clsName = this.getClass.getCanonicalName protected val emptySchema = StructType(Seq.empty).catalogString -57,7 +59,7 .replaceAll("Created By.*", s"Created By $notIncludedMsg") .replaceAll("Created Time.*", s"Created Time $notIncludedMsg") .replaceAll("Last Access.*", s"Last Access $notIncludedMsg") - .replaceAll("Owner\t.*", s"Owner\t$notIncludedMsg") + .replaceAll("Owner[\\t ]+(.*)", s"Owner\t$notIncludedMsg") .replaceAll("Partition Statistics\t\\d+", s"Partition Statistics\t$notIncludedMsg") .replaceAll("CTERelationDef \\d+,", s"CTERelationDef xxxx,") .replaceAll("CTERelationRef \\d+,", s"CTERelationRef xxxx,") ``` ```shell SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z create_view.sql" ``` Before this PR: <img width="351" height="173" alt="image" src="https://github.com/user-attachments/assets/78dc575a-c572-433e-a26a-760e1d2fc738" /> After this PR: <img width="356" height="182" alt="image" src="https://github.com/user-attachments/assets/4ff85499-2bbc-4fc1-aee1-2dc1a412b8fb" /> ### Was this patch authored or co-authored using generative AI tooling? No. Closes #51901 from wangyum/SPARK-53173. Authored-by: Yuming Wang <yumw...@ebay.com> Signed-off-by: Yuming Wang <yumw...@ebay.com> --- sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala index 548f34cfdb77..23a43dbd641d 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestHelper.scala @@ -57,7 +57,7 @@ trait SQLQueryTestHelper extends SQLConfHelper with Logging { .replaceAll("Created By.*", s"Created By $notIncludedMsg") .replaceAll("Created Time.*", s"Created Time $notIncludedMsg") .replaceAll("Last Access.*", s"Last Access $notIncludedMsg") - .replaceAll("Owner\t.*", s"Owner\t$notIncludedMsg") + .replaceAll("Owner[\t ]+(.*)", s"Owner\t$notIncludedMsg") .replaceAll("Partition Statistics\t\\d+", s"Partition Statistics\t$notIncludedMsg") .replaceAll("CTERelationDef \\d+,", s"CTERelationDef xxxx,") .replaceAll("CTERelationRef \\d+,", s"CTERelationRef xxxx,") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org