carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [1/2] carbondata git commit: added partition column info in describe formatted
Date Mon, 12 Jun 2017 13:55:50 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 3a04ea4c0 -> fe7ef52c4


added partition column info in describe formatted


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/a2ed1eec
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/a2ed1eec
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/a2ed1eec

Branch: refs/heads/master
Commit: a2ed1eeca3fea6e2bc15d3f30efb4802b1bc9c30
Parents: 3a04ea4
Author: kunal642 <kunalkapoor642@gmail.com>
Authored: Tue Jun 6 19:20:57 2017 +0530
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Mon Jun 12 17:56:57 2017 +0530

----------------------------------------------------------------------
 .../testsuite/partition/TestDDLForPartitionTable.scala      | 9 +++++++++
 .../spark/sql/execution/command/carbonTableSchema.scala     | 5 +++++
 .../spark/sql/execution/command/carbonTableSchema.scala     | 5 +++++
 3 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/a2ed1eec/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
index 97798c7..6bd66ad 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
@@ -122,6 +122,14 @@ class TestDDLForPartitionTable  extends QueryTest with BeforeAndAfterAll
{
     intercept[Exception] { sql("alter table test drop columns(c)") }
   }
 
+  test("test describe formatted for partition column") {
+    sql(
+      """create table des(a int, b string) partitioned by (c string) stored by 'carbondata'
+        |tblproperties ('partition_type'='list','list_info'='1,2')""".stripMargin)
+    checkExistence(sql("describe formatted des"),true, "Partition Columns")
+    sql("drop table if exists des")
+  }
+
   override def afterAll = {
     dropTable
   }
@@ -130,6 +138,7 @@ class TestDDLForPartitionTable  extends QueryTest with BeforeAndAfterAll
{
     sql("drop table if exists hashTable")
     sql("drop table if exists rangeTable")
     sql("drop table if exists listTable")
+    sql("drop table if exists test")
   }
 
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/a2ed1eec/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index 226769c..b7bdda9 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -834,6 +834,11 @@ private[sql] case class DescribeCommandFormatted(
     val dimension = carbonTable
       .getDimensionByTableName(relation.tableMeta.carbonTableIdentifier.getTableName)
     results ++= getColumnGroups(dimension.asScala.toList)
+    if (carbonTable.getPartitionInfo(carbonTable.getFactTableName) != null) {
+      results ++=
+      Seq(("Partition Columns: ", carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+        .getColumnSchemaList.asScala.map(_.getColumnName).mkString(","), ""))
+    }
     results.map { case (name, dataType, comment) =>
       Row(f"$name%-36s $dataType%-80s $comment%-72s")
     }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/a2ed1eec/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index c331f4a..beb8610 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -865,6 +865,11 @@ private[sql] case class DescribeCommandFormatted(
     val dimension = carbonTable
       .getDimensionByTableName(relation.tableMeta.carbonTableIdentifier.getTableName)
     results ++= getColumnGroups(dimension.asScala.toList)
+    if (carbonTable.getPartitionInfo(carbonTable.getFactTableName) != null) {
+      results ++=
+      Seq(("Partition Columns: ", carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+        .getColumnSchemaList.asScala.map(_.getColumnName).mkString(","), ""))
+    }
     results.map { case (name, dataType, comment) =>
       Row(f"$name%-36s", f"$dataType%-80s", f"$comment%-72s")
     }


Mime
View raw message