prestodb/presto · error · ParseError

ColumnHandle ColumnHandle

Error message

 ColumnHandle  ColumnHandle

What it means

from_json for shared_ptr<ColumnHandle> in the tpch connector module extracts the subclass key with getSubclassKey; a nlohmann json::parse_error raised there is converted into a protocol ParseError with the message suffix ' ColumnHandle ColumnHandle'. It signals the incoming JSON for a ColumnHandle is structurally invalid before any tpch dispatch can happen.

Source

Thrown at presto-native-execution/presto_cpp/presto_protocol/connector/tpch/presto_protocol_tpch.cpp:117

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

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

  throw TypeError(type + " no abstract type ColumnHandle ");
}
} // namespace facebook::presto::protocol::tpch
namespace facebook::presto::protocol::tpch {
TpchTableHandle::TpchTableHandle() noexcept {
  _type = "tpch";
}

void to_json(json& j, const TpchTableHandle& p) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Capture and validate the raw JSON payload with a parser/linter to locate the malformed section
  2. Check coordinator and native worker versions agree on ColumnHandle wire format
  3. Ensure the producer always emits the '_type' discriminator inside a well-formed JSON object
  4. Catch ParseError at the deserialization boundary and log the offending fragment for triage

Example fix

// before: malformed payload
from_json(json::parse("{\"_type\": tpch}"), columnHandle); // invalid JSON literal
// after: validate before deserializing
json j = json::parse(payload);
if (!j.is_object() || !j.contains("_type")) {
  throw std::runtime_error("Invalid ColumnHandle json: " + payload);
}
from_json(j, columnHandle);
Defensive patterns

Strategy: try-catch

Validate before calling

json j = json::parse(payload);
if (!j.is_object() || !j.contains("_type") || !j["_type"].is_string()) {
  throw std::runtime_error("ColumnHandle json missing valid _type");
}

Type guard

bool isDeserializableColumnHandle(const json& j) {
  return j.is_object() && j.contains("_type") && j["_type"].is_string();
}

Try / catch

try {
  facebook::presto::protocol::tpch::from_json(j, columnHandle);
} catch (const facebook::presto::protocol::ParseError& e) {
  LOG(ERROR) << "tpch ColumnHandle parse failed: " << e.what() << " payload=" << j.dump();
  throw;
}

Prevention

When it happens

Trigger: Deserializing a plan/split payload where the ColumnHandle JSON is malformed — non-object input, corrupted bytes, or an unexpected schema that makes getSubclassKey's json access throw parse_error — inside facebook::presto::protocol::tpch::from_json.

Common situations: Truncated HTTP task-update bodies from the coordinator; JSON produced by an incompatible coordinator version; manually constructed protocol JSON in tests with wrong nesting.

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/e43d2094247ce122. Report an issue: GitHub.