imay commented on a change in pull request #1610: Add bitmap agg type and udaf
URL: https://github.com/apache/incubator-doris/pull/1610#discussion_r316948274
##########
File path: be/src/olap/row_cursor.cpp
##########
@@ -184,30 +178,11 @@ OLAPStatus
RowCursor::allocate_memory_for_string_type(const TabletSchema& schema
char* fixed_ptr = _fixed_buf;
char* variable_ptr = _variable_buf;
for (auto cid : _schema->column_ids()) {
- const TabletColumn& column = schema.column(cid);
fixed_ptr = _fixed_buf + _schema->column_offset(cid);
- FieldType type = column.type();
- if (type == OLAP_FIELD_TYPE_VARCHAR) {
- Slice* slice = reinterpret_cast<Slice*>(fixed_ptr + 1);
- slice->data = variable_ptr;
- slice->size = column.length() - OLAP_STRING_MAX_BYTES;
- variable_ptr += slice->size;
- } else if (type == OLAP_FIELD_TYPE_CHAR) {
- Slice* slice = reinterpret_cast<Slice*>(fixed_ptr + 1);
- slice->data = variable_ptr;
- slice->size = column.length();
- variable_ptr += slice->size;
- } else if (type == OLAP_FIELD_TYPE_HLL) {
- // slice.data points to serialized HLL, (slice.data - 8) points to
HllContext object used to aggregate HLL
- auto slice = reinterpret_cast<Slice*>(fixed_ptr + 1);
- HllContext* context = new HllContext();
- hll_contexts.push_back(context);
-
- *(size_t*)(variable_ptr) = (size_t)(context);
- variable_ptr += sizeof(HllContext*);
- slice->data = variable_ptr; // serialized HLL will be populated
when finalizing HllContext
- slice->size = HLL_COLUMN_DEFAULT_LEN;
- variable_ptr += slice->size;
+ FieldType type = schema.column(cid).type();
+ if (type == OLAP_FIELD_TYPE_VARCHAR || type == OLAP_FIELD_TYPE_CHAR) {
Review comment:
when type is HLL or Bitmap, we can let slice->data = nullptr which can lead
process crash if it is not initialized
----------------------------------------------------------------
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]