File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed 
sql/core/src/main/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -63,12 +63,14 @@ case class Union(children: Seq[SparkPlan])(@transient sc: SparkContext) extends
6363}
6464
6565/** 
66-  * Take the first limit elements. 
66+  * Take the first limit elements. Note that the implementation is different depending on whether 
67+  * this is a terminal operator or not. If it is terminal and is invoked using executeCollect, 
68+  * this operator uses Spark's take method on the Spark driver. If it is not terminal or is 
69+  * invoked using execute, we first take the limit on each partition, and then repartition all the 
70+  * data to a single partition to compute the global limit. 
6771 */  
6872case  class  Limit (limit : Int , child : SparkPlan )(@ transient sc : SparkContext ) extends  UnaryNode  {
6973  override  def  otherCopyArgs  =  sc ::  Nil 
70-   //  Note that the implementation is different depending on
71-   //  whether this is a terminal operator or not.
7274
7375  override  def  output  =  child.output
7476
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments