-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: add parse
module
#89
Conversation
@mbrobbel Just wondering if you've had a chance to make any more progress on this? I cloned this branch & started expanding the functionality. I'd be happy to continue this work if our are unable. |
Yes I made some progress. I'll push it and fix conflicts. Happy to collaborate. |
@@ -140,6 +145,10 @@ | |||
//! # Ok(()) } | |||
//! ``` | |||
//! | |||
//! # Parsing | |||
//! | |||
//! Write about [parse] module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation goes here?
/// Returns the compound names of this simple extensions function. | ||
pub fn compound_names(&self) -> Vec<String> { | ||
// todo(mbrobbel): parse functions | ||
// notes : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover comments to self?
Substrait(semver::Version, semver::VersionReq), | ||
} | ||
|
||
impl<C: Context> Parse<C> for proto::Version { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised to see all of this validation here. Were you aiming for putting the validation into a separate step from the parsing?
@@ -12,6 +12,11 @@ | |||
//! Protobuf serialization and deserialization are provided via [prost] in the | |||
//! [proto] module. | |||
//! | |||
//! > Please note that [protoc](https://grpc.io/docs/protoc-installation/) is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the canonical protobuf installation guide for Rust is on the grpc.io site? I would have expected a link to the protobuf site.
#[error("undefined reference to extension function with anchor `{0}`")] | ||
UndefinedExtensionFunction(Anchor<ExtensionFunction>), | ||
|
||
/// Undefined reference to extension function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function definition
version: Version, | ||
simple_extension_uris: Vec<SimpleExtensionURI>, | ||
simple_extension_declarations: Vec<SimpleExtensionDeclaration>, | ||
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a TODO?
#[cfg(feature = "parse-reqwest")] | ||
#[derive(Default)] | ||
/// A resolver that uses [reqwest] to resolve simple extensions. | ||
pub struct ReqwestResolver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, reqwest is a package name. It may be useful to disable external checking of URIs -- that seems more like a validation step that might not be useful on systems just trying to use plans.
use crate::proto; | ||
use thiserror::Error; | ||
|
||
/// A parsed [proto::Plan]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a naming standpoint I'd consider the plan to be parsed once you use the protobuf parse methods to deserialize it. As a second step (perhaps called study) it makes more sense to me to have the validation that is present in this PR. I could see even more validation as an optional third step, like checking for issues with output mappings, function name checking, etc.
pub enum Relation { | ||
/// A read relation. | ||
Read(ReadRelation), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for the other relation types?
Closing (I'm going to spllit this PR up). See #157. |
Include core extensions from `Subtrait`. The majority of the code originates from the un-merged pr #89. --------- Co-authored-by: Matthijs Brobbel <[email protected]>
Some requirements of Substrait data can not be expressed via Protobuf definition or schema files. This module provides new types for the generated types, that when constructed are known to be checked. This enables producers and consumers to skip redundant checking of invariants described by the specification.
This is based on the idea described in the Parse don't validate blog post.
Proposal
The approach is to build the parsing around two traits: one for parsing and one for the parser context.
Progress