Skip to content

An unrecognized Hint.ComputationType aborts the whole plan import #1071

Description

@nielspardon

Hint.ComputationType.fromProto scans values() and throws IllegalArgumentException on any proto value it does not recognise, including UNRECOGNIZED (core/src/main/java/io/substrait/hint/Hint.java:87-93).

It is reachable from plan deserialization — ProtoRelConverter.optionalHint calls it for every loaded and saved computation (core/src/main/java/io/substrait/relation/ProtoRelConverter.java:1591 and :1599) — so a hint written by a producer built against a newer spec aborts the entire plan import.

That is a heavy failure mode for hints specifically, since they are defined as non-semantic metadata a consumer is free to ignore. The enum already has a natural degrade target: COMPUTATION_TYPE_UNKNOWN.

Suggested fix: have ComputationType.fromProto fall back to COMPUTATION_TYPE_UNKNOWN instead of throwing.

Note this is deliberately not a blanket argument against the fromProto-throws convention used by the other POJO enums (Set.SetOp, Join.JoinType, …) — those map semantically meaningful values where failing loudly is right. Hints are the case where forward compatibility should win.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorePull requests that update java code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions