prestodb/presto · error · TypeError

no abstract type ColumnHandle

Error message

 no abstract type ColumnHandle 

What it means

This TypeError is thrown by the to_json overload for std::shared_ptr<ColumnHandle> in the tpcds protocol serializer, which only serializes TpcdsColumnHandle handles tagged "tpcds". Any other discriminator falls through to the throw stating the abstract ColumnHandle type has no mapping for the given type string.

Source

Thrown at presto-native-execution/presto_cpp/presto_protocol/connector/tpcds/presto_protocol_tpcds.cpp:110

      p.totalRows,
      "TpcdsPartitioningHandle",
      "int64_t",
      "totalRows");
}
} // namespace facebook::presto::protocol::tpcds
namespace facebook::presto::protocol::tpcds {
void to_json(json& j, const std::shared_ptr<ColumnHandle>& p) {
  if (p == nullptr) {
    return;
  }
  String type = p->_type;

  if (type == "tpcds") {
    j = *std::static_pointer_cast<TpcdsColumnHandle>(p);
    return;
  }

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

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

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

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure the handle is a TpcdsColumnHandle with _type == "tpcds" before serializing in the tpcds layer
  2. Populate the subclass key correctly at handle construction
  3. Add the corresponding to_json branch in presto_protocol_tpcds.cpp if a new tag must serialize

Example fix

// before
to_json(j, handle); // handle _type == "hive" -> TypeError in tpcds layer
// after
auto tpcds = std::dynamic_pointer_cast<TpcdsColumnHandle>(handle);
if (!tpcds) {
  throw TypeError("expected TpcdsColumnHandle for tpcds serialization");
}
to_json(j, std::static_pointer_cast<ColumnHandle>(tpcds));
Defensive patterns

Strategy: type-guard

Validate before calling

std::string tag = handle->getType();
if (tag != "tpcds") {
  throw TypeError("cannot serialize " + tag + " ColumnHandle via tpcds protocol");
}

Type guard

bool isTpcdsColumnHandle(const std::shared_ptr<ColumnHandle>& p) {
  return std::dynamic_pointer_cast<TpcdsColumnHandle>(p) != nullptr;
}

Try / catch

try {
  to_json(j, columnHandle);
} catch (const TypeError& e) {
  LOG(ERROR) << "Tpcds ColumnHandle serialization failed: " << e.what();
  throw;
}

Prevention

When it happens

Trigger: Calling to_json on a shared_ptr<ColumnHandle> whose getSubclassKey() is not "tpcds" — e.g. a HiveColumnHandle or ArrowColumnHandle routed through presto_protocol_tpcds.cpp's serializer.

Common situations: TPC-DS benchmark plans accidentally mixing production connector handles; test fixtures reusing handles from other connectors; subclass key never set on hand-constructed handles.

Related errors


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