@@ -178,14 +178,18 @@ class SchemaRDD(
178178 def orderBy (sortExprs : SortOrder * ): SchemaRDD =
179179 new SchemaRDD (sqlContext, Sort (sortExprs, logicalPlan))
180180
181+ @ deprecated(" use limit with integer argument" , " 1.1.0" )
182+ def limit (limitExpr : Expression ): SchemaRDD =
183+ new SchemaRDD (sqlContext, Limit (limitExpr, logicalPlan))
184+
181185 /**
182- * Limits the results by the given expressions .
186+ * Limits the results by the given integer .
183187 * {{{
184188 * schemaRDD.limit(10)
185189 * }}}
186190 */
187- def limit (limitExpr : Expression ): SchemaRDD =
188- new SchemaRDD (sqlContext, Limit (limitExpr , logicalPlan))
191+ def limit (limitNum : Int ): SchemaRDD =
192+ new SchemaRDD (sqlContext, Limit (Literal (limitNum) , logicalPlan))
189193
190194 /**
191195 * Performs a grouping followed by an aggregation.
@@ -374,8 +378,7 @@ class SchemaRDD(
374378
375379 override def collect (): Array [Row ] = queryExecution.executedPlan.executeCollect()
376380
377- override def take (num : Int ): Array [Row ] =
378- new SchemaRDD (sqlContext, Limit (Literal (num), logicalPlan)).collect()
381+ override def take (num : Int ): Array [Row ] = limit(num).collect()
379382
380383 // =======================================================================
381384 // Base RDD functions that do NOT change schema
0 commit comments