Skip to content

Conversation

@benbellick
Copy link
Member

Adds some very simple tests validating the already existing URN logic.

@benbellick
Copy link
Member Author

I have fairly limited rust experience, but want to become more involved in this part of the substrait community. This is just a small PR to get my feet wet :)

owner: owner.to_string(),
id: id.to_string(),
}),
_ => Err(InvalidUrn),
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I caught a small bug that allowed urns like extension:one:two:three:four:five. Let me know if this is an okay implementation!

Copy link
Member

Choose a reason for hiding this comment

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

Where is it specified that this is an invalid identifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, it isn't specified anywhere. However, if we do use extension:one:two:three:four:five, then there is an ambiguous parse. Any one of the following could be the owner for example:

  • "one"
  • "one:two"
  • "one:two:three"
  • "one:two:three:four"

Since this isn't formally captured in the substrait docs, I have opened a PR in upstream here.

The behavior introduced in this PR is consistent with the implementations in other projects

For consistency with the other libraries, we could instead use a regex to validate? It would probably be slower, but what do you think?

I could also introduce the regex into the substrait upstream itself.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I think I see the distinction now. You raise a fair point. Perhaps the correct solution is actually to upstream to the parent substrait lib a clarification that extension:owner:<something that may contain ':'> will always parse in the way you had it before as owner=owner, and id=<something that may contain ':'>.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, we are already breaking from urn convention, as our "urns" do not have urn: prepended to them

I originally wrote about the <NID> being invalid because it has periods, but I realize now that our <NID> is in fact extension, so that part is fine.

Shall we clarify then that for us, urns are valid "official" urns but just with the urn: prefix chopped off?

Copy link
Member

Choose a reason for hiding this comment

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

Shall we clarify then that for us, urns are valid "official" urns but just with the urn: prefix chopped off?

Sounds good to me (this was also my understanding). Let's discuss and document this in the main repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reopened the PR in upstream with this clarification. Thanks!

@benbellick benbellick requested a review from mbrobbel October 31, 2025 21:00
add a few more tests as well
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