@@ -62,17 +62,12 @@ class PartitionedTablePerfStatsSuite
62
62
}
63
63
64
64
private def setupPartitionedHiveTable (
65
- tableName : String , dir : File , scale : Int ,
66
- clearMetricsBeforeCreate : Boolean = false , repair : Boolean = true ): Unit = {
65
+ tableName : String , dir : File , scale : Int , repair : Boolean = true ): Unit = {
67
66
spark.range(scale).selectExpr(" id as fieldOne" , " id as partCol1" , " id as partCol2" ).write
68
67
.partitionBy(" partCol1" , " partCol2" )
69
68
.mode(" overwrite" )
70
69
.parquet(dir.getAbsolutePath)
71
70
72
- if (clearMetricsBeforeCreate) {
73
- HiveCatalogMetrics .reset()
74
- }
75
-
76
71
spark.sql(s """
77
72
|create external table $tableName (fieldOne long)
78
73
|partitioned by (partCol1 int, partCol2 int)
@@ -88,17 +83,12 @@ class PartitionedTablePerfStatsSuite
88
83
}
89
84
90
85
private def setupPartitionedDatasourceTable (
91
- tableName : String , dir : File , scale : Int ,
92
- clearMetricsBeforeCreate : Boolean = false , repair : Boolean = true ): Unit = {
86
+ tableName : String , dir : File , scale : Int , repair : Boolean = true ): Unit = {
93
87
spark.range(scale).selectExpr(" id as fieldOne" , " id as partCol1" , " id as partCol2" ).write
94
88
.partitionBy(" partCol1" , " partCol2" )
95
89
.mode(" overwrite" )
96
90
.parquet(dir.getAbsolutePath)
97
91
98
- if (clearMetricsBeforeCreate) {
99
- HiveCatalogMetrics .reset()
100
- }
101
-
102
92
spark.sql(s """
103
93
|create table $tableName (fieldOne long, partCol1 int, partCol2 int)
104
94
|using parquet
@@ -271,8 +261,8 @@ class PartitionedTablePerfStatsSuite
271
261
withSQLConf(SQLConf .HIVE_MANAGE_FILESOURCE_PARTITIONS .key -> " true" ) {
272
262
withTable(" test" ) {
273
263
withTempDir { dir =>
274
- setupPartitionedDatasourceTable(
275
- " test" , dir, scale = 10 , clearMetricsBeforeCreate = true , repair = false )
264
+ HiveCatalogMetrics .reset()
265
+ setupPartitionedDatasourceTable( " test" , dir, scale = 10 , repair = false )
276
266
assert(HiveCatalogMetrics .METRIC_FILES_DISCOVERED .getCount() == 0 )
277
267
assert(HiveCatalogMetrics .METRIC_FILE_CACHE_HITS .getCount() == 0 )
278
268
}
@@ -285,8 +275,7 @@ class PartitionedTablePerfStatsSuite
285
275
withTable(" test" ) {
286
276
withTempDir { dir =>
287
277
HiveCatalogMetrics .reset()
288
- setupPartitionedHiveTable(
289
- " test" , dir, scale = 10 , clearMetricsBeforeCreate = true , repair = false )
278
+ setupPartitionedHiveTable(" test" , dir, scale = 10 , repair = false )
290
279
assert(HiveCatalogMetrics .METRIC_FILES_DISCOVERED .getCount() == 0 )
291
280
assert(HiveCatalogMetrics .METRIC_FILE_CACHE_HITS .getCount() == 0 )
292
281
}
@@ -416,12 +405,8 @@ class PartitionedTablePerfStatsSuite
416
405
})
417
406
executorPool.shutdown()
418
407
executorPool.awaitTermination(30 , TimeUnit .SECONDS )
419
- // check the cache hit, we use the metric of METRIC_FILES_DISCOVERED and
420
- // METRIC_PARALLEL_LISTING_JOB_COUNT to check this, while the lock take effect,
421
- // only one thread can really do the build, so the listing job count is 2, the other
422
- // one is cache.load func. Also METRIC_FILES_DISCOVERED is $partition_num * 2
423
- assert(HiveCatalogMetrics .METRIC_FILES_DISCOVERED .getCount() == 100 )
424
- assert(HiveCatalogMetrics .METRIC_PARALLEL_LISTING_JOB_COUNT .getCount() == 2 )
408
+ assert(HiveCatalogMetrics .METRIC_FILES_DISCOVERED .getCount() == 50 )
409
+ assert(HiveCatalogMetrics .METRIC_PARALLEL_LISTING_JOB_COUNT .getCount() == 1 )
425
410
}
426
411
}
427
412
}
0 commit comments