Can someone please review https://issues.apache.org/jira/browse/CALCITE-1054? I've made a major change for how we handle null semantics for operators implemented in Enumerable convention. We now do it by transforming the RexNode tree, rather than by carrying around context during code generation about what expressions are known to be not-null.
The effect is that every Java expression that is known to be NOT NULL can can be stored in a primitive type will be stored in a primitive type. So an INTEGER NOT NULL (and for that matter a DATE NOT NULL) will be stored in a primitive int variable. If x is nullable and we evaluate 'WHERE x > 10 AND x < 20' we first check whether x is null, and if so return false, and thereafter use x as a primitive int. Julian
