{"record":{"id":"cb0bb6c566134cb8","repo":"databendlabs/databend","slug":"unreachable-cb0bb6","errorCode":null,"errorMessage":"_ => unreachable!()","messagePattern":"_ => unreachable!\\(\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/service/src/pipelines/processors/transforms/new_hash_join/hash_join_factory.rs","lineNumber":302,"sourceCode":"                let anti_right_hash_join = AntiRightHashJoin::create(\n                    &self.ctx,\n                    self.function_ctx.clone(),\n                    self.hash_method.clone(),\n                    self.desc.clone(),\n                    self.create_basic_state(id)?,\n                )?;\n\n                Ok(Box::new(GraceHashJoin::create(\n                    self.ctx.clone(),\n                    self.function_ctx.clone(),\n                    self.hash_method.clone(),\n                    self.desc.clone(),\n                    self.create_grace_state(id + 1)?,\n                    anti_right_hash_join,\n                    0,\n                )?))\n            }\n            _ => unreachable!(),\n        }\n    }\n\n    /// Create a basic memory join (used internally by HybridHashJoin)\n    pub fn create_memory_join(\n        self: &Arc<Self>,\n        typ: JoinType,\n        level: usize,\n    ) -> Result<Box<dyn GraceMemoryJoin>> {\n        let basic_state = self.create_basic_state(level)?;\n        match typ {\n            JoinType::Inner => {\n                let settings = self.ctx.get_settings();\n                let nested_loop_desc = self\n                    .desc\n                    .create_nested_loop_desc(&settings, &self.function_ctx)?;\n\n                let inner = InnerHashJoin::create(","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/service/src/pipelines/processors/transforms/new_hash_join/hash_join_factory.rs#L284-L320","documentation":"HashJoinFactory::create_grace_join panics when the join type is not one of the nine explicitly handled JoinType variants (Inner, Left, LeftSemi, LeftAnti, Right, RightSemi, RightAnti, and cross/nested-loop variants). It is an internal exhaustiveness guard: grace join construction assumes the planner only produces supported join types.","triggerScenarios":"Calling HashJoinFactory::create_grace_join with a JoinType not covered by the match (e.g. a newly added JoinType variant, or a NestedLoop/Cross join passed into the grace-join path).","commonSituations":"Adding a new join type to the planner without extending the factory, constructing joins directly in tests with an exotic JoinType, or rebasing code where JoinType gained a variant.","solutions":["Inspect the JoinType value passed in and ensure create_grace_join is only called for grace-supported types","Add the missing JoinType arm to the match at hash_join_factory.rs:302 if the type should be supported","Route unsupported types (e.g. cross/nested-loop) to create_memory_join or the nested-loop executor instead","Add a compile-time exhaustiveness test or match on the enum without a wildcard arm"],"exampleFix":"// before\nmatch typ {\n    JoinType::Inner => { ... }\n    ...\n    JoinType::RightAnti => { ... }\n    _ => unreachable!(),\n}\n// after\nJoinType::Cross => return Err(ErrorCode::Unimplemented(\n    \"grace join does not support cross join\")),\n_ => unreachable!(),","handlingStrategy":"validation","validationCode":"debug_assert!(matches!(typ, JoinType::Inner | JoinType::Left | JoinType::LeftSemi | JoinType::LeftAnti | JoinType::Right | JoinType::RightSemi | JoinType::RightAnti), \"grace join unsupported type: {:?}\", typ);","typeGuard":"fn supports_grace_join(t: &JoinType) -> bool {\n    !matches!(t, JoinType::Cross)\n}","tryCatchPattern":null,"preventionTips":["Match JoinType without a wildcard so the compiler forces updates on new variants","Check JoinType dispatch coverage when adding join types to the planner","Prefer returning ErrorCode over unreachable!() at public factory boundaries","Add factory-level tests for every JoinType"],"tags":["rust","panic","hash-join","join-type"],"backgroundTag":"unsupported-enum-value","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}