{"record":{"id":"f5d590ae102bb654","repo":"databendlabs/databend","slug":"unsupported-column-type-for-encoding","errorCode":null,"errorMessage":"Unsupported column type for encoding","messagePattern":"Unsupported column type for encoding","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/pipeline/transforms/src/processors/transforms/sorts/core/row_convert/fixed.rs","lineNumber":460,"sourceCode":"    fn visit_interval(&mut self, buffer: Buffer<months_days_micros>) -> Result<()> {\n        let buffer_bytes = buffer_to_bytes(self.buffer);\n        fixed_encode(\n            buffer_bytes,\n            self.offsets,\n            buffer,\n            self.validity,\n            self.field.asc,\n            self.field.nulls_first,\n        );\n        Ok(())\n    }\n\n    fn visit_typed_column<T: ValueType>(\n        &mut self,\n        _column: T::Column,\n        _data_type: &DataType,\n    ) -> Result<()> {\n        unimplemented!(\"Unsupported column type for encoding\")\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use std::sync::Arc;\n\n    use databend_common_expression::DataField;\n    use databend_common_expression::DataSchemaRef;\n    use databend_common_expression::DataSchemaRefExt;\n    use databend_common_expression::SortColumnDescription;\n    use databend_common_expression::SortField;\n    use proptest::prelude::*;\n    use proptest::strategy::Strategy;\n    use proptest::strategy::ValueTree;\n    use proptest::test_runner::TestRunner;\n\n    use super::super::test_util::*;","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/pipeline/transforms/src/processors/transforms/sorts/core/row_convert/fixed.rs#L442-L478","documentation":"The sort row-encoding fixed-size visitor encodes columns into fixed-width sort keys. Its default visit_typed_column arm raises unimplemented!(\"Unsupported column type for encoding\") for column types that cannot be represented as fixed-size rows. Sorting (ORDER BY / top-N) on such a column type via the fixed encoder is not supported.","triggerScenarios":"A query sorts by, or uses in a sort key, a column whose type the fixed-size row encoder lacks an arm for (e.g. complex/nested or large types that must use the variable encoder).","commonSituations":"ORDER BY on unusual types (arrays, maps, variants, bitmaps) reaching the fixed encoder; optimizer choosing fixed encoding for a newly added data type; window functions sorting over unsupported columns.","solutions":["Cast the sort column to a supported comparable type (e.g. VARCHAR for variant, or sort by an extracted scalar)","Sort by a simpler expression/key (e.g. a numeric or string column) instead of the nested type","Upgrade Databend if the type is standard — encoder coverage grows over releases","Implement the missing type arm in the fixed encoder if you maintain the code, or route it to the variable encoder"],"exampleFix":"// before\nSELECT * FROM t ORDER BY json_col;\n// after\nSELECT * FROM t ORDER BY json_col::string;","handlingStrategy":"validation","validationCode":"-- sql: verify sort keys are encoder-friendly scalar types\nSELECT data_type FROM information_schema.columns\nWHERE table_name = 't' AND column_name IN ('sort_col');\n-- prefer Integer/Float/String/Date/Timestamp types for ORDER BY","typeGuard":"fn sortable_fixed_type(ty: &DataType) -> bool {\n    matches!(ty, DataType::Number(_) | DataType::String | DataType::Date\n        | DataType::Timestamp | DataType::Boolean | DataType::Nullable(box inner)\n        if matches!(**inner, DataType::Number(_) | DataType::String))\n        || matches!(ty, DataType::Number(_) | DataType::String | DataType::Date | DataType::Timestamp | DataType::Boolean)\n}","tryCatchPattern":null,"preventionTips":["Cast nested/complex types to strings or scalars before ORDER BY","Sort on extracted fields rather than whole variant/map/array values","Review release notes for sorter type-coverage before relying on new types in sort keys"],"tags":["rust","panic","sort","row-encoding","unsupported-type"],"backgroundTag":"method-not-implemented","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"}