{"record":{"id":"8445e842c7e226ea","repo":"risingwavelabs/risingwave","slug":"invalid-order-key-column-column-hint-only-pla","errorCode":null,"errorMessage":"Invalid order key column `{column}`\nHINT: Only plain column names are supported in order_key","messagePattern":"Invalid order key column `(.+?)`\nHINT: Only plain column names are supported in order_key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/iceberg/create_table.rs","lineNumber":502,"sourceCode":"    for raw_item in expr.split(',') {\n        let item = raw_item.trim();\n        if item.is_empty() {\n            bail!(\"Invalid order key: empty item in `{expr}`\");\n        }\n\n        let tokens = item.split_whitespace().collect_vec();\n        if tokens.is_empty() {\n            bail!(\"Invalid order key item `{item}`\");\n        }\n        if tokens.len() > 4 {\n            bail!(\n                \"Invalid order key item `{item}`\\nHINT: Supported format is `column [asc|desc] [nulls first|last]`\"\n            );\n        }\n\n        let column = tokens[0];\n        if !ORDER_KEY_COLUMN_RE.is_match(column) {\n            bail!(\n                \"Invalid order key column `{column}`\\nHINT: Only plain column names are supported in order_key\"\n            );\n        }\n        if !seen_columns.insert(column.to_ascii_lowercase()) {\n            bail!(\"Duplicate column `{column}` in order_key\");\n        }\n\n        let mut direction = SortDirection::Ascending;\n        let mut null_order = None;\n        let mut idx = 1;\n        while idx < tokens.len() {\n            match tokens[idx].to_ascii_lowercase().as_str() {\n                \"asc\" => {\n                    direction = SortDirection::Ascending;\n                    idx += 1;\n                }\n                \"desc\" => {\n                    direction = SortDirection::Descending;","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/iceberg/create_table.rs#L484-L520","documentation":"The first token of each order key item must match ORDER_KEY_COLUMN_RE, a pattern that accepts only plain SQL column identifiers. Quoted identifiers, qualified names like t.col, function calls, or other expression forms are rejected because the Iceberg sink order_key maps 1:1 onto table columns.","triggerScenarios":"order_key items such as `\\\"user id\\\"` (quoted), `t.id` (qualified), `count(*)`, `col + 1`, or identifiers starting with a digit/special char that fail the regex.","commonSituations":"Copying an ORDER BY expression from a query into order_key; qualifying column names out of habit; spaces inside a column name without knowing quoting is unsupported in this option.","solutions":["Use the bare, unquoted column name exactly as declared (e.g. `id`, not `t.id` or `\\\"id\\\"`)","Rename columns with special characters/spaces, or add clean alias columns","Move any computed value into a real table column and reference that column in order_key","Validate each item against the regex ^[A-Za-z_][A-Za-z0-9_]*$-style identifier before configuring"],"exampleFix":"// before\norder_key = 't.event_time desc'\n// after\norder_key = 'event_time desc'","handlingStrategy":"validation","validationCode":"let column_re = regex::Regex::new(r\"^[A-Za-z_][A-Za-z0-9_]*$\").unwrap();\nfor item in expr.split(',').map(|s| s.trim()) {\n    let col = item.split_whitespace().next().unwrap_or(\"\");\n    if !column_re.is_match(col) {\n        return Err(format!(\"order_key column `{col}` must be a plain identifier\"));\n    }\n}","typeGuard":"fn is_plain_identifier(column: &str) -> bool {\n    !column.is_empty()\n        && column.chars().next().map_or(false, |c| c.is_ascii_alphabetic() || c == '_')\n        && column.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')\n}","tryCatchPattern":null,"preventionTips":["Use bare column names — no quoting, no schema/table qualification","Rename or alias columns containing spaces or special characters","Look up the exact column names in the created table before writing order_key","Mirror the parser's regex check in your config pipeline"],"tags":["validation","iceberg","identifier","sql"],"backgroundTag":"invalid-identifier-format","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"}