Skip to content

feat(parse): add proto::extensions::SimpleExtensionDeclaration parser#170

Open
ilikepi63 wants to merge 18 commits into
substrait-io:mainfrom
ilikepi63:main
Open

feat(parse): add proto::extensions::SimpleExtensionDeclaration parser#170
ilikepi63 wants to merge 18 commits into
substrait-io:mainfrom
ilikepi63:main

Conversation

@ilikepi63

Copy link
Copy Markdown

Adds a parser for proto::extensions::SimpleExtensionDeclaration that parses the declaration.

@CLAassistant

CLAassistant commented Apr 4, 2024

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ilikepi63
❌ Cameron Harris


Cameron Harris seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mbrobbel mbrobbel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. I left some comments.

Marked this as non-breaking (for now).

Comment thread src/parse/proto/extensions/simple_extension_declaration/extension_function.rs Outdated
Comment thread src/parse/proto/extensions/simple_extension_declaration/extension_function.rs Outdated
type Parsed = ExtensionFunction;
type Error = SimpleExtensionDeclarationError;

fn parse(self, _ctx: &mut C) -> Result<Self::Parsed, Self::Error> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parser should add the function to the context, checking that the referenced extension uri is valid, the used anchor is unique, and that the definition contains a matching function with the given name in the referenced extension.

Comment thread src/parse/proto/extensions/simple_extension_declaration/extension_function.rs Outdated
Comment on lines +1 to +2
use crate::parse::{Anchor, Context, Parse};
use crate::proto;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you merge those?

type Parsed = ExtensionTypeVariation;
type Error = SimpleExtensionDeclarationError;

fn parse(self, _ctx: &mut C) -> Result<Self::Parsed, Self::Error> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment thread src/parse/proto/extensions/simple_extension_declaration/mapping_type.rs Outdated
Comment thread src/parse/proto/extensions/simple_extension_declaration/mod.rs Outdated

Ok(SimpleExtensionDeclaration {
mapping_type: mapping_type
.map(|mapping_type| mapping_type.parse(ctx).ok())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want this to silently error on parser errors.

@mbrobbel mbrobbel changed the title feat(parse)!: add proto::extensions::SimpleExtensionDeclaration parser feat(parse): add proto::extensions::SimpleExtensionDeclaration parser Apr 4, 2024
Cameron Harris and others added 11 commits April 8, 2024 05:37
…ion_function.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_function.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_function.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_type.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_type.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_type_variation.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…ion_type_variation.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…g_type.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…_extension_declaration.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
@mbrobbel mbrobbel marked this pull request as ready for review April 8, 2024 14:11
@mbrobbel mbrobbel marked this pull request as draft April 8, 2024 14:11
@mbrobbel mbrobbel mentioned this pull request Apr 9, 2024
32 tasks
Comment thread src/parse/context.rs Outdated
Comment on lines +42 to +50
/// Add a [ExtensionFunction] to this context. Must return an error for duplicate
/// anchors, when the URI is not supported or if the definition does not contain a matching function with the given name.
///
/// This function must eagerly resolve and parse the simple extension, returning an
/// error if either fails.
fn add_extension_function(
&mut self,
extension_function: &ExtensionFunction,
) -> Result<&SimpleExtensions, ContextError>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return types and comments of these functions should be updated.

Cameron Harris and others added 5 commits May 2, 2024 12:20
…_extension_declaration.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
…_extension_declaration.rs

Co-authored-by: Matthijs Brobbel <m1brobbel@gmail.com>
@ilikepi63 ilikepi63 marked this pull request as ready for review May 5, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants