You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by pa...@apache.org on 2023/01/15 02:40:42 UTC

[doris] branch master updated: [Chore](build) enable -Wextra and remove some -Wno (#15760)

This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new b727033906 [Chore](build) enable -Wextra and remove some -Wno (#15760)
b727033906 is described below

commit b727033906cef0f1bfdf620da7bc17c1ade0f747
Author: Pxl <px...@qq.com>
AuthorDate: Sun Jan 15 10:40:35 2023 +0800

    [Chore](build) enable -Wextra and remove some -Wno (#15760)
    
    enable -Wextra and remove some -Wno
---
 be/CMakeLists.txt                                  | 16 +++-------
 be/src/exec/arrow/arrow_reader.cpp                 |  2 +-
 be/src/exec/decompressor.cpp                       |  2 +-
 be/src/exec/plain_text_line_reader.cpp             |  2 +-
 .../schema_scanner/schema_charsets_scanner.cpp     |  3 +-
 be/src/http/action/pprof_actions.cpp               | 12 +++++---
 be/src/olap/column_vector.cpp                      |  1 -
 be/src/olap/delta_writer.h                         |  4 +--
 .../olap/rowset/segment_v2/bitmap_index_reader.cpp |  4 +--
 be/src/olap/rowset/segment_v2/bloom_filter.cpp     |  2 +-
 be/src/olap/rowset/segment_v2/column_reader.cpp    | 36 ++++++++++------------
 .../rowset/segment_v2/indexed_column_reader.cpp    |  2 +-
 be/src/olap/tablet.cpp                             |  4 +--
 be/src/runtime/decimalv2_value.cpp                 |  1 -
 be/src/util/bfd_parser.cpp                         |  9 ++++--
 be/src/util/block_compression.cpp                  |  2 +-
 be/src/util/frame_of_reference_coding.cpp          |  5 +--
 be/src/util/pprof_utils.cpp                        | 11 ++++---
 be/src/util/zip_util.cpp                           |  4 ---
 be/src/vec/data_types/data_type_decimal.h          |  2 +-
 .../file_reader/new_plain_text_line_reader.cpp     |  2 +-
 be/src/vec/exec/vset_operation_node.cpp            |  1 -
 be/src/vec/functions/if.cpp                        |  1 -
 be/src/vec/olap/vertical_merge_iterator.cpp        |  1 -
 be/src/vec/olap/vgeneric_iterators.cpp             |  2 --
 be/test/olap/aggregate_func_test.cpp               |  1 -
 be/test/vec/function/function_test_util.cpp        |  2 +-
 .../utils/arrow_column_to_doris_column_test.cpp    |  1 -
 28 files changed, 60 insertions(+), 75 deletions(-)

diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 43f8abe2b3..f7431a9710 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -453,12 +453,13 @@ check_function_exists(sched_getcpu HAVE_SCHED_GETCPU)
 
 # compiler flags that are common across debug/release builds
 #  -Wall: Enable all warnings.
-#  -Wno-sign-compare: suppress warnings for comparison between signed and unsigned
 #    integers
 #  -pthread: enable multithreaded malloc
 #  -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG: enable nanosecond precision for boost
 #  -fno-omit-frame-pointers: Keep frame pointer for functions in register
-set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wall -Wno-sign-compare -pthread -Werror")
+set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -g -Wall -Wextra -pthread -Werror")
+# TODO: resolve and remove those wno
+set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-implicit-fallthrough -Wno-sign-compare")
 set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fstrict-aliasing -fno-omit-frame-pointer")
 set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -std=gnu++17 -D__STDC_FORMAT_MACROS")
 set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG")
@@ -482,9 +483,7 @@ endfunction()
 
 # In terms of performance, mold> lld> gold> ld
 set(CUSTUM_LINKER_COMMAND "ld")
-# TODO: mold will link fail on thirdparty brpc now, waiting for investigation.
-# TRY_TO_CHANGE_LINKER("mold" "mold")
-
+TRY_TO_CHANGE_LINKER("mold" "mold")
 TRY_TO_CHANGE_LINKER("lld" "LLD")
 TRY_TO_CHANGE_LINKER("gold" "GNU gold")
 if (NOT CUSTUM_LINKER_COMMAND STREQUAL "ld")
@@ -523,7 +522,7 @@ if ("${CMAKE_BUILD_TARGET_ARCH}" STREQUAL "x86" OR "${CMAKE_BUILD_TARGET_ARCH}"
         set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -mavx2")
     endif()
 endif()
-set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-attributes -DS2_USE_GFLAGS -DS2_USE_GLOG")
+set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DS2_USE_GFLAGS -DS2_USE_GLOG")
 
 if (WITH_MYSQL)
     set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DDORIS_WITH_MYSQL")
@@ -563,11 +562,6 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
     set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -faligned-new")
 endif()
 
-# For any gcc builds:
-#   -g: Enable symbols for profiler tools. Produce debugging information in the operating system’s native formt
-#   -Wno-unused-local-typedefs: Do not warn for local typedefs that are unused.
-set(CXX_GCC_FLAGS "${CXX_GCC_FLAGS} -g -Wno-unused-local-typedefs")
-
 if (USE_DWARF)
     set(CXX_GCC_FLAGS "${CXX_GCC_FLAGS} -gdwarf-5")
 endif()
diff --git a/be/src/exec/arrow/arrow_reader.cpp b/be/src/exec/arrow/arrow_reader.cpp
index 79e206649f..39e362205f 100644
--- a/be/src/exec/arrow/arrow_reader.cpp
+++ b/be/src/exec/arrow/arrow_reader.cpp
@@ -262,7 +262,7 @@ arrow::Result<std::shared_ptr<arrow::Buffer>> ArrowFile::Read(int64_t nbytes) {
     ARROW_RETURN_NOT_OK(bytes_read);
     // If bytes_read is equal with read_buf's capacity, we just assign
     if (bytes_read.ValueOrDie() == nbytes) {
-        return std::move(read_buf);
+        return read_buf;
     } else {
         return arrow::SliceBuffer(read_buf, 0, bytes_read.ValueOrDie());
     }
diff --git a/be/src/exec/decompressor.cpp b/be/src/exec/decompressor.cpp
index 881c46c98b..18bf064fcb 100644
--- a/be/src/exec/decompressor.cpp
+++ b/be/src/exec/decompressor.cpp
@@ -69,7 +69,7 @@ GzipDecompressor::~GzipDecompressor() {
 }
 
 Status GzipDecompressor::init() {
-    _z_strm = {nullptr};
+    _z_strm = {};
     _z_strm.zalloc = Z_NULL;
     _z_strm.zfree = Z_NULL;
     _z_strm.opaque = Z_NULL;
diff --git a/be/src/exec/plain_text_line_reader.cpp b/be/src/exec/plain_text_line_reader.cpp
index 06d55dccd2..3c24a345b7 100644
--- a/be/src/exec/plain_text_line_reader.cpp
+++ b/be/src/exec/plain_text_line_reader.cpp
@@ -85,7 +85,7 @@ void PlainTextLineReader::close() {
 inline bool PlainTextLineReader::update_eof() {
     if (done()) {
         _eof = true;
-    } else if (_decompressor == nullptr && (_min_length >= 0 && _total_read_bytes >= _min_length)) {
+    } else if (_decompressor == nullptr && _total_read_bytes >= _min_length) {
         _eof = true;
     }
     return _eof;
diff --git a/be/src/exec/schema_scanner/schema_charsets_scanner.cpp b/be/src/exec/schema_scanner/schema_charsets_scanner.cpp
index 6621b10e1d..27772c85bf 100644
--- a/be/src/exec/schema_scanner/schema_charsets_scanner.cpp
+++ b/be/src/exec/schema_scanner/schema_charsets_scanner.cpp
@@ -17,7 +17,6 @@
 
 #include "exec/schema_scanner/schema_charsets_scanner.h"
 
-#include "runtime/primitive_type.h"
 #include "runtime/string_value.h"
 
 namespace doris {
@@ -32,7 +31,7 @@ SchemaScanner::ColumnDesc SchemaCharsetsScanner::_s_css_columns[] = {
 
 SchemaCharsetsScanner::CharsetStruct SchemaCharsetsScanner::_s_charsets[] = {
         {"utf8", "utf8_general_ci", "UTF-8 Unicode", 3},
-        {nullptr, nullptr, 0},
+        {nullptr, nullptr, nullptr, 0},
 };
 
 SchemaCharsetsScanner::SchemaCharsetsScanner()
diff --git a/be/src/http/action/pprof_actions.cpp b/be/src/http/action/pprof_actions.cpp
index 1cc5a43d33..c0f03f03bc 100644
--- a/be/src/http/action/pprof_actions.cpp
+++ b/be/src/http/action/pprof_actions.cpp
@@ -227,12 +227,16 @@ void CmdlineAction::handle(HttpRequest* req) {
         HttpChannel::send_reply(req, str);
         return;
     }
+
+    std::string str;
     char buf[1024];
-    // Ignore unused return value
-    if (fscanf(fp, "%1023s ", buf))
-        ;
+    if (fscanf(fp, "%1023s ", buf) == 1) {
+        str = buf;
+    } else {
+        str = "Unable to read file: /proc/self/cmdline";
+    }
+
     fclose(fp);
-    std::string str = buf;
 
     HttpChannel::send_reply(req, str);
 }
diff --git a/be/src/olap/column_vector.cpp b/be/src/olap/column_vector.cpp
index 8211bd9d1a..7ec51ca672 100644
--- a/be/src/olap/column_vector.cpp
+++ b/be/src/olap/column_vector.cpp
@@ -239,7 +239,6 @@ void ArrayColumnVectorBatch::put_item_ordinal(segment_v2::ordinal_t* ordinals, s
 }
 
 void ArrayColumnVectorBatch::get_offset_by_length(size_t start_idx, size_t size) {
-    DCHECK(start_idx >= 0);
     DCHECK(start_idx + size < _offsets->capacity());
 
     for (size_t i = start_idx; i < start_idx + size; ++i) {
diff --git a/be/src/olap/delta_writer.h b/be/src/olap/delta_writer.h
index 7b68145047..5de52fd7b8 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -47,8 +47,8 @@ struct WriteRequest {
     // slots are in order of tablet's schema
     const std::vector<SlotDescriptor*>* slots;
     bool is_high_priority = false;
-    POlapTableSchemaParam ptable_schema_param;
-    int64_t index_id;
+    POlapTableSchemaParam ptable_schema_param = {};
+    int64_t index_id = 0;
 };
 
 // Writer for a particular (load, index, tablet).
diff --git a/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp b/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
index ce8e164d58..072c12b02d 100644
--- a/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
@@ -47,7 +47,7 @@ Status BitmapIndexIterator::seek_dictionary(const void* value, bool* exact_match
 }
 
 Status BitmapIndexIterator::read_bitmap(rowid_t ordinal, roaring::Roaring* result) {
-    DCHECK(0 <= ordinal && ordinal < _reader->bitmap_nums());
+    DCHECK(ordinal < _reader->bitmap_nums());
 
     size_t num_to_read = 1;
     auto data_type = vectorized::DataTypeFactory::instance().create_data_type(
@@ -65,7 +65,7 @@ Status BitmapIndexIterator::read_bitmap(rowid_t ordinal, roaring::Roaring* resul
 }
 
 Status BitmapIndexIterator::read_union_bitmap(rowid_t from, rowid_t to, roaring::Roaring* result) {
-    DCHECK(0 <= from && from <= to && to <= _reader->bitmap_nums());
+    DCHECK(from <= to && to <= _reader->bitmap_nums());
 
     for (rowid_t pos = from; pos < to; pos++) {
         roaring::Roaring bitmap;
diff --git a/be/src/olap/rowset/segment_v2/bloom_filter.cpp b/be/src/olap/rowset/segment_v2/bloom_filter.cpp
index 667cc9b595..e11fe6ca1d 100644
--- a/be/src/olap/rowset/segment_v2/bloom_filter.cpp
+++ b/be/src/olap/rowset/segment_v2/bloom_filter.cpp
@@ -52,7 +52,7 @@ uint32_t BloomFilter::optimal_bit_num(uint64_t n, double fpp) {
     // ref parquet bloom_filter branch(BlockSplitBloomFilter.java)
     uint32_t num_bits = -8 * (double)n / log(1 - pow(fpp, 1.0 / 8));
     uint32_t max_bits = MAXIMUM_BYTES << 3;
-    if (num_bits > max_bits || num_bits < 0) {
+    if (num_bits > max_bits) {
         num_bits = max_bits;
     }
 
diff --git a/be/src/olap/rowset/segment_v2/column_reader.cpp b/be/src/olap/rowset/segment_v2/column_reader.cpp
index 6f49aa23cf..df591a0605 100644
--- a/be/src/olap/rowset/segment_v2/column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/column_reader.cpp
@@ -536,28 +536,26 @@ Status ArrayFileColumnIterator::next_batch(size_t* n, ColumnBlockView* dst, bool
 
     // read item
     size_t item_size = ordinals[*n] - ordinals[0];
-    if (item_size >= 0) {
-        bool item_has_null = false;
-        ColumnVectorBatch* item_vector_batch = array_batch->elements();
-
-        bool rebuild_array_from0 = false;
-        if (item_vector_batch->capacity() < array_batch->item_offset(dst->current_offset() + *n)) {
-            item_vector_batch->resize(array_batch->item_offset(dst->current_offset() + *n));
-            rebuild_array_from0 = true;
-        }
-
-        ColumnBlock item_block = ColumnBlock(item_vector_batch, dst->pool());
-        ColumnBlockView item_view =
-                ColumnBlockView(&item_block, array_batch->item_offset(dst->current_offset()));
-        size_t real_read = item_size;
-        RETURN_IF_ERROR(_item_iterator->next_batch(&real_read, &item_view, &item_has_null));
-        DCHECK(item_size == real_read);
+    bool item_has_null = false;
+    ColumnVectorBatch* item_vector_batch = array_batch->elements();
 
-        size_t rebuild_start_offset = rebuild_array_from0 ? 0 : dst->current_offset();
-        size_t rebuild_size = rebuild_array_from0 ? dst->current_offset() + *n : *n;
-        array_batch->prepare_for_read(rebuild_start_offset, rebuild_size, item_has_null);
+    bool rebuild_array_from0 = false;
+    if (item_vector_batch->capacity() < array_batch->item_offset(dst->current_offset() + *n)) {
+        item_vector_batch->resize(array_batch->item_offset(dst->current_offset() + *n));
+        rebuild_array_from0 = true;
     }
 
+    ColumnBlock item_block = ColumnBlock(item_vector_batch, dst->pool());
+    ColumnBlockView item_view =
+            ColumnBlockView(&item_block, array_batch->item_offset(dst->current_offset()));
+    size_t real_read = item_size;
+    RETURN_IF_ERROR(_item_iterator->next_batch(&real_read, &item_view, &item_has_null));
+    DCHECK(item_size == real_read);
+
+    size_t rebuild_start_offset = rebuild_array_from0 ? 0 : dst->current_offset();
+    size_t rebuild_size = rebuild_array_from0 ? dst->current_offset() + *n : *n;
+    array_batch->prepare_for_read(rebuild_start_offset, rebuild_size, item_has_null);
+
     dst->advance(*n);
     return Status::OK();
 }
diff --git a/be/src/olap/rowset/segment_v2/indexed_column_reader.cpp b/be/src/olap/rowset/segment_v2/indexed_column_reader.cpp
index bac8b7b51a..2114435551 100644
--- a/be/src/olap/rowset/segment_v2/indexed_column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/indexed_column_reader.cpp
@@ -124,7 +124,7 @@ Status IndexedColumnIterator::_read_data_page(const PagePointer& pp) {
 }
 
 Status IndexedColumnIterator::seek_to_ordinal(ordinal_t idx) {
-    DCHECK(idx >= 0 && idx <= _reader->num_values());
+    DCHECK(idx <= _reader->num_values());
 
     if (!_reader->support_ordinal_seek()) {
         return Status::NotSupported("no ordinal index");
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index c4b0f835aa..f6eda348f3 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2010,8 +2010,8 @@ Status Tablet::lookup_row_key(const Slice& encoded_key, const RowsetIdUnorderedS
             return s;
         }
         loc.rowset_id = rs.first->rowset_id();
-        if (version >= 0 && _tablet_meta->delete_bitmap().contains_agg(
-                                    {loc.rowset_id, loc.segment_id, version}, loc.row_id)) {
+        if (_tablet_meta->delete_bitmap().contains_agg({loc.rowset_id, loc.segment_id, version},
+                                                       loc.row_id)) {
             // if has sequence col, we continue to compare the sequence_id of
             // all rowsets, util we find an existing key.
             if (_schema->has_sequence_col()) {
diff --git a/be/src/runtime/decimalv2_value.cpp b/be/src/runtime/decimalv2_value.cpp
index adae08efd1..3d7f56c047 100644
--- a/be/src/runtime/decimalv2_value.cpp
+++ b/be/src/runtime/decimalv2_value.cpp
@@ -243,7 +243,6 @@ static std::pair<double, double> quadratic_equation_naive(__uint128_t a, __uint1
     __uint128_t dis = b * b - 4 * a * c;
     // assert(dis >= 0);
     // not handling complex root
-    if (dis < 0) return std::make_pair(0, 0);
     double sqrtdis = std::sqrt(static_cast<double>(dis));
     double a_r = static_cast<double>(a);
     double b_r = static_cast<double>(b);
diff --git a/be/src/util/bfd_parser.cpp b/be/src/util/bfd_parser.cpp
index 4486ce26b0..98f0a46d62 100644
--- a/be/src/util/bfd_parser.cpp
+++ b/be/src/util/bfd_parser.cpp
@@ -102,9 +102,12 @@ BfdParser* BfdParser::create() {
     }
 
     char prog_name[1024];
-    // Ignore unused return value
-    if (fscanf(file, "%1023s ", prog_name))
-        ;
+
+    if (fscanf(file, "%1023s ", prog_name) != 1) {
+        fclose(file);
+        return nullptr;
+    }
+
     fclose(file);
     std::unique_ptr<BfdParser> parser(new BfdParser(prog_name));
     if (parser->parse()) {
diff --git a/be/src/util/block_compression.cpp b/be/src/util/block_compression.cpp
index 821636c4f9..4ff091b677 100644
--- a/be/src/util/block_compression.cpp
+++ b/be/src/util/block_compression.cpp
@@ -817,7 +817,7 @@ public:
     ~GzipBlockCompression() override = default;
 
     Status decompress(const Slice& input, Slice* output) override {
-        z_stream z_strm = {nullptr};
+        z_stream z_strm = {};
         z_strm.zalloc = Z_NULL;
         z_strm.zfree = Z_NULL;
         z_strm.opaque = Z_NULL;
diff --git a/be/src/util/frame_of_reference_coding.cpp b/be/src/util/frame_of_reference_coding.cpp
index 5ab334b3c3..0e7bb57b64 100644
--- a/be/src/util/frame_of_reference_coding.cpp
+++ b/be/src/util/frame_of_reference_coding.cpp
@@ -235,9 +235,6 @@ bool ForDecoder<T>::init() {
     _last_frame_size = _max_frame_size - (_max_frame_size * _frame_count - _values_num);
 
     size_t bit_width_offset = _buffer_len - 5 - _frame_count * 2;
-    if (bit_width_offset < 0) {
-        return false;
-    }
 
     // read _storage_formats, bit_widths and compute frame_offsets
     u_int32_t frame_start_offset = 0;
@@ -398,7 +395,7 @@ bool ForDecoder<T>::get_batch(T* val, size_t count) {
 
 template <typename T>
 bool ForDecoder<T>::skip(int32_t skip_num) {
-    if (_current_index + skip_num >= _values_num || _current_index + skip_num < 0) {
+    if (_current_index + skip_num >= _values_num) {
         return false;
     }
     _current_index = _current_index + skip_num;
diff --git a/be/src/util/pprof_utils.cpp b/be/src/util/pprof_utils.cpp
index 51c0486f92..8fc58410c8 100644
--- a/be/src/util/pprof_utils.cpp
+++ b/be/src/util/pprof_utils.cpp
@@ -66,12 +66,15 @@ Status PprofUtils::get_self_cmdline(std::string* cmd) {
         return Status::InternalError("Unable to open file: /proc/self/cmdline");
     }
     char buf[1024];
-    // Ignore unused return value
-    if (fscanf(fp, "%1023s ", buf))
-        ;
+
+    Status res = Status::OK();
+
+    if (fscanf(fp, "%1023s ", buf) != 1) {
+        res = Status::InternalError("get_self_cmdline read buffer failed");
+    }
     fclose(fp);
     *cmd = buf;
-    return Status::OK();
+    return res;
 }
 
 Status PprofUtils::get_readable_profile(const std::string& file_or_content, bool is_file,
diff --git a/be/src/util/zip_util.cpp b/be/src/util/zip_util.cpp
index 901230e5cb..95e4d686fc 100644
--- a/be/src/util/zip_util.cpp
+++ b/be/src/util/zip_util.cpp
@@ -123,10 +123,6 @@ Status ZipFile::extract_file(const std::string& target_path) {
     size_t size = 0;
     do {
         size = unzReadCurrentFile(_zip_file, (voidp)file_data.get(), file_size);
-        if (size < 0) {
-            return Status::IOError("unzip file {} failed", file_name);
-        }
-
         RETURN_IF_ERROR(wfile->append(Slice(file_data.get(), size)));
     } while (size > 0);
 
diff --git a/be/src/vec/data_types/data_type_decimal.h b/be/src/vec/data_types/data_type_decimal.h
index 633ed8963b..358fe79438 100644
--- a/be/src/vec/data_types/data_type_decimal.h
+++ b/be/src/vec/data_types/data_type_decimal.h
@@ -128,7 +128,7 @@ public:
             LOG(FATAL) << fmt::format("Precision {} is out of bounds", precision);
         }
 
-        if (UNLIKELY(scale < 0 || static_cast<UInt32>(scale) > max_precision())) {
+        if (UNLIKELY(static_cast<UInt32>(scale) > max_precision())) {
             LOG(FATAL) << fmt::format("Scale {} is out of bounds", scale);
         }
     }
diff --git a/be/src/vec/exec/format/file_reader/new_plain_text_line_reader.cpp b/be/src/vec/exec/format/file_reader/new_plain_text_line_reader.cpp
index 52af605154..89089ff375 100644
--- a/be/src/vec/exec/format/file_reader/new_plain_text_line_reader.cpp
+++ b/be/src/vec/exec/format/file_reader/new_plain_text_line_reader.cpp
@@ -88,7 +88,7 @@ void NewPlainTextLineReader::close() {
 inline bool NewPlainTextLineReader::update_eof() {
     if (done()) {
         _eof = true;
-    } else if (_decompressor == nullptr && (_min_length >= 0 && _total_read_bytes >= _min_length)) {
+    } else if (_decompressor == nullptr && (_total_read_bytes >= _min_length)) {
         _eof = true;
     }
     return _eof;
diff --git a/be/src/vec/exec/vset_operation_node.cpp b/be/src/vec/exec/vset_operation_node.cpp
index 16f3975dd5..9ad65dbf1c 100644
--- a/be/src/vec/exec/vset_operation_node.cpp
+++ b/be/src/vec/exec/vset_operation_node.cpp
@@ -81,7 +81,6 @@ struct HashTableProbe {
 
     Status mark_data_in_hashtable(HashTableContext& hash_table_ctx) {
         using KeyGetter = typename HashTableContext::State;
-        using Mapped = typename HashTableContext::Mapped;
 
         KeyGetter key_getter(_probe_raw_ptrs, _operation_node->_probe_key_sz, nullptr);
         if constexpr (ColumnsHashing::IsPreSerializedKeysHashMethodTraits<KeyGetter>::value) {
diff --git a/be/src/vec/functions/if.cpp b/be/src/vec/functions/if.cpp
index 0d36f462ae..031ec30118 100644
--- a/be/src/vec/functions/if.cpp
+++ b/be/src/vec/functions/if.cpp
@@ -206,7 +206,6 @@ public:
         auto call = [&](const auto& types) -> bool {
             using Types = std::decay_t<decltype(types)>;
             using T0 = typename Types::LeftType;
-            using T1 = typename Types::RightType;
             using result_type = typename Types::LeftType;
 
             // for doris, args type and return type must be sanme beacause of type cast has already done before, so here just need one type;
diff --git a/be/src/vec/olap/vertical_merge_iterator.cpp b/be/src/vec/olap/vertical_merge_iterator.cpp
index 7259c90199..7523dc3237 100644
--- a/be/src/vec/olap/vertical_merge_iterator.cpp
+++ b/be/src/vec/olap/vertical_merge_iterator.cpp
@@ -257,7 +257,6 @@ void VerticalMergeIteratorContext::copy_rows(Block* block, bool advanced) {
 
     // copy a row to dst block column by column
     size_t start = _index_in_block - _cur_batch_num + 1 - advanced;
-    DCHECK(start >= 0);
 
     for (size_t i = 0; i < _ori_return_cols; ++i) {
         auto& s_col = src.get_by_position(i);
diff --git a/be/src/vec/olap/vgeneric_iterators.cpp b/be/src/vec/olap/vgeneric_iterators.cpp
index 2d6d54f762..db38ebe6c4 100644
--- a/be/src/vec/olap/vgeneric_iterators.cpp
+++ b/be/src/vec/olap/vgeneric_iterators.cpp
@@ -138,7 +138,6 @@ void VMergeIteratorContext::copy_rows(Block* block, bool advanced) {
 
     // copy a row to dst block column by column
     size_t start = _index_in_block - _cur_batch_num + 1 - advanced;
-    DCHECK(start >= 0);
 
     for (size_t i = 0; i < _num_columns; ++i) {
         auto& s_col = src.get_by_position(i);
@@ -159,7 +158,6 @@ void VMergeIteratorContext::copy_rows(BlockView* view, bool advanced) {
         return;
     }
     size_t start = _index_in_block - _cur_batch_num + 1 - advanced;
-    DCHECK(start >= 0);
 
     const auto& tmp_pre_ctx_same_bit = get_pre_ctx_same();
     for (size_t i = 0; i < _cur_batch_num; ++i) {
diff --git a/be/test/olap/aggregate_func_test.cpp b/be/test/olap/aggregate_func_test.cpp
index 687048419b..8cb1cc0120 100644
--- a/be/test/olap/aggregate_func_test.cpp
+++ b/be/test/olap/aggregate_func_test.cpp
@@ -311,7 +311,6 @@ void test_replace() {
 
 template <FieldType field_type>
 void test_replace_string() {
-    using CppType = typename CppTypeTraits<field_type>::CppType;
     constexpr size_t string_field_size = sizeof(bool) + sizeof(Slice);
 
     char dst[string_field_size];
diff --git a/be/test/vec/function/function_test_util.cpp b/be/test/vec/function/function_test_util.cpp
index 0dbea78d02..ae35124e66 100644
--- a/be/test/vec/function/function_test_util.cpp
+++ b/be/test/vec/function/function_test_util.cpp
@@ -51,7 +51,7 @@ uint64_t str_to_datetime_v2(std::string datetime_str, std::string datetime_forma
 size_t type_index_to_data_type(const std::vector<AnyType>& input_types, size_t index,
                                ut_type::UTDataTypeDesc& ut_desc, DataTypePtr& type) {
     doris_udf::FunctionContext::TypeDesc& desc = ut_desc.type_desc;
-    if (index < 0 || index >= input_types.size()) {
+    if (index >= input_types.size()) {
         return -1;
     }
 
diff --git a/be/test/vec/utils/arrow_column_to_doris_column_test.cpp b/be/test/vec/utils/arrow_column_to_doris_column_test.cpp
index 608775ef13..fda70edd56 100644
--- a/be/test/vec/utils/arrow_column_to_doris_column_test.cpp
+++ b/be/test/vec/utils/arrow_column_to_doris_column_test.cpp
@@ -389,7 +389,6 @@ void test_arrow_to_decimal_column(std::shared_ptr<arrow::Decimal128Type> type,
 template <bool is_nullable>
 void test_decimalv2(std::shared_ptr<arrow::Decimal128Type> type,
                     const std::vector<std::string>& test_cases, size_t num_elements) {
-    using ArrowCppType = typename arrow::TypeTraits<arrow::Decimal128Type>::CType;
     size_t counter = 0;
     auto pt = arrow_type_to_primitive_type(type->id());
     ASSERT_NE(pt, INVALID_TYPE);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org