Github user mallman commented on a diff in the pull request:
https://github.com/apache/spark/pull/15539#discussion_r83990858
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveTablePerfStatsSuite.scala
---
@@ -103,11 +92,84 @@ class HiveDataFrameSuite extends QueryTest with
TestHiveSingleton with SQLTestUt
assert(HiveCatalogMetrics.METRIC_PARTITIONS_FETCHED.getCount()
== 5)
assert(HiveCatalogMetrics.METRIC_FILES_DISCOVERED.getCount() ==
5)
- // read all should be cached
+ // read all should not be cached
HiveCatalogMetrics.reset()
spark.sql("select * from test").count()
+ assert(HiveCatalogMetrics.METRIC_PARTITIONS_FETCHED.getCount()
== 5)
+ assert(HiveCatalogMetrics.METRIC_FILES_DISCOVERED.getCount() ==
5)
+
+ // cache should be disabled
+ assert(HiveCatalogMetrics.METRIC_FILE_CACHE_HITS.getCount() == 0)
+ }
+ }
+ }
+ }
+
+ test("lazy partition pruning with file status caching enabled") {
+ withSQLConf(
+ "spark.sql.hive.filesourcePartitionPruning" -> "true",
+ "spark.sql.hive.filesourcePartitionFileCacheEnabled" -> "true") {
+ withTable("test") {
+ withTempDir { dir =>
+ setupPartitionedTable("test", dir)
+ HiveCatalogMetrics.reset()
+ spark.sql("select * from test where partCol1 = 999").count()
--- End diff --
I suggest wrapping this and other such calls in an `assert` to declare and
validate assumptions, e.g.
```
assert(spark.sql("select * from test where partCol1 = 999").count() == 0)
```
whereas
```
assert(spark.sql("select * from test where partCol1 < 2").count() == 2)
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]