alamb commented on code in PR #8580:
URL: https://github.com/apache/arrow-datafusion/pull/8580#discussion_r1431764542


##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -186,6 +187,25 @@ async fn test_fn_approx_percentile_cont() -> Result<()> {
 
     assert_batches_eq!(expected, &batches);
 
+    // the arg2 parameter is a complex expr, but it can be evaluated to the 
literal value

Review Comment:
   I think this may be related to aliasing rather than simply complex 
expressions
   
   ```sql
   ❯ create table t (x int) as values (1), (2);
   0 rows in set. Query took 0.001 seconds.
   
   ❯ select APPROX_PERCENTILE_CONT(x,  cast(1 as double)) from t;
   +--------------------------------------+
   | APPROX_PERCENTILE_CONT(t.x,Int64(1)) |
   +--------------------------------------+
   | 2                                    |
   +--------------------------------------+
   1 row in set. Query took 0.002 seconds.
   ```
   
   However, I couldn't express the same alias using SQL. 
   
   I wonder if the expression simplifier code could be generalized to handle 
this case, so it applied to all arguments, not just the arguments to 
`APPROX_PERCENTILE_CONT` 🤔 
   
   



-- 
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]

Reply via email to