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

    https://github.com/apache/spark/pull/11431#discussion_r54792050
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -101,19 +105,62 @@ class Dataset[T] private[sql](
        * Prints the schema of the underlying [[Dataset]] to the console in a 
nice tree format.
        * @since 1.6.0
        */
    -  override def printSchema(): Unit = toDF().printSchema()
    +  // scalastyle:off println
    +  override def printSchema(): Unit = println(schema.treeString)
    +  // scalastyle:on println
     
       /**
        * Prints the plans (logical and physical) to the console for debugging 
purposes.
        * @since 1.6.0
        */
    -  override def explain(extended: Boolean): Unit = toDF().explain(extended)
    +  override def explain(extended: Boolean): Unit = {
    +    val explain = ExplainCommand(queryExecution.logical, extended = 
extended)
    +    sqlContext.executePlan(explain).executedPlan.executeCollect().foreach {
    +      // scalastyle:off println
    +      r => println(r.getString(0))
    +      // scalastyle:on println
    +    }
    +  }
     
       /**
        * Prints the physical plan to the console for debugging purposes.
        * @since 1.6.0
        */
    -  override def explain(): Unit = toDF().explain()
    +  override def explain(): Unit = explain(extended = false)
    +
    +  /**
    +   * Returns all column names and their data types as an array.
    +   * @since 2.0.0
    --- End diff --
    
    Yea I'd just have it as 2.0.



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to