Skip to content

Conversation

@liamzwbao
Copy link
Contributor

Which issue does this PR close?

  • Closes #NNN.

Rationale for this change

What changes are included in this PR?

Fix the minor errors in the ListArray doc. slice(1, 3) should get value(3) = Null and value(4) = D, so the value(5) is unused

Are these changes tested?

Docs only

Are there any user-facing changes?

No

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 7, 2025
@liamzwbao liamzwbao marked this pull request as ready for review November 7, 2025 00:02
@alamb
Copy link
Contributor

alamb commented Nov 9, 2025

Fix the minor errors in the ListArray doc. slice(1, 3) should get value(3) = Null and value(4) = D, so the value(5) is unused

I think the diagram is actually correct -- the nullability of the ListArray is defined by its own null mask (not the null mask of the child)

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @liamzwbao -- I took another look and I agree the changes on line 156 are great.

I think the change on line R117 should be reverted

Thanks again for the find and sticking with this PR

Comment on lines 110 to 127
/// ┌─────────────┐ ┌───────┐ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐
/// │ [A,B,C] │ │ (0,3) │ │ 1 │ │ 0 │ │ │ 1 │ │ A │ │ 0 │
/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤
/// │ [] │ │ (3,3) │ │ 1 │ │ 3 │ │ │ 1 │ │ B │ │ 1 │
/// │ [] (empty) │ │ (3,3) │ │ 1 │ │ 3 │ │ │ 1 │ │ B │ │ 1 │
/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤
/// │ NULL │ │ (3,4) │ │ 0 │ │ 3 │ │ │ 1 │ │ C │ │ 2 │
/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤
/// │ [D] │ │ (4,5) │ │ 1 │ │ 4 │ │ │ ? │ │ ? │ │ 3 │
/// ├─────────────┤ ├───────┤ │ ├───┤ ├───┤ ├───┤ ├───┤
/// │ [NULL, F] │ │ (5,7) │ │ 1 │ │ 5 │ │ │ 1 │ │ D │ │ 4 │
/// └─────────────┘ └───────┘ │ └───┘ ├───┤ ├───┤ ├───┤
/// │ 7 │ │ │ 0 │ │ ? │ │ 5 │
/// │ Validity └───┘ ├───┤ ├───┤
/// Logical Logical (nulls) Offsets │ │ 1 │ │ F │ │ 6 │
/// Values Offsets │ └───┘ └───┘
/// │ Values │ │
/// (offsets[i], │ ListArray (Array)
/// offsets[i+1]) └ ─ ─ ─ ─ ─ ─ ┘ │
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @alamb, while taking a look at generic_list_builder, I noticed that we shouldn't increment offset for NULL as the top level element. so the logic offsets should be [[0, 3], [3, 3], [3, 3], [3, 4], [4, 6]] and the values offsets should be [0, 3, 3, 3, 4, 6], is that right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nd the values offsets should be [0, 3, 3, 3, 4, 6], is that right?

Yes that sounds right

Isn't that what this line says:

 &[0, 3, 3, 3, 4, 6]

Maybe I don't understand your question

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the example in generic_list_builder is correct but the example here in list_array is wrong. So we need to change the doc here, let me update the PR to make it clear

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see -- you are saying that we don't have to have an element in the underlying values array for a null list in the parent. I think either is fine, but your change here is probably clearer.

Thank you

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @liamzwbao -- this looks great to me now

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @liamzwbao -- this looks great to me now

@alamb alamb merged commit 5133cb9 into apache:main Nov 14, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants