Crate substrait_validator

Source
Expand description

Crate for validating Substrait.

§Usage

The usage pattern is roughly as follows.

  1. Build a Config structure to configure the validator. You can also just use std::default::Default if you don’t need to configure anything, but you might want to at least call Config::add_curl_uri_resolver() (if you’re using the curl feature).
  2. Parse the incoming substrait.Plan message using parse() or validate(). This creates a ParseResult, containing a tree structure corresponding to the query plan that also contains diagnostics and other annotations added by the validator.
  3. You can traverse the tree yourself using ParseResult::root, or you can use one of the methods associated with ParseResult to obtain the validation results you need.

Note that only the binary protobuf serialization format is supported at the input; the JSON format is not supported. This is a limitation of prost, the crate that was used for protobuf deserialization. If you’re looking for a library (or CLI) that supports more human-friendly input, check out the Python bindings.

Re-exports§

pub use input::config::Config;
pub use output::comment::Comment;
pub use output::diagnostic::Classification;
pub use output::diagnostic::Diagnostic;
pub use output::diagnostic::Level;
pub use output::parse_result::ParseResult;
pub use output::parse_result::Validity;

Modules§

export
Module dealing with serializing a ParseResult to a byte stream in various formats.
input
Input representation module.
output
Output representation module.

Structs§

Pattern
A compiled Unix shell style pattern.

Functions§

iter_diagnostics
Returns an iterator that yields all known diagnostic classes.
parse
Parses and validates the given substrait Plan message and returns the parse tree and diagnostic results.
substrait_version
Returns the version of Substrait that this version of the validator was built against.
substrait_version_req
Returns the Substrait version requirement for plans to be known to be supported.
substrait_version_req_loose
Returns the Substrait version requirement for plans to possibly be supported.
validate
Validates the given substrait Plan message and returns the parse tree and diagnostic results.
version
Returns the version of the validator.