Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESQL: Pages and blocks being closed #100001

Closed
costin opened this issue Sep 28, 2023 · 3 comments
Closed

ESQL: Pages and blocks being closed #100001

costin opened this issue Sep 28, 2023 · 3 comments
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:QL (Deprecated) Meta label for query languages team

Comments

@costin
Copy link
Member

costin commented Sep 28, 2023

Description

Currently a Page can contain the same block multiple times when a column is repeated { a, a }.
Internally the same block is used in both position 0 and 1 so the data is not duplicated yet when eliminating a position (e.g. projection) the block get released which invalidates all the other positions where it is being used.

Furthermore the Page cannot be closed since it expects all blocks to be available yet there's no defensive mechanism against that - if a block was somehow externally closed (inside an operator) the page release blocks asserts out when closing.

Two ideas on this front:

  • a Page could hold references to the block it uses ; it can thus release a block only when certain it's not used elsewhere
  • modifying the blocks inside a Page requires creating a new Page instance since the old one is already invalid and cannot close its blocks anymore.

Relates #99982

@elasticsearchmachine elasticsearchmachine added the Team:QL (Deprecated) Meta label for query languages team label Sep 28, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL)

costin added a commit to costin/elasticsearch that referenced this issue Oct 5, 2023
Page now takes into account that a block can be used in multiple
 positions (such as the same column aliased under multiple names).

Relates elastic#100001
Fix elastic#100365
Fix elastic#100356
costin added a commit that referenced this issue Oct 6, 2023
Page now takes into account that a block can be used in multiple
 positions (such as the same column aliased under multiple names).
Introduce newPageAndRelease method that handles clean-up of blocks that
 are not-used when creating a new page

Relates #100001
Fix #100365
Fix #100356
costin added a commit to costin/elasticsearch that referenced this issue Oct 6, 2023
Page now takes into account that a block can be used in multiple
 positions (such as the same column aliased under multiple names).
Introduce newPageAndRelease method that handles clean-up of blocks that
 are not-used when creating a new page

Relates elastic#100001
Fix elastic#100365
Fix elastic#100356

(cherry picked from commit 44068cb)
elasticsearchmachine pushed a commit that referenced this issue Oct 6, 2023
* ESQL: Page shouldn't close a block twice (#100370)

Page now takes into account that a block can be used in multiple
 positions (such as the same column aliased under multiple names).
Introduce newPageAndRelease method that handles clean-up of blocks that
 are not-used when creating a new page

Relates #100001
Fix #100365
Fix #100356

(cherry picked from commit 44068cb)

* Fix order inside test
@costin
Copy link
Member Author

costin commented Oct 10, 2023

Solved by #100370

@costin costin closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:QL (Deprecated) Meta label for query languages team
Projects
None yet
Development

No branches or pull requests

2 participants