Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/1741#discussion_r15732118
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala ---
@@ -26,6 +26,53 @@ import org.apache.spark.sql.hive.test.TestHive._
class StatisticsSuite extends QueryTest {
+ test("analyze MetastoreRelations") {
+ def queryTotalSize(tableName: String): BigInt =
+ catalog.lookupRelation(None, tableName).statistics.sizeInBytes
+
+ // Non-partitioned table
+ hql("CREATE TABLE srcToBeAnalyzed (key STRING, value
STRING)").collect()
+ hql("INSERT INTO TABLE srcToBeAnalyzed SELECT * FROM src").collect()
+ hql("INSERT INTO TABLE srcToBeAnalyzed SELECT * FROM src").collect()
+
+ assert(queryTotalSize("srcToBeAnalyzed") === defaultSizeInBytes)
+
+ analyze("srcTobeAnalyzed")
+
+ assert(queryTotalSize("srcToBeAnalyzed") === BigInt(11624))
+
+ hql("DROP TABLE srcToBeAnalyzed").collect()
--- End diff --
We'll need to coordinate this with #1746. The only problem will be
deprecation warning though, so I'm okay fixing it up in a follow up PR.
---
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]