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/05/23 04:42:42 UTC

[GitHub] [incubator-doris] BiteTheDDDDt opened a new pull request, #9734: [Bug] [Vectorized] add padding when load char type data

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

   # Proposed changes
   
   Issue Number: close #9733
   
   ## Problem Summary:
   
   Describe the overview of 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/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] cambyzju commented on a diff in pull request #9734: [Bug] [Vectorized] add padding when load char type data

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


##########
be/src/vec/olap/olap_data_convertor.cpp:
##########
@@ -372,6 +372,21 @@ Status OlapBlockDataConvertor::OlapColumnDataConvertorChar::convert_to_olap() {
 
     assert(column_string);
 
+    size_t rows = column_string->size();
+    if (column_string->chars_size() != _length * rows) {
+        _column = vectorized::ColumnString::create();
+        auto padded_column =
+                assert_cast<vectorized::ColumnString*>(_column->assume_mutable().get());
+        padded_column->resize(rows);

Review Comment:
   ```suggestion
           padded_column->reserve(rows);
   ```



-- 
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 #9734: [Bug] [Vectorized] add padding when load char type data

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

   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] HappenLee commented on a diff in pull request #9734: [Bug] [Vectorized] add padding when load char type data

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


##########
be/src/vec/olap/olap_data_convertor.h:
##########
@@ -99,8 +102,41 @@ class OlapBlockDataConvertor {
         Status convert_to_olap() override;
 
     private:
+        static bool should_padding(const ColumnString* column, size_t padding_length) {
+            // Check sum of data length, including terminating zero.
+            return column->size() * (padding_length + 1) != column->chars.size();
+        }
+
+        static void insert_data_padded(ColumnString* column, StringRef str, size_t padding_length) {
+            const size_t old_size = column->chars.size();
+            const size_t data_size = old_size + str.size;
+            const size_t full_size = old_size + padding_length + 1;
+
+            column->chars.resize(full_size);
+            column->offsets.push_back(full_size);
+
+            if (str.size) {
+                memcpy(column->chars.data() + old_size, str.data, str.size);
+            }
+            memset(column->chars.data() + data_size, 0, full_size - data_size);
+        }
+
+        static ColumnPtr clone_and_padding(const ColumnString* input, size_t padding_length) {
+            auto column = vectorized::ColumnString::create();
+            auto padded_column =
+                    assert_cast<vectorized::ColumnString*>(column->assume_mutable().get());
+            padded_column->reserve(input->size());

Review Comment:
   resize/memset chars `column->size() * (padding_length + 1)`
   resize offsets `column->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] github-actions[bot] commented on pull request #9734: [Bug] [Vectorized] add padding when load char type data

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

   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] HappenLee merged pull request #9734: [Bug] [Vectorized] add padding when load char type data

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


-- 
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 commented on a diff in pull request #9734: [Bug] [Vectorized] add padding when load char type data

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


##########
be/src/vec/olap/olap_data_convertor.h:
##########
@@ -99,8 +102,41 @@ class OlapBlockDataConvertor {
         Status convert_to_olap() override;
 
     private:
+        static bool should_padding(const ColumnString* column, size_t padding_length) {
+            // Check sum of data length, including terminating zero.
+            return column->size() * (padding_length + 1) != column->chars.size();
+        }
+
+        static void insert_data_padded(ColumnString* column, StringRef str, size_t padding_length) {
+            const size_t old_size = column->chars.size();
+            const size_t data_size = old_size + str.size;
+            const size_t full_size = old_size + padding_length + 1;
+
+            column->chars.resize(full_size);

Review Comment:
   not do the work in `insert_data_padded`



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