Hello,
It seems that the array item operator (a[x]) always returns a nullable result,
irrespective of the nullability of the elements of the array, or of the index.
Is this a bug, or is this by design?
It looks like the standard array item operator throws for out of bound
accesses, so why not respect the nullability of the array element type?
class SqlItemOperator {
@Override public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
final RelDataType operandType = opBinding.getOperandType(0);
switch (operandType.getSqlTypeName()) {
case ARRAY:
return typeFactory.createTypeWithNullability(
getComponentTypeOrThrow(operandType), true); // << always TRUE
Thank you,
Mihai