aboutsummaryrefslogtreecommitdiff
path: root/sql/hive/src/test
diff options
context:
space:
mode:
authorgatorsmile <gatorsmile@gmail.com>2016-08-10 16:25:01 +0800
committerWenchen Fan <wenchen@databricks.com>2016-08-10 16:25:01 +0800
commitbdd537164dcfeec5e9c51d54791ef16997ff2597 (patch)
tree0fbf0397a3d34e0fe97af4a61a93c6877ded5f95 /sql/hive/src/test
parent1203c8415cd11540f79a235e66a2f241ca6c71e4 (diff)
downloadspark-bdd537164dcfeec5e9c51d54791ef16997ff2597.tar.gz
spark-bdd537164dcfeec5e9c51d54791ef16997ff2597.tar.bz2
spark-bdd537164dcfeec5e9c51d54791ef16997ff2597.zip
[SPARK-16959][SQL] Rebuild Table Comment when Retrieving Metadata from Hive Metastore
### What changes were proposed in this pull request? The `comment` in `CatalogTable` returned from Hive is always empty. We store it in the table property when creating a table. However, when we try to retrieve the table metadata from Hive metastore, we do not rebuild it. The `comment` is always empty. This PR is to fix the issue. ### How was this patch tested? Fixed the test case to verify the change. Author: gatorsmile <gatorsmile@gmail.com> Closes #14550 from gatorsmile/tableComment.
Diffstat (limited to 'sql/hive/src/test')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
index e078b58542..970b6885f6 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
@@ -135,8 +135,11 @@ class HiveDDLSuite
sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName")
val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default")))
val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default")))
- assert(tableMetadata.properties.get("comment") == Option("BLABLA"))
- assert(viewMetadata.properties.get("comment") == Option("no comment"))
+ assert(tableMetadata.comment == Option("BLABLA"))
+ assert(viewMetadata.comment == Option("no comment"))
+ // Ensure that `comment` is removed from the table property
+ assert(tableMetadata.properties.get("comment").isEmpty)
+ assert(viewMetadata.properties.get("comment").isEmpty)
}
}
}