Hi devs,

I opened a ticket CALCITE-5948[1] to solved the questions below.

If we call elements cast in array or map functions such as `array(1, cast(2
as tinyint))` or `map[1, 1, 2, cast(2 as smallint)]` it will be success in
validation but failed in runtime with exception. Actually we need a
explicit casting if the type of an element in ARRAY/MAP not equals with the
derived component type.

currently some other issues such as CALCITE-4850[2] also indicate this bug
from a concrete case. We should fix this because not only the array
function is wrong and also it affects all other array functions.

BTW, In the process of solving this issue, I found another issue
CALCITE-5960[3] which is related with this. I have fixed it in one PR.
Becasuse they are related and can be covered by CALCITE-5948 test cases.

If someone has time, please help me to review this PR. thanks.

The PR link: https://github.com/apache/calcite/pull/3395

[1] https://issues.apache.org/jira/browse/CALCITE-5948
[2] https://issues.apache.org/jira/browse/CALCITE-4850
[3] https://issues.apache.org/jira/browse/CALCITE-5960


Best Regards,
Ran Tao
https://github.com/chucheng92

Reply via email to