-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: compute min and max of indices for multi-table queries && remo…
…ve `get_offset` and `get_length` from `ProofPlan` (#361) Please be sure to look over the pull request guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md#submit-pr. # Please go through the following checklist - [x] The PR title and commit messages adhere to guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md. In particular `!` is used if and only if at least one breaking change has been introduced. - [x] I have run the ci check script with `source scripts/run_ci_checks.sh`. # Rationale for this change We need to allow composable `ProofPlan`s and multiple table queries. Hence it no longer makes sense to have every `ProofPlan` have its own `get_offset` and `get_length` for input length. There can be multiple input lengths for a `ProofPlan` and offsets only make sense for source tables (that is, `TableExec`) but not intermediate `ProofPlan`s. Hence we have to refactor `query_proof.rs` to remove any reference to a single input length and a single offset. For proofs purposes what we actually care about are actually the smallest row index (that is, the smallest offset) among all input tables, the largest row index among all input tables and the length of the longest intermediate table (that is, the largest row index among all intermediate tables if we start from 0). The last value will remain less than or equal to the second one until we add unions, joins and other `ProofPlan`s that actually make output tables longer than input ones. <!-- Why are you proposing this change? If this is already explained clearly in the linked issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. Example: Add `NestedLoopJoinExec`. Closes #345. Since we added `HashJoinExec` in #323 it has been possible to do provable inner joins. However performance is not satisfactory in some cases. Hence we need to fix the problem by implement `NestedLoopJoinExec` and speed up the code for `HashJoinExec`. --> # What changes are included in this PR? - add `indexset` macro (thanks @JayWhite2357 for putting it in a review comment in #346) - add `get_index_range` to compute the index range - refactor `QueryProof` to use the index range as opposed to a single `input_length` / `offset_generators` - remove `get_offset` and `get_length` from `ProofPlan` which are no longer used <!-- There is no need to duplicate the description in the ticket here but it is sometimes worth providing a summary of the individual changes in this PR. Example: - Add `NestedLoopJoinExec`. - Speed up `HashJoinExec`. - Route joins to `NestedLoopJoinExec` if the outer input is sufficiently small. --> # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? Example: Yes. --> Existing tests do pass
- Loading branch information
Showing
11 changed files
with
136 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.