diff --git a/crates/proof-of-sql/src/sql/proof/proof_plan.rs b/crates/proof-of-sql/src/sql/proof/proof_plan.rs index e2b01b0c0..208de3ab1 100644 --- a/crates/proof-of-sql/src/sql/proof/proof_plan.rs +++ b/crates/proof-of-sql/src/sql/proof/proof_plan.rs @@ -1,6 +1,6 @@ use super::{CountBuilder, FinalRoundBuilder, FirstRoundBuilder, VerificationBuilder}; use crate::base::{ - database::{Column, ColumnField, ColumnRef, DataAccessor, OwnedTable, TableRef}, + database::{Column, ColumnField, ColumnRef, OwnedTable, Table, TableRef}, map::{IndexMap, IndexSet}, proof::ProofError, scalar::Scalar, @@ -39,7 +39,7 @@ pub trait ProverEvaluate { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec>; /// Evaluate the query and modify `FirstRoundBuilder` to form the query's proof. @@ -55,7 +55,7 @@ pub trait ProverEvaluate { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec>; } diff --git a/crates/proof-of-sql/src/sql/proof/query_proof_test.rs b/crates/proof-of-sql/src/sql/proof/query_proof_test.rs index 1e1a82a4f..2c74763d5 100644 --- a/crates/proof-of-sql/src/sql/proof/query_proof_test.rs +++ b/crates/proof-of-sql/src/sql/proof/query_proof_test.rs @@ -7,7 +7,7 @@ use crate::{ database::{ owned_table_utility::{bigint, owned_table}, Column, ColumnField, ColumnRef, ColumnType, DataAccessor, OwnedTable, - OwnedTableTestAccessor, TableRef, + OwnedTableTestAccessor, Table, TableRef, }, map::{indexset, IndexMap, IndexSet}, proof::ProofError, @@ -43,7 +43,7 @@ impl ProverEvaluate for TrivialTestProofPlan { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let col = alloc.alloc_slice_fill_copy(self.length, self.column_fill_value); vec![Column::BigInt(col)] @@ -55,7 +55,7 @@ impl ProverEvaluate for TrivialTestProofPlan { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let col = alloc.alloc_slice_fill_copy(self.length, self.column_fill_value); builder.produce_intermediate_mle(col as &[_]); @@ -212,7 +212,7 @@ impl ProverEvaluate for SquareTestProofPlan { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let res: &[_] = alloc.alloc_slice_copy(&self.res); vec![Column::BigInt(res)] @@ -224,13 +224,13 @@ impl ProverEvaluate for SquareTestProofPlan { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { - let x = accessor.get_column(ColumnRef::new( - "sxt.test".parse().unwrap(), - "x".parse().unwrap(), - ColumnType::BigInt, - )); + let x = accessor + .get(&TableRef::new("sxt.test".parse().unwrap())) + .inner_table() + .get("x".parse().unwrap()) + .unwrap(); let res: &[_] = alloc.alloc_slice_copy(&self.res); builder.produce_intermediate_mle(res); builder.produce_sumcheck_subpolynomial( @@ -389,7 +389,7 @@ impl ProverEvaluate for DoubleSquareTestProofPlan { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let res: &[_] = alloc.alloc_slice_copy(&self.res); vec![Column::BigInt(res)] @@ -401,13 +401,13 @@ impl ProverEvaluate for DoubleSquareTestProofPlan { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { - let x = accessor.get_column(ColumnRef::new( - "sxt.test".parse().unwrap(), - "x".parse().unwrap(), - ColumnType::BigInt, - )); + let x = accessor + .get(&TableRef::new("sxt.test".parse().unwrap())) + .inner_table() + .get("x".parse().unwrap()) + .unwrap(); let res: &[_] = alloc.alloc_slice_copy(&self.res); let z: &[_] = alloc.alloc_slice_copy(&self.z); builder.produce_intermediate_mle(z); @@ -596,7 +596,7 @@ impl ProverEvaluate for ChallengeTestProofPlan { fn result_evaluate<'a, S: Scalar>( &self, _alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { vec![Column::BigInt(&[9, 25])] } @@ -609,13 +609,13 @@ impl ProverEvaluate for ChallengeTestProofPlan { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { - let x = accessor.get_column(ColumnRef::new( - "sxt.test".parse().unwrap(), - "x".parse().unwrap(), - ColumnType::BigInt, - )); + let x = accessor + .get(&TableRef::new("sxt.test".parse().unwrap())) + .inner_table() + .get("x".parse().unwrap()) + .unwrap(); let res: &[_] = alloc.alloc_slice_copy(&[9, 25]); let alpha = builder.consume_post_result_challenge(); let _beta = builder.consume_post_result_challenge(); diff --git a/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test.rs b/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test.rs index 7417fc2ef..627ee7307 100644 --- a/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test.rs +++ b/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test.rs @@ -8,7 +8,7 @@ use crate::{ database::{ owned_table_utility::{bigint, owned_table}, Column, ColumnField, ColumnRef, ColumnType, DataAccessor, OwnedTable, - OwnedTableTestAccessor, TableRef, + OwnedTableTestAccessor, Table, TableRef, }, map::{indexset, IndexMap, IndexSet}, proof::ProofError, @@ -28,7 +28,7 @@ impl ProverEvaluate for EmptyTestQueryExpr { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let zeros = vec![0; self.length]; let res: &[_] = alloc.alloc_slice_copy(&zeros); @@ -39,7 +39,7 @@ impl ProverEvaluate for EmptyTestQueryExpr { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { let zeros = vec![0; self.length]; let res: &[_] = alloc.alloc_slice_copy(&zeros); diff --git a/crates/proof-of-sql/src/sql/proof_plans/empty_exec.rs b/crates/proof-of-sql/src/sql/proof_plans/empty_exec.rs index 0ee0d92fc..b26824bea 100644 --- a/crates/proof-of-sql/src/sql/proof_plans/empty_exec.rs +++ b/crates/proof-of-sql/src/sql/proof_plans/empty_exec.rs @@ -1,6 +1,6 @@ use crate::{ base::{ - database::{Column, ColumnField, ColumnRef, DataAccessor, OwnedTable, TableRef}, + database::{Column, ColumnField, ColumnRef, OwnedTable, TableRef}, map::{IndexMap, IndexSet}, proof::ProofError, scalar::Scalar, @@ -66,7 +66,7 @@ impl ProverEvaluate for EmptyExec { fn result_evaluate<'a, S: Scalar>( &self, _alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { Vec::new() } @@ -79,7 +79,7 @@ impl ProverEvaluate for EmptyExec { &self, _builder: &mut FinalRoundBuilder<'a, S>, _alloc: &'a Bump, - _accessor: &'a dyn DataAccessor, + _accessor: &IndexMap>, ) -> Vec> { Vec::new() } diff --git a/crates/proof-of-sql/src/sql/proof_plans/projection_exec.rs b/crates/proof-of-sql/src/sql/proof_plans/projection_exec.rs index 6c90b2a47..c43854af1 100644 --- a/crates/proof-of-sql/src/sql/proof_plans/projection_exec.rs +++ b/crates/proof-of-sql/src/sql/proof_plans/projection_exec.rs @@ -88,7 +88,7 @@ impl ProverEvaluate for ProjectionExec { fn result_evaluate<'a, S: Scalar>( &self, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { let column_refs = self.get_column_references(); let used_table = accessor.get_table(self.table.table_ref, &column_refs); @@ -112,7 +112,7 @@ impl ProverEvaluate for ProjectionExec { &self, builder: &mut FinalRoundBuilder<'a, S>, alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { let column_refs = self.get_column_references(); let used_table = accessor.get_table(self.table.table_ref, &column_refs); diff --git a/crates/proof-of-sql/src/sql/proof_plans/table_exec.rs b/crates/proof-of-sql/src/sql/proof_plans/table_exec.rs index 4a61f0cd9..623edb4f5 100644 --- a/crates/proof-of-sql/src/sql/proof_plans/table_exec.rs +++ b/crates/proof-of-sql/src/sql/proof_plans/table_exec.rs @@ -86,9 +86,9 @@ impl ProverEvaluate for TableExec { fn result_evaluate<'a, S: Scalar>( &self, _alloc: &'a Bump, - accessor: &'a dyn DataAccessor, + accessor: &IndexMap>, ) -> Vec> { - self.get_table(accessor) + self.get } fn first_round_evaluate(&self, _builder: &mut FirstRoundBuilder) {}