Expand description
Crate for validating Substrait.
§Usage
The usage pattern is roughly as follows.
- Build a
Config
structure to configure the validator. You can also just usestd::default::Default
if you don’t need to configure anything, but you might want to at least callConfig::add_curl_uri_resolver()
(if you’re using thecurl
feature). - Parse the incoming
substrait.Plan
message usingparse()
orvalidate()
. This creates a ParseResult, containing a tree structure corresponding to the query plan that also contains diagnostics and other annotations added by the validator. - 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.