-
Notifications
You must be signed in to change notification settings - Fork 411
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
Add insertMany interface for IColumn #8925
Conversation
Signed-off-by: Lloyd-Pottiger <[email protected]>
Signed-off-by: Lloyd-Pottiger <[email protected]>
virtual void insertDisjunctFrom(const IColumn & src, const std::vector<size_t> & position_vec) = 0; | ||
|
||
/// Appends one field multiple times. Can be optimized in inherited classes. | ||
virtual void insertMany(const Field & field, size_t length) |
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.
May reduce virtual function call like this:
tiflash/dbms/src/Columns/IColumn.h
Lines 476 to 477 in adc57e2
template <typename Derived> | |
std::vector<MutablePtr> scatterImpl(ColumnIndex num_columns, const Selector & selector) 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.
It should be called as IColumn->insertMany(v)
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.
Yeah, the insert virutal function is called inside the loop
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.
compiler can help optimize this, no vtable lookup here https://gcc.godbolt.org/z/Y48rMoqqc
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.
I don't think so, think like this: different derived instances can call insertMany function, thus optimizer can't infer which insert function to be called next. Thus optimizer should lookup the vtable of current instance to find the actual insert function address. That's what "call qword ptr [rax + 8]" do, I guess.
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.
Anyway, I think it is ok to improve it later.
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.
Others LGTM
Signed-off-by: Lloyd-Pottiger <[email protected]>
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JaySon-Huang, yibin87 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/run-all-tests |
/run-unit-test |
/run-unit-test |
@Lloyd-Pottiger: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests
If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/run-unit-test |
/run-integration-test |
1 similar comment
/run-integration-test |
/run-integration-test |
Caused by my tidb PR, pingcap/tidb#52143, I'm fixing it now. Maybe you can temporarily bypass this case to pass the integration tests. |
Signed-off-by: Lloyd-Pottiger <[email protected]>
/run-all-tests |
What problem does this PR solve?
Issue Number: ref #8904
Problem Summary:
What is changed and how it works?
I used
insertManyFrom
in #8854, where the source column is a const column while the target column is not and it causes #8904. To fix this, addinsertMany
interface to avoid convert const column to full column.Check List
Tests
Side effects
Documentation
Release note