Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnionListWriter#startList points the inner writer at the wrong position #585

Closed
nbauernfeind opened this issue Feb 4, 2025 · 2 comments
Closed
Labels
Type: bug Something isn't working

Comments

@nbauernfeind
Copy link
Contributor

nbauernfeind commented Feb 4, 2025

UnionListWriter's impl:

  @Override
  public void startList() {
    vector.startNewValue(idx());
    writer.setPosition(vector.getOffsetBuffer().getInt((idx() + 1L) * OFFSET_WIDTH));
    listStarted = true;
  }

Whereas UnionLargeListViewWriter:

  @Override
  public void startList() {
    vector.startNewValue(idx());
    writer.setPosition(vector.getOffsetBuffer().getInt((idx()) * OFFSET_WIDTH));
    listStarted = true;
  }

Note that the issue is that UnionListWriter fetches the offset of idx() + 1 -- not the offset of idx() like the Large impl.

Also note that startNewValue returns the position that the writer can be set to; we don't need to poke into the offset buffer.

@nbauernfeind nbauernfeind added the Type: bug Something isn't working label Feb 4, 2025
@nbauernfeind
Copy link
Contributor Author

Possibly this is the cause of #296.

@nbauernfeind
Copy link
Contributor Author

Nevermind. While using the returned value from startNewValue is more appropriate, when you start a new value the end offset is initialized to the start offset. While a little confusing, this does not seem to be the issue I'm running into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant