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

    https://github.com/apache/spark/pull/19363#discussion_r143904084
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala ---
    @@ -564,4 +565,30 @@ class KeyValueGroupedDataset[K, V] private[sql](
           encoder: Encoder[R]): Dataset[R] = {
         cogroup(other)((key, left, right) => f.call(key, left.asJava, 
right.asJava).asScala)(encoder)
       }
    +
    +  override def toString: String = {
    +    try {
    +      val builder = new StringBuilder
    +      val kFields = kExprEnc.schema.map {
    +        case f => s"${f.name}: ${f.dataType.simpleString(2)}"
    +      }
    +      val vFields = vExprEnc.schema.map {
    +        case f => s"${f.name}: ${f.dataType.simpleString(2)}"
    +      }
    +      builder.append("[key: [")
    +      builder.append(kFields.take(2).mkString(", "))
    +      if (kFields.length > 2) {
    +        builder.append(" ... " + (kFields.length - 2) + " more field(s)")
    +      }
    +      builder.append("], value: [")
    +      builder.append(vFields.take(2).mkString(", "))
    +      if (vFields.length > 2) {
    +        builder.append(" ... " + (vFields.length - 2) + " more field(s)")
    +      }
    +      builder.append("]]").toString()
    +    } catch {
    +      case NonFatal(e) =>
    --- End diff --
    
    I once thought you would answer that for me 
https://github.com/apache/spark/blame/master/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala#L374,
 LOL


---

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

Reply via email to