prestodb/presto · error · ParseError

ColumnHandle ColumnHandle

Error message

 ColumnHandle  ColumnHandle

What it means

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.

Source

Thrown at presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp:1567

  if (p == nullptr) {
    return;
  }
  String type = p->_type;

  if (type == "hive") {
    j = *std::static_pointer_cast<HiveColumnHandle>(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 == "hive") {
    std::shared_ptr<HiveColumnHandle> k = std::make_shared<HiveColumnHandle>();
    j.get_to(*k);
    p = std::static_pointer_cast<ColumnHandle>(k);
    return;
  }

  throw TypeError(type + " no abstract type ColumnHandle ");
}
} // namespace facebook::presto::protocol::hive
namespace facebook::presto::protocol::hive {

void to_json(json& j, const TableToPartitionMapping& p) {
  j = json::object();
  to_json_key(
      j,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Validate that the JSON is a well-formed object containing the discriminator before deserialization
  2. Ensure the coordinator produces complete HiveColumnHandle JSON including the type key
  3. Wrap plan ingestion in ParseError handling and surface a structured error instead of propagating raw parse output

Example fix

// before
from_json(rawJson, columnHandle); // rawJson malformed -> ParseError
// after
try {
  from_json(json::parse(rawJsonString), columnHandle);
} catch (const json::parse_error& e) {
  throw ParseError(std::string("invalid ColumnHandle json: ") + e.what());
}
Defensive patterns

Strategy: validation

Validate before calling

if (!j.is_object()) {
  throw ParseError("hive ColumnHandle json must be an object");
}

Try / catch

try {
  from_json(j, columnHandle);
} catch (const ParseError& e) {
  LOG(ERROR) << "Malformed hive ColumnHandle json: " << e.what();
  throw;
}

Prevention

When it happens

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

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

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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