Skip to content

Commit e3dd03f

Browse files
author
akhilthatipamula
committed
Modified showString() method
1 parent a21012b commit e3dd03f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ class DataFrame private[sql](
230230

231231
sb.append(sep)
232232

233-
// For Data that has more than 20 records.
234-
if (this.count() > 20) sb.append("only showing the top 20 rows\n")
233+
// For Data that has more than N(numRows) records.
234+
if (take(numRows + 1).length > numRows) {
235+
sb.append("only showing the top " + numRows.toString + " rows\n")
236+
}
235237

236238
sb.toString()
237239
}
@@ -362,7 +364,7 @@ class DataFrame private[sql](
362364

363365
/**
364366
* Returns a [[DataFrameNaFunctions]] for working with missing data.
365-
* {{{
367+
* {{{
366368
* // Dropping rows containing any null values.
367369
* df.na.drop()
368370
* }}}

0 commit comments

Comments
 (0)