Github user wzhfy commented on a diff in the pull request:
https://github.com/apache/spark/pull/14712#discussion_r76949035
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala ---
@@ -168,6 +169,81 @@ class StatisticsSuite extends QueryTest with
TestHiveSingleton with SQLTestUtils
TableIdentifier("tempTable"), ignoreIfNotExists = true, purge =
false)
}
+ private def checkMetastoreRelationStats(
+ tableName: String,
+ totalSize: Long,
+ rowCount: Option[BigInt]): Unit = {
+ val df = sql(s"SELECT * FROM $tableName")
+ val relations = df.queryExecution.analyzed.collect { case rel:
MetastoreRelation =>
+ rel.statistics
+ assert(rel.statistics.sizeInBytes === totalSize)
+ assert(rel.statistics.rowCount === rowCount)
+ }
+ assert(relations.size === 1)
+ }
+
+ private def checkLogicalRelationStats(tableName: String, rowCount:
Option[BigInt]): Unit = {
+ val df = sql(s"SELECT * FROM $tableName")
+ val relations = df.queryExecution.analyzed.collect { case rel:
LogicalRelation =>
+ assert(rel.statistics.sizeInBytes === rel.relation.sizeInBytes)
+ assert(rel.statistics.rowCount === rowCount)
+ }
+ assert(relations.size === 1)
+ }
+
+ test("test table-level statistics for hive tables created in
HiveExternalCatalog") {
--- End diff --
Yes, I've split it in the latest code.
---
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]