[ASTERIXDB-2615][*DB] Enable constant folding rule to determine when to fold - user model changes: no - storage format changes: no - interface changes: no
Details: Currently, some functions are excluded from being evaluated at compile time in constant folding rule. Those functions are maintained in a set. The reason for excluding them is because they can produce records/lists in their "open" format and constant folding them will make them "closed" which would lead to incorrect results. Any time a new function is implemented, the developer would have to pay attention and add their functions if they should be excluded, too.
The exclusion set should be removed. The constant folding rule should determine from the output type of the function whether it can/should be folded or not.
- fixed an issue with StaticTypeCastUtil where it would not open up a field when that field's value is a function call. - modified casting items of lists to avoid casting open the item when it is already in the opened up format. - modified the type computer of object_remove_fields to handle constant arguments (the 2nd argument which is the name of the fields) since the argument can be constant folded now. - modified field-access-by-index to handle evaluating it at compile time (by constant folding rule) in the case where the object accessed is missing (or non-object)
[FUN] fix array functions when args have ANY type - user model changes: no - storage format changes: no - interface changes: no
details: This is to fix the array functions that use type inferer in order to infer the types of the arguments at compile time. In some cases, the args could have ANY type at compile time but they return the correct required type at runtime. This patch handles such scenarios.