Fix write queries using sm.var_offsets.extra_element=true. #5033
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Story details: https://app.shortcut.com/tiledb-inc/story/48614
The write query uses
coords_info_.coords_num_
as a stand-in for the number of cells in the write query input. This value is computed as*buffer_offsets_size / constants::cell_var_offset_size
, which makes sense for the traditional tiledb input where the number of offsets is the same as the number of cells.The configuration
sm.var_offsets.extra_element
, however, breaks that assumption. This option is useful for arrow compatibility but also simplifies upstream code - we want to use it intiledb-rs
, for example. When this option is used,coords_num_
must be adjusted accordingly. Previously it was not, and now it is.The added unit test demonstrates that if
num_coords_
is not adjusted, then the unordered writer finds an extra "empty" element at the end. This results in a duplicate coordinate if there is an actual empty element.In addition to the unit test, the branch trying to use this feature in
tiledb-rs
passes its property-based testing when linking against this branch of core.TYPE: BUG
DESC: Fix write queries using
sm.var_offsets.extra_element=true