Repository navigation
Read IN and NOT IN subqueries of a WHILE condition in every round to close #3200 - #3210
Open
zzoraemon043 wants to merge 1 commit into
Open
zzoraemon043 wants to merge 1 commit into
zzoraemon043 wants to merge 1 commit into
Conversation
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.
Thank you for the time you are putting into AlaSQL!
Closes #3200
alasql.precompilegives the WHILE one run context, and the condition is evaluated with it in every round. The IN and NOT IN lookup keeps the subquery result inthis.ctx.caches, so the first round's result was used for the whole loop.Each round now evaluates the condition with a run context of its own, on an object made with
Object.createfrom the WHILE, sothis.queriesfnis read as before and nothing is written to the statement.Before the fix / after:
WHILE 1 IN (SELECT x FROM w) BEGIN DELETE FROM w WHERE x = 1; ... IF @n > 5 BREAK; ENDgives@n = 6/1WHILE 1 NOT IN (SELECT x FROM w) BEGIN INSERT INTO w VALUES (1); ... ENDgives6/1alasql.promise(the asynchronous loop) gives6/1test/test3200.jscovers IN, NOT IN, a row deleted in each round, and the asynchronous loop. All 4 fail before the change and pass after it. The full suite has no new failures (test107-B and test2149 fail the same way on main on Windows).