File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -279,9 +279,15 @@ class Analyzer(
279279     *  We need to get all of its subsets for a given GROUPBY expression, the subsets are 
280280     *  represented as sequence of expressions. 
281281     */  
282-     def  cubeExprs (exprs : Seq [Expression ]):  Seq [Seq [Expression ]] =  exprs.toList match  {
282+     def  cubeExprs (exprs : Seq [Expression ]):  Seq [Seq [Expression ]] =  {
283+       //  `cubeExprs0` is recursive and returns a lazy Stream. Here we call `toIndexedSeq` to
284+       //  materialize it and avoid serialization problems later on.
285+       cubeExprs0(exprs).toIndexedSeq
286+     }
287+ 
288+     def  cubeExprs0 (exprs : Seq [Expression ]):  Seq [Seq [Expression ]] =  exprs.toList match  {
283289      case  x ::  xs => 
284-         val  initial  =  cubeExprs (xs)
290+         val  initial  =  cubeExprs0 (xs)
285291        initial.map(x +:  _) ++  initial
286292      case  Nil  => 
287293        Seq (Seq .empty)
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments