prestodb/presto · error · TypeError

no abstract type ExecutionWriterTarget

Error message

{type} no abstract type ExecutionWriterTarget 

What it means

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.

Solutions

  1. Check the type value in the error message and confirm which writer target kind it is.
  2. Upgrade presto-native-execution to a version registering that writer target type.
  3. Avoid/feature-gate the query feature (e.g. new merge/refresh semantics) until the native side supports it.
  4. Add the missing if (type == "...") branch to the ExecutionWriterTarget to_json dispatch.

Example fix

// before: only Create/Insert/Delete/Merge handles handled; new "RefreshHandle" target fails
// after:
// if (type == "RefreshHandle") {
//   j = *std::static_pointer_cast<RefreshHandle>(p);
//   return;
// }
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check writer target kind before serialization
bool isRegisteredWriterTarget(const facebook::presto::protocol::ExecutionWriterTarget& t) {
  static const std::set<std::string> kTypes = {"CreateHandle", "InsertHandle", "DeleteHandle", "MergeHandle"};
  return kTypes.count(t.getType()) > 0; // or the subclass key accessor
}

Type guard

bool isMergeHandle(const std::shared_ptr<facebook::presto::protocol::ExecutionWriterTarget>& p) {
  return dynamic_cast<facebook::presto::protocol::MergeHandle*>(p.get()) != nullptr;
}

Try / catch

try {
  to_json(j, writerTarget);
} catch (const facebook::presto::protocol::TypeError& e) {
  LOG(ERROR) << "Unsupported ExecutionWriterTarget: " << e.what();
  // disable the write feature or upgrade the native build
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/ad795d7a3f4afaf6. Report an issue: GitHub.

Appendix: source

Thrown at presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp:2422

  }
  if (type == "DeleteHandle") {
    j = *std::static_pointer_cast<DeleteHandle>(p);
    return;
  }
  if (type == "UpdateHandle") {
    j = *std::static_pointer_cast<UpdateHandle>(p);
    return;
  }
  if (type == "ExecuteProcedureHandle") {
    j = *std::static_pointer_cast<ExecuteProcedureHandle>(p);
    return;
  }
  if (type == "MergeHandle") {
    j = *std::static_pointer_cast<MergeHandle>(p);
    return;
  }

  throw TypeError(type + " no abstract type ExecutionWriterTarget ");
}

void from_json(const json& j, std::shared_ptr<ExecutionWriterTarget>& p) {
  String type;
  try {
    type = p->getSubclassKey(j);
  } catch (json::parse_error& e) {
    throw ParseError(
        std::string(e.what()) +
        " ExecutionWriterTarget  ExecutionWriterTarget");
  }

  if (type == "CreateHandle") {
    std::shared_ptr<CreateHandle> k = std::make_shared<CreateHandle>();
    j.get_to(*k);
    p = std::static_pointer_cast<ExecutionWriterTarget>(k);
    return;
  }

View on GitHub (pinned to 55bb57d202)