Describe the bug
cardinality() returns incorrect results for ragged nested arrays.
For nested arrays, cardinality() should count the total number of leaf elements. However, the current implementation computes array dimensions using the first child array and then multiplies those dimensions. This works for rectangular nested arrays, but gives incorrect results for ragged nested arrays.
To Reproduce
SELECT cardinality([[1], [2, 3]]);
Current result:
2
Expected result:
3
Expected behavior
No response
Additional context
No response
Describe the bug
cardinality()returns incorrect results for ragged nested arrays.For nested arrays,
cardinality()should count the total number of leaf elements. However, the current implementation computes array dimensions using the first child array and then multiplies those dimensions. This works for rectangular nested arrays, but gives incorrect results for ragged nested arrays.To Reproduce
Current result:
2
Expected result:
3
Expected behavior
No response
Additional context
No response