Converts an OFFSET expression into a value.
(offset: HirScalarExpr)
| 1629 | |
| 1630 | /// Converts an OFFSET expression into a value. |
| 1631 | pub(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 | |
| 1641 | pub(crate) fn negative_offset_error(offset: i64) -> PlanError { |
| 1642 | PlanError::InvalidOffset(format!("must not be negative, got {}", offset)) |
no test coverage detected