Github user OopsOutOfMemory commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4127#discussion_r23359441
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/commands.scala ---
    @@ -178,3 +180,34 @@ case class DescribeCommand(
         child.output.map(field => Row(field.name, field.dataType.toString, 
null))
       }
     }
    +
    +/**
    + * :: DeveloperApi ::
    + */
    +@DeveloperApi
    +case class DDLDescribeCommand(
    +    dbName: Option[String],
    +    tableName: String, isExtended: Boolean) extends RunnableCommand {
    +
    +  override def run(sqlContext: SQLContext) = {
    +    val tblRelation = dbName match {
    +      case Some(db) => UnresolvedRelation(Seq(db, tableName))
    +      case None => UnresolvedRelation(Seq(tableName))
    +    }
    +    val logicalRelation = sqlContext.executePlan(tblRelation).analyzed
    +    val rows = new ArrayBuffer[Row]()
    +    rows ++= logicalRelation.schema.fields.map{field =>
    +      Row(field.name, field.dataType.toSimpleString, null)}
    +
    +    /*
    +     * TODO if future support partition table, add header below:
    +     * # Partition Information
    +     * # col_name data_type comment
    --- End diff --
    
    @marmbrus yeah, I understand your concern.
    I refereed hive's describe implementation. 
    We should provide a  `getPartitionedColumns` method in partition table. 
Maybe the partition info description can be done after 
[SPARK-5182](https://issues.apache.org/jira/browse/SPARK-5182). 
    What about just make the PR only do `describe table`. After 
[SPARK-5182](https://issues.apache.org/jira/browse/SPARK-5182) , we can do 
`extended` operation and show partition columns info ? /cc @rxin 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to