xinlifoobar commented on issue #11749:
URL: https://github.com/apache/datafusion/issues/11749#issuecomment-2268492991

   I tested it on my machine and even on PostgreSQL the NULL literary is very 
random. I limited the change to min/max while there are better error handling 
in other aggregate functions, e.g., stddev, in datafusion.
   
   ```
   postgres=# select version();
                                           version                              
          
   
---------------------------------------------------------------------------------------
    PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 14.1.1 
20240720, 64-bit
   (1 row)
   
   postgres=# select avg(NULL);
   ERROR:  function avg(unknown) is not unique
   LINE 1: select avg(NULL);
                  ^
   HINT:  Could not choose a best candidate function. You might need to add 
explicit type casts.
   
   postgres=# select bit_and(NULL);
   ERROR:  function bit_and(unknown) is not unique
   LINE 1: select bit_and(NULL);
                  ^
   HINT:  Could not choose a best candidate function. You might need to add 
explicit type casts.
   
   postgres=# select bit_or(NULL);
   ERROR:  function bit_or(unknown) is not unique
   LINE 1: select bit_or(NULL);
                  ^
   HINT:  Could not choose a best candidate function. You might need to add 
explicit type casts.
   
   postgres=# select bool_and(NULL);
    bool_and 
   ----------
    
   (1 row)
   
   
   postgres=# select count(NULL);
    count 
   -------
        0
   (1 row)
   
   
   postgres=# select count(DISTINCT NULL);
    count 
   -------
        0
   (1 row)
   
   
   postgres=# select every(NULL);
    every 
   -------
    
   (1 row)
   
   
   postgres=# select max(NULL);
    max 
   -----
    
   (1 row)
   
   
   postgres=# select min(NULL);
    min 
   -----
    
   (1 row)
   
   
   postgres=# select sum(NULL);
   ERROR:  function sum(unknown) is not unique
   LINE 1: select sum(NULL);
                  ^
   HINT:  Could not choose a best candidate function. You might need to add 
explicit type casts.
   
   postgres=# select stddev(NULL);
    stddev 
   --------
          
   (1 row)
   
   
   postgres=# select corr(NULL, NULL);
    corr 
   ------
        
   (1 row)
   
   
   postgres=# select covar_pop(NULL, NULL);
    covar_pop 
   -----------
             
   (1 row)
   
   
   postgres=# select covar_samp(NULL, NULL);
    covar_samp 
   ------------
              
   (1 row)
   
   
   postgres=# select regr_avgx(NULL, NULL);
    regr_avgx 
   -----------
             
   (1 row)
   
   
   postgres=# select regr_avgy(NULL, NULL);
    regr_avgy 
   -----------
             
   (1 row)
   
   
   postgres=# select regr_count(NULL, NULL);
    regr_count 
   ------------
             0
   (1 row)
   
   
   postgres=# select regr_intercept(NULL, NULL);
    regr_intercept 
   ----------------
                  
   (1 row)
   
   
   postgres=# select regr_r2(NULL, NULL);
    regr_r2 
   ---------
           
   (1 row)
   
   
   postgres=# select regr_slope(NULL, NULL);
    regr_slope 
   ------------
              
   (1 row)
   
   
   postgres=# select regr_sxx(NULL, NULL);
    regr_sxx 
   ----------
            
   (1 row)
   
   
   postgres=# select regr_sxy(NULL, NULL);
    regr_sxy 
   ----------
            
   (1 row)
   
   
   postgres=# select regr_syy(NULL, NULL);
    regr_syy 
   ----------
            
   (1 row)
   
   
   postgres=# select stddev_pop(NULL);
    stddev_pop 
   ------------
              
   (1 row)
   
   
   postgres=# select stddev_samp(NULL);
    stddev_samp 
   -------------
               
   (1 row)
   
   
   postgres=# select variance(NULL);
    variance 
   ----------
            
   (1 row)
   
   
   postgres=# select var_pop(NULL);
    var_pop 
   ---------
           
   (1 row)
   
   
   postgres=# select var_samp(NULL);
    var_samp 
   ----------
            
   (1 row)
   
   
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to