Remove this change please, as it should not be necessary. See my comment on your new ScalarFunction for getting an array element. The returned data type from that should not be an array, it should be the element type of the array.