Skip to main content

uqa_execution/batch/
schema_runtime.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Runtime operations on SQL-owned schema layouts.
8
9use super::{ExecResult, PhysicalRow, PhysicalRowView, RowSchema};
10
11/// Physical row operations implemented by the execution crate.
12pub trait RowSchemaExecution {
13    fn view<'a>(&'a self, row: &'a PhysicalRow) -> PhysicalRowView<'a>;
14
15    fn relayout_physical_row(
16        &self,
17        row: PhysicalRow,
18        target: &RowSchema,
19    ) -> ExecResult<PhysicalRow>;
20}
21
22impl RowSchemaExecution for RowSchema {
23    fn view<'a>(&'a self, row: &'a PhysicalRow) -> PhysicalRowView<'a> {
24        PhysicalRowView { schema: self, row }
25    }
26
27    fn relayout_physical_row(
28        &self,
29        row: PhysicalRow,
30        target: &RowSchema,
31    ) -> ExecResult<PhysicalRow> {
32        let slots = self.relayout_slots(target)?;
33        Ok(row.project_slots(&slots))
34    }
35}