Repository navigation
avoid quadratic positional access over linked-list column lists - #2860
Merged
manticore-projects merged 1 commit intoOct 27, 2026
Merged
manticore-projects merged 1 commit into
manticore-projects merged 1 commit into
Conversation
Contributor
|
Thank you! |
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.
Select.appendStringListTobuilds a comma-separated list by reading its argument positionally withlist.get(i).Joinstores itsUSINGcolumns in aLinkedList, so deparsingSELECT ... JOIN ... USING (c0, ..., cN)throughJoin.toStringis O(N^2), and theUSINGcolumn list has no bound in the grammar. Parsing a 200k-column clause and then callingStatement.toStringdoes not finish within 5 s here, against about 55 ms after the change, and the parser timeout does not cover deparsing.ConnectExpressionsVisitorhas the same shape: it connects the select items it collected into aLinkedListby indexing them withget(i)in a loop, so joining a select with many items is quadratic too. Both now walk the list once with an iterator instead of by index; the deparsed text and the built expression tree are unchanged. I added regression tests over 200k elements under a 5 s preemptive timeout, which hang before the change and pass after.