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

Move Expression based schema project to Schema class #137

Merged
merged 2 commits into from
Sep 3, 2022

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Sep 2, 2022

Add Schema::Project(const arrow::compute::Expression&) method to project the fields based on the fields references in the expression.

@eddyxu eddyxu requested a review from changhiskhan September 2, 2022 20:28
Copy link
Contributor

@changhiskhan changhiskhan left a comment

Choose a reason for hiding this comment

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

Minor questions for clarification

@@ -499,6 +499,19 @@ ::arrow::Result<std::shared_ptr<Schema>> Schema::Project(
return projection;
}

::arrow::Result<std::shared_ptr<Schema>> Schema::Project(
const ::arrow::compute::Expression& expr) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does input need to be bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not. This just read the schema and run projections.
Bound expr is only needed to feed into arrow::compute

return nullptr;
}
std::vector<std::string> columns;
for (auto& ref : ::arrow::compute::FieldsInExpression(expr)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This does solve the nested field reference problem right?

Copy link
Contributor Author

@eddyxu eddyxu Sep 3, 2022

Choose a reason for hiding this comment

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

Oh, no. That's a separated issue.

@@ -14,6 +14,7 @@

#pragma once

#include <arrow/compute/exec/expression.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this Arrow public API? Or is there a higher level header file for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a arrow/compute/api.h should i use that one?

@eddyxu eddyxu mentioned this pull request Sep 3, 2022
@eddyxu eddyxu merged commit 9e61510 into main Sep 3, 2022
@eddyxu eddyxu deleted the lei/schema_proj_over_expression branch September 3, 2022 20:42
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.

2 participants