Report.to_substrait()
The verified plan for any conforming Substrait consumer, with its
Usage
Report.to_substrait(self, format: Literal['json'] = 'json', shims: Literal['apply', 'annotate', 'refuse'] = 'apply') -> str
Report.to_substrait(self, format: Literal['binary'], shims: Literal['apply', 'annotate', 'refuse'] = 'apply') -> bytescontract as metadata (#664).
Every function call names its YAML’s URN, its compound name and its output type (Substrait 0.106). Every option the proof depends on (depends) is pinned in the call’s options at the reference’s behaviour. Where Substrait has no option for a choice the proof uses (a spec gap, upstream/bugs/ST-*.json), shims decides: "apply" rewrites the plan into well-specified Substrait, "annotate" keeps it and records the choice in the metadata as an assumption the consumer must honour, and "refuse" refuses the export. A gap where the reference raises needs no shim in any mode: the preconditions, which travel with the plan, rule those inputs out.
The contract travels in the plan’s advanced_extensions as an io.sverify.substrait.v1.Contract: requires (declared, inferred and assumed) and ensures, each in your terms and as a Substrait plan, and a manifest (the profile, the pinned options, the shims and assumptions, the observation the result holds up to, the Substrait version and extension URNs, sverify’s version). sv.Report.from_substrait reads it back and proves the contract again.
Parameters
format: Literal["json", "binary"] = "json"-
"json"(protobuf JSON, a string) or"binary"(the serializedsubstrait.Plan). shims: Literal["apply", "annotate", "refuse"] = "apply"- What to do at a spec gap the proof depends on.
Returns
str | bytes- The plan, as protobuf JSON or bytes.
Raises
sverify.errors.ExportError- The report is not proved, or the plan has no conforming Substrait form that keeps the proof; the message names the reason and the gap.