diff options
author | Cheng Lian <lian@databricks.com> | 2016-05-09 10:53:32 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-05-09 10:53:32 -0700 |
commit | 671b382a80bc789d50f609783c7ba88fafc0c251 (patch) | |
tree | 57ee5ce4ecaaeb13b9abd5612c0dda8a5a97f4e6 /sql/hive/src/test | |
parent | b1e01fd519d4d1bc6d9bd2270f9504d757dbd0d2 (diff) | |
download | spark-671b382a80bc789d50f609783c7ba88fafc0c251.tar.gz spark-671b382a80bc789d50f609783c7ba88fafc0c251.tar.bz2 spark-671b382a80bc789d50f609783c7ba88fafc0c251.zip |
[SPARK-14127][SQL] Makes 'DESC [EXTENDED|FORMATTED] <table>' support data source tables
## What changes were proposed in this pull request?
This is a follow-up of PR #12844. It makes the newly updated `DescribeTableCommand` to support data sources tables.
## How was this patch tested?
A test case is added to check `DESC [EXTENDED | FORMATTED] <table>` output.
Author: Cheng Lian <lian@databricks.com>
Closes #12934 from liancheng/spark-14127-desc-table-follow-up.
Diffstat (limited to 'sql/hive/src/test')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala | 19 |
1 files changed, 18 insertions, 1 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 d55ddb251d..aa5b5e6309 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 @@ -365,7 +365,7 @@ class HiveDDLSuite } } - test("desc table") { + test("desc table for Hive table") { withTable("tab1") { val tabName = "tab1" sql(s"CREATE TABLE $tabName(c1 int)") @@ -503,4 +503,21 @@ class HiveDDLSuite }.getMessage assert(message.contains("Can not drop default database")) } + + test("desc table for data source table") { + withTable("tab1") { + val tabName = "tab1" + sqlContext.range(1).write.format("json").saveAsTable(tabName) + + assert(sql(s"DESC $tabName").collect().length == 1) + + assert( + sql(s"DESC FORMATTED $tabName").collect() + .exists(_.getString(0) == "# Storage Information")) + + assert( + sql(s"DESC EXTENDED $tabName").collect() + .exists(_.getString(0) == "# Detailed Table Information")) + } + } } |