risingwavelabs/risingwave · error
expected int64, got
Error message
expected int64, got {:?} What it means
`expr_impl_to_u64_fn` only accepts Int64 scalar constants for time parameters. When constant folding yields a scalar of any other type (e.g. Int32, Decimal, Timestamp), it errors with `expected int64, got {scalar:?}`.
Solutions
- Cast the argument to BIGINT: `internal_get_channel_delta_stats(60::bigint, 0::bigint)`.
- Avoid string or decimal arguments; use plain int64 literals.
- Adjust the expression so it folds to an Int64 scalar.
- Check the function signature and supply arguments in the expected types.
Example fix
-- before
SELECT * FROM internal_get_channel_delta_stats('60', '0');
-- after
SELECT * FROM internal_get_channel_delta_stats(60::bigint, 0::bigint); Defensive patterns
Strategy: validation
Validate before calling
-- Cast arguments to BIGINT before calling SELECT * FROM internal_get_channel_delta_stats(60::bigint, 0::bigint);
Type guard
fn require_int64(s: &ScalarImpl) -> Option<i64> {
match s { ScalarImpl::Int64(v) => Some(*v), _ => None }
} Try / catch
match expr_impl_to_u64_fn(expr) {
Ok(v) => /* proceed */,
Err(e) => eprintln!("arg type error: {e:#}"),
} Prevention
- Always write int64 literals or use ::bigint casts
- Never pass strings or decimals to the function
- Check inferred literal types in EXPLAIN before use
When it happens
Trigger: Passing a constant argument of non-Int64 type to `internal_get_channel_delta_stats`, such as an integer literal typed as Int32, a decimal, or a string.
Common situations: Users passing raw numeric literals that the frontend infers as Int32, or casting to the wrong type; also passing quoted strings like '60'.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- call predicate_pushdown of the PlanRef instead of calling…
- call prune_col of the PlanRef instead of calling directly…
- Chunk operation error
- Column ` ` in Postgres table ` ` has type ` `, but sink…
- ` ` column not found in backfill table
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/783de2786e0975cf.
Report an issue: GitHub.
Appendix: source
Thrown at src/frontend/src/optimizer/rule/table_function_to_internal_get_channel_delta_stats.rs:52
.cast_implicit(&DataType::Int64)?
.try_fold_const()
{
Some(Ok(value)) => {
let Some(scalar) = value else {
return Ok(None);
};
match scalar {
ScalarImpl::Int64(value) => {
if value < 0 {
Err(anyhow::anyhow!(
"time parameter cannot be negative, got {}",
value
))
} else {
Ok(Some(value as u64))
}
}
_ => Err(anyhow::anyhow!("expected int64, got {:?}", scalar)),
}
}
Some(Err(err)) => Err(anyhow!(err).context("failed to fold constant")),
None => Err(anyhow::anyhow!("expression must be a constant value")),
}
}
/// Transform the `internal_get_channel_delta_stats()` table function
/// into a plan graph which will return channel statistics from the dashboard API.
/// It will return channel stats with `upstream_fragment_id` and `downstream_fragment_id` as primary key.
pub struct TableFunctionToInternalGetChannelDeltaStatsRule {}
impl FallibleRule<Logical> for TableFunctionToInternalGetChannelDeltaStatsRule {
fn apply(&self, plan: PlanRef) -> ApplyResult<PlanRef> {
let logical_table_function: &LogicalTableFunction = plan.as_logical_table_function()?;
if logical_table_function.table_function().function_type
!= TableFunctionType::InternalGetChannelDeltaStats
{
return ApplyResult::NotApplicable;View on GitHub (pinned to 6469eb736d)