hey @Ravi Teja there is two methods by which we can limit our datafame , by using take and limit .
refer this concept
myDataFrame.take(10)
-> results in an Array of Rows. This is an action and performs collecting the data (like collect does).
myDataFrame.limit(10)
-> results in a new Dataframe. This is a transformation and does not perform collecting the data.
Rishabh Pandey