{"record":{"id":"5d9773755752efa9","repo":"risingwavelabs/risingwave","slug":"expect-array-type","errorCode":null,"errorMessage":"Expect Array Type","messagePattern":"Expect Array Type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/expr/core/src/expr/expr_some_all.rs","lineNumber":242,"sourceCode":"        let outer_expr_type = prost.get_function_type().unwrap();\n        let (outer_children, outer_return_type) = get_children_and_return_type(prost)?;\n        ensure!(matches!(outer_return_type, DataType::Boolean));\n\n        let mut inner_expr_type = outer_children[0].get_function_type().unwrap();\n        let (mut inner_children, mut inner_return_type) =\n            get_children_and_return_type(&outer_children[0])?;\n        let mut stack = vec![];\n        while inner_children.len() != 2 {\n            stack.push((inner_expr_type, inner_return_type));\n            inner_expr_type = inner_children[0].get_function_type().unwrap();\n            (inner_children, inner_return_type) = get_children_and_return_type(&inner_children[0])?;\n        }\n\n        let left_expr = build_child(&inner_children[0])?;\n        let right_expr = build_child(&inner_children[1])?;\n\n        let DataType::List(right_list_type) = right_expr.return_type() else {\n            bail!(\"Expect Array Type\");\n        };\n        let right_expr_return_type = right_list_type.into_elem();\n\n        let eval_func = {\n            let left_expr_input_ref = ExprNode {\n                function_type: Type::Unspecified as i32,\n                return_type: Some(left_expr.return_type().to_protobuf()),\n                rex_node: Some(RexNode::InputRef(0)),\n            };\n            let right_expr_input_ref = ExprNode {\n                function_type: Type::Unspecified as i32,\n                return_type: Some(right_expr_return_type.to_protobuf()),\n                rex_node: Some(RexNode::InputRef(1)),\n            };\n            let mut root_expr_node = ExprNode {\n                function_type: inner_expr_type as i32,\n                return_type: Some(inner_return_type.to_protobuf()),\n                rex_node: Some(RexNode::FuncCall(FunctionCall {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/expr/core/src/expr/expr_some_all.rs#L224-L260","documentation":"When building SOME/ALL (e.g. array containment) expressions, the builder requires the right-hand child's return type to be a list (array) so the element type can be extracted for the inner comparison expression. If the right side is a scalar or any non-list type, it bails with 'Expect Array Type'.","triggerScenarios":"Writing a query where the right operand of SOME/ALL operators (like = ANY(...)) is not an array — e.g. `x = ANY(5)` or a column that resolved to a non-List type.","commonSituations":"Typos in queries passing a scalar instead of an array; schema changes turning an array column into scalar; planner bugs mis-typing the right operand.","solutions":["Rewrite the query so the right operand of ANY/ALL is an array (e.g. use ARRAY[...] or an array column)","Check the right-hand column's schema type — it may have changed from List to scalar","Cast the right side to the expected array type if the planner allows","If the types look correct, check the planner for a type-inference bug"],"exampleFix":"-- before\nSELECT * FROM t WHERE id = ANY(1);\n-- after\nSELECT * FROM t WHERE id = ANY(ARRAY[1,2,3]);","handlingStrategy":"validation","validationCode":"-- Ensure the right operand of ANY/ALL is an array\nSELECT * FROM t WHERE x = ANY(ARRAY[1,2]); -- not ANY(1)","typeGuard":"fn is_list_type(dt: &DataType) -> bool { matches!(dt, DataType::List(_)) }","tryCatchPattern":"match build_expr(node) { Err(e) if e.to_string().contains(\"Expect Array Type\") => hint_user_to_use_array(&e), Err(e) => return Err(e), Ok(v) => v }","preventionTips":["Verify array-ness of columns used with ANY/ALL in queries","Re-check column types after schema migrations","Cast scalars explicitly with ARRAY[...] when needed"],"tags":["rust","sql","type-mismatch","some-all"],"backgroundTag":"type-mismatch","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}