Skip to content

Commit

Permalink
Fix StatisticsSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGekk committed Dec 13, 2020
1 parent 8916218 commit 4a9abab
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 4a9abab

Please sign in to comment.