xiaokang commented on code in PR #9566:
URL: https://github.com/apache/incubator-doris/pull/9566#discussion_r872940972
##########
be/src/util/block_compression.cpp:
##########
@@ -370,27 +388,39 @@ class ZlibBlockCompression : public BlockCompressionCodec
{
};
Status get_block_compression_codec(segment_v2::CompressionTypePB type,
- const BlockCompressionCodec** codec) {
+ std::unique_ptr<BlockCompressionCodec>&
codec) {
+ BlockCompressionCodec* ptr = nullptr;
switch (type) {
case segment_v2::CompressionTypePB::NO_COMPRESSION:
- *codec = nullptr;
- break;
+ codec.reset(nullptr);
+ return Status::OK();
case segment_v2::CompressionTypePB::SNAPPY:
- *codec = SnappyBlockCompression::instance();
+ ptr = new SnappyBlockCompression();
Review Comment:
Yes, it's an easier way to use codec.reset(new SnappyBlockCompression()).
But I changed to the current more complex way, new a ptr first and then call
ptr->init() and call codec.reset(ptr) finally, to avoid reset codec to a not
properly initialized prt.
--
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]