databendlabs/databend · error
Unsupported column type for encoding
Error message
Unsupported column type for encoding
What it means
This is a catch-all panic in the sort-row encoding visitor: `visit_typed_column` is the default visitor method that every concrete ValueType must override. It is hit when the encoding logic encounters a column type whose ValueType visitor did not implement typed-column conversion, so the framework aborts with `unimplemented!` instead of silently producing wrong sort keys.
Solutions
- Check which data type the failing query sorts on and confirm whether its ValueType visitor implements visit_typed_column in src/query/pipeline/transforms/src/processors/transforms/sorts/core/row_convert/
- Implement visit_typed_column for that ValueType, encoding the column into the variable-length sort row
- Work around in SQL by casting the column to a supported sortable type (e.g. CAST(variant_col AS VARCHAR)) before ORDER BY
- File a Databend issue with the query and data type if the type should be supported
Example fix
// before (visitor for MyType falls through to default)
// ... no visit_typed_column impl ...
// after
fn visit_typed_column(&mut self, column: MyTypeColumn, data_type: &DataType) -> Result<()> {
self.builder.push(my_type_sort_key(column), data_type)
} Defensive patterns
Strategy: validation
Validate before calling
const SORTABLE_ENCODABLE_TYPES = ["Nullable","String","Number","Date","Timestamp","Decimal"];
function isSortEncodable(colType) {
return SORTABLE_ENCODABLE_TYPES.some(t => colType.startsWith(t)) ||
!/^(variant|map|array|tuple|geography|geometry)$/i.test(colType.replace(/^nullable\((.*)\)$/, "$1"));
}
if (!isSortEncodable(column.dataType)) {
column.query = `CAST(${column.name} AS VARCHAR)`;
} Type guard
function isVariantLike(dataType) {
const base = dataType.replace(/^Nullable\((.*)\)$/, "$1").toLowerCase();
return ["variant","map","object"].includes(base);
} Prevention
- Restrict ORDER BY / sort keys to primitive types; cast VARIANT/MAP columns to VARCHAR before sorting
- When adding a new ValueType in Databend, always override visit_typed_column rather than relying on the default
- Keep a test that sorts every supported data type to catch unimplemented encoder paths early
When it happens
Trigger: Sorting (ORDER BY / top-k) over a column whose data type's ValueType<T> does not override `visit_typed_column` in `row_convert/variable.rs`, e.g. a newly added or unusual type (map, variant, exotic nested types) reaching the variable-length row encoder.
Common situations: Running ORDER BY on an exotic column type (e.g. VARIANT, MAP, or a newly supported type) that the sort key encoder hasn't been extended for; adding a new data type in the query engine without updating the sort row converters.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported column type for encoding
- Unsupported column type for length calculation
- Unsupported format for
- Unsupported source type. Expected path, pandas.DataFrame…
- Access denied: is outside allowed directories
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/2f3bf2eefa3a2d46.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/pipeline/transforms/src/processors/transforms/sorts/core/row_convert/variable.rs:798
}
fn visit_variant(&mut self, column: BinaryColumn) -> Result<()> {
var_encode(
self.out,
column.iter(),
self.validity,
self.field.asc,
self.field.nulls_first,
);
Ok(())
}
fn visit_typed_column<T: ValueType>(
&mut self,
_column: T::Column,
_data_type: &DataType,
) -> Result<()> {
unimplemented!("Unsupported column type for encoding")
}
}
#[cfg(test)]
mod tests {
use databend_common_base::base::OrderedFloat;
use databend_common_expression::Column;
use databend_common_expression::DataField;
use databend_common_expression::DataSchemaRefExt;
use databend_common_expression::FromData;
use databend_common_expression::SortColumnDescription;
use databend_common_expression::SortField;
use databend_common_expression::types::*;
use jsonb::OwnedJsonb;
use proptest::prelude::*;
use proptest::strategy::ValueTree;
use proptest::test_runner::TestRunner;View on GitHub (pinned to 288d84d76e)