alamb commented on PR #8447:
URL: 
https://github.com/apache/arrow-datafusion/pull/8447#issuecomment-1850294075

   > For example, this test 
https://github.com/apache/arrow-datafusion/blob/main/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L1533-L1549
   will never pass now, because it uses the now function, that uses call_fn 
which doesn't get resolved if they analyzer is not applied
   
   
   
   I think these tests will need to be updated to resolve the expressions 
`"now"` to the actual `now()` function
   
   However, I think this brings up a good point about making sure the 
`expr_fn`s can be easily used with the lower level expr api (like 
simplification). 
   
   For any API on the `SessionContext` or `DataFrame`, `expr_fn::now()` and 
related functions will be run through the analyzer.
   
   However, if we create the exprs directly like in `expr_simplifer` (and there 
are some examples) we have to arrange for the expressions to be resolved.
   
   Maybe we could add a function like `Expr::resolve` to do this more easily?
   
   So it could be used like
   
   ```rust
   let expr = now()
     .cast(DataType::Integer) // cast now to integer
     .resolve() // recursively resolve all functions calls, like `now()` into 
actual function referenes
   ```
   
   🤔 
   
   I can try and sketch up something like this later today if you want?


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