zenoyang commented on code in PR #8967:
URL: https://github.com/apache/incubator-doris/pull/8967#discussion_r848265385


##########
be/src/vec/columns/predicate_column.h:
##########
@@ -205,13 +218,30 @@ class PredicateColumnType final : public 
COWHelper<IColumn, PredicateColumnType<
         }
     }
 
+    void insert_many_date(const char* data_ptr, size_t num) {
+        size_t intput_type_size  = sizeof(uint24_t);
+        size_t res_type_size = sizeof(uint32_t);
+        char* input_data_ptr = const_cast<char*>(data_ptr);
+        
+        char* res_ptr = (char*)data.get_end_ptr();
+        memset(res_ptr, 0, res_type_size * num);
+        for (int i = 0; i < num; i++) {

Review Comment:
   Why not batch memcpy?



##########
be/src/vec/runtime/vdatetime_value.h:
##########
@@ -203,6 +203,21 @@ class VecDateTimeValue { // Now this type is a temp 
solution with little changes
         return check_range_and_set_time(year, month, day, hour, minute, 
second, _type);
     }
 
+    //note(wb) not check in this method
+    void inline set_olap_date(uint64_t olap_date_val) {
+        _neg = 0;
+        _type = TIME_DATE;
+
+         _day = olap_date_val & 0x1f;
+        _month = (olap_date_val >> 5) & 0x0f;
+        _year = olap_date_val >> 9;
+        _neg = 0;
+        _type = TIME_DATE;

Review Comment:
   ```
   _neg = 0;
   _type = TIME_DATE;
   ```
   Duplicated with the code above



##########
be/src/vec/columns/column_vector.h:
##########
@@ -168,18 +168,16 @@ class ColumnVector final : public 
COWHelper<ColumnVectorHelper, ColumnVector<T>>
     }
 
     void insert_date_column(const char* data_ptr, size_t num) {
-        size_t value_size = sizeof(uint24_t);
+        size_t input_value_size = sizeof(uint24_t);
+        
         for (int i = 0; i < num; i++) {
-            const char* cur_ptr = data_ptr + value_size * i;
-            uint64_t value = 0;
-            value = *(unsigned char*)(cur_ptr + 2);
-            value <<= 8;
-            value |= *(unsigned char*)(cur_ptr + 1);
-            value <<= 8;
-            value |= *(unsigned char*)(cur_ptr);
-            vectorized::VecDateTimeValue date;
-            date.from_olap_date(value);
-            this->insert_data(reinterpret_cast<char*>(&date), 0);
+            uint64_t val = 0;
+            memcpy((char*)(&val), data_ptr, input_value_size);
+            data_ptr += input_value_size;
+
+            VecDateTimeValue date;

Review Comment:
   ```VecDateTimeValue date;```
   Better to move outside the loop.



##########
be/src/vec/columns/predicate_column.h:
##########
@@ -64,6 +64,19 @@ class PredicateColumnType final : public COWHelper<IColumn, 
PredicateColumnType<
         }
     }
 
+    void insert_date32_to_res_column(const uint16_t* sel, size_t sel_size,
+                                   vectorized::ColumnVector<Int64>* res_ptr) {
+        res_ptr->reserve(sel_size);
+        auto& res_data = res_ptr->get_data();
+
+        for (size_t i = 0; i < sel_size; i++) {
+            VecDateTimeValue date;

Review Comment:
   same as above



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to