-
Notifications
You must be signed in to change notification settings - Fork 251
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
Conversation
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.
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 { |
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.
Does input need to be bound?
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 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)) { |
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.
This does solve the nested field reference problem right?
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.
Oh, no. That's a separated issue.
cpp/src/lance/format/schema.h
Outdated
@@ -14,6 +14,7 @@ | |||
|
|||
#pragma once | |||
|
|||
#include <arrow/compute/exec/expression.h> |
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.
Is this Arrow public API? Or is there a higher level header file for this?
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.
There is a arrow/compute/api.h
should i use that one?
Add
Schema::Project(const arrow::compute::Expression&)
method to project the fields based on the fields references in the expression.