[CALCITE-547] Set nullability while inferring return type of item(any,...) operator

Close apache/incubator-calcite#37
When registering a RelNode, be tolerant if it is equivalent to a RelNode with different traits
Fix code style
[CALCITE-545] When a projected expression can only have one value, replace with that constant

Fix conversion of Character to char in generated Java code.