Skip to content

fix(backport): count ragged array cardinality correctly - #14

Open
discord9 wants to merge 1 commit into
GreptimeTeam:greptimedb-53.1.0-function-signature-exec-errorfrom
discord9:fix/qp-022-ragged-cardinality
Open

fix(backport): count ragged array cardinality correctly#14
discord9 wants to merge 1 commit into
GreptimeTeam:greptimedb-53.1.0-function-signature-exec-errorfrom
discord9:fix/qp-022-ragged-cardinality

Conversation

@discord9

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

cardinality inferred rectangular dimensions and multiplied them, producing wrong results for ragged nested arrays. For example, the three regression witnesses returned 2, 6, 0 instead of 3, 3, 2.

What changes are included in this PR?

  • Recursively count actual leaf elements in nested list representations.
  • Treat null nested lists as contributing zero while preserving null leaf slots as elements.
  • Return a controlled error if the u64 total overflows.
  • Add focused ragged, nested representation, and null-semantics regression coverage.

Are these changes tested?

  • cargo fmt --all -- --check
  • cargo test -p datafusion-functions-nested --lib
  • cargo test -p datafusion-sqllogictest --test sqllogictests -- array.slt:5393
  • git diff --check

Are there any user-facing changes?

Yes. cardinality now returns the correct number of leaf elements for ragged nested arrays. There are no API or signature changes.

Signed-off-by: discord9 <discord9@163.com>
@discord9 discord9 changed the title fix: count ragged array cardinality correctly fix(backport): count ragged array cardinality correctly Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant