Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.18.0
-
None
-
Using Apache Beam 1ad4affb450809842670df0434e12d953af31e166. (See
BEAM-6401).Does not reproduce on Calcite 064974d543874e47a9da8ea0595824dde398bee1.
Does reproduce on Calcite b470a0cd4572c9f6c4c0e9b51926b97c5af58d3f, 1.18, and master@62b47aeeb7eeb59beaf5b8f3b54a5c58ba4ca76d.
(This is introduced by
CALCITE-1413)Using Apache Beam 1ad4affb450809842670df0434e12d953af31e166. (See BEAM-6401 ). Does not reproduce on Calcite 064974d543874e47a9da8ea0595824dde398bee1. Does reproduce on Calcite b470a0cd4572c9f6c4c0e9b51926b97c5af58d3f, 1.18, and master@62b47aeeb7eeb59beaf5b8f3b54a5c58ba4ca76d. (This is introduced by CALCITE-1413 )
Description
This first appears in 1.18, and is introduced by CALCITE-1413.
I have a table "table" with column "f0" of nullable booleans. Table contains the following values:
true false null
Working query:
SELECT coalesce(f0, true) FROM table; true false true
Broken query:
SELECT coalesce(f0, true) = true FROM table; Caused by: java.lang.NullPointerException at org.apache.calcite.runtime.SqlFunctions.cannotConvert(SqlFunctions.java:1457) at org.apache.calcite.runtime.SqlFunctions.toBoolean(SqlFunctions.java:1480) at SC.eval0(Unknown Source)
Broken generated code:
{ final Boolean inp0_ = ((Row) c.element()).getBoolean(0); c.output(Row.withSchema(outputSchema).addValue((SqlFunctions.isTrue(inp0_) || inp0_ == null ? Boolean.TRUE : inp0_ == null ? (Boolean) null : Boolean.FALSE) == null ? (Boolean) null : Boolean.valueOf(SqlFunctions.toBoolean(inp0_) || inp0_ == null)).build()); }