-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix: project rel to and from substrait to include pass through columns #135
base: main
Are you sure you want to change the base?
Conversation
7ed491d
to
eebaf3d
Compare
common = &sop.project().common(); | ||
break; | ||
default: | ||
throw InternalException("Unsupported relation type " + to_string(sop.rel_type_case())); |
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.
Almost every relation should be in this list. I'd consider calling anything missing not yet implemented.
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.
Ah..! Thanks for pointing out, I missed this.
This also reminds me that I could avoid a project by using output mapping, whenever I only have to change the column order of a give relation.
default: | ||
throw InternalException("Unsupported relation type " + to_string(sop.rel_type_case())); | ||
} | ||
if (!common->has_emit()) { |
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.
It may be useful to break this into code to get the common table and code to get the emit from the mapping. That way you can use .the common structure to update direct and emit if necessary. You might be able to use templates to get the RelCommon which could reduce the overall amount of code.
auto mapping = GetOutputMapping(sop); | ||
auto num_input_columns = input_rel->Columns().size(); | ||
if (mapping.empty()) { | ||
for (int i = 1; i <= num_input_columns; i++) { |
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.
The first column is numbered at zero. I found https://substrait.io/tutorial/sql_to_substrait/#field-indices to be useful (in addition to the individual relation pages).
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.
The index i
is used to create the duckdb column reference not substrait. For reference please see here.
No description provided.