Skip to content

Commit

Permalink
fix: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iajoiner committed Nov 14, 2024
1 parent 98cbde8 commit 6723c5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
5 changes: 2 additions & 3 deletions crates/proof-of-sql/src/sql/proof_plans/group_by_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,12 @@ impl ProverEvaluate for GroupByExec {
.clone()
.into_iter()
.chain(sum_result_columns_iter)
.chain(iter::once(Column::BigInt(count_column)))
.collect::<Vec<_>>();
.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
Expand Down
25 changes: 3 additions & 22 deletions crates/proof-of-sql/src/sql/proof_plans/table_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,6 @@ impl TableExec {
pub fn new(table_ref: TableRef, schema: Vec<ColumnField>) -> 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<S>) -> 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 {
Expand Down Expand Up @@ -93,7 +74,7 @@ impl ProverEvaluate for TableExec {
_alloc: &'a Bump,
accessor: &'a dyn DataAccessor<S>,
) -> 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) {}
Expand All @@ -106,8 +87,8 @@ impl ProverEvaluate for TableExec {
alloc: &'a Bump,
accessor: &'a dyn DataAccessor<S>,
) -> 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
Expand Down

0 comments on commit 6723c5c

Please sign in to comment.