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/06/10 10:00:39 UTC

[GitHub] [incubator-doris] adonis0147 opened a new pull request, #10065: [feature-wip](array-type) Support loading data in vectorized format

adonis0147 opened a new pull request, #10065:
URL: https://github.com/apache/incubator-doris/pull/10065

   # Proposed changes
   
   Issue Number: close #10064
   
   ## Problem Summary:
   
   Please refer to #10064
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: No
   2. Has unit tests been added: Yes
   3. Has document been added or modified: No Need
   4. Does it need to update dependencies: No
   5. Are there any changes that cannot be rolled back: 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] [incubator-doris] eldenmoon commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
eldenmoon commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1152285619

   Sorry for my issue in this PR
   I'm currently using Array, found that when I build BE with ASAN,  using the column type  like `ARRAY<STRING>`, after I insert with vectorized engine enabled, there will be a coredump which is heap-use-after-free, see issue  #9934  for more details. I commented the clue I found in this PR https://github.com/apache/incubator-doris/pull/9466 (the last comment) , but I'm not quite sure how to solve it


-- 
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] [incubator-doris] adonis0147 commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1152291339

   Hi @eldenmoon , thanks for your feedback. I will investigate the issue you mentioned and try to solve it.


-- 
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] [incubator-doris] HappenLee merged pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
HappenLee merged PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065


-- 
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] [incubator-doris] cambyzju commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
cambyzju commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1153559754

   LGTM


-- 
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] [incubator-doris] cambyzju commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894370999


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {

Review Comment:
   ```suggestion
       for (size_t i = start; i < offsets_data.size(); ++i) {
   ```
   we will change offsets of array to int64 later.



-- 
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] [incubator-doris] adonis0147 commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894654169


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {
+        offsets_data[i] += offsets_data[i - 1]; // -1 is ok
+    }
+
+    auto column_items_ptr = column_array->get_data().assume_mutable();
+    for (int64_t i = start; i < offsets_data.size(); ++i) {
+        auto offset = offsets_data[i - 1]; // -1 is ok.
+        auto size = offsets_data[i] - offset;
+        if (size == 0) {
+            continue;
+        }
+        size_t num_items = size;
+        bool items_has_null = false;
+        _item_iterator->next_batch(&num_items, column_items_ptr, &items_has_null);

Review Comment:
   Refined.



-- 
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] [incubator-doris] eldenmoon commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
eldenmoon commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1152222425

   Sorry for my issue in this PR, I'm currently using Array, found that when  BE build with ASAN,  the column type is like ARRAY<STRING>,  there will be a coredump which is heap-use-after-free after I insert a data with `enable_vectorized_engine`


-- 
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] [incubator-doris] adonis0147 commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894652397


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {

Review Comment:
   It is not the case here, because the size of `offsets_data` is limited to the number of entries read from file and the number is limited to the batch size.



-- 
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] [incubator-doris] adonis0147 commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894656962


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {
+        offsets_data[i] += offsets_data[i - 1]; // -1 is ok
+    }

Review Comment:
   The value of `*n` was updated at [L413](https://github.com/apache/incubator-doris/blob/c4bdfb2d1194f16b923837785719a0edb2eaf78c/be/src/olap/rowset/segment_v2/column_reader.cpp#L413)



-- 
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] [incubator-doris] github-actions[bot] commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1154671370

   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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1154671349

   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] [incubator-doris] cambyzju commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894376462


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {
+        offsets_data[i] += offsets_data[i - 1]; // -1 is ok
+    }

Review Comment:
   we need set `n` after read data success.



-- 
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] [incubator-doris] adonis0147 commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894648585


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);

Review Comment:
   Added



-- 
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] [incubator-doris] cambyzju commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894368499


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);

Review Comment:
   RETURN_IF_ERROR



-- 
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] [incubator-doris] eldenmoon commented on pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
eldenmoon commented on PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#issuecomment-1152217635

   Sorry for my issue in this PR.


-- 
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] [incubator-doris] cambyzju commented on a diff in pull request #10065: [feature-wip](array-type) Support loading data in vectorized format

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10065:
URL: https://github.com/apache/incubator-doris/pull/10065#discussion_r894374280


##########
be/src/olap/rowset/segment_v2/column_reader.cpp:
##########
@@ -461,6 +461,46 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
     return Status::OK();
 }
 
+Status ArrayFileColumnIterator::next_batch(size_t* n, vectorized::MutableColumnPtr& dst,
+                                           bool* has_null) {
+    const auto* column_array = vectorized::check_and_get_column<vectorized::ColumnArray>(
+            dst->is_nullable() ? static_cast<vectorized::ColumnNullable&>(*dst).get_nested_column()
+                               : *dst);
+
+    bool offsets_has_null = false;
+    auto column_offsets_ptr = column_array->get_offsets_column().assume_mutable();
+    auto start = column_offsets_ptr->size();
+    _length_iterator->next_batch(n, column_offsets_ptr, &offsets_has_null);
+    auto& column_offsets =
+            static_cast<vectorized::ColumnArray::ColumnOffsets&>(*column_offsets_ptr);
+    auto& offsets_data = column_offsets.get_data();
+    for (int i = start; i < offsets_data.size(); ++i) {
+        offsets_data[i] += offsets_data[i - 1]; // -1 is ok
+    }
+
+    auto column_items_ptr = column_array->get_data().assume_mutable();
+    for (int64_t i = start; i < offsets_data.size(); ++i) {
+        auto offset = offsets_data[i - 1]; // -1 is ok.
+        auto size = offsets_data[i] - offset;
+        if (size == 0) {
+            continue;
+        }
+        size_t num_items = size;
+        bool items_has_null = false;
+        _item_iterator->next_batch(&num_items, column_items_ptr, &items_has_null);

Review Comment:
   First get total item size, then call next_batch repeatedly until reach total item size, we could reduce the call of next_batch.



-- 
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