cloud-fan commented on code in PR #52173: URL: https://github.com/apache/spark/pull/52173#discussion_r2338939290
########## sql/core/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/CommandResult.scala: ########## @@ -40,4 +40,23 @@ case class CommandResult( override def computeStats(): Statistics = Statistics(sizeInBytes = EstimationUtils.getSizePerRow(output) * rows.length) + + override def simpleString(maxFields: Int): String = { + val outputStr = output.map(_.name).mkString("[", ", ", "]") + val dataStr = if (rows.nonEmpty) { + val formattedRows = rows.take(maxFields).map { row => + output.zipWithIndex.map { case (attr, i) => + val value = row.get(i, attr.dataType) + if (value == null) "null" else value.toString + }.mkString("[", ", ", "]") + } + s", data=[${formattedRows.mkString(", ")}]" + } else { + "" + } + s"CommandResult $outputStr$dataStr" + } + + // Don't override toString - let the default TreeNode.toString handle tree structure Review Comment: most logical plans do not override `toString`, do we really need this comment here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org