Skip to content

Give each run of an alasql.compile() statement its own copy while another run is still going - #2747

Merged
mathiasrw merged 1 commit into
developfrom
fix/2596
Oct 21, 2026
Merged

mathiasrw merged 1 commit into
developfrom
fix/2596

Conversation

@mathiasrw

Copy link
Copy Markdown
Member

Part of #2596.

#2465 gave each overlapping run of a cached statement its own copy, inside alasql.dexec. Statements kept from alasql.compile() do not go through dexec, so they still shared one compiled object between runs:

Case, with a statement from alasql.compile() develop With this PR
Two runs at once with an asynchronous source the first never settles both settle
The same through statement.promise() the first never settles both settle
A user function that runs the same statement again wrong result, no error right result

The statement function that alasql.compile() returns now runs through the same runStatement as dexec: while a run is still going, a new call compiles its own copy; otherwise it uses the compiled statement as before.

Test: test/test2596.js (the three cases above fail on develop, plus one case for runs one after the other). Full suite green.

What is left of #2596 is structural (one state object per run instead of a copy when runs overlap) and is planned with #2724.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant