Consider the following table schema, view and 2 queries on the view:
Note that in query 1, with the equality condition on 'ts' the constant value is propagated to the 'mydate = CAST(ts as date)' predicate. This gets applied as a partition predicate. Whereas, in query 2 which has a range predicate, the constant is not propagated and no partition predicate is created for the scan. We should support the second case also for constant propagation. The constant predicates such as >, >=. <. <= and involving date or timestamp literals should be considered ..but we have to analyze the cases where the propagation is valid. E.g with date_add, date_diff type of functions is there a potential for incorrect propagation.
Note that a predicate can be a BETWEEN condition such as:
In this case both need to be applied