Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I propose that we compute predicate constants when we create a RelOptPredicateList, and store them in an immutable field constantMap.
Currently, any rule that wishes to detect constants by aliasing (e.g. if we know x = 5 and x = y then we can deduce y = 5) must start with a RelOptPredicateList (from the metadata supplier) and call the ReduceExpressionsRule.predicateConstants method. This method is called many times: in the current Calcite suite 1,201 instances of RelOptPredicateList are created and predicateConstants is called 82,670 times.
Pre-computing would use a little extra memory but reduce the method calls by ~68x.