MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / offset_into_value

Function offset_into_value

src/sql/src/plan/query.rs:1631–1639  ·  view source on GitHub ↗

Converts an OFFSET expression into a value.

(offset: HirScalarExpr)

Source from the content-addressed store, hash-verified

1629
1630/// Converts an OFFSET expression into a value.
1631pub(crate) fn offset_into_value(offset: HirScalarExpr) -> Result<i64, PlanError> {
1632 let offset = offset
1633 .try_into_literal_int64()
1634 .map_err(|err| PlanError::InvalidOffset(err.to_string_with_causes()))?;
1635 if offset < 0 {
1636 return Err(negative_offset_error(offset));
1637 }
1638 Ok(offset)
1639}
1640
1641pub(crate) fn negative_offset_error(offset: i64) -> PlanError {
1642 PlanError::InvalidOffset(format!("must not be negative, got {}", offset))

Callers 3

plan_query_innerFunction · 0.85
plan_select_innerFunction · 0.85

Calls 3

negative_offset_errorFunction · 0.85
to_string_with_causesMethod · 0.80

Tested by

no test coverage detected