diff --git a/crates/proof-of-sql/src/sql/proof_plans/group_by_exec.rs b/crates/proof-of-sql/src/sql/proof_plans/group_by_exec.rs index 41f6db0b6..706a9a108 100644 --- a/crates/proof-of-sql/src/sql/proof_plans/group_by_exec.rs +++ b/crates/proof-of-sql/src/sql/proof_plans/group_by_exec.rs @@ -299,13 +299,12 @@ impl ProverEvaluate for GroupByExec { .clone() .into_iter() .chain(sum_result_columns_iter) - .chain(iter::once(Column::BigInt(count_column))) - .collect::>(); + .chain(iter::once(Column::BigInt(count_column))); let res = Table::<'a, S>::try_from_iter( self.get_column_result_fields() .into_iter() .map(|field| field.name()) - .zip(columns.clone().into_iter()), + .zip(columns.clone()), ) .expect("Failed to create table from column references"); // 5. Produce MLEs 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 2091b3390..7c34cc5a2 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 @@ -31,25 +31,6 @@ impl TableExec { pub fn new(table_ref: TableRef, schema: Vec) -> Self { Self { table_ref, schema } } - - /// Returns the entire table. - /// - /// # Panics - /// Panics if columns from the accessor have different lengths. - /// In practice, this should never happen. - fn get_table<'a, S: Scalar>(&self, accessor: &'a dyn DataAccessor) -> Table<'a, S> { - Table::<'a, S>::try_from_iter(self.schema.iter().map(|field| { - ( - field.name(), - accessor.get_column(ColumnRef::new( - self.table_ref, - field.name(), - field.data_type(), - )), - ) - })) - .expect("Failed to create table from column references") - } } impl ProofPlan for TableExec { @@ -93,7 +74,7 @@ impl ProverEvaluate for TableExec { _alloc: &'a Bump, accessor: &'a dyn DataAccessor, ) -> Table<'a, S> { - self.get_table(accessor) + accessor.get_table(self.table_ref, &self.get_column_references()) } fn first_round_evaluate(&self, _builder: &mut FirstRoundBuilder) {} @@ -106,8 +87,8 @@ impl ProverEvaluate for TableExec { alloc: &'a Bump, accessor: &'a dyn DataAccessor, ) -> Table<'a, S> { - let table = self.get_table(accessor); - for column in table.inner_table().values() { + let table = accessor.get_table(self.table_ref, &self.get_column_references()); + for column in table.columns() { builder.produce_intermediate_mle(column.as_scalar(alloc)); } table