{"record":{"id":"6a9686cb48b093bd","repo":"prestodb/presto","slug":"no-abstract-type-columnhandle-6a9686","errorCode":null,"errorMessage":" no abstract type ColumnHandle ","messagePattern":" no abstract type ColumnHandle ","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.cpp","lineNumber":109,"sourceCode":"      p.totalRows,\n      \"TpchPartitioningHandle\",\n      \"int64_t\",\n      \"totalRows\");\n}\n} // namespace facebook::presto::protocol::tpch\nnamespace facebook::presto::protocol::tpch {\nvoid to_json(json& j, const std::shared_ptr<ColumnHandle>& p) {\n  if (p == nullptr) {\n    return;\n  }\n  String type = p->_type;\n\n  if (type == \"tpch\") {\n    j = *std::static_pointer_cast<TpchColumnHandle>(p);\n    return;\n  }\n\n  throw TypeError(type + \" no abstract type ColumnHandle \");\n}\n\nvoid from_json(const json& j, std::shared_ptr<ColumnHandle>& p) {\n  String type;\n  try {\n    type = p->getSubclassKey(j);\n  } catch (json::parse_error& e) {\n    throw ParseError(std::string(e.what()) + \" ColumnHandle  ColumnHandle\");\n  }\n\n  if (type == \"tpch\") {\n    std::shared_ptr<TpchColumnHandle> k = std::make_shared<TpchColumnHandle>();\n    j.get_to(*k);\n    p = std::static_pointer_cast<ColumnHandle>(k);\n    return;\n  }\n\n  throw TypeError(type + \" no abstract type ColumnHandle \");","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.cpp#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: serializing a tpcds handle through the tpch serializer\nstd::shared_ptr<ColumnHandle> p = std::make_shared<TpcdsColumnHandle>();\nto_json(j, p); // -> TypeError: tpcds no abstract type ColumnHandle\n// after\nstd::shared_ptr<ColumnHandle> p = std::make_shared<TpchColumnHandle>();\nto_json(j, p);","handlingStrategy":"type-guard","validationCode":"if (auto* t = dynamic_cast<TpchColumnHandle*>(p.get()); !t) {\n  throw std::runtime_error(\"to_json(tpch) requires a TpchColumnHandle\");\n}","typeGuard":"bool isTpchColumnHandle(const std::shared_ptr<ColumnHandle>& p) {\n  return p && p->getSubclassKey(json::object()) == \"tpch\";\n}","tryCatchPattern":"try {\n  to_json(j, p);\n} catch (const facebook::presto::protocol::TypeError& e) {\n  LOG(ERROR) << \"Cannot serialize ColumnHandle: \" << e.what();\n  throw;\n}","preventionTips":["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"],"tags":["serialization","type-error","presto-protocol","column-handle","subclass-dispatch"],"backgroundTag":"unknown-subclass-type-discriminator","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}