Hi,
Does anyone know why optiq does not perform constant reduction at rex level?
I noticed if (false) code in OptiqPrepareImpl:
// Change the below to enable constant-reduction.
if (false) {
planner.addRule(ReduceExpressionsRule.PROJECT_INSTANCE);
planner.addRule(ReduceExpressionsRule.FILTER_INSTANCE);
planner.addRule(ReduceExpressionsRule.CALC_INSTANCE);
planner.addRule(ReduceExpressionsRule.JOIN_INSTANCE);
planner.addRule(ReduceValuesRule.FILTER_INSTANCE);
planner.addRule(ReduceValuesRule.PROJECT_FILTER_INSTANCE);
planner.addRule(ReduceValuesRule.PROJECT_INSTANCE);
}
It looks like those rules might help optimizing where 1=2 to empty relation eliminating the enumerator(), next(), etc.
From my non-optiq experience, those kind of conditions often arise from "generic queries".
Vladimir