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 arrow_flight protocol serializer when p->getSubclassKey(j) throws an nlohmann::json::parse_error — meaning the input JSON is malformed or the discriminator field cannot be extracted. The catch block augments the parse message with " ColumnHandle ColumnHandle" to indicate the failure occurred while resolving the ColumnHandle subclass discriminator.

Source

Thrown at presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.cpp:146

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

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

  throw TypeError(type + " no abstract type ColumnHandle ");
}
} // namespace facebook::presto::protocol::arrow_flight
namespace facebook::presto::protocol::arrow_flight {
ArrowTableLayoutHandle::ArrowTableLayoutHandle() noexcept {
  _type = "arrow-flight";
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Validate the JSON payload parses and contains the subclass discriminator field before deserializing
  2. Fix the producer so ColumnHandle JSON always includes the type key (e.g. "@type": "arrow-flight")
  3. Catch ParseError at the plan-ingest boundary and return a clear protocol error to the coordinator instead of crashing

Example fix

// before
std::shared_ptr<ColumnHandle> p;
from_json(maybeMalformedJson, p);
// after
if (!maybeMalformedJson.is_object() || !maybeMalformedJson.contains("@type")) {
  throw ParseError("ColumnHandle json missing @type discriminator");
}
from_json(maybeMalformedJson, p);
Defensive patterns

Strategy: validation

Validate before calling

// before from_json on a ColumnHandle
if (!j.is_object()) {
  throw ParseError("ColumnHandle json must be an object");
}

Try / catch

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

Prevention

When it happens

Trigger: Calling from_json on a json value that is not a valid object (or is truncated/invalid JSON) when deserializing a shared_ptr<ColumnHandle>, so getSubclassKey cannot read the type field.

Common situations: Corrupt or hand-edited plan/protocol JSON payloads; a producer writing the ColumnHandle JSON with a different schema (missing "@type"/"_type" field); truncation of large plans in transport or logs.

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