-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[native] Migrate TaskStatus, TaskUpdateRequest, TaskInfo to Thrift with JSON fields in CPP #25079
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
Conversation
This pull request was exported from Phabricator. Differential Revision: D72886878 |
283fdee
to
56f1f9e
Compare
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Differential Revision: D72886878
presto-native-execution/presto_cpp/main/tests/data/Fragment.txt
Outdated
Show resolved
Hide resolved
|
||
namespace facebook::presto::thrift { | ||
|
||
void toThrift(const std::string& proto, std::string& thrift); |
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.
Are ProtocolToThrift files auto generated?
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.
no, the changes in ProtocolToThrift files are now hand-written. there used to be a complicated workflow to use python and chevron templates to auto-gen it, but it does not support some functionalities and we removed it as part of this PR.
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, I think I misread. This class is responsible for creating Thrift objects from presto::protocol objects and the other way around. The thrift objects are auto generated, 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.
A couple of questions, otherwise looks good to me
auto acceptHeader = headers.getSingleOrEmpty(proxygen::HTTP_HEADER_ACCEPT); | ||
auto useThrift = | ||
const auto& acceptHeader = headers.getSingleOrEmpty(proxygen::HTTP_HEADER_ACCEPT); | ||
const auto sendThrift = |
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.
Do we need to do the same for TaskInfo?
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.
Discussed offline. Needs Java changes. Will be added as a follow up
|
||
namespace facebook::presto::thrift { | ||
|
||
void toThrift(const std::string& proto, std::string& thrift); |
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, I think I misread. This class is responsible for creating Thrift objects from presto::protocol objects and the other way around. The thrift objects are auto generated, right?
enum ErrorType { | ||
USER_ERROR = 0, | ||
INTERNAL_ERROR = 1, | ||
INSUFFICIENT_RESOURCES = 2, | ||
EXTERNAL = 3, | ||
} | ||
|
||
enum ErrorCause { |
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 file is auto generated based on idl, 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.
Discussed offline.
The IDL is generated based on Java classes. IDL will be generated automatically once we land changes to Drift. CMake generates thrift:: protocol classes during build process, they are not commited.
As a follow up we will also be generating the ProtocolToThrift.h
…ields in CPP (prestodb#25079) Summary: Pull Request resolved: prestodb#25079 Reviewed By: yuandagits Differential Revision: D72886878
This pull request was exported from Phabricator. Differential Revision: D72886878 |
@vhsu14 can you help to describe clearly how the code generation works? Based on the PR description, the coordinator somehow does this--can you explain? |
@tdcmeehan we are using the idl generator from drift to generate the idl file from drift annotation. And we use the generate d idl file to generate cpp classes. This step is still manual and we will make it automatic in next step. There are also some issues with current pipeline, the one which use python scripts to do code generation, on how to support optional fields in thrift. And we will fix this in next step as well. Hope this answer your question. |
…elds (#25020) ## Description 1. We are enabling thrift for task update request, and task info for critical api communication between coordinator and worker. We have two config toggles for task update request sent to worker and the task info returned to coordinator, 2. However, there are some classes that are java interface/polymorphic fields. We keep them as json encoding for now and will migrate them in the next step. 3. We are also doing proper change for native worker: #25079 ## Motivation and Context 1. We observed that coordinator can spend too much cpu/heap memory on json serde for taskUpdateRequest. ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> ## Test Plan 1. Passed verifier tests ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Improve communication between coordinator and worker with thrift serde. ```
## Description <!---Describe your changes in detail--> In #25079, ProtocolToThrift files were manually written. This PR generates these files using pythons scripts and chevron templates. ## Motivation and Context <!---Why is this change required? What problem does it solve?--> <!---If it fixes an open issue, please link to the issue here.--> ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> ## Test Plan <!---Please fill in how you tested your change--> Unit test + Verifier (test_id 225961) ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Update ProtocolToThrift files to be generated for cpp thrift serde.
…elds (prestodb#25020) ## Description 1. We are enabling thrift for task update request, and task info for critical api communication between coordinator and worker. We have two config toggles for task update request sent to worker and the task info returned to coordinator, 2. However, there are some classes that are java interface/polymorphic fields. We keep them as json encoding for now and will migrate them in the next step. 3. We are also doing proper change for native worker: prestodb#25079 ## Motivation and Context 1. We observed that coordinator can spend too much cpu/heap memory on json serde for taskUpdateRequest. ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> ## Test Plan 1. Passed verifier tests ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Improve communication between coordinator and worker with thrift serde. ```
…th JSON fields in CPP (prestodb#25079) ## Description This PR depends on prestodb#25020. Changes include: - Use IDL generated by coordinator and make relevant changes to enable thrift for TaskStatus, TaskUpdateRequest, and TaskInfo on native worker. - Remove old pipeline of using python, json, and chevron templates for producing C++ code. ## Motivation and Context We observed that coordinator can spend too much cpu/heap memory on json serde for taskUpdateRequest. ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> ## Test Plan Verifier ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == RELEASE NOTES == General Changes * Improve communication between coordinator and worker with thrift serde. ```
Description
This PR depends on #25020. Changes include:
Motivation and Context
We observed that coordinator can spend too much cpu/heap memory on json serde for taskUpdateRequest.
Impact
Test Plan
Verifier
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.