Hi folks,
The patch is coming along nicely now. I do have a couple of questions
about the implementation in transformArrayExpr though.
----
1) How should we determine whether the array is multidimensional if we
know the type in advance?
Currently, transformArrayExpr uses the results of its search for a
common element type to figure out whether the array is
multidimensional. If we know the type in advance, we don't need to do
the common type search (a nice side-effect), so we need some other way
of figuring out how to set ArrayExpr->multidims on the new node.
I could just check the nodeTag of the elements as they are
transformed, but I'm concerned that the existing code might be relying
on select_common_type to catch stupid input, like a mixture of scalar
and array elements. If that's the case it might be unwise to bypass
select_common_type or, at least, I'd need to come up with something
else to provide the same level of sanity assurance in both code paths.
----
2) Should the typecast propagate downwards into nested array elements?
If we have a nested array written as, say, ARRAY[ARRAY[1, 2], ARRAY[3,
4], ARRAY[5, 6]]::float[], should we treat the inner arrays the same
way as the outer array (with the advance knowledge that the array type
should be float[])?
If I'm reading the code correctly, the end result should be much the
same, because the inner arrays will end up being coerced to float[]
anyway. But shortcutting the coercion could save some cycles.
Comments?
Regards,
BJ