Skip to content

Commit 1139f60

Browse files
committed
Clarify RowFn unsafe contracts
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent ac1f2ca commit 1139f60

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎vortex-array/src/scalar_fn/row/row_fn.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ pub trait RowFn: 'static + Sized + Clone + Send + Sync {
3939
/// The arguments in display order. Its length is the function's exact arity.
4040
const ARG_NAMES: &'static [&'static str];
4141

42-
/// Whether any legal dispatch can raise a semantic error as defined by
43-
/// [`ScalarFnVTable::is_fallible`](crate::scalar_fn::ScalarFnVTable::is_fallible).
42+
/// Whether any legal dispatch or encoding-aware execution can raise a semantic error as
43+
/// defined by [`ScalarFnVTable::is_fallible`](crate::scalar_fn::ScalarFnVTable::is_fallible).
4444
///
4545
/// The framework checks this at compile time for every fallible dispatched element or result.
4646
/// A conservative `true` is allowed when only some dtype choices are fallible.
47+
///
48+
/// Set this to `true` when [`reduce_encoded`](Self::reduce_encoded) can return a semantic
49+
/// error or [`RowExecution::DeferredError`]. Compile-time checks cover dispatched element and
50+
/// result types, but cannot inspect that hook.
4751
const FALLIBLE: bool = false;
4852

4953
/// Returns the ID of the scalar function.

‎vortex-array/src/scalar_fn/row/types/sink.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ use crate::scalar_fn::OutputElement;
3333
/// substitutable for another row.
3434
/// - A present [`SKIPPED_ROWS_INITIALIZER`](Self::SKIPPED_ROWS_INITIALIZER) **must** initialize
3535
/// every row handed to it.
36+
/// - `Self` and every borrowed [`Rows`](Self::Rows) view **must** remain safe to drop if decoding,
37+
/// preparation, skipped-row initialization, or a row callback returns an error or unwinds. The
38+
/// executor can abandon a sink after any prefix of rows.
3639
/// - [`finish`](Self::finish) **must** be sound once every visited callback returned its required
3740
/// token and the skipped-row initializer, when present, ran successfully.
3841
///
@@ -146,8 +149,9 @@ impl InitializedElement {
146149
/// The row closure must return the [`InitializedElement`] from [`InitializedElement::write`] on
147150
/// success. The token is zero-sized, so the proof adds no runtime row state.
148151
///
149-
/// Skip-invalid execution initializes placeholders before omitting rows. Immediate failures are
150-
/// safe because [`OutputSink::finish`] is not called after one.
152+
/// Skip-invalid execution initializes placeholders before omitting rows. Errors and unwinds are
153+
/// safe because `values` keeps length zero until `finish`; `T: Copy` means initialized
154+
/// spare-capacity elements require no destruction.
151155
pub struct UninitElementSink<T> {
152156
/// Spare storage written in increasing row order.
153157
values: Vec<T>,

0 commit comments

Comments
 (0)