{"record":{"id":"fe10a50ad81d56c0","repo":"prestodb/presto","slug":"columnhandle-columnhandle-fe10a5","errorCode":null,"errorMessage":" ColumnHandle  ColumnHandle","messagePattern":" ColumnHandle  ColumnHandle","errorType":"exception","errorClass":"ParseError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp","lineNumber":1567,"sourceCode":"  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 \");\n}\n} // namespace facebook::presto::protocol::hive\nnamespace facebook::presto::protocol::hive {\n\nvoid to_json(json& j, const TableToPartitionMapping& p) {\n  j = json::object();\n  to_json_key(\n      j,","sourceCodeStart":1549,"sourceCodeEnd":1585,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp#L1549-L1585","documentation":"This ParseError is thrown by from_json for std::shared_ptr<ColumnHandle> in the hive protocol serializer when getSubclassKey(j) raises an nlohmann::json::parse_error while extracting the subclass discriminator. The message appends \" ColumnHandle  ColumnHandle\" to flag that the ColumnHandle polymorphic deserialization failed at the parse stage.","triggerScenarios":"Passing invalid JSON (non-object, malformed, or truncated) into the hive layer's ColumnHandle from_json so that reading the discriminator field throws a parse error.","commonSituations":"Damaged serialized plans from a coordinator; JSON produced by an older/other version lacking the expected type field; logs or configs edited by hand and fed back into deserialization.","solutions":["Validate that the JSON is a well-formed object containing the discriminator before deserialization","Ensure the coordinator produces complete HiveColumnHandle JSON including the type key","Wrap plan ingestion in ParseError handling and surface a structured error instead of propagating raw parse output"],"exampleFix":"// before\nfrom_json(rawJson, columnHandle); // rawJson malformed -> ParseError\n// after\ntry {\n  from_json(json::parse(rawJsonString), columnHandle);\n} catch (const json::parse_error& e) {\n  throw ParseError(std::string(\"invalid ColumnHandle json: \") + e.what());\n}","handlingStrategy":"validation","validationCode":"if (!j.is_object()) {\n  throw ParseError(\"hive ColumnHandle json must be an object\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  from_json(j, columnHandle);\n} catch (const ParseError& e) {\n  LOG(ERROR) << \"Malformed hive ColumnHandle json: \" << e.what();\n  throw;\n}","preventionTips":["Check JSON integrity (checksums/lengths) when plans cross process boundaries","Ensure the coordinator emits complete hive handle JSON including the discriminator","Guard ingestion with a parse-error handler that returns a protocol error","Add regression tests with malformed payloads"],"tags":["json-parse","deserialization","hive"],"backgroundTag":"json-parse-error","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}