{"record":{"id":"f37835e5481b2482","repo":"databendlabs/databend","slug":"aggregatemeta-does-not-support-exchanging-between","errorCode":null,"errorMessage":"AggregateMeta does not support exchanging between multiple nodes","messagePattern":"AggregateMeta does not support exchanging between multiple nodes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/service/src/pipelines/processors/transforms/aggregator/aggregate_meta.rs","lineNumber":296,"sourceCode":"    }\n\n    pub fn create_spilled(payloads: Vec<SpilledPayload>) -> BlockMetaInfoPtr {\n        Box::new(AggregateMeta::Spilled(payloads))\n    }\n\n    pub fn create_partitioned(bucket: Option<isize>, data: PartitionedData) -> BlockMetaInfoPtr {\n        Box::new(AggregateMeta::Partitioned { bucket, data })\n    }\n\n    pub fn into_datablock(self) -> DataBlock {\n        DataBlock::empty_with_meta(Box::new(self))\n    }\n}\n\nimpl serde::Serialize for AggregateMeta {\n    fn serialize<S>(&self, _: S) -> std::result::Result<S::Ok, S::Error>\n    where S: serde::Serializer {\n        unreachable!(\"AggregateMeta does not support exchanging between multiple nodes\")\n    }\n}\n\nimpl<'de> serde::Deserialize<'de> for AggregateMeta {\n    fn deserialize<D>(_: D) -> std::result::Result<Self, D::Error>\n    where D: serde::Deserializer<'de> {\n        unreachable!(\"AggregateMeta does not support exchanging between multiple nodes\")\n    }\n}\n\nimpl Debug for AggregateMeta {\n    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {\n        match self {\n            AggregateMeta::Partitioned { .. } => {\n                f.debug_struct(\"AggregateMeta::Partitioned\").finish()\n            }\n            AggregateMeta::Serialized { .. } => {\n                f.debug_struct(\"AggregateMeta::Serialized\").finish()","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/service/src/pipelines/processors/transforms/aggregator/aggregate_meta.rs#L278-L314","documentation":"`AggregateMeta` implements `serde::Serialize` solely to panic. Aggregate partial results are exchanged within a node via shared state, not serialized over the wire, so any attempt to serialize this metadata means an aggregate pipeline was (incorrectly) set up for cross-node data exchange.","triggerScenarios":"The distributed execution framework attempts to `serde::serialize` an `AggregateMeta` fragment, which only happens if an aggregation pipeline fragment is exchanged between cluster nodes.","commonSituations":"Distributed aggregation plan bugs where fragments containing AggregateMeta are routed to remote nodes instead of being kept local; cluster deployments exercising exchange paths that local runs never hit.","solutions":["Check the query plan (EXPLAIN) to see why aggregation fragments are exchanged across nodes instead of executed locally","Avoid the affected plan shape (e.g. adjust aggregation/exchange planning or query patterns) until fixed","Serialize AggregateMeta properly if cross-node exchange of partial aggregate state is required, or return an explicit error","Report with cluster topology and plan; this is a plan-exchange bug, not a user data problem"],"exampleFix":"// before\nfn serialize<S>(&self, _: S) -> Result<S::Ok, S::Error> {\n    unreachable!(\"AggregateMeta does not support exchanging between multiple nodes\")\n}\n// after\nfn serialize<S>(&self, _: S) -> Result<S::Ok, S::Error> {\n    Err(serde::ser::Error::custom(\"AggregateMeta does not support exchanging between multiple nodes\"))\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn is_exchangable<M: FragmentKind>(m: &M) -> bool { /* AggregateMeta must never be scheduled for cross-node exchange */ !m.requires_local_execution() }","tryCatchPattern":null,"preventionTips":["Never schedule pipeline fragments containing AggregateMeta for cross-node exchange","Add plan validation that rejects serializing aggregate fragments in cluster mode","Test distributed aggregation plans to confirm fragments stay local"],"tags":["rust","panic","aggregation","distributed"],"backgroundTag":"internal-invariant-violation","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"}