diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala index d31a297ca3b71..f481e9f9ff475 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala @@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec( val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields) val outputString = truncatedString(output, "[", ",", "]", maxFields) - s"TakeOrderedAndProject(limit=$limit, offset=$offset, " + + val offsetStr = if (offset > 0) { s" offset=$offset, " } else { "" } + s"TakeOrderedAndProject(limit=$limit, $offsetStr" + s"orderBy=$orderByString, output=$outputString)" }