github-actions[bot] commented on code in PR #29869:
URL: https://github.com/apache/doris/pull/29869#discussion_r1448575192
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -316,30 +316,26 @@ Status IndexBuilder::_add_nullable(const std::string&
column_name,
}
return step;
};
+ // TODO: need to process null data for inverted index
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- BitmapIterator null_iter(null_map, num_rows);
- bool is_null = false;
- size_t this_run = 0;
- while ((this_run = null_iter.Next(&is_null)) > 0) {
- if (is_null) {
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_nulls(this_run));
- } else {
- // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
- auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
- // total number length
- size_t element_cnt = size_t((unsigned long)(*data_ptr));
- auto offset_data = *(data_ptr + 1);
- const uint8_t* offsets_ptr = (const uint8_t*)offset_data;
- if (element_cnt > 0) {
- auto data = *(data_ptr + 2);
- auto nested_null_map = *(data_ptr + 3);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(),
reinterpret_cast<const void*>(data),
- reinterpret_cast<const uint8_t*>(nested_null_map),
offsets_ptr,
- num_rows));
- }
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
Review Comment:
warning: 'auto data_ptr' can be declared as 'const auto *data_ptr'
[readability-qualified-auto]
```suggestion
const auto *data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
```
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -377,9 +366,19 @@
try {
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- const auto* col_cursor = reinterpret_cast<const
CollectionValue*>(*ptr);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(), col_cursor, num_rows));
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
+ // total number length
+ size_t element_cnt = size_t((unsigned long)(*data_ptr));
+ auto offset_data = *(data_ptr + 1);
+ const uint8_t* offsets_ptr = (const uint8_t*)offset_data;
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
const auto* offsets_ptr = (const uint8_t*)offset_data;
```
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -316,30 +316,26 @@
}
return step;
};
+ // TODO: need to process null data for inverted index
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- BitmapIterator null_iter(null_map, num_rows);
- bool is_null = false;
- size_t this_run = 0;
- while ((this_run = null_iter.Next(&is_null)) > 0) {
- if (is_null) {
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_nulls(this_run));
- } else {
- // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
- auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
- // total number length
- size_t element_cnt = size_t((unsigned long)(*data_ptr));
- auto offset_data = *(data_ptr + 1);
- const uint8_t* offsets_ptr = (const uint8_t*)offset_data;
- if (element_cnt > 0) {
- auto data = *(data_ptr + 2);
- auto nested_null_map = *(data_ptr + 3);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(),
reinterpret_cast<const void*>(data),
- reinterpret_cast<const uint8_t*>(nested_null_map),
offsets_ptr,
- num_rows));
- }
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
+ // total number length
+ size_t element_cnt = size_t((unsigned long)(*data_ptr));
+ auto offset_data = *(data_ptr + 1);
+ const uint8_t* offsets_ptr = (const uint8_t*)offset_data;
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
const auto* offsets_ptr = (const uint8_t*)offset_data;
```
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -377,9 +366,19 @@
try {
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- const auto* col_cursor = reinterpret_cast<const
CollectionValue*>(*ptr);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(), col_cursor, num_rows));
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
+ // total number length
+ size_t element_cnt = size_t((unsigned long)(*data_ptr));
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
auto element_cnt = size_t((unsigned long)(*data_ptr));
```
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -377,9 +366,19 @@
try {
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- const auto* col_cursor = reinterpret_cast<const
CollectionValue*>(*ptr);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(), col_cursor, num_rows));
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
Review Comment:
warning: 'auto data_ptr' can be declared as 'const auto *data_ptr'
[readability-qualified-auto]
```suggestion
const auto *data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
```
##########
be/src/olap/task/index_builder.cpp:
##########
@@ -316,30 +316,26 @@
}
return step;
};
+ // TODO: need to process null data for inverted index
if (field->type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
DCHECK(field->get_sub_field_count() == 1);
- BitmapIterator null_iter(null_map, num_rows);
- bool is_null = false;
- size_t this_run = 0;
- while ((this_run = null_iter.Next(&is_null)) > 0) {
- if (is_null) {
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_nulls(this_run));
- } else {
- // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
- auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
- // total number length
- size_t element_cnt = size_t((unsigned long)(*data_ptr));
- auto offset_data = *(data_ptr + 1);
- const uint8_t* offsets_ptr = (const uint8_t*)offset_data;
- if (element_cnt > 0) {
- auto data = *(data_ptr + 2);
- auto nested_null_map = *(data_ptr + 3);
-
RETURN_IF_ERROR(_inverted_index_builders[index_writer_sign]->add_array_values(
- field->get_sub_field(0)->size(),
reinterpret_cast<const void*>(data),
- reinterpret_cast<const uint8_t*>(nested_null_map),
offsets_ptr,
- num_rows));
- }
+ // [size, offset_ptr, item_data_ptr, item_nullmap_ptr]
+ auto data_ptr = reinterpret_cast<const uint64_t*>(*ptr);
+ // total number length
+ size_t element_cnt = size_t((unsigned long)(*data_ptr));
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
auto element_cnt = size_t((unsigned long)(*data_ptr));
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]