Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
In case in an AND expression a null constant appears earlier than a nullable boolean; the return type is set to NULL instead of boolean.
The problem can be reproduced; however I'm not sure if it would happen naturally or not - I've discovered it during enhancing case simplification.
@Test
public void testUsageOfConstantNull() {
RexLiteral constantNull = rexBuilder.constantNull();
RexNode node1 = or(constantNull, vBool());
assertThat(node1.getType(), is(vBool().getType()));
RexNode node2 = or(vBoolNotNull(), constantNull);
assertThat(node2.getType(), is(vBool().getType()));
RexNode node3 = or(constantNull, constantNull);
assertThat(node3.getType(), is(constantNull.getType()));
}