File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed 
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -304,13 +304,25 @@ private static TestCaseSupplier makeSupplier(
304304                .limit (limit )
305305                .toList ();
306306
307+             String  baseName ;
308+             if  (limit  != 1 ) {
309+                 baseName  = "Top" ;
310+             } else  {
311+                 // If the limit is 1 we rewrite TOP into MIN or MAX and never run our lovely TOP code. 
312+                 if  (order .equals ("asc" )) {
313+                     baseName  = "Min" ;
314+                 } else  {
315+                     baseName  = "Max" ;
316+                 }
317+             }
318+ 
307319            return  new  TestCaseSupplier .TestCase (
308320                List .of (
309321                    fieldTypedData ,
310322                    limitTypedData ,
311323                    new  TestCaseSupplier .TypedData (new  BytesRef (order ), DataType .KEYWORD , order  + " order" ).forceLiteral ()
312324                ),
313-                 standardAggregatorName ("Top" , fieldTypedData .type ()),
325+                 standardAggregatorName (baseName , fieldTypedData .type ()),
314326                fieldSupplier .type (),
315327                equalTo (expected .size () == 1  ? expected .get (0 ) : expected )
316328            );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments