You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/09/21 06:53:21 UTC
[GitHub] [doris] BiteTheDDDDt opened a new pull request, #12807: [Enhancement](optimize) optimize for insert_indices_from
BiteTheDDDDt opened a new pull request, #12807:
URL: https://github.com/apache/doris/pull/12807
# Proposed changes
for tpch Q5:
before:

after:

## Problem summary
Describe your changes.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] yiguolei merged pull request #12807: [Enhancement](optimize) optimize for insert_indices_from
Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #12807:
URL: https://github.com/apache/doris/pull/12807
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #12807: [Enhancement](optimize) optimize for insert_indices_from
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12807:
URL: https://github.com/apache/doris/pull/12807#issuecomment-1258267603
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] adonis0147 commented on a diff in pull request #12807: [Enhancement](optimize) optimize for insert_indices_from
Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #12807:
URL: https://github.com/apache/doris/pull/12807#discussion_r976185747
##########
be/src/vec/columns/column_vector.cpp:
##########
@@ -324,20 +324,21 @@ void ColumnVector<T>::insert_range_from(const IColumn& src, size_t start, size_t
template <typename T>
void ColumnVector<T>::insert_indices_from(const IColumn& src, const int* indices_begin,
const int* indices_end) {
- const Self& src_vec = assert_cast<const Self&>(src);
auto origin_size = size();
auto new_size = indices_end - indices_begin;
data.resize(origin_size + new_size);
- for (int i = 0; i < new_size; ++i) {
- int offset = indices_begin[i];
- if constexpr (std::is_same_v<T, UInt8>) {
- // Now Uint8 use to identify null and non null
- // 1. nullable column : offset == -1 means is null at the here, set true here
- // 2. real data column : offset == -1 what at is meaningless
- data[origin_size + i] = (offset == -1) ? T {1} : src_vec.get_element(offset);
- } else {
- data[origin_size + i] = (offset == -1) ? T {0} : src_vec.get_element(offset);
+ const T* src_data = reinterpret_cast<const T*>(src.get_raw_data().data);
+
+ if constexpr (std::is_same_v<T, UInt8>) {
+ // nullmap : offset == -1 means is null at the here, set true here
+ for (int i = 0; i < new_size; ++i) {
+ data[origin_size + i] = (indices_begin[i] == -1);
+ }
+ } else {
+ // real data : offset == -1 what at is meaningless
Review Comment:
ditto
##########
be/src/vec/columns/column_vector.cpp:
##########
@@ -324,20 +324,21 @@ void ColumnVector<T>::insert_range_from(const IColumn& src, size_t start, size_t
template <typename T>
void ColumnVector<T>::insert_indices_from(const IColumn& src, const int* indices_begin,
const int* indices_end) {
- const Self& src_vec = assert_cast<const Self&>(src);
auto origin_size = size();
auto new_size = indices_end - indices_begin;
data.resize(origin_size + new_size);
- for (int i = 0; i < new_size; ++i) {
- int offset = indices_begin[i];
- if constexpr (std::is_same_v<T, UInt8>) {
- // Now Uint8 use to identify null and non null
- // 1. nullable column : offset == -1 means is null at the here, set true here
- // 2. real data column : offset == -1 what at is meaningless
- data[origin_size + i] = (offset == -1) ? T {1} : src_vec.get_element(offset);
- } else {
- data[origin_size + i] = (offset == -1) ? T {0} : src_vec.get_element(offset);
+ const T* src_data = reinterpret_cast<const T*>(src.get_raw_data().data);
+
+ if constexpr (std::is_same_v<T, UInt8>) {
+ // nullmap : offset == -1 means is null at the here, set true here
Review Comment:
Is the comment relevant? `offset` is missing here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] HappenLee commented on a diff in pull request #12807: [Enhancement](optimize) optimize for insert_indices_from
Posted by GitBox <gi...@apache.org>.
HappenLee commented on code in PR #12807:
URL: https://github.com/apache/doris/pull/12807#discussion_r979950567
##########
be/src/vec/columns/column_vector.cpp:
##########
@@ -349,20 +349,22 @@ void ColumnVector<T>::insert_range_from(const IColumn& src, size_t start, size_t
template <typename T>
void ColumnVector<T>::insert_indices_from(const IColumn& src, const int* indices_begin,
const int* indices_end) {
- const Self& src_vec = assert_cast<const Self&>(src);
auto origin_size = size();
auto new_size = indices_end - indices_begin;
data.resize(origin_size + new_size);
- for (int i = 0; i < new_size; ++i) {
- int offset = indices_begin[i];
- if constexpr (std::is_same_v<T, UInt8>) {
- // Now Uint8 use to identify null and non null
- // 1. nullable column : offset == -1 means is null at the here, set true here
- // 2. real data column : offset == -1 what at is meaningless
- data[origin_size + i] = (offset == -1) ? T {1} : src_vec.get_element(offset);
- } else {
- data[origin_size + i] = (offset == -1) ? T {0} : src_vec.get_element(offset);
+ const T* src_data = reinterpret_cast<const T*>(src.get_raw_data().data);
+
+ if constexpr (std::is_same_v<T, UInt8>) {
+ // nullmap : indices_begin[i] == -1 means is null at the here, set true here
+ for (int i = 0; i < new_size; ++i) {
+ data[origin_size + i] = (indices_begin[i] == -1) +
+ (indices_begin[i] != -1) * src_data[indices_begin[i]];
+ }
+ } else {
+ // real data : indices_begin[i] == -1 what at is meaningless
+ for (int i = 0; i < new_size; ++i) {
+ data[origin_size + i] = src_data[indices_begin[i]];
Review Comment:
This is undefined behavior, and might break horribly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #12807: [Enhancement](optimize) optimize for insert_indices_from
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12807:
URL: https://github.com/apache/doris/pull/12807#issuecomment-1258267655
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org