{"record":{"id":"59acf73c5d559123","repo":"databendlabs/databend","slug":"unions-are-not-supported","errorCode":null,"errorMessage":"unions are not supported","messagePattern":"unions are not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/ast/visit_derive/src/lib.rs","lineNumber":85,"sourceCode":"            #[automatically_derived]\n            impl #impl_generics crate::visit::Walk for #ident #ty_generics #where_clause {\n                fn walk<V: crate::visit::Visitor + ?Sized>(\n                    &self,\n                    visitor: &mut V,\n                ) -> std::result::Result<crate::visit::VisitControl<V::Break>, V::Error> {\n                    #walk_body\n                    Ok(crate::visit::VisitControl::Continue)\n                }\n            }\n        })\n    }\n}\n\nfn emit_walk_body(data: &Data, mutable: bool) -> syn::Result<TokenStream2> {\n    match data {\n        Data::Struct(data) => emit_struct_body(data, mutable),\n        Data::Enum(data) => emit_enum_body(data, mutable),\n        Data::Union(data) => Err(Error::new(\n            data.union_token.span(),\n            \"unions are not supported\",\n        )),\n    }\n}\n\nfn emit_struct_body(data: &DataStruct, mutable: bool) -> syn::Result<TokenStream2> {\n    let access = |member: TokenStream2| {\n        if mutable {\n            quote!(&mut self.#member)\n        } else {\n            quote!(&self.#member)\n        }\n    };\n\n    let stmts = match &data.fields {\n        Fields::Named(fields) => fields\n            .named","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/ast/visit_derive/src/lib.rs#L67-L103","documentation":"A compile-time guard in the derive macro's emit_walk_body: derive(Walk)/derive(WalkMut) can only be applied to structs and enums. This error fires when the macro is invoked on a syn::Data::Union, because there is no defined traversal order for union fields; the derive expansion fails at compile time.","triggerScenarios":"Thrown at src/query/ast/visit_derive/src/lib.rs:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Refactor the AST node to avoid union types in positions processed by the Walk/WalkMut derive, since emit_walk_body only handles structs and enums.","Implement Walk/WalkMut manually for the affected type instead of using the derive.","Restructure the union as an enum with tagged variants so the derive can enumerate cases."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}