risingwavelabs/risingwave · error

Invalid sign: {}

Error message

Invalid sign: {}

What it means

The approx_percentile global aggregator decodes per-bucket counts from its state table, where each row carries a `sign` column (0 for negative buckets, 1 for positive buckets, and zeros handled separately). `refill_cache` bails when it reads a sign value other than the expected 0/1 set, meaning the persisted bucket state is corrupt or from an incompatible schema version.

Source

Thrown at src/stream/src/executor/approx_percentile/global_state.rs:109

            .iter_with_prefix(&[Datum::None; 0], &bounds, PrefetchOptions::default())
            .await?
        {
            let row = keyed_row?.into_owned_row();
            let sign = row.datum_at(0).unwrap().into_int16();
            let bucket_id = row.datum_at(1).unwrap().into_int32();
            let count = row.datum_at(2).unwrap().into_int64();
            match sign {
                -1 => {
                    self.cache.neg_buckets.insert(bucket_id, count as i64);
                }
                0 => {
                    self.cache.zeros = count as i64;
                }
                1 => {
                    self.cache.pos_buckets.insert(bucket_id, count as i64);
                }
                _ => {
                    bail!("Invalid sign: {}", sign);
                }
            }
        }
        Ok(())
    }

    async fn get_row_count_state(&self) -> StreamExecutorResult<Option<OwnedRow>> {
        self.count_state_table.get_row(&[Datum::None; 0]).await
    }

    fn decode_row_count(row_count_state: &Option<OwnedRow>) -> StreamExecutorResult<i64> {
        if let Some(row) = row_count_state.as_ref() {
            let Some(datum) = row.datum_at(0) else {
                bail!("Invalid row count state: {:?}", row)
            };
            Ok(datum.into_int64())
        } else {
            Ok(0)

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Identify the materialized view containing approx_percentile and recreate it (DROP and re-CREATE) to rebuild clean state.
  2. Check whether the cluster was upgraded between writing and reading this state; restore from a backup taken with the same version if possible.
  3. Enable debug logging on the affected table ID and inspect the state table rows to confirm corruption; report it if it's a writer bug.
  4. Upgrade to the latest patch release in case the writer side has been fixed.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Restoring approx_percentile aggregation state from a state table whose rows contain an unexpected `sign` value (e.g. state written by different code version or manually corrupted), during `init` when refilling the in-memory cache from persisted buckets.

Common situations: RisingWave version upgrade with changed state-table schema, state store corruption, or recovery from a checkpoint written by a buggy build.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/c57066b7a18a440d. Report an issue: GitHub.