{"record":{"id":"be7d6ef0fa71481f","repo":"risingwavelabs/risingwave","slug":"cardinality-0","errorCode":null,"errorMessage":"cardinality > 0","messagePattern":"cardinality > 0","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/stream/src/executor/values.rs","lineNumber":92,"sourceCode":"        let paused_on_startup = barrier.is_pause_on_startup();\n\n        yield Message::Barrier(barrier);\n\n        // If it's failover, do not evaluate rows (assume they have been yielded)\n        if emit {\n            if paused_on_startup {\n                // Wait for the data stream to be resumed before yielding the chunks.\n                while let Some(barrier) = barrier_receiver.recv().await {\n                    let is_resume = barrier.is_resume();\n                    yield Message::Barrier(barrier);\n                    if is_resume {\n                        break;\n                    }\n                }\n            }\n\n            let cardinality = schema.len();\n            ensure!(cardinality > 0);\n            while !rows.is_empty() {\n                // We need a one row chunk rather than an empty chunk because constant\n                // expression's eval result is same size as input chunk\n                // cardinality.\n                let one_row_chunk = DataChunk::new_dummy(1);\n\n                let chunk_size = DEFAULT_CHUNK_SIZE.min(rows.len());\n                let mut array_builders = schema.create_array_builders(chunk_size);\n                for row in rows.by_ref().take(chunk_size) {\n                    for (expr, builder) in row.into_iter().zip_eq_fast(&mut array_builders) {\n                        let out = expr.eval_infallible(&one_row_chunk).await;\n                        builder.append_array(&out);\n                    }\n                }\n\n                let columns: Vec<_> = array_builders\n                    .into_iter()\n                    .map(|b| b.finish().into())","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/values.rs#L74-L110","documentation":"Thrown in the VALUES executor's `execute_inner` when the declared schema has zero columns. A VALUES (constant relation) must emit at least one column; a zero-column schema would make the one-row dummy chunk meaningless and downstream expression evaluation impossible.","triggerScenarios":"Creating a `ValuesExecutor` whose `schema.len() == 0`, e.g. planning a `VALUES` clause or a query that resolves to a constant relation with an empty column list.","commonSituations":"Frontend planner bugs producing an empty projection for a constant relation; SQL like `SELECT;` or a `VALUES` with an empty field list reaching the stream engine; misconfigured internal constant-relations used for system catalogs.","solutions":["Fix the planner so the constant relation always has at least one column (e.g. add a dummy unit column).","Check the SQL that produced the plan; avoid statements yielding an empty column set.","Ensure frontend and stream versions match; older frontends may emit degenerate schemas."],"exampleFix":"-- before\nSELECT;\n-- after\nSELECT 1; -- or ensure the VALUES clause lists at least one column","handlingStrategy":"validation","validationCode":"// before constructing ValuesExecutor\nif schema.is_empty() {\n    // add a dummy unit column or reject the plan early\n}","typeGuard":"fn has_columns(schema: &Schema) -> bool { !schema.fields.is_empty() }","tryCatchPattern":null,"preventionTips":["Never plan constant relations with zero columns; add a dummy column in the frontend","Add planner tests for degenerate SELECT/VALUES shapes","Check schema before feeding constant relations into the stream engine"],"tags":["streaming","schema","values-executor"],"backgroundTag":"empty-required-field","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}