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

    https://github.com/apache/spark/pull/13070#discussion_r65655636
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
    @@ -140,6 +170,32 @@ case class CatalogTable(
           locationUri, inputFormat, outputFormat, serde, compressed, 
serdeProperties))
       }
     
    +  override def toString: String = {
    +    val tableProperties = properties.map(p => p._1 + "=" + 
p._2).mkString("[", ", ", "]")
    +    val partitionColumns = partitionColumnNames.map("`" + _ + 
"`").mkString("[", ", ", "]")
    +    val sortColumns = sortColumnNames.map("`" + _ + "`").mkString("[", ", 
", "]")
    +    val bucketColumns = bucketColumnNames.map("`" + _ + "`").mkString("[", 
", ", "]")
    +
    +    val output =
    +      Seq(s"Table:${identifier.quotedString}",
    +        if (owner.nonEmpty) s"Owner:$owner" else "",
    +        s"Created:${new Date(createTime).toString}",
    +        s"Last Access:${new Date(lastAccessTime).toString}",
    +        s"Type:${tableType.name}",
    +        if (schema.nonEmpty) s"Schema:${schema.mkString("[", ", ", "]")}" 
else "",
    +        if (partitionColumnNames.nonEmpty) s"Partition 
Columns:$partitionColumns" else "",
    +        if (numBuckets != -1) s"Num Buckets:$numBuckets" else "",
    +        if (bucketColumnNames.nonEmpty) s"Bucket Columns:$bucketColumns" 
else "",
    +        if (sortColumnNames.nonEmpty) s"Sort Columns:$sortColumns" else "",
    +        viewOriginalText.map("Original View:" + _).getOrElse(""),
    +        viewText.map("View:" + _).getOrElse(""),
    +        comment.map("Comment:" + _).getOrElse(""),
    +        if (properties.nonEmpty) s"Properties:$tableProperties" else "",
    +        s"$storage")
    +
    +    output.filter(_.nonEmpty).mkString("CatalogTable(", ", ", ")")
    --- End diff --
    
    Since we are using `, ` as a separator, the output of EXPLAIN is like:
    ```
    CreateTableCommand CatalogTable(Table:`extTable_with_partitions`, 
Created:Thu Jun 02 21:25:26 PDT 2016, Last Access:Wed Dec 31 15:59:59 PST 1969, 
Type:EXTERNAL, Schema:[`key` int, `value` string, `ds` string, `hr` string], 
Partition Columns:[`ds`, `hr`], 
Storage(Location:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-472564ea-a321-447b-8224-7790edf454ab,
 InputFormat:org.apache.hadoop.mapred.TextInputFormat, 
OutputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat)), false
    ```
    
    If we change it to `\n`, it will be like
    ```
    CreateTableCommand CatalogTable(Table:`extTable_with_partitions`
    Created:Thu Jun 02 21:28:32 PDT 2016
    Last Access:Wed Dec 31 15:59:59 PST 1969
    Type:EXTERNAL
    Schema:[`key` int, `value` string, `ds` string, `hr` string]
    Partition Columns:[`ds`, `hr`]
    
Storage(Location:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-a8e78990-3d9c-4f83-9ec4-6121473c1d09,
 InputFormat:org.apache.hadoop.mapred.TextInputFormat, 
OutputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat)), false
    ```
    
    Another option is to use `\n\t` in `mkString` (i.e., 
`mkString("CatalogTable(\n\t", "\n\t", ")")`). Then, it will become 
    ```
    CreateTableCommand CatalogTable(
        Table:`extTable_with_partitions`
        Created:Thu Jun 02 21:30:54 PDT 2016
        Last Access:Wed Dec 31 15:59:59 PST 1969
        Type:EXTERNAL
        Schema:[`key` int, `value` string, `ds` string, `hr` string]
        Partition Columns:[`ds`, `hr`]
        
Storage(Location:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-a06083b8-8e88-4d07-9ff0-d6bd8d943ad3,
 InputFormat:org.apache.hadoop.mapred.TextInputFormat, 
OutputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat)), false
    ```


---
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