Skip to content

Commit

Permalink
KE-42576 fix ivy ut (apache#673)
Browse files Browse the repository at this point in the history
* KE-42576 fix ivy ut
  • Loading branch information
leejaywei authored and frearb committed Sep 19, 2023
1 parent 1494706 commit 1d996c3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/test/scala/org/apache/spark/LocalSparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ trait LocalSparkContext extends BeforeAndAfterEach with BeforeAndAfterAll { self
override def beforeAll(): Unit = {
super.beforeAll()
InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE)
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")
}

override def afterEach(): Unit = {
Expand Down
2 changes: 2 additions & 0 deletions core/src/test/scala/org/apache/spark/SparkFunSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ abstract class SparkFunSuite
if (enableAutoThreadAudit) {
doThreadPreAudit()
}
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")
super.beforeAll()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ class SparkSubmitSuite

// SPARK-7287
test("includes jars passed in through --packages") {
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")
val unusedJar = TestUtils.createJarWithClasses(Seq.empty)
val main = MavenCoordinate("my.great.lib", "mylib", "0.1")
val dep = MavenCoordinate("my.great.dep", "mylib", "0.1")
Expand All @@ -682,6 +684,8 @@ class SparkSubmitSuite
"--packages", Seq(main, dep).mkString(","),
"--repositories", repo,
"--conf", "spark.ui.enabled=false",
"--conf", "spark.driver.extraJavaOptions=-Djavax.xml.parsers.SAXParserFactory=" +
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
"--conf", "spark.master.rest.enabled=false",
"--conf", s"spark.jars.ivySettings=${emptyIvySettings.getAbsolutePath()}",
unusedJar.toString,
Expand All @@ -691,6 +695,8 @@ class SparkSubmitSuite
}

test("includes jars passed through spark.jars.packages and spark.jars.repositories") {
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")
val unusedJar = TestUtils.createJarWithClasses(Seq.empty)
val main = MavenCoordinate("my.great.lib", "mylib", "0.1")
val dep = MavenCoordinate("my.great.dep", "mylib", "0.1")
Expand All @@ -702,6 +708,8 @@ class SparkSubmitSuite
"--conf", "spark.jars.packages=my.great.lib:mylib:0.1,my.great.dep:mylib:0.1",
"--conf", s"spark.jars.repositories=$repo",
"--conf", "spark.ui.enabled=false",
"--conf", "spark.driver.extraJavaOptions=-Djavax.xml.parsers.SAXParserFactory=" +
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
"--conf", "spark.master.rest.enabled=false",
"--conf", s"spark.jars.ivySettings=${emptyIvySettings.getAbsolutePath()}",
unusedJar.toString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class PlannerSuite extends SharedSparkSession with AdaptiveSparkPlanHelper {
val planned = sql(
"""
|SELECT l.a, l.b
|FROM testData2 l JOIN (SELECT * FROM testLimit LIMIT 1) r ON (l.a = r.key)
|FROM testData2 l JOIN (SELECT * FROM testLimit LIMIT 2) r ON (l.a = r.key)
""".stripMargin).queryExecution.sparkPlan

val broadcastHashJoins = planned.collect { case join: BroadcastHashJoinExec => join }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ trait SharedSparkSession extends SQLTestUtils with SharedSparkSessionBase {

protected override def beforeAll(): Unit = {
doThreadPreAudit()
System.setProperty("javax.xml.parsers.SAXParserFactory",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")

super.beforeAll()
}

Expand Down

0 comments on commit 1d996c3

Please sign in to comment.