{"record":{"id":"54b286c1b1ee2691","repo":"prestodb/presto","slug":"no-abstract-type-columnhandle-54b286","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/hive/presto_protocol_hive.cpp","lineNumber":1559,"sourceCode":"      \"List<HiveType>\",\n      \"hiveTypes\");\n  from_json_key(\n      j, \"types\", p.types, \"HivePartitioningHandle\", \"List<Type>\", \"types\");\n}\n} // namespace facebook::presto::protocol::hive\nnamespace facebook::presto::protocol::hive {\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 == \"hive\") {\n    j = *std::static_pointer_cast<HiveColumnHandle>(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 == \"hive\") {\n    std::shared_ptr<HiveColumnHandle> k = std::make_shared<HiveColumnHandle>();\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":1541,"sourceCodeEnd":1577,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp#L1541-L1577","documentation":"This TypeError comes from the to_json overload for std::shared_ptr<ColumnHandle> in the hive protocol serializer. Serialization dispatches on the handle's subclass key; only \"hive\" (HiveColumnHandle) is handled. Any other discriminator reaches the fallthrough throw, indicating a non-Hive ColumnHandle was serialized through the Hive protocol layer.","triggerScenarios":"Calling to_json on a shared_ptr<ColumnHandle> whose getSubclassKey() is not \"hive\" — e.g. an ArrowFlightColumnHandle or TpcdsColumnHandle passed into presto_protocol_hive.cpp's serializer.","commonSituations":"Using a Hive table scan plan with handles produced by another connector; copies of plans where _type was not preserved; tests constructing base ColumnHandle mocks without setting the discriminator.","solutions":["Make sure the handle is a HiveColumnHandle with _type == \"hive\" before serializing in the hive layer","Fix handle construction so the subclass key is populated","Add a to_json branch for the actual tag if hive layer legitimately needs to serialize other handles"],"exampleFix":"// before\nto_json(j, std::static_pointer_cast<ColumnHandle>(tpcdsHandle)); // hive to_json -> TypeError\n// after\nauto hive = std::dynamic_pointer_cast<HiveColumnHandle>(handle);\nif (!hive) {\n  throw TypeError(\"expected HiveColumnHandle for hive protocol serialization\");\n}\nto_json(j, std::static_pointer_cast<ColumnHandle>(hive));","handlingStrategy":"type-guard","validationCode":"std::string tag = handle->getType();\nif (tag != \"hive\") {\n  throw TypeError(\"cannot serialize \" + tag + \" ColumnHandle via hive protocol\");\n}","typeGuard":"bool isHiveColumnHandle(const std::shared_ptr<ColumnHandle>& p) {\n  return std::dynamic_pointer_cast<HiveColumnHandle>(p) != nullptr;\n}","tryCatchPattern":"try {\n  to_json(j, columnHandle);\n} catch (const TypeError& e) {\n  LOG(ERROR) << \"Hive ColumnHandle serialization failed: \" << e.what();\n  throw;\n}","preventionTips":["Verify handle provenance before serializing in the hive layer","Round-trip test all handle subclasses in CI","Set _type in every HiveColumnHandle constructor","Fail fast with a clear message when a foreign handle reaches the connector layer"],"tags":["json-serialization","polymorphic-dispatch","hive"],"backgroundTag":"unknown-polymorphic-subtype","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"}