datafusion
datafusion copied to clipboard
Add interface to determine whether expr is a constant
for datafusion, we need to add interface which is used to identify the expr is constant or literal or not.
If we have this interface, we can make more optimization.
But the interface should be better in the logical expr not in the physical expr like sprak fold
Originally posted by @liukun4515 in https://github.com/apache/arrow-datafusion/pull/2834#discussion_r913453698
this feature can be used to do some optimization in plan optimizer or expression folding
In my mind, if we we always ran 'constant folding' on an Expr
then checking for a constant should be a matter of calling matches!(expr, Expr::Literal)
In other words, I had hoped that the constant folding
pass was a general purpose mechanism to detect constants
In my mind, if we we always ran 'constant folding' on an
Expr
then checking for a constant should be a matter of callingmatches!(expr, Expr::Literal)
In other words, I had hoped that the
constant folding
pass was a general purpose mechanism to detect constants
I go through the code about optimizer and simplify expr, and find some codes about constant folding. I will take more time to look this carefully and give my feedback.