calcite icon indicating copy to clipboard operation
calcite copied to clipboard

[CALCITE-3332] Query failed with AssertionError: cannot cast null as class java.math.BigDecima

Open DonnyZone opened this issue 5 years ago • 3 comments

Calcite runtime can process null semantic. However, the null literal is not properly handled when figuring out SqlMonotonicity, as demonstrated in CALCITE-3332.

DonnyZone avatar Sep 10 '19 04:09 DonnyZone

In current code of SqlOperatorBinding#isOperandNull, the doc for param of allowCast is like below

* @param allowCast whether to regard CAST(constant) as a constant

Shall we update it and update 'constant' with 'null' in this PR ? That will be more clear. I'm not sure if this PR could include such change.

jinxing64 avatar Sep 10 '19 09:09 jinxing64

Thanks for your fix @DonnyZone and it's good for me overall ~ I left minor comments and you can check if they are valid.

jinxing64 avatar Sep 10 '19 09:09 jinxing64

According to the current semantics in SqlUtil#isNullLiteral, we can replace the word "constant" with "null" here.

DonnyZone avatar Sep 10 '19 10:09 DonnyZone