prestodb/presto · error · TypeError
no abstract type ColumnHandle
Error message
no abstract type ColumnHandle
What it means
The to_json serializer for shared_ptr<ColumnHandle> dispatches on the handle's subclass key and only knows 'tpch'. If the runtime type discriminator is anything else (or the null/empty type of a default-constructed handle), serialization cannot proceed and a TypeError '<type> no abstract type ColumnHandle ' is thrown. Serialization is strict: unknown concrete types are never silently coerced.
Source
Thrown at presto-native-execution/presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.cpp:109
p.totalRows,
"TpchPartitioningHandle",
"int64_t",
"totalRows");
}
} // namespace facebook::presto::protocol::tpch
namespace facebook::presto::protocol::tpch {
void to_json(json& j, const std::shared_ptr<ColumnHandle>& p) {
if (p == nullptr) {
return;
}
String type = p->_type;
if (type == "tpch") {
j = *std::static_pointer_cast<TpchColumnHandle>(p);
return;
}
throw TypeError(type + " no abstract type ColumnHandle ");
}
void from_json(const json& j, std::shared_ptr<ColumnHandle>& p) {
String type;
try {
type = p->getSubclassKey(j);
} catch (json::parse_error& e) {
throw ParseError(std::string(e.what()) + " ColumnHandle ColumnHandle");
}
if (type == "tpch") {
std::shared_ptr<TpchColumnHandle> k = std::make_shared<TpchColumnHandle>();
j.get_to(*k);
p = std::static_pointer_cast<ColumnHandle>(k);
return;
}
throw TypeError(type + " no abstract type ColumnHandle ");View on GitHub (pinned to 55bb57d202)
Solutions
- Confirm the object passed to to_json is a TpchColumnHandle (or that its subclass key equals 'tpch')
- Add the missing 'if (type == "<newtype>")' branch in to_json for the new concrete handle in presto_protocol_tpch.cpp
- Ensure custom ColumnHandle subclasses implement getSubclassKey and initialize _type
- Link the correct connector protocol module for the connector whose handle you are serializing
Example fix
// before: serializing a tpcds handle through the tpch serializer std::shared_ptr<ColumnHandle> p = std::make_shared<TpcdsColumnHandle>(); to_json(j, p); // -> TypeError: tpcds no abstract type ColumnHandle // after std::shared_ptr<ColumnHandle> p = std::make_shared<TpchColumnHandle>(); to_json(j, p);
Defensive patterns
Strategy: type-guard
Validate before calling
if (auto* t = dynamic_cast<TpchColumnHandle*>(p.get()); !t) {
throw std::runtime_error("to_json(tpch) requires a TpchColumnHandle");
} Type guard
bool isTpchColumnHandle(const std::shared_ptr<ColumnHandle>& p) {
return p && p->getSubclassKey(json::object()) == "tpch";
} Try / catch
try {
to_json(j, p);
} catch (const facebook::presto::protocol::TypeError& e) {
LOG(ERROR) << "Cannot serialize ColumnHandle: " << e.what();
throw;
} Prevention
- Only pass handles whose subclass key matches the serializer module in use
- Implement getSubclassKey and initialize _type in every custom ColumnHandle
- Add serialization branches for every new concrete handle type
- Unit-test round-trip to_json/from_json for each handle type
When it happens
Trigger: Serializing a ColumnHandle whose getSubclassKey() returns a value other than 'tpch' — e.g. passing a TpcdsColumnHandle or a null/dispatch-failing handle into to_json for a tpch-registered protocol object, or serializing a handle whose subclass key field is uninitialized.
Common situations: Mixing connector handles across tpch/tpcds protocol translation units in tests or custom code; a custom ColumnHandle that does not override getSubclassKey; forgetting to register the new handle type in to_json's dispatch chain after adding a connector.
Related errors
- no abstract type FunctionHandle
- no abstract type RowExpression
- {type_error} {className} {typeName} {fieldName}
- ColumnHandle ColumnHandle
- ColumnHandle ColumnHandle
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/6a9686cb48b093bd.
Report an issue: GitHub.