Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B85D4200B50 for ; Thu, 14 Jul 2016 17:18:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B764B160A60; Thu, 14 Jul 2016 15:18:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0DF23160A63 for ; Thu, 14 Jul 2016 17:18:42 +0200 (CEST) Received: (qmail 2684 invoked by uid 500); 14 Jul 2016 15:18:42 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 2538 invoked by uid 99); 14 Jul 2016 15:18:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 15:18:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A961AE383A; Thu, 14 Jul 2016 15:18:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hvanhovell@apache.org To: commits@spark.apache.org Message-Id: <8c2daa6596f84dc7b0179f39dbe0fdf5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: spark git commit: [SPARK-16543][SQL] Rename the columns of `SHOW PARTITION/COLUMNS` commands Date: Thu, 14 Jul 2016 15:18:41 +0000 (UTC) archived-at: Thu, 14 Jul 2016 15:18:43 -0000 Repository: spark Updated Branches: refs/heads/master 1b5c9e52a -> 56183b84f [SPARK-16543][SQL] Rename the columns of `SHOW PARTITION/COLUMNS` commands ## What changes were proposed in this pull request? This PR changes the name of columns returned by `SHOW PARTITION` and `SHOW COLUMNS` commands. Currently, both commands uses `result` as a column name. **Comparison: Column Name** Command|Spark(Before)|Spark(After)|Hive ----------|--------------|------------|----- SHOW PARTITIONS|result|partition|partition SHOW COLUMNS|result|col_name|field Note that Spark/Hive uses `col_name` in `DESC TABLES`. So, this PR chooses `col_name` for consistency among Spark commands. **Before** ```scala scala> sql("show partitions p").show() +------+ |result| +------+ | b=2| +------+ scala> sql("show columns in p").show() +------+ |result| +------+ | a| | b| +------+ ``` **After** ```scala scala> sql("show partitions p").show +---------+ |partition| +---------+ | b=2| +---------+ scala> sql("show columns in p").show +--------+ |col_name| +--------+ | a| | b| +--------+ ``` ## How was this patch tested? Manual. Author: Dongjoon Hyun Closes #14199 from dongjoon-hyun/SPARK-16543. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/56183b84 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/56183b84 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/56183b84 Branch: refs/heads/master Commit: 56183b84fb64ea13977d89ec55a9dd3997b4dacf Parents: 1b5c9e5 Author: Dongjoon Hyun Authored: Thu Jul 14 17:18:34 2016 +0200 Committer: Herman van Hovell Committed: Thu Jul 14 17:18:34 2016 +0200 ---------------------------------------------------------------------- .../scala/org/apache/spark/sql/execution/command/tables.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/56183b84/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala index 6651c33..6e52a46 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala @@ -622,9 +622,8 @@ case class ShowTablePropertiesCommand(table: TableIdentifier, propertyKey: Optio * }}} */ case class ShowColumnsCommand(table: TableIdentifier) extends RunnableCommand { - // The result of SHOW COLUMNS has one column called 'result' override val output: Seq[Attribute] = { - AttributeReference("result", StringType, nullable = false)() :: Nil + AttributeReference("col_name", StringType, nullable = false)() :: Nil } override def run(sparkSession: SparkSession): Seq[Row] = { @@ -652,9 +651,8 @@ case class ShowColumnsCommand(table: TableIdentifier) extends RunnableCommand { case class ShowPartitionsCommand( table: TableIdentifier, spec: Option[TablePartitionSpec]) extends RunnableCommand { - // The result of SHOW PARTITIONS has one column called 'result' override val output: Seq[Attribute] = { - AttributeReference("result", StringType, nullable = false)() :: Nil + AttributeReference("partition", StringType, nullable = false)() :: Nil } private def getPartName(spec: TablePartitionSpec, partColNames: Seq[String]): String = { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org