Skip to content

Conversation

@gefjon
Copy link
Contributor

@gefjon gefjon commented Mar 1, 2024

Description of Changes

Alter our representation of query expressions and compiled query plans so that they no longer contain MemTable. Instead, SourceExpr::MemTable an identifier for a MemTable within a SourceSet.

Storing DbTable within query plans is unchanged.

API and ABI breaking changes

N/a.

Expected complexity level and risk

3 - the query engine has changed substantially, in ways that may inadvertently change behavior.

How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.

This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.

Rework `SourceExpr` to be a logical placeholder for a table,
rather than a table itself.

Make query eval functions take an additional argument, a set of tables.
When evaluating a `SourceExpr` to a table, they will treat the `SourceExpr`
as a reference into the set of sources, and use the referred table.

This commit modifies only the VM crate; modifications to `core` are forthcoming.
It's possible that this commit's scheme for referring to `SourceExpr`s
will need to change,
as currently it forbids duplicate `SourceExpr`s,
which I think might occur during index joins.
@gefjon gefjon requested review from joshua-spacetime and mamcx March 1, 2024 19:26
@gefjon gefjon force-pushed the phoebe/remove-memtable-from-plans branch from 4281c06 to 8066ac8 Compare March 1, 2024 20:22
@gefjon
Copy link
Contributor Author

gefjon commented Mar 1, 2024

So we don't lose it: when I merged #694 (now reverted) into this branch, the merge was 4281c06 .

Per review from Joshua, this commit makes `SourceExpr` into an enum
similar to the previous definition, with a `DbTable(DbTable)` variant.
Indirection to a `SourceSet` is imposed only for the `MemTable` variant.

This sould make the PR's overall diff much simpler
(assuming I haven't inadvertently made any changes
in the process of reverting the `DbTable` code paths).

Related to the above, this PR simplifies `SourceSet`.
`SourceSet` now holds a `Vec<Option<MemTable>>`, where previously
it was a transparent newtype around `[Option<Table>]`.
This change eliminates the need for unsafe unsized conversions,
removes `SourceBuilder`,
and causes `SourceSet` to be uniformly consumed by the high-level query eval operators,
where previously `SourceSet`s had to be semi-reusable
because they could contain `DbTable`s.
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; only the docs / commentary stuff I'd say is blocking.

@gefjon gefjon requested a review from Centril March 4, 2024 20:19
@gefjon gefjon enabled auto-merge March 4, 2024 20:20
@gefjon gefjon added this pull request to the merge queue Mar 4, 2024
Merged via the queue into master with commit 9afbfa7 Mar 4, 2024
@Centril Centril deleted the phoebe/remove-memtable-from-plans branch March 5, 2024 10:07
@joshua-spacetime joshua-spacetime linked an issue Mar 5, 2024 that may be closed by this pull request
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.

Do not inline virtual tables in query plans

4 participants