Skip to content

Commit

Permalink
[SPARK-33084][SQL][TEST][FOLLOWUP] Add ResetSystemProperties trait to…
Browse files Browse the repository at this point in the history
… SQLQuerySuite to avoid clearing ivy.home

### What changes were proposed in this pull request?
Add the `ResetSystemProperties` trait to `SQLQuerySuite` so that system property changes made by any of the tests will not affect other suites/tests. Specifically, the system property changes made by `SPARK-33084: Add jar support Ivy URI in SQL -- jar contains udf class` are targeted here (which sets and then clears `ivy.home`).

### Why are the changes needed?
PR #29966 added a new test case that adjusts the `ivy.home` system property to force Ivy to resolve an artifact from a custom location. At the end of the test, the value is cleared. Clearing the value meant that, if a custom value of `ivy.home` was configured externally, it would not apply for tests run after this test case.

### Does this PR introduce _any_ user-facing change?
No, this is only in tests.

### How was this patch tested?
Existing unit tests continue to pass, whether or not `spark.jars.ivySettings` is configured (which adjusts the behavior of Ivy w.r.t. handling of `ivy.home` and `ivy.default.ivy.user.dir` properties).

Closes #31694 from xkrogen/xkrogen-SPARK-33084-ivyhome-sysprop-followon.

Authored-by: Erik Krogen <xkrogen@apache.org>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
  • Loading branch information
xkrogen authored and HyukjinKwon committed Mar 3, 2021
1 parent 8005900 commit 9d2d620
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ import org.apache.spark.sql.test.{SharedSparkSession, TestSQLContext}
import org.apache.spark.sql.test.SQLTestData._
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.CalendarInterval
import org.apache.spark.util.ResetSystemProperties

class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSparkPlanHelper {
class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSparkPlanHelper
with ResetSystemProperties {
import testImplicits._

setupTestData()
Expand Down Expand Up @@ -3860,7 +3862,6 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
checkAnswer(sql("SELECT * FROM v1"), Seq(Row(2.0)))
}
}
System.clearProperty("ivy.home")
}
}

Expand Down

0 comments on commit 9d2d620

Please sign in to comment.