HappenLee commented on code in PR #47624:
URL: https://github.com/apache/doris/pull/47624#discussion_r1957338349
##########
be/src/olap/push_handler.cpp:
##########
@@ -692,4 +680,95 @@ Status PushBrokerReader::_get_next_reader() {
return Status::OK();
}
+Status PushBrokerReader::_convert_bitmap(vectorized::Block* block,
+ vectorized::ColumnWithTypeAndName&
arg, uint32_t idx,
+ vectorized::DataTypePtr return_type) {
+ const vectorized::ColumnPtr& src_column = arg.column;
+ const vectorized::ColumnPtr& inner_column =
+ arg.type->is_nullable() ? assert_cast<const
vectorized::ColumnNullable&>(*src_column)
+ .get_nested_column_ptr()
+ : src_column;
+ auto inner_type = std::make_shared<vectorized::DataTypeString>();
+ auto base64_return_type = std::make_shared<vectorized::DataTypeString>();
+
+ vectorized::Block temp_block;
+ temp_block.insert({inner_column, inner_type, "source"});
+ temp_block.insert({nullptr, base64_return_type, "result"});
+
+ auto func_to_base64 =
vectorized::SimpleFunctionFactory::instance().get_function(
+ "to_base64", {vectorized::ColumnWithTypeAndName {inner_column,
inner_type, "source"}},
+ base64_return_type);
+ auto dst_column = vectorized::ColumnString::create();
+ temp_block.replace_by_position(1, std::move(dst_column));
+
+ RETURN_IF_ERROR(func_to_base64->execute(nullptr, temp_block, {0}, 1,
inner_column->size()));
+ auto result_column = temp_block.get_by_position(1).column;
+ if (arg.type->is_nullable()) {
+ const auto& null_map = assert_cast<const
vectorized::ColumnNullable&>(*src_column)
+ .get_null_map_column_ptr();
+ auto nullable_result =
vectorized::ColumnNullable::create(result_column, null_map);
+ block->get_by_position(idx).column = std::move(nullable_result);
+ block->get_by_position(idx).type = make_nullable(base64_return_type);
+ } else {
+ block->get_by_position(idx).column = std::move(result_column);
+ block->get_by_position(idx).type = std::move(base64_return_type);
+ }
+
+ auto& arg_base64 = _src_block_ptr->get_by_position(idx);
+ auto func_bitmap_from_base64 =
vectorized::SimpleFunctionFactory::instance().get_function(
+ "bitmap_from_base64", {arg_base64}, return_type);
+
+ RETURN_IF_ERROR(func_bitmap_from_base64->execute(nullptr, *block, {idx},
idx,
+
arg_base64.column->size()));
+ block->get_by_position(idx).type = std::move(return_type);
+ return Status::OK();
+}
+
+Status PushBrokerReader::_convert_hll(vectorized::Block* block,
Review Comment:
the only different with `_convert_hll` and `_convert_bitmap` is the last
function name `hll_from_base64` or `bitmap_from_base64`. so the better way is
make the function name be a param or template param
--
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]