{"record":{"id":"f304c515d25aa076","repo":"risingwavelabs/risingwave","slug":"source-has-no-unaligned-join","errorCode":null,"errorMessage":"source has no unaligned_join","messagePattern":"source has no unaligned_join","errorType":"error_code","errorClass":"NotSupported","httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/alter_streaming_enable_unaligned_join.rs","lineNumber":42,"sourceCode":"pub async fn handle_alter_streaming_enable_unaligned_join(\n    handler_args: HandlerArgs,\n    name: ObjectName,\n    enable: bool,\n) -> Result<RwPgResponse> {\n    if cfg!(debug_assertions) {\n        let session = handler_args.session.clone();\n        let job_id = {\n            let mut binder = Binder::new_for_system(&session);\n            Binder::validate_cross_db_reference(&session.database(), &name)?;\n            let not_found_err = CatalogError::not_found(\"stream job\", name.to_string());\n\n            if let Ok(relation) = binder.bind_catalog_relation_by_object_name(&name, true) {\n                match relation {\n                    Relation::Source(s) => {\n                        if s.is_shared() {\n                            s.catalog.id.as_share_source_job_id()\n                        } else {\n                            bail!(ErrorCode::NotSupported(\n                                \"source has no unaligned_join\".to_owned(),\n                                \"Please only target materialized views or sinks\".to_owned(),\n                            ));\n                        }\n                    }\n                    Relation::BaseTable(t) => t.table_catalog.id.as_job_id(),\n                    Relation::SystemTable(_t) => {\n                        bail!(ErrorCode::NotSupported(\n                            \"system table has no unaligned_join\".to_owned(),\n                            \"Please only target materialized views or sinks\".to_owned(),\n                        ));\n                    }\n                    Relation::Share(_s) => {\n                        bail!(ErrorCode::NotSupported(\n                            \"view has no unaligned_join\".to_owned(),\n                            \"Please only target materialized views or sinks\".to_owned(),\n                        ));\n                    }","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/alter_streaming_enable_unaligned_join.rs#L24-L60","documentation":"This is a deliberate `NotSupported` error raised by `handle_alter_streaming_enable_unaligned_join` when the ALTER ... SET UNALIGNED JOIN target is a shared source rather than a materialized view or sink. Only streaming jobs (MV/sink/table jobs) have fragment-level unaligned join support; a source relation has no such streaming fragments, so the command bails with \"source has no unaligned_join\".","triggerScenarios":"Executing `ALTER SOURCE ... SET UNALIGNED JOIN` (or the equivalent handler path) on a source; specifically a shared source (`is_shared()`) whose id resolves to a shared-source job id instead of a stream job id.","commonSituations":"Operators applying an unaligned-join tuning command across all relations in a script without filtering relation types; confusion between sources (ingestion definitions) and materialized views (streaming compute jobs) when enabling the unaligned join feature.","solutions":["Target a materialized view or sink instead: `ALTER MATERIALIZED VIEW mv_name SET ...` / the corresponding sink command.","Check the relation type first with `SHOW MATERIALIZED VIEWS` / `SHOW SOURCES` before issuing the ALTER.","If you intended to alter the MV that reads from the source, use the MV's name, not the source's.","Remove the command for sources in automation scripts (filter to MVs/sinks only)."],"exampleFix":"-- before\nALTER SOURCE my_source SET UNALIGNED JOIN ...;\n-- after\nALTER MATERIALIZED VIEW my_mv SET UNALIGNED JOIN ...;","handlingStrategy":"validation","validationCode":"-- verify the target is an MV or sink before running the unaligned-join ALTER\nSELECT name FROM rw_catalog.rw_materialized_views WHERE name = 'target';","typeGuard":null,"tryCatchPattern":"// caller side\nmatch run_alter_unaligned_join(target) {\n    Err(e) if e.to_string().contains(\"no unaligned_join\") => {\n        // skip non-MV/sink relations or rewrite command for the owning MV\n    }\n    other => other?,\n}","preventionTips":["Filter automation scripts to materialized views and sinks when tuning unaligned join.","Check relation type in rw_catalog before issuing ALTER commands.","Document that sources define ingestion only and carry no join fragments.","Use consistent naming conventions (e.g. mv_*, sink_*) so operators pick the right object type."],"tags":["not-supported","unaligned-join","alter","risingwave"],"backgroundTag":"unsupported-operation","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"}