pub trait TableRow: Sized {
const COLUMNS: usize;
// Required methods
fn column_types() -> Result<Vec<LogicalType>>;
fn write_row(
self,
cols: &mut [VectorMut<'_>],
row: usize,
projection: Option<&[usize]>,
) -> UdfResult<()>;
}Expand description
One output row of a table function: a tuple of values, one per column, in column order.
Implemented only for tuples — never for a bare T — so that a
single-column function’s Item = T and a multi-column function’s
Item = (A, B, ...) cannot both match the same blanket impl. The
#[duckdb_table_function] macro wraps a non-tuple Item type in a
one-element tuple during code generation, so callers never need to write
(T,) themselves.
Required Associated Constants§
Required Methods§
Sourcefn column_types() -> Result<Vec<LogicalType>>
fn column_types() -> Result<Vec<LogicalType>>
The DuckDB logical type of each column, in order.
§Errors
Returns an error if a column’s logical type cannot be built.
Sourcefn write_row(
self,
cols: &mut [VectorMut<'_>],
row: usize,
projection: Option<&[usize]>,
) -> UdfResult<()>
fn write_row( self, cols: &mut [VectorMut<'_>], row: usize, projection: Option<&[usize]>, ) -> UdfResult<()>
Writes each element into the matching column vector at row.
projection, when Some, lists which logical column each entry of
cols corresponds to (DuckDB only allocates vectors for the columns a
pushdown-enabled query actually requested, in that order — cols may
then be shorter than COLUMNS, and cols[i] is
logical column projection[i], not column i). None means every
column is wanted, in order (cols.len() == COLUMNS).
§Errors
Returns an error if a value cannot be converted to a DuckDB value, or
if projection names a column index outside 0..COLUMNS.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".