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

[2023 Others]: rethink physical operator impl principles #39

Open
luooofan opened this issue Oct 27, 2023 · 0 comments
Open

[2023 Others]: rethink physical operator impl principles #39

luooofan opened this issue Oct 27, 2023 · 0 comments
Labels

Comments

@luooofan
Copy link
Owner

luooofan commented Oct 27, 2023

description:

主要是考虑到后续做子查询,可能会:(取决于具体实现)

  • 多次 open next close 算子
  • 当算子 next 返回 RECORD_EOF 的时候,还有可能会再次调用 next
  • 调用 next 的时候才会设置子查询的 parent tuple

因而实现 physical operator 的时候有几个基本原则:

  • open 的时候要重置好各种状态,上一次的 open next close 不能对这次造成影响
  • next 返回 RECORD_EOF 后是可重入的,再次调用还会返回 RECORD_EOF
  • 算子如果可能会从 parent tuple 取数据的话,应该把执行逻辑放在 next 函数中,而不是 open 函数中,比如 order by 算子,应该在第一次调用 next 函数时取全部数据并排序

这几条取决于具体实现,比如子查询 get_value 也可以先 set parent tuple,再 open 再 next,这样有些算子就没必要非得把执行逻辑放在 next 函数中了,比如 order by

@luooofan luooofan changed the title [2023 Others]: physical operator impl principles [2023 Others]: rethink physical operator impl principles Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant