imay commented on a change in pull request #1646: Support page compression in 
BetaRowset
URL: https://github.com/apache/incubator-doris/pull/1646#discussion_r314312451
 
 

 ##########
 File path: be/src/olap/rowset/segment_v2/column_writer.cpp
 ##########
 @@ -226,10 +228,14 @@ Status ColumnWriter::_write_data_page(Page* page) {
 Status ColumnWriter::_write_physical_page(std::vector<Slice>* origin_data, 
PagePointer* pp) {
     std::vector<Slice>* output_data = origin_data;
     std::vector<Slice> compressed_data;
-    // TODO(zc): support compress
-    // if (_need_compress) {
-    //     output_data = &compressed_data;
-    // }
+
+    // Put compressor out of if block, because we should use compressor's
+    // content until this function finished.
+    PageCompressor compressor(_compress_codec);
+    if (_compress_codec != nullptr) {
+        RETURN_IF_ERROR(compressor.compress(*origin_data, &compressed_data));
+        output_data = &compressed_data;
+    }
 
     // checksum
     uint8_t checksum_buf[sizeof(uint32_t)];
 
 Review comment:
   this is a stack array, can not leak

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org
For additional commands, e-mail: dev-h...@doris.apache.org

Reply via email to