This PR has some main goals, while other changes are less important and are done as additional work (see commit descriptions). I recommend reviewing this PR commit by commit after having reviewed https://github.com/clockworklabs/SpacetimeDB/pull/1166 upon which this PR is based.
In this PR, we want to:
Let build_query and query execution work on a ColumnOp that stores ColId rather than FieldName (23e00d23cd22bc6d495c26e036c84503a9ef9db3). The previous version of ColumnOp is now called FieldOp and uses FieldName as before. This type is used by SQL compilation and query planning and is eventually compiled down to a ColumnOp. This means that Header is no longer used by ColumnOp nor build_query.
Making build_query itself (20340c88606d6e0af4be5e962938b2f453d33da7) and query execution infallible (3415702df3bba5fe2485c2ddb2a218fddbc614c5 and 986d80e70e5ee500bdcca7d10b8d54f3d5ec9119). To make this possible, we must ensure that we only get bools where anything else does not make sense (977b5bb9db7636c38e6e1121222aea24415dfd9b).
Split IndexSemiJoin into left and right versions (e0c12cef61ed2eb51f361741ce5e60c57a9d51d2 and 3968f4fec39a8d1a91e14571674e3b39d5bcb51d). This enables us to make both versions less branchy and to significantly shrink the size of the right case (312 bytes vs 64).
Benchmarks
Benchmarks relative to based master on i7-7700K, 64GB RAM:
Description of Changes
The main goal of this PR
This PR has some main goals, while other changes are less important and are done as additional work (see commit descriptions). I recommend reviewing this PR commit by commit after having reviewed https://github.com/clockworklabs/SpacetimeDB/pull/1166 upon which this PR is based.
In this PR, we want to:
build_query
and query execution work on aColumnOp
that storesColId
rather thanFieldName
(23e00d23cd22bc6d495c26e036c84503a9ef9db3). The previous version ofColumnOp
is now calledFieldOp
and usesFieldName
as before. This type is used by SQL compilation and query planning and is eventually compiled down to aColumnOp
. This means thatHeader
is no longer used byColumnOp
norbuild_query
.build_query
itself (20340c88606d6e0af4be5e962938b2f453d33da7) and query execution infallible (3415702df3bba5fe2485c2ddb2a218fddbc614c5 and 986d80e70e5ee500bdcca7d10b8d54f3d5ec9119). To make this possible, we must ensure that we only getbool
s where anything else does not make sense (977b5bb9db7636c38e6e1121222aea24415dfd9b).IndexSemiJoin
into left and right versions (e0c12cef61ed2eb51f361741ce5e60c57a9d51d2 and 3968f4fec39a8d1a91e14571674e3b39d5bcb51d). This enables us to make both versions less branchy and to significantly shrink the size of the right case (312 bytes vs 64).Benchmarks
Benchmarks relative to based master on i7-7700K, 64GB RAM:
API and ABI breaking changes
None
Expected complexity level and risk
2, large diff in terms of query planning and execution, but each change isn't as huge.
Testing
Existing tests have been tweaked to fit the changes.