{"record":{"id":"ad795d7a3f4afaf6","repo":"prestodb/presto","slug":"type-no-abstract-type-executionwritertarget","errorCode":null,"errorMessage":"{type} no abstract type ExecutionWriterTarget ","messagePattern":"(.+?) no abstract type ExecutionWriterTarget ","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp","lineNumber":2422,"sourceCode":"  }\n  if (type == \"DeleteHandle\") {\n    j = *std::static_pointer_cast<DeleteHandle>(p);\n    return;\n  }\n  if (type == \"UpdateHandle\") {\n    j = *std::static_pointer_cast<UpdateHandle>(p);\n    return;\n  }\n  if (type == \"ExecuteProcedureHandle\") {\n    j = *std::static_pointer_cast<ExecuteProcedureHandle>(p);\n    return;\n  }\n  if (type == \"MergeHandle\") {\n    j = *std::static_pointer_cast<MergeHandle>(p);\n    return;\n  }\n\n  throw TypeError(type + \" no abstract type ExecutionWriterTarget \");\n}\n\nvoid from_json(const json& j, std::shared_ptr<ExecutionWriterTarget>& p) {\n  String type;\n  try {\n    type = p->getSubclassKey(j);\n  } catch (json::parse_error& e) {\n    throw ParseError(\n        std::string(e.what()) +\n        \" ExecutionWriterTarget  ExecutionWriterTarget\");\n  }\n\n  if (type == \"CreateHandle\") {\n    std::shared_ptr<CreateHandle> k = std::make_shared<CreateHandle>();\n    j.get_to(*k);\n    p = std::static_pointer_cast<ExecutionWriterTarget>(k);\n    return;\n  }","sourceCodeStart":2404,"sourceCodeEnd":2440,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp#L2404-L2440","documentation":"to_json for std::shared_ptr<ExecutionWriterTarget> serializes a polymorphic writer target by dispatching on its subclass key; supported kinds include CreateHandle, InsertHandle, DeleteHandle, and MergeHandle (shown above the throw). If the in-memory target's key matches none of these branches, the serializer throws TypeError(type + \" no abstract type ExecutionWriterTarget\"). This means the writer operation's target type is not recognized by this protocol build.","triggerScenarios":"Serializing an ExecutionWriterTarget whose subclass key is not CreateHandle/InsertHandle/DeleteHandle/MergeHandle — e.g. a newly introduced writer target from a newer coordinator, or a custom/extension target used with an unpatched native build.","commonSituations":"Version skew where the Java side added a new writer operation (new target handle kind) absent from the native library; forks adding custom writer targets; test code constructing ExecutionWriterTarget subclasses without setting the expected _type key.","solutions":["Check the type value in the error message and confirm which writer target kind it is.","Upgrade presto-native-execution to a version registering that writer target type.","Avoid/feature-gate the query feature (e.g. new merge/refresh semantics) until the native side supports it.","Add the missing if (type == \"...\") branch to the ExecutionWriterTarget to_json dispatch."],"exampleFix":"// before: only Create/Insert/Delete/Merge handles handled; new \"RefreshHandle\" target fails\n// after:\n// if (type == \"RefreshHandle\") {\n//   j = *std::static_pointer_cast<RefreshHandle>(p);\n//   return;\n// }","handlingStrategy":"try-catch","validationCode":"// Pre-check writer target kind before serialization\nbool isRegisteredWriterTarget(const facebook::presto::protocol::ExecutionWriterTarget& t) {\n  static const std::set<std::string> kTypes = {\"CreateHandle\", \"InsertHandle\", \"DeleteHandle\", \"MergeHandle\"};\n  return kTypes.count(t.getType()) > 0; // or the subclass key accessor\n}","typeGuard":"bool isMergeHandle(const std::shared_ptr<facebook::presto::protocol::ExecutionWriterTarget>& p) {\n  return dynamic_cast<facebook::presto::protocol::MergeHandle*>(p.get()) != nullptr;\n}","tryCatchPattern":"try {\n  to_json(j, writerTarget);\n} catch (const facebook::presto::protocol::TypeError& e) {\n  LOG(ERROR) << \"Unsupported ExecutionWriterTarget: \" << e.what();\n  // disable the write feature or upgrade the native build\n}","preventionTips":["Upgrade native builds before enabling new coordinator write features.","Keep the to_json dispatch chain covered by unit tests for every target type.","Gate fork/extension-specific targets behind capability checks.","Assert _type values in fixtures match registered keys."],"tags":["json-serialization","polymorphic-type","presto-native","writer-target"],"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"}