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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 7c687d45547  [branch-2.0](pick) Delete unused function to improve test 
coverage #25233 (#25406)
7c687d45547 is described below

commit 7c687d455474e8c3e9161d6f189950af3657f750
Author: Gabriel <[email protected]>
AuthorDate: Fri Oct 13 18:35:16 2023 +0800

     [branch-2.0](pick) Delete unused function to improve test coverage #25233 
(#25406)
---
 be/src/runtime/datetime_value.h                   | 78 --------------------
 be/src/runtime/runtime_state.cpp                  |  5 ++
 be/src/runtime/runtime_state.h                    |  5 +-
 be/src/vec/common/schema_util.h                   |  2 -
 be/src/vec/core/materialize_block.cpp             | 13 ----
 be/src/vec/core/materialize_block.h               |  1 -
 be/src/vec/core/sort_block.cpp                    | 90 -----------------------
 be/src/vec/core/sort_block.h                      | 18 -----
 be/src/vec/core/types.h                           |  1 +
 be/src/vec/exec/format/parquet/parquet_pred_cmp.h |  3 +
 10 files changed, 10 insertions(+), 206 deletions(-)

diff --git a/be/src/runtime/datetime_value.h b/be/src/runtime/datetime_value.h
index 88279af1b0e..d63bb53ab73 100644
--- a/be/src/runtime/datetime_value.h
+++ b/be/src/runtime/datetime_value.h
@@ -17,21 +17,6 @@
 
 #pragma once
 
-#include <re2/re2.h>
-#include <stdint.h>
-
-// IWYU pragma: no_include <bits/chrono.h>
-#include <chrono>
-#include <cstddef>
-#include <iostream>
-
-#include "cctz/civil_time.h"
-#include "cctz/time_zone.h"
-#include "udf/udf.h"
-#include "util/hash_util.hpp"
-#include "util/timezone_utils.h"
-#include "vec/runtime/vdatetime_value.h"
-
 namespace doris {
 
 enum TimeUnit {
@@ -57,72 +42,9 @@ enum TimeUnit {
     YEAR_MONTH
 };
 
-struct TimeInterval {
-    int64_t year;
-    int64_t month;
-    int64_t day;
-    int64_t hour;
-    int64_t minute;
-    int64_t second;
-    int64_t microsecond;
-    bool is_neg;
-
-    TimeInterval()
-            : year(0),
-              month(0),
-              day(0),
-              hour(0),
-              minute(0),
-              second(0),
-              microsecond(0),
-              is_neg(false) {}
-
-    TimeInterval(TimeUnit unit, int64_t count, bool is_neg_param)
-            : year(0),
-              month(0),
-              day(0),
-              hour(0),
-              minute(0),
-              second(0),
-              microsecond(0),
-              is_neg(is_neg_param) {
-        switch (unit) {
-        case YEAR:
-            year = count;
-            break;
-        case MONTH:
-            month = count;
-            break;
-        case WEEK:
-            day = 7 * count;
-            break;
-        case DAY:
-            day = count;
-            break;
-        case HOUR:
-            hour = count;
-            break;
-        case MINUTE:
-            minute = count;
-            break;
-        case SECOND:
-            second = count;
-            break;
-        case MICROSECOND:
-            microsecond = count;
-            break;
-        default:
-            break;
-        }
-    }
-};
-
 enum TimeType { TIME_TIME = 1, TIME_DATE = 2, TIME_DATETIME = 3 };
 
 // 9999-99-99 99:99:99.999999; 26 + 1('\0')
 const int MAX_DTVALUE_STR_LEN = 27;
 
-constexpr size_t const_length(const char* str) {
-    return (str == nullptr || *str == 0) ? 0 : const_length(str + 1) + 1;
-}
 } // namespace doris
diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp
index 631e0490a71..a4fa27dff72 100644
--- a/be/src/runtime/runtime_state.cpp
+++ b/be/src/runtime/runtime_state.cpp
@@ -381,4 +381,9 @@ int64_t RuntimeState::get_load_mem_limit() {
     }
 }
 
+bool RuntimeState::enable_page_cache() const {
+    return !config::disable_storage_page_cache &&
+           (_query_options.__isset.enable_page_cache && 
_query_options.enable_page_cache);
+}
+
 } // end namespace doris
diff --git a/be/src/runtime/runtime_state.h b/be/src/runtime/runtime_state.h
index 126e6046298..8c2d32b05a4 100644
--- a/be/src/runtime/runtime_state.h
+++ b/be/src/runtime/runtime_state.h
@@ -341,10 +341,7 @@ public:
         return _query_options.__isset.skip_delete_bitmap && 
_query_options.skip_delete_bitmap;
     }
 
-    bool enable_page_cache() const {
-        return !config::disable_storage_page_cache &&
-               (_query_options.__isset.enable_page_cache && 
_query_options.enable_page_cache);
-    }
+    bool enable_page_cache() const;
 
     int partitioned_hash_join_rows_threshold() const {
         if (!_query_options.__isset.partitioned_hash_join_rows_threshold) {
diff --git a/be/src/vec/common/schema_util.h b/be/src/vec/common/schema_util.h
index 8a5b1423d69..6d6e5c25a90 100644
--- a/be/src/vec/common/schema_util.h
+++ b/be/src/vec/common/schema_util.h
@@ -96,8 +96,6 @@ struct FullBaseSchemaView {
     int32_t table_id = 0;
     std::string table_name;
     std::string db_name;
-
-    bool empty() { return column_name_to_column.empty() && schema_version == 
-1; }
 };
 
 Status send_add_columns_rpc(ColumnsWithTypeAndName column_type_names,
diff --git a/be/src/vec/core/materialize_block.cpp 
b/be/src/vec/core/materialize_block.cpp
index 294800202dc..cfa3047cbb4 100644
--- a/be/src/vec/core/materialize_block.cpp
+++ b/be/src/vec/core/materialize_block.cpp
@@ -27,19 +27,6 @@
 
 namespace doris::vectorized {
 
-Block materialize_block(const Block& block) {
-    if (!block) return block;
-
-    Block res = block;
-    size_t columns = res.columns();
-    for (size_t i = 0; i < columns; ++i) {
-        auto& element = res.get_by_position(i);
-        element.column = element.column->convert_to_full_column_if_const();
-    }
-
-    return res;
-}
-
 void materialize_block_inplace(Block& block) {
     for (size_t i = 0; i < block.columns(); ++i) {
         block.replace_by_position_if_const(i);
diff --git a/be/src/vec/core/materialize_block.h 
b/be/src/vec/core/materialize_block.h
index d445d0eb43d..31126a37c0b 100644
--- a/be/src/vec/core/materialize_block.h
+++ b/be/src/vec/core/materialize_block.h
@@ -26,7 +26,6 @@ namespace doris::vectorized {
 
 /** Converts columns-constants to full columns ("materializes" them).
   */
-Block materialize_block(const Block& block);
 void materialize_block_inplace(Block& block);
 
 template <typename Iterator>
diff --git a/be/src/vec/core/sort_block.cpp b/be/src/vec/core/sort_block.cpp
index e31b18a9fcd..552b1d84d79 100644
--- a/be/src/vec/core/sort_block.cpp
+++ b/be/src/vec/core/sort_block.cpp
@@ -42,26 +42,6 @@ ColumnsWithSortDescriptions 
get_columns_with_sort_description(const Block& block
     return res;
 }
 
-struct PartialSortingLess {
-    const ColumnsWithSortDescriptions& columns;
-
-    explicit PartialSortingLess(const ColumnsWithSortDescriptions& columns_) : 
columns(columns_) {}
-
-    bool operator()(size_t a, size_t b) const {
-        for (ColumnsWithSortDescriptions::const_iterator it = columns.begin(); 
it != columns.end();
-             ++it) {
-            int res = it->second.direction *
-                      it->first->compare_at(a, b, *it->first, 
it->second.nulls_direction);
-            if (res < 0) {
-                return true;
-            } else if (res > 0) {
-                return false;
-            }
-        }
-        return false;
-    }
-};
-
 void sort_block(Block& src_block, Block& dest_block, const SortDescription& 
description,
                 UInt64 limit) {
     if (!src_block) {
@@ -117,74 +97,4 @@ void sort_block(Block& src_block, Block& dest_block, const 
SortDescription& desc
     }
 }
 
-void stable_get_permutation(const Block& block, const SortDescription& 
description,
-                            IColumn::Permutation& out_permutation) {
-    if (!block) {
-        return;
-    }
-
-    size_t size = block.rows();
-    out_permutation.resize(size);
-    for (size_t i = 0; i < size; ++i) {
-        out_permutation[i] = i;
-    }
-
-    ColumnsWithSortDescriptions columns_with_sort_desc =
-            get_columns_with_sort_description(block, description);
-
-    std::stable_sort(out_permutation.begin(), out_permutation.end(),
-                     PartialSortingLess(columns_with_sort_desc));
-}
-
-bool is_already_sorted(const Block& block, const SortDescription& description) 
{
-    if (!block) {
-        return true;
-    }
-
-    size_t rows = block.rows();
-
-    ColumnsWithSortDescriptions columns_with_sort_desc =
-            get_columns_with_sort_description(block, description);
-
-    PartialSortingLess less(columns_with_sort_desc);
-
-    /** If the rows are not too few, then let's make a quick attempt to verify 
that the block is not sorted.
-     * Constants - at random.
-     */
-    static constexpr size_t num_rows_to_try = 10;
-    if (rows > num_rows_to_try * 5) {
-        for (size_t i = 1; i < num_rows_to_try; ++i) {
-            size_t prev_position = rows * (i - 1) / num_rows_to_try;
-            size_t curr_position = rows * i / num_rows_to_try;
-
-            if (less(curr_position, prev_position)) {
-                return false;
-            }
-        }
-    }
-
-    for (size_t i = 1; i < rows; ++i) {
-        if (less(i, i - 1)) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-void stable_sort_block(Block& block, const SortDescription& description) {
-    if (!block) {
-        return;
-    }
-
-    IColumn::Permutation perm;
-    stable_get_permutation(block, description, perm);
-
-    size_t columns = block.columns();
-    for (size_t i = 0; i < columns; ++i) {
-        block.safe_get_by_position(i).column =
-                block.safe_get_by_position(i).column->permute(perm, 0);
-    }
-}
-
 } // namespace doris::vectorized
diff --git a/be/src/vec/core/sort_block.h b/be/src/vec/core/sort_block.h
index 6b24c160dcb..db3592e9a72 100644
--- a/be/src/vec/core/sort_block.h
+++ b/be/src/vec/core/sort_block.h
@@ -56,24 +56,6 @@ namespace doris::vectorized {
 void sort_block(Block& src_block, Block& dest_block, const SortDescription& 
description,
                 UInt64 limit = 0);
 
-/** Used only in StorageMergeTree to sort the data with INSERT.
-  * Sorting is stable. This is important for keeping the order of rows in the 
CollapsingMergeTree engine
-  *  - because based on the order of rows it is determined whether to delete 
or leave groups of rows when collapsing.
-  * Collations are not supported. Partial sorting is not supported.
-  */
-void stable_sort_block(Block& block, const SortDescription& description);
-
-/** Same as stable_sort_block, but do not sort the block, but only calculate 
the permutation of the values,
-  *  so that you can rearrange the column values yourself.
-  */
-void stable_get_permutation(const Block& block, const SortDescription& 
description,
-                            IColumn::Permutation& out_permutation);
-
-/** Quickly check whether the block is already sorted. If the block is not 
sorted - returns false as fast as possible.
-  * Collations are not supported.
-  */
-bool is_already_sorted(const Block& block, const SortDescription& description);
-
 using ColumnWithSortDescription = std::pair<const IColumn*, 
SortColumnDescription>;
 
 using ColumnsWithSortDescriptions = std::vector<ColumnWithSortDescription>;
diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h
index 51fc436fe2f..340bbc81504 100644
--- a/be/src/vec/core/types.h
+++ b/be/src/vec/core/types.h
@@ -35,6 +35,7 @@ class BitmapValue;
 class HyperLogLog;
 struct decimal12_t;
 struct uint24_t;
+struct StringRef;
 
 template <typename T>
 class QuantileState;
diff --git a/be/src/vec/exec/format/parquet/parquet_pred_cmp.h 
b/be/src/vec/exec/format/parquet/parquet_pred_cmp.h
index c76fa95f4ad..b993370a159 100644
--- a/be/src/vec/exec/format/parquet/parquet_pred_cmp.h
+++ b/be/src/vec/exec/format/parquet/parquet_pred_cmp.h
@@ -20,9 +20,12 @@
 #include <cstring>
 #include <vector>
 
+#include "cctz/civil_time.h"
+#include "cctz/time_zone.h"
 #include "exec/olap_common.h"
 #include "gutil/endian.h"
 #include "parquet_common.h"
+#include "util/timezone_utils.h"
 #include "vec/data_types/data_type_decimal.h"
 #include "vec/exec/format/format_common.h"
 #include "vec/exec/format/parquet/schema_desc.h"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to