sarutak commented on a change in pull request #31721:
URL: https://github.com/apache/spark/pull/31721#discussion_r589670113
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
##########
@@ -857,6 +857,31 @@ class HiveQuerySuite extends HiveComparisonTest with
SQLTestUtils with BeforeAnd
assert(sql(s"list file $testFile").count() == 1)
}
+ test("ADD ARCHIVE command") {
+ withTempDir { dir =>
+ val file = File.createTempFile("someprefix1", "somesuffix1", dir)
+ val zipFile = new File(dir, "test.zip")
+ TestUtils.createJar(Seq(file), zipFile)
+ sql(s"ADD ARCHIVE ${zipFile.getAbsolutePath}#foo")
+
+ val checkAddArchive =
+ sparkContext.parallelize(
+ Seq(
+ "foo",
+ s"foo/${file.getName}"), 1).map { name =>
+ (name, new File(SparkFiles.get(name)).canRead)
+ }.collect()
+
+ assert(checkAddArchive(0) === ("foo", true))
+ assert(checkAddArchive(1) === (s"foo/${file.getName}", true))
+ assert(sql("list archives").
+ filter(_.getString(0).contains(s"${zipFile.getAbsolutePath}")).count()
> 0)
+ assert(sql("list archive").
Review comment:
[same
reply](https://github.com/apache/spark/pull/31721#discussion_r589581473).
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
##########
@@ -857,6 +857,31 @@ class HiveQuerySuite extends HiveComparisonTest with
SQLTestUtils with BeforeAnd
assert(sql(s"list file $testFile").count() == 1)
}
+ test("ADD ARCHIVE command") {
+ withTempDir { dir =>
+ val file = File.createTempFile("someprefix1", "somesuffix1", dir)
+ val zipFile = new File(dir, "test.zip")
+ TestUtils.createJar(Seq(file), zipFile)
+ sql(s"ADD ARCHIVE ${zipFile.getAbsolutePath}#foo")
+
+ val checkAddArchive =
+ sparkContext.parallelize(
+ Seq(
+ "foo",
+ s"foo/${file.getName}"), 1).map { name =>
+ (name, new File(SparkFiles.get(name)).canRead)
+ }.collect()
+
+ assert(checkAddArchive(0) === ("foo", true))
+ assert(checkAddArchive(1) === (s"foo/${file.getName}", true))
+ assert(sql("list archives").
+ filter(_.getString(0).contains(s"${zipFile.getAbsolutePath}")).count()
> 0)
+ assert(sql("list archive").
+ filter(_.getString(0).contains(s"${zipFile.getAbsolutePath}")).count()
> 0)
+ assert(sql(s"list archive ${zipFile.getAbsolutePath}").count() == 1)
Review comment:
[same
reply](https://github.com/apache/spark/pull/31721#discussion_r589581473)
----------------------------------------------------------------
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]