LuciferYang commented on a change in pull request #31294:
URL: https://github.com/apache/spark/pull/31294#discussion_r563000971
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogVersionsSuite.scala
##########
@@ -237,17 +237,20 @@ class HiveExternalCatalogVersionsSuite extends
SparkSubmitTestUtils {
}
object PROCESS_TABLES extends QueryTest with SQLTestUtils {
- val releaseMirror = "https://dist.apache.org/repos/dist/release"
+ val releaseMirror = sys.env.getOrElse("SPARK_RELEASE_MIRROR",
+ "https://dist.apache.org/repos/dist/release")
// Tests the latest version of every release line.
val testingVersions: Seq[String] = {
import scala.io.Source
val versions: Seq[String] = try {
- Source.fromURL(s"${releaseMirror}/spark").mkString
- .split("\n")
- .filter(_.contains("""<li><a href="spark-"""))
- .filterNot(_.contains("preview"))
- .map("""<a
href="spark-(\d.\d.\d)/">""".r.findFirstMatchIn(_).get.group(1))
- .filter(_ < org.apache.spark.SPARK_VERSION)
+ Utils.tryWithResource(Source.fromURL(s"$releaseMirror/spark")) {
htmlContent =>
+ htmlContent.mkString
+ .split("\n")
+ .filter(_.contains("""<a href="spark-"""))
Review comment:
@dongjoon-hyun I'm not sure if the image can be seen, the verification
process is as follows:
```
scala> val releaseMirror = "https://dist.apache.org/repos/dist/release"
val releaseMirror: String = https://dist.apache.org/repos/dist/release
scala> scala.io.Source.fromURL(s"${releaseMirror}/spark").mkString
| .split("\n")
| .filter(_.contains("""<a href="spark-"""))
| .filterNot(_.contains("preview"))
| .map("""<a
href="spark-(\d.\d.\d)/">""".r.findFirstMatchIn(_).get.group(1))
val res0: Array[String] = Array(2.4.7, 3.0.1)
scala> scala.io.Source.fromURL(s"${releaseMirror}/spark").mkString
| .split("\n")
| .filter(_.contains("""<li><a href="spark-"""))
| .filterNot(_.contains("preview"))
| .map("""<a
href="spark-(\d.\d.\d)/">""".r.findFirstMatchIn(_).get.group(1))
val res1: Array[String] = Array(2.4.7, 3.0.1)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]