This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch branch-3.1 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.1 by this push: new f76f657 [SPARK-34682][SQL] Use PrivateMethodTester instead of reflection f76f657 is described below commit f76f657fd3335cba47e34bad680b71373b589ee3 Author: Andy Grove <andygrov...@gmail.com> AuthorDate: Wed Mar 10 12:08:31 2021 -0800 [SPARK-34682][SQL] Use PrivateMethodTester instead of reflection ### Why are the changes needed? SPARK-34682 was merged prematurely. This PR implements feedback from the review. I wasn't sure whether I should create a new JIRA or not. ### Does this PR introduce _any_ user-facing change? No. Just improves the test. ### How was this patch tested? Updated test. Closes #31798 from andygrove/SPARK-34682-follow-up. Authored-by: Andy Grove <andygrov...@gmail.com> Signed-off-by: Dongjoon Hyun <dh...@apple.com> (cherry picked from commit fc182f7e7f9ff55a6a005044ae0968340cf6f30d) Signed-off-by: Dongjoon Hyun <dh...@apple.com> --- .../sql/execution/adaptive/AdaptiveQueryExecSuite.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala index cdd1901..f7570c0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala @@ -18,10 +18,10 @@ package org.apache.spark.sql.execution.adaptive import java.io.File -import java.lang.reflect.InvocationTargetException import java.net.URI import org.apache.log4j.Level +import org.scalatest.PrivateMethodTester import org.apache.spark.scheduler.{SparkListener, SparkListenerEvent, SparkListenerJobStart} import org.apache.spark.sql.{Dataset, QueryTest, Row, SparkSession, Strategy} @@ -46,7 +46,8 @@ import org.apache.spark.util.Utils class AdaptiveQueryExecSuite extends QueryTest with SharedSparkSession - with AdaptiveSparkPlanHelper { + with AdaptiveSparkPlanHelper + with PrivateMethodTester { import testImplicits._ @@ -881,12 +882,11 @@ class AdaptiveQueryExecSuite val reader = readers.head val c = reader.canonicalized.asInstanceOf[CustomShuffleReaderExec] // we can't just call execute() because that has separate checks for canonicalized plans - val doExecute = c.getClass.getMethod("doExecute") - doExecute.setAccessible(true) - val ex = intercept[InvocationTargetException] { - doExecute.invoke(c) + val ex = intercept[IllegalStateException] { + val doExecute = PrivateMethod[Unit](Symbol("doExecute")) + c.invokePrivate(doExecute()) } - assert(ex.getCause.getMessage === "operating on canonicalized plan") + assert(ex.getMessage === "operating on canonicalized plan") } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org