I see there is issue https://issues.apache.org/jira/browse/CALCITE-3796 still
open, about allowing comparisons on arrays.
I have a related question: today the validator seems to accept comparisons
between any kinds of arrays.
For example, the validator rejects this comparison (taken from
SqlValidatorTest):
expr("^x'a4'=1^")
.fails("(?s).*Cannot apply '=' to arguments of type '<BINARY.1.> =
<INTEGER>'.*");
But happily accepts this comparison:
expr("array[x'e4'] <> array[1]")
.ok();
This seems to me somewhat inconsistent. I think the validator should either
1.
Require array element types to be identical for comparisons
2.
At least require element types to be comparable
I was trying to give a solution to
https://issues.apache.org/jira/browse/CALCITE-6735 Type coercion for
comparisons does not coerce generic types (ROW, ARRAY, etc), but I actually
don't know what the solution should be for arrays (and maps, multisets, etc)
given this state of affairs for the validator.
Mihai