Skip to content
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 SubqueryAliasRel #648

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions proto/substrait/algebra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ message ReadRel {
}
}

// (Re)qualify column names in a relation. If the system does not need qualified names, this can be ignored.
message SubqueryAliasRel {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this unique to subqueries? Wouldn't you want to be able to insert an alias at any point in a plan?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's just the name Spark and DataFusion uses - it can be added anywhere in the plan

Copy link
Member

Choose a reason for hiding this comment

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

When adding a new relation you should add it to the Rel one of or else it will not be usable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RelCommon common = 1;
Rel input = 2;
repeated string names = 3;
Copy link
Member

Choose a reason for hiding this comment

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

If we have structured content would these names be in depth first form as described elsewhere? If so, that comment should be copied here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be aliaising the subquery, not the field names - so this is more similar to the names on a NamedTable rather than the depth-first order used for fields.

Copy link
Member

Choose a reason for hiding this comment

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

Based on that it sounds like this is a list of names that all refer to the input relation.

substrait.extensions.AdvancedExtension advanced_extension = 10;
}

// This operator allows to represent calculated expressions of fields (e.g., a+b). Direct/Emit are used to represent classical relational projections
message ProjectRel {
RelCommon common = 1;
Expand Down Expand Up @@ -434,6 +442,7 @@ message Rel {
JoinRel join = 6;
ProjectRel project = 7;
SetRel set = 8;
SubqueryAliasRel subquery_alias = 22;
ExtensionSingleRel extension_single = 9;
ExtensionMultiRel extension_multi = 10;
ExtensionLeafRel extension_leaf = 11;
Expand Down
Loading