Repository navigation
perf(storage): project requested columns before taking rows - #920
Open
egolearner wants to merge 2 commits into
Open
egolearner wants to merge 2 commits into
egolearner wants to merge 2 commits into
Conversation
Arrow can concatenate chunks while taking rows from a table. Select the requested columns first so primary-key fetches skip large text columns while the query holds the collection read lock.
Return an Invalid status with the column name when the Arrow table cannot resolve a requested field. Cover a projection that previously succeeded with only a subset of its requested columns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why project before taking rows?
A ranked query that returns only primary keys and scores needs just the primary key from the forward store. Previously,
MemForwardStoreran Arrow'sTakeon the full table and selected the output columns afterward. When hits span record batches,Takecan concatenate chunks and copy large text values that the query will discard. This work runs while the query holds the collection read lock and can make a writer wait longer.Select the requested columns first, then pass the original row indices to
Take. This preserves hit order and duplicate hits. If the Arrow table has no unique match for a requested physical column, projection returns anInvalidstatus naming the column before taking any rows.Measured allocations
The regression test fetches only primary keys for row indices
[1, 0, 0]. Row 0 is in a stored batch and contains a 256 KiB text value. Row 1 is still pending. The test measures the change in Arrow's cumulative allocated-byte counter around a singlefetchcall on macOS arm64.8d978b0)Regression results
Invalidstatus containing the missing column's name.