Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ abstract class ExternalCatalogSuite extends SparkFunSuite with BeforeAndAfterEac
partitionColumnNames = Seq("partCol1", "partCol2"))
catalog.createTable(table, ignoreIfExists = false)

val newLocationPart1 = newUriForDatabase()
val newLocationPart2 = newUriForDatabase()
val newLocationPart1 = newUriForPartition(Seq("p1=1", "p2=2"))
val newLocationPart2 = newUriForPartition(Seq("p1=3", "p2=4"))

val partition1 =
CatalogTablePartition(Map("partCol1" -> "1", "partCol2" -> "2"),
Expand Down Expand Up @@ -991,6 +991,11 @@ abstract class CatalogTestUtils {

def newUriForDatabase(): URI = new URI(Utils.createTempDir().toURI.toString.stripSuffix("/"))

def newUriForPartition(parts: Seq[String]): URI = {
val path = parts.foldLeft(Utils.createTempDir())(new java.io.File(_, _))
new URI(path.toURI.toString.stripSuffix("/"))
}

def newDb(name: String): CatalogDatabase = {
CatalogDatabase(name, name + " description", newUriForDatabase(), Map.empty)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,12 +983,16 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto
assert(fetched1.get.colStats.size == 2)

withTempPaths(numPaths = 2) { case Seq(dir1, dir2) =>
val file1 = new File(dir1 + "/data")
val partDir1 = new File(new File(dir1, "ds=2008-04-09"), "hr=11")
val file1 = new File(partDir1, "data")
file1.getParentFile.mkdirs()
Utils.tryWithResource(new PrintWriter(file1)) { writer =>
writer.write("1,a")
}

val file2 = new File(dir2 + "/data")
val partDir2 = new File(new File(dir2, "ds=2008-04-09"), "hr=12")
val file2 = new File(partDir2, "data")
file2.getParentFile.mkdirs()
Utils.tryWithResource(new PrintWriter(file2)) { writer =>
writer.write("1,a")
}
Expand All @@ -997,8 +1001,8 @@ class StatisticsSuite extends StatisticsCollectionTestBase with TestHiveSingleto
sql(
s"""
|ALTER TABLE $table ADD
|PARTITION (ds='2008-04-09', hr='11') LOCATION '${dir1.toURI.toString}'
|PARTITION (ds='2008-04-09', hr='12') LOCATION '${dir2.toURI.toString}'
|PARTITION (ds='2008-04-09', hr='11') LOCATION '${partDir1.toURI.toString}'
|PARTITION (ds='2008-04-09', hr='12') LOCATION '${partDir1.toURI.toString}'
""".stripMargin)
if (autoUpdate) {
val fetched2 = checkTableStats(table, hasSizeInBytes = true, expectedRowCounts = None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ class HiveDDLSuite
val tab = "tab_with_partitions"
withTempDir { tmpDir =>
val basePath = new File(tmpDir.getCanonicalPath)
val part1Path = new File(basePath + "/part1")
val part2Path = new File(basePath + "/part2")
val part1Path = new File(new File(basePath, "part10"), "part11")
val part2Path = new File(new File(basePath, "part20"), "part21")
val dirSet = part1Path :: part2Path :: Nil

// Before data insertion, all the directory are empty
Expand Down