-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: generalize one eval to arbitrary lengths (#381)
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 When `ProofPlan`s compose it makes no sense to have `table_length` in `VerificationBuilder`. Instead it becomes necessary to record each and every instance of length used for one_eval and pass the info to the verifier. <!-- 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? - remove `VerificationBuilder::table_length` - generalize one eval from `input_length` and `output_length` to arbitrary lengths - add `one_evaluation_lengths` in `FinalRoundBuilder` to collect the lengths - add consumption of the lengths in `VerificationBuilder` <!-- 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. --> Yes.
- Loading branch information
Showing
33 changed files
with
402 additions
and
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::base::scalar::Scalar; | ||
use alloc::vec::Vec; | ||
|
||
/// The result of evaluating a table | ||
#[derive(Debug, Eq, PartialEq, Clone)] | ||
pub struct TableEvaluation<S: Scalar> { | ||
/// Evaluation of each column in the table | ||
column_evals: Vec<S>, | ||
/// Evaluation of an all-one column with the same length as the table | ||
one_eval: S, | ||
} | ||
|
||
impl<S: Scalar> TableEvaluation<S> { | ||
/// Creates a new [`TableEvaluation`]. | ||
#[must_use] | ||
pub fn new(column_evals: Vec<S>, one_eval: S) -> Self { | ||
Self { | ||
column_evals, | ||
one_eval, | ||
} | ||
} | ||
|
||
/// Returns the evaluation of each column in the table. | ||
#[must_use] | ||
pub fn column_evals(&self) -> &[S] { | ||
&self.column_evals | ||
} | ||
|
||
/// Returns the evaluation of an all-one column with the same length as the table. | ||
#[must_use] | ||
pub fn one_eval(&self) -> &S { | ||
&self.one_eval | ||
} | ||
} |
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.