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

zhangstar333 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 279c162c71d [Refactor](BE) Uniform Expr, Block, Columns size-relative 
interface (Part II) (#43218)
279c162c71d is described below

commit 279c162c71d73884a7da6c5529992e20f9739db8
Author: zclllhhjj <zhaochan...@selectdb.com>
AuthorDate: Mon Nov 11 10:44:21 2024 +0800

    [Refactor](BE) Uniform Expr, Block, Columns size-relative interface (Part 
II) (#43218)
    
    part 2 of https://github.com/apache/doris/pull/42930
    
    two modifications:
    1. when parsing data of json array, cast to target type when parse int
    data no matter what source type is.
    2. in explode_numbers, the argument column type is certain Int32. so
    reduce some virtual function call.
---
 be/src/vec/exprs/table_function/table_function.h   |  6 ++++-
 .../table_function/table_function_factory.cpp      |  3 ++-
 .../exprs/table_function/table_function_factory.h  |  3 +++
 .../exprs/table_function/udf_table_function.cpp    |  4 ++++
 .../vec/exprs/table_function/udf_table_function.h  |  2 ++
 be/src/vec/exprs/table_function/vexplode.cpp       |  5 ++--
 be/src/vec/exprs/table_function/vexplode.h         | 11 +++++----
 .../vec/exprs/table_function/vexplode_bitmap.cpp   |  5 ++--
 be/src/vec/exprs/table_function/vexplode_bitmap.h  | 13 ++++-------
 .../exprs/table_function/vexplode_json_array.cpp   |  9 ++++----
 .../vec/exprs/table_function/vexplode_json_array.h | 13 ++++++-----
 .../exprs/table_function/vexplode_json_object.cpp  | 17 ++++++++------
 .../exprs/table_function/vexplode_json_object.h    | 11 +++------
 be/src/vec/exprs/table_function/vexplode_map.cpp   |  5 ++--
 be/src/vec/exprs/table_function/vexplode_map.h     | 11 ++++-----
 .../vec/exprs/table_function/vexplode_numbers.cpp  | 27 ++++++++++++++--------
 be/src/vec/exprs/table_function/vexplode_numbers.h |  9 ++++----
 be/src/vec/exprs/table_function/vexplode_split.cpp |  3 +++
 be/src/vec/exprs/table_function/vexplode_split.h   |  3 ++-
 19 files changed, 91 insertions(+), 69 deletions(-)

diff --git a/be/src/vec/exprs/table_function/table_function.h 
b/be/src/vec/exprs/table_function/table_function.h
index bd926c36570..ef36ca881d7 100644
--- a/be/src/vec/exprs/table_function/table_function.h
+++ b/be/src/vec/exprs/table_function/table_function.h
@@ -18,13 +18,15 @@
 #pragma once
 
 #include <fmt/core.h>
-#include <stddef.h>
+
+#include <cstddef>
 
 #include "common/status.h"
 #include "vec/core/block.h"
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 constexpr auto COMBINATOR_SUFFIX_OUTER = "_outer";
 
@@ -101,4 +103,6 @@ protected:
     bool _is_nullable = false;
     bool _is_const = false;
 };
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/table_function_factory.cpp 
b/be/src/vec/exprs/table_function/table_function_factory.cpp
index 332eaed37d4..ad080e49151 100644
--- a/be/src/vec/exprs/table_function/table_function_factory.cpp
+++ b/be/src/vec/exprs/table_function/table_function_factory.cpp
@@ -21,7 +21,6 @@
 
 #include <memory>
 #include <string_view>
-#include <utility>
 
 #include "common/object_pool.h"
 #include "vec/exprs/table_function/table_function.h"
@@ -37,6 +36,7 @@
 #include "vec/utils/util.hpp"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 template <typename TableFunctionType>
 struct TableFunctionCreator {
@@ -91,4 +91,5 @@ Status TableFunctionFactory::get_fn(const TFunction& t_fn, 
ObjectPool* pool, Tab
     return Status::NotSupported("Table function {} is not support", 
t_fn.name.function_name);
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/table_function_factory.h 
b/be/src/vec/exprs/table_function/table_function_factory.h
index cd06c202f37..617d5e9583e 100644
--- a/be/src/vec/exprs/table_function/table_function_factory.h
+++ b/be/src/vec/exprs/table_function/table_function_factory.h
@@ -27,6 +27,8 @@
 #include "common/status.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
+
 class ObjectPool;
 
 namespace vectorized {
@@ -41,4 +43,5 @@ public:
             _function_map;
 };
 } // namespace vectorized
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/vec/exprs/table_function/udf_table_function.cpp 
b/be/src/vec/exprs/table_function/udf_table_function.cpp
index 9aa850d68b7..237b6806da6 100644
--- a/be/src/vec/exprs/table_function/udf_table_function.cpp
+++ b/be/src/vec/exprs/table_function/udf_table_function.cpp
@@ -33,6 +33,8 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
 const char* EXECUTOR_CLASS = "org/apache/doris/udf/UdfExecutor";
 const char* EXECUTOR_CTOR_SIGNATURE = "([B)V";
 const char* EXECUTOR_EVALUATE_SIGNATURE = "(Ljava/util/Map;Ljava/util/Map;)J";
@@ -206,4 +208,6 @@ int UDFTableFunction::get_value(MutableColumnPtr& column, 
int max_step) {
     forward(max_step);
     return max_step;
 }
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/udf_table_function.h 
b/be/src/vec/exprs/table_function/udf_table_function.h
index b9707bf0693..c5f55a1c0cb 100644
--- a/be/src/vec/exprs/table_function/udf_table_function.h
+++ b/be/src/vec/exprs/table_function/udf_table_function.h
@@ -26,6 +26,7 @@
 #include "vec/functions/array/function_array_utils.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 class UDFTableFunction final : public TableFunction {
     ENABLE_FACTORY_CREATOR(UDFTableFunction);
@@ -94,4 +95,5 @@ private:
     size_t _array_offset = 0;        // start offset of array[row_idx]
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode.cpp 
b/be/src/vec/exprs/table_function/vexplode.cpp
index b3d3c770138..feef58cd277 100644
--- a/be/src/vec/exprs/table_function/vexplode.cpp
+++ b/be/src/vec/exprs/table_function/vexplode.cpp
@@ -20,12 +20,10 @@
 #include <glog/logging.h>
 
 #include <ostream>
-#include <vector>
 
 #include "common/status.h"
 #include "vec/columns/column.h"
 #include "vec/columns/column_object.h"
-#include "vec/common/string_ref.h"
 #include "vec/core/block.h"
 #include "vec/core/column_with_type_and_name.h"
 #include "vec/data_types/data_type.h"
@@ -33,6 +31,7 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeTableFunction::VExplodeTableFunction() {
     _fn_name = "vexplode";
@@ -124,4 +123,6 @@ int VExplodeTableFunction::get_value(MutableColumnPtr& 
column, int max_step) {
     forward(max_step);
     return max_step;
 }
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode.h 
b/be/src/vec/exprs/table_function/vexplode.h
index b59b9718ad5..17b67d07824 100644
--- a/be/src/vec/exprs/table_function/vexplode.h
+++ b/be/src/vec/exprs/table_function/vexplode.h
@@ -17,18 +17,18 @@
 
 #pragma once
 
-#include <stddef.h>
+#include <cstddef>
 
 #include "common/status.h"
 #include "vec/data_types/data_type.h"
 #include "vec/exprs/table_function/table_function.h"
 #include "vec/functions/array/function_array_utils.h"
 
-namespace doris {
-namespace vectorized {
+namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
 class Block;
-} // namespace vectorized
-} // namespace doris
+} // namespace doris::vectorized
 
 namespace doris::vectorized {
 
@@ -52,4 +52,5 @@ private:
     size_t _array_offset; // start offset of array[row_idx]
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_bitmap.cpp 
b/be/src/vec/exprs/table_function/vexplode_bitmap.cpp
index 5327c2e1633..b76d49d95a2 100644
--- a/be/src/vec/exprs/table_function/vexplode_bitmap.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_bitmap.cpp
@@ -21,7 +21,6 @@
 
 #include <memory>
 #include <ostream>
-#include <vector>
 
 #include "common/status.h"
 #include "util/bitmap_value.h"
@@ -36,6 +35,7 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeBitmapTableFunction::VExplodeBitmapTableFunction() {
     _fn_name = "vexplode_bitmap";
@@ -126,7 +126,7 @@ int 
VExplodeBitmapTableFunction::get_value(MutableColumnPtr& column, int max_ste
         }
         auto origin_size = target->size();
         target->resize(origin_size + max_step);
-        auto target_data = target->get_data().data();
+        auto* target_data = target->get_data().data();
         for (int i = 0; i < max_step; ++i) {
             target_data[i + origin_size] = **_cur_iter;
             ++(*_cur_iter);
@@ -135,4 +135,5 @@ int 
VExplodeBitmapTableFunction::get_value(MutableColumnPtr& column, int max_ste
     TableFunction::forward(max_step);
     return max_step;
 }
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_bitmap.h 
b/be/src/vec/exprs/table_function/vexplode_bitmap.h
index 17c1070646b..74e16d5e4b1 100644
--- a/be/src/vec/exprs/table_function/vexplode_bitmap.h
+++ b/be/src/vec/exprs/table_function/vexplode_bitmap.h
@@ -17,8 +17,7 @@
 
 #pragma once
 
-#include <stddef.h>
-
+#include <cstddef>
 #include <memory>
 
 #include "common/status.h"
@@ -26,13 +25,10 @@
 #include "vec/data_types/data_type.h"
 #include "vec/exprs/table_function/table_function.h"
 
-namespace doris {
-namespace vectorized {
-class Block;
-} // namespace vectorized
-} // namespace doris
-
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
+class Block;
 
 class VExplodeBitmapTableFunction final : public TableFunction {
     ENABLE_FACTORY_CREATOR(VExplodeBitmapTableFunction);
@@ -60,4 +56,5 @@ private:
     ColumnPtr _value_column;
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_json_array.cpp 
b/be/src/vec/exprs/table_function/vexplode_json_array.cpp
index 3c22ef4e078..673ae0c9c26 100644
--- a/be/src/vec/exprs/table_function/vexplode_json_array.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_json_array.cpp
@@ -18,16 +18,12 @@
 #include "vec/exprs/table_function/vexplode_json_array.h"
 
 #include <glog/logging.h>
-#include <inttypes.h>
 #include <rapidjson/rapidjson.h>
-#include <stdio.h>
 
 #include <algorithm>
-#include <limits>
+#include <cstdio>
 
 #include "common/status.h"
-#include "util/jsonb_parser.h"
-#include "util/jsonb_utils.h"
 #include "vec/columns/column.h"
 #include "vec/columns/column_nullable.h"
 #include "vec/columns/columns_number.h"
@@ -38,6 +34,8 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
+
 template <typename DataImpl>
 VExplodeJsonArrayTableFunction<DataImpl>::VExplodeJsonArrayTableFunction() : 
TableFunction() {
     _fn_name = "vexplode_json_array";
@@ -155,4 +153,5 @@ template class 
VExplodeJsonArrayTableFunction<ParsedDataDouble>;
 template class VExplodeJsonArrayTableFunction<ParsedDataString>;
 template class VExplodeJsonArrayTableFunction<ParsedDataJSON>;
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_json_array.h 
b/be/src/vec/exprs/table_function/vexplode_json_array.h
index 28428b8f89f..94378708f9e 100644
--- a/be/src/vec/exprs/table_function/vexplode_json_array.h
+++ b/be/src/vec/exprs/table_function/vexplode_json_array.h
@@ -20,21 +20,19 @@
 #include <glog/logging.h>
 #include <rapidjson/document.h>
 
-#include <ostream>
 #include <string>
 #include <vector>
 
 #include "common/status.h"
-#include "gutil/integral_types.h"
 #include "rapidjson/stringbuffer.h"
 #include "rapidjson/writer.h"
 #include "vec/common/string_ref.h"
 #include "vec/core/types.h"
 #include "vec/data_types/data_type.h"
 #include "vec/exprs/table_function/table_function.h"
-#include "vec/functions/function_string.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 template <typename T>
 struct ParsedData {
@@ -50,7 +48,7 @@ struct ParsedData {
                                                 int max_step) = 0;
     virtual void insert_many_same_value_from_parsed_data(MutableColumnPtr& 
column,
                                                          int64_t cur_offset, 
int length) = 0;
-    const char* get_null_flag_address(int cur_offset) {
+    const char* get_null_flag_address(size_t cur_offset) {
         return reinterpret_cast<const char*>(_values_null_flag.data() + 
cur_offset);
     }
     std::vector<UInt8> _values_null_flag;
@@ -77,7 +75,8 @@ struct ParsedDataInt : public ParsedData<int64_t> {
                 }
             } else if (v.IsDouble()) {
                 auto value = v.GetDouble();
-                if (value > MAX_VALUE) {
+                // target slot is int64(cast double to int64). so compare with 
int64_max
+                if (static_cast<int64_t>(value) > MAX_VALUE) {
                     _backup_data[i] = MAX_VALUE;
                 } else if (value < MIN_VALUE) {
                     _backup_data[i] = MIN_VALUE;
@@ -107,7 +106,8 @@ struct ParsedDataInt : public ParsedData<int64_t> {
                 _backup_data[i] = static_cast<const JsonbInt64Val&>(val).val();
             } else if (val.isDouble()) {
                 auto value = static_cast<const JsonbDoubleVal&>(val).val();
-                if (value > MAX_VALUE) {
+                // target slot is int64(cast double to int64). so compare with 
int64_max
+                if (static_cast<int64_t>(value) > MAX_VALUE) {
                     _backup_data[i] = MAX_VALUE;
                 } else if (value < MIN_VALUE) {
                     _backup_data[i] = MIN_VALUE;
@@ -420,4 +420,5 @@ private:
     DataTypePtr _text_datatype;
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
\ No newline at end of file
diff --git a/be/src/vec/exprs/table_function/vexplode_json_object.cpp 
b/be/src/vec/exprs/table_function/vexplode_json_object.cpp
index 1981f48f62c..7db4da395ae 100644
--- a/be/src/vec/exprs/table_function/vexplode_json_object.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_json_object.cpp
@@ -20,10 +20,10 @@
 #include <glog/logging.h>
 
 #include <ostream>
-#include <vector>
 
 #include "common/status.h"
 #include "vec/columns/column.h"
+#include "vec/columns/column_struct.h"
 #include "vec/common/string_ref.h"
 #include "vec/core/block.h"
 #include "vec/core/column_with_type_and_name.h"
@@ -31,6 +31,7 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeJsonObjectTableFunction::VExplodeJsonObjectTableFunction() {
     _fn_name = "vexplode_json_object";
@@ -55,7 +56,7 @@ void VExplodeJsonObjectTableFunction::process_row(size_t 
row_idx) {
     StringRef text = _json_object_column->get_data_at(row_idx);
     if (text.data != nullptr) {
         JsonbDocument* doc = JsonbDocument::createDocument(text.data, 
text.size);
-        if (UNLIKELY(!doc || !doc->getValue())) {
+        if (!doc || !doc->getValue()) [[unlikely]] {
             // error jsonb, put null into output, cur_size = 0 , we will 
insert_default
             return;
         }
@@ -64,18 +65,18 @@ void VExplodeJsonObjectTableFunction::process_row(size_t 
row_idx) {
         auto writer = std::make_unique<JsonbWriter>();
         if (value->isObject()) {
             _cur_size = value->length();
-            ObjectVal* obj = (ObjectVal*)value;
+            auto* obj = (ObjectVal*)value;
             _object_pairs.first =
                     ColumnNullable::create(ColumnString::create(), 
ColumnUInt8::create());
             _object_pairs.second =
                     ColumnNullable::create(ColumnString::create(), 
ColumnUInt8::create());
             _object_pairs.first->reserve(_cur_size);
             _object_pairs.second->reserve(_cur_size);
-            for (auto it = obj->begin(); it != obj->end(); ++it) {
-                _object_pairs.first->insert_data(it->getKeyStr(), it->klen());
+            for (auto& it : *obj) {
+                _object_pairs.first->insert_data(it.getKeyStr(), it.klen());
                 writer->reset();
-                writer->writeValue(it->value());
-                if (it->value()->isNull()) {
+                writer->writeValue(it.value());
+                if (it.value()->isNull()) {
                     _object_pairs.second->insert_default();
                 } else {
                     const std::string_view& jsonb_value = std::string_view(
@@ -157,4 +158,6 @@ int 
VExplodeJsonObjectTableFunction::get_value(MutableColumnPtr& column, int max
     forward(max_step);
     return max_step;
 }
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_json_object.h 
b/be/src/vec/exprs/table_function/vexplode_json_object.h
index 9173fd9cbac..c0ab5d148cc 100644
--- a/be/src/vec/exprs/table_function/vexplode_json_object.h
+++ b/be/src/vec/exprs/table_function/vexplode_json_object.h
@@ -17,21 +17,15 @@
 
 #pragma once
 
-#include <stddef.h>
+#include <cstddef>
 
 #include "common/status.h"
-#include "vec/columns/column_map.h"
 #include "vec/data_types/data_type.h"
-#include "vec/data_types/data_type_array.h"
-#include "vec/data_types/data_type_map.h"
 #include "vec/exprs/table_function/table_function.h"
-#include "vec/functions/array/function_array_utils.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 class Block;
-} // namespace doris::vectorized
-
-namespace doris::vectorized {
 
 // explode_json_object("{\"a\": 1, \"b\": 2}") ->
 // | key | value |
@@ -56,4 +50,5 @@ private:
     std::pair<MutableColumnPtr, MutableColumnPtr> _object_pairs; // 
ColumnNullable<ColumnString>
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_map.cpp 
b/be/src/vec/exprs/table_function/vexplode_map.cpp
index ee88d9f07df..a9b59f3c69c 100644
--- a/be/src/vec/exprs/table_function/vexplode_map.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_map.cpp
@@ -20,17 +20,16 @@
 #include <glog/logging.h>
 
 #include <ostream>
-#include <vector>
 
 #include "common/status.h"
 #include "vec/columns/column.h"
-#include "vec/common/string_ref.h"
 #include "vec/core/block.h"
 #include "vec/core/column_with_type_and_name.h"
 #include "vec/exprs/vexpr.h"
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeMapTableFunction::VExplodeMapTableFunction() {
     _fn_name = "vexplode_map";
@@ -156,4 +155,6 @@ int VExplodeMapTableFunction::get_value(MutableColumnPtr& 
column, int max_step)
     forward(max_step);
     return max_step;
 }
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_map.h 
b/be/src/vec/exprs/table_function/vexplode_map.h
index c9756c9499b..ea8e9584896 100644
--- a/be/src/vec/exprs/table_function/vexplode_map.h
+++ b/be/src/vec/exprs/table_function/vexplode_map.h
@@ -17,21 +17,17 @@
 
 #pragma once
 
-#include <stddef.h>
+#include <cstddef>
 
 #include "common/status.h"
 #include "vec/columns/column_map.h"
 #include "vec/data_types/data_type.h"
-#include "vec/data_types/data_type_array.h"
-#include "vec/data_types/data_type_map.h"
 #include "vec/exprs/table_function/table_function.h"
-#include "vec/functions/array/function_array_utils.h"
 
 namespace doris::vectorized {
-class Block;
-} // namespace doris::vectorized
+#include "common/compile_check_begin.h"
 
-namespace doris::vectorized {
+class Block;
 
 struct ColumnMapExecutionData {
 public:
@@ -66,4 +62,5 @@ private:
     size_t _collection_offset; // start offset of array[row_idx]
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_numbers.cpp 
b/be/src/vec/exprs/table_function/vexplode_numbers.cpp
index dbfb8d3edc1..0c4c330f73c 100644
--- a/be/src/vec/exprs/table_function/vexplode_numbers.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_numbers.cpp
@@ -20,7 +20,6 @@
 #include <glog/logging.h>
 
 #include <ostream>
-#include <vector>
 
 #include "common/status.h"
 #include "runtime/runtime_state.h"
@@ -36,6 +35,7 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeNumbersTableFunction::VExplodeNumbersTableFunction() {
     _fn_name = "vexplode_numbers";
@@ -52,19 +52,25 @@ Status VExplodeNumbersTableFunction::process_init(Block* 
block, RuntimeState* st
     _value_column = block->get_by_position(value_column_idx).column;
     if (is_column_const(*_value_column)) {
         _cur_size = 0;
-        auto& column_nested = assert_cast<const 
ColumnConst&>(*_value_column).get_data_column_ptr();
+
+        // the argument columns -> Int32
+        const auto& column_nested =
+                assert_cast<const 
ColumnConst&>(*_value_column).get_data_column_ptr();
         if (column_nested->is_nullable()) {
             if (!column_nested->is_null_at(0)) {
-                _cur_size = assert_cast<const 
ColumnNullable*>(column_nested.get())
-                                    ->get_nested_column()
-                                    .get_int(0);
+                _cur_size = assert_cast<const ColumnInt32*>(
+                                    assert_cast<const 
ColumnNullable*>(column_nested.get())
+                                            ->get_nested_column_ptr()
+                                            .get())
+                                    ->get_element(0);
             }
         } else {
-            _cur_size = column_nested->get_int(0);
+            _cur_size = assert_cast<const 
ColumnInt32*>(column_nested.get())->get_element(0);
         }
+
         ((ColumnInt32*)_elements_column.get())->clear();
         //_cur_size may be a negative number
-        _cur_size = std::max<int64_t>(0, _cur_size);
+        _cur_size = std::max(0L, _cur_size);
         if (_cur_size &&
             _cur_size <= state->batch_size()) { // avoid elements_column too 
big or empty
             _is_const = true;                   // use const optimize
@@ -96,17 +102,20 @@ void 
VExplodeNumbersTableFunction::get_same_many_values(MutableColumnPtr& column
     if (current_empty()) {
         column->insert_many_defaults(length);
     } else {
+        // for explode numbers, the argument is int32. so cast is safe.
         if (_is_nullable) {
             assert_cast<ColumnInt32*>(
                     
assert_cast<ColumnNullable*>(column.get())->get_nested_column_ptr().get())
-                    ->insert_many_vals(_cur_offset, length);
+                    ->insert_many_vals(static_cast<int32_t>(_cur_offset), 
length);
             assert_cast<ColumnUInt8*>(
                     
assert_cast<ColumnNullable*>(column.get())->get_null_map_column_ptr().get())
                     ->insert_many_defaults(length);
         } else {
-            
assert_cast<ColumnInt32*>(column.get())->insert_many_vals(_cur_offset, length);
+            assert_cast<ColumnInt32*>(column.get())
+                    ->insert_many_vals(static_cast<int32_t>(_cur_offset), 
length);
         }
     }
 }
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_numbers.h 
b/be/src/vec/exprs/table_function/vexplode_numbers.h
index dda4a047a20..403b87e2e1d 100644
--- a/be/src/vec/exprs/table_function/vexplode_numbers.h
+++ b/be/src/vec/exprs/table_function/vexplode_numbers.h
@@ -17,9 +17,8 @@
 
 #pragma once
 
-#include <stddef.h>
-
 #include <algorithm>
+#include <cstddef>
 
 #include "common/status.h"
 #include "vec/columns/column_nullable.h"
@@ -29,10 +28,9 @@
 #include "vec/exprs/table_function/table_function.h"
 
 namespace doris::vectorized {
-class Block;
-} // namespace doris::vectorized
+#include "common/compile_check_begin.h"
 
-namespace doris::vectorized {
+class Block;
 
 class VExplodeNumbersTableFunction : public TableFunction {
     ENABLE_FACTORY_CREATOR(VExplodeNumbersTableFunction);
@@ -92,4 +90,5 @@ private:
     ColumnPtr _elements_column = ColumnInt32::create();
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_split.cpp 
b/be/src/vec/exprs/table_function/vexplode_split.cpp
index 51a95dbd5c6..950459f9b20 100644
--- a/be/src/vec/exprs/table_function/vexplode_split.cpp
+++ b/be/src/vec/exprs/table_function/vexplode_split.cpp
@@ -34,6 +34,7 @@
 #include "vec/exprs/vexpr_context.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 VExplodeSplitTableFunction::VExplodeSplitTableFunction() {
     _fn_name = "vexplode_split";
@@ -156,4 +157,6 @@ int 
VExplodeSplitTableFunction::get_value(doris::vectorized::MutableColumnPtr& c
     TableFunction::forward(max_step);
     return max_step;
 }
+
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/table_function/vexplode_split.h 
b/be/src/vec/exprs/table_function/vexplode_split.h
index 089abe23dda..860f7a7b087 100644
--- a/be/src/vec/exprs/table_function/vexplode_split.h
+++ b/be/src/vec/exprs/table_function/vexplode_split.h
@@ -19,7 +19,6 @@
 
 #include <cstddef>
 #include <cstdint>
-#include <string_view>
 #include <vector>
 
 #include "common/status.h"
@@ -28,6 +27,7 @@
 #include "vec/exprs/table_function/table_function.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 class Block;
 template <typename T>
@@ -58,4 +58,5 @@ private:
     StringRef _delimiter = {};
 };
 
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized


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

Reply via email to