imay commented on a change in pull request #1599: Add bitmap Agg type and Udaf
URL: https://github.com/apache/incubator-doris/pull/1599#discussion_r311496178
 
 

 ##########
 File path: be/src/olap/field.h
 ##########
 @@ -363,6 +326,137 @@ uint32_t Field::hash_code(const CellType& cell, uint32_t 
seed) const {
     return _type_info->hash_code(cell.cell_ptr(), seed);
 }
 
+class CharField: public Field {
+public:
+    explicit CharField(const TabletColumn& column):Field(column) {
+    }
+
+    //the char field is especial, which need the _length info when consume raw 
data
+    void init(char* dest, void* value, Arena* arena)  {
+        const StringValue* src = reinterpret_cast<StringValue*>(value);
+        auto* dest_slice = (Slice*)(dest);
+        dest_slice->size = _length;
+        dest_slice->data = arena->Allocate(dest_slice->size);
+        memcpy(dest_slice->data, src->ptr, src->len);
+        memset(dest_slice->data + src->len, 0, dest_slice->size - src->len);
+    }
+
+    size_t get_variable_len() const override {
+        return  _length;
+    }
+
+    void allocate_memory(Slice* slice, char* variable_ptr, Arena* arena) const 
override {
+        slice->data = variable_ptr;
+        slice->size = _length;
+        variable_ptr += slice->size;
+    }
+
+    CharField* clone() const override {
+        return new CharField(*this);
+    }
+};
+
+class VarcharField: public Field {
+public:
+    explicit VarcharField(const TabletColumn& column): Field(column) {
+    }
+
+    size_t get_variable_len() const override {
+        return  _length - OLAP_STRING_MAX_BYTES;
+    }
+
+    void allocate_memory(Slice* slice, char* variable_ptr, Arena* arena) const 
override {
+        slice->data = variable_ptr;
+        slice->size = _length - OLAP_STRING_MAX_BYTES;
+        variable_ptr += slice->size;
+    }
+
+    VarcharField* clone() const override {
+        return new VarcharField(*this);
+    }
+};
+
+class BitmapAggField: public Field {
+public:
+    explicit BitmapAggField(const TabletColumn& column):Field(column) {
 
 Review comment:
   ```suggestion
       explicit BitmapAggField(const TabletColumn& column) : Field(column) {
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to