Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[env](compile) open compile_check in some file #46061

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions be/src/runtime/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "runtime/primitive_type.h"

namespace doris {
#include "common/compile_check_begin.h"

TypeDescriptor::TypeDescriptor(const std::vector<TTypeNode>& types, int* idx)
: len(-1), precision(-1), scale(-1) {
Expand Down Expand Up @@ -262,8 +263,8 @@ TypeDescriptor::TypeDescriptor(const google::protobuf::RepeatedPtrField<PTypeNod
}
case TTypeNodeType::STRUCT: {
type = TYPE_STRUCT;
size_t children_size = node.struct_fields_size();
for (size_t i = 0; i < children_size; ++i) {
int children_size = node.struct_fields_size();
for (int i = 0; i < children_size; ++i) {
const auto& field = node.struct_fields(i);
field_names.push_back(field.name());
contains_nulls.push_back(field.contains_null());
Expand Down Expand Up @@ -362,4 +363,5 @@ TTypeDesc create_type_desc(PrimitiveType type, int precision, int scale) {
type_desc.__set_types(node_type);
return type_desc;
}
#include "common/compile_check_end.h"
} // namespace doris
4 changes: 3 additions & 1 deletion be/src/udf/udf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "vec/common/string_ref.h"

namespace doris {
#include "common/compile_check_begin.h"

static const int MAX_WARNINGS = 1000;

Expand Down Expand Up @@ -127,7 +128,7 @@ doris::ColumnPtrWrapper* FunctionContext::get_constant_col(int i) const {
}

int FunctionContext::get_num_args() const {
return _arg_types.size();
return (int)_arg_types.size();
}

const doris::TypeDescriptor& FunctionContext::get_return_type() const {
Expand All @@ -151,4 +152,5 @@ StringRef FunctionContext::create_temp_string_val(int64_t len) {
return StringRef((uint8_t*)_string_result.c_str(), len);
}

#include "common/compile_check_end.h"
} // namespace doris
4 changes: 3 additions & 1 deletion be/src/util/cidr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "common/logging.h"

namespace doris {
#include "common/compile_check_begin.h"

constexpr std::uint8_t kIPv4Bits = 32;
constexpr std::uint8_t kIPv6Bits = 128;
Expand Down Expand Up @@ -72,7 +73,7 @@ bool CIDR::reset(const std::string& cidr_str) {
LOG(WARNING) << "Wrong CIDR mask format. network=" << cidr_str;
return false;
}
_netmask_len = len;
_netmask_len = (uint8_t)len; // len <= _netmask_len
return true;
}

Expand All @@ -93,4 +94,5 @@ bool CIDR::contains(const CIDR& ip) const {
return (_address[bytes] & mask) == (ip._address[bytes] & mask);
}

#include "common/compile_check_end.h"
} // end namespace doris
14 changes: 8 additions & 6 deletions be/src/util/runtime_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "util/container_util.hpp"

namespace doris {
#include "common/compile_check_begin.h"

// Thread counters name
static const std::string THREAD_TOTAL_TIME = "TotalWallClockTime";
Expand Down Expand Up @@ -263,7 +264,7 @@ void RuntimeProfile::compute_time_in_profile(int64_t total) {
int64_t local_time = total_time_counter()->value() - total_child_time;
// Counters have some margin, set to 0 if it was negative.
local_time = std::max<int64_t>(0L, local_time);
_local_time_percent = static_cast<double>(local_time) / total;
_local_time_percent = static_cast<double>(local_time) / static_cast<double>(total);
_local_time_percent = std::min(1.0, _local_time_percent) * 100;

// Recurse on children
Expand Down Expand Up @@ -574,7 +575,7 @@ void RuntimeProfile::to_thrift(TRuntimeProfileTree* tree) {
}

void RuntimeProfile::to_thrift(std::vector<TRuntimeProfileNode>* nodes) {
int index = nodes->size();
size_t index = nodes->size();
nodes->push_back(TRuntimeProfileNode());
TRuntimeProfileNode& node = (*nodes)[index];
node.name = _name;
Expand Down Expand Up @@ -605,11 +606,11 @@ void RuntimeProfile::to_thrift(std::vector<TRuntimeProfileNode>* nodes) {
std::lock_guard<std::mutex> l(_children_lock);
children = _children;
}
node.num_children = children.size();
node.num_children = (int)children.size();
nodes->reserve(nodes->size() + children.size());

for (int i = 0; i < children.size(); ++i) {
int child_idx = nodes->size();
for (size_t i = 0; i < children.size(); ++i) {
size_t child_idx = nodes->size();
children[i].first->to_thrift(nodes);
// fix up indentation flag
(*nodes)[child_idx].indent = children[i].second;
Expand All @@ -626,7 +627,7 @@ int64_t RuntimeProfile::units_per_second(const RuntimeProfile::Counter* total_co
}

double secs = static_cast<double>(timer->value()) / 1000.0 / 1000.0 / 1000.0;
return int64_t(total_counter->value() / secs);
return int64_t((double)total_counter->value() / secs);
}

int64_t RuntimeProfile::counter_sum(const std::vector<Counter*>* counters) {
Expand Down Expand Up @@ -709,4 +710,5 @@ void RuntimeProfile::print_child_counters(const std::string& prefix,
}
}

#include "common/compile_check_end.h"
} // namespace doris
5 changes: 4 additions & 1 deletion be/src/util/runtime_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
#include <utility>
#include <vector>

#include "common/cast_set.h"
#include "common/compiler_util.h" // IWYU pragma: keep
#include "util/binary_cast.hpp"
#include "util/container_util.hpp"
#include "util/pretty_printer.h"
#include "util/stopwatch.hpp"

namespace doris {
#include "common/compile_check_begin.h"
class TRuntimeProfileNode;
class TRuntimeProfileTree;

Expand Down Expand Up @@ -448,7 +450,7 @@ class RuntimeProfile {
void get_all_children(std::vector<RuntimeProfile*>* children);

// Returns the number of counters in this profile
int num_counters() const { return _counter_map.size(); }
int num_counters() const { return cast_set<int>(_counter_map.size()); }

// Returns name of this profile
const std::string& name() const { return _name; }
Expand Down Expand Up @@ -725,4 +727,5 @@ class ScopedRawTimer {
C* _counter = nullptr;
};

#include "common/compile_check_end.h"
} // namespace doris
4 changes: 3 additions & 1 deletion be/src/vec/common/string_ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "common/compiler_util.h" // IWYU pragma: keep

namespace doris {
#include "common/compile_check_begin.h"

StringRef StringRef::trim() const {
// Remove leading and trailing spaces.
Expand All @@ -32,7 +33,7 @@ StringRef StringRef::trim() const {
++begin;
}

int32_t end = size - 1;
int64_t end = size - 1;

while (end > begin && data[end] == ' ') {
--end;
Expand Down Expand Up @@ -93,4 +94,5 @@ bool StringRef::end_with(const StringRef& search_string) const {
return 0 == memcmp(data + size - search_string.size, search_string.data, search_string.size);
#endif
}
#include "common/compile_check_end.h"
} // namespace doris
4 changes: 2 additions & 2 deletions be/src/vec/common/string_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ struct StringRef {
explicit operator std::string() const { return to_string(); }
operator std::string_view() const { return std::string_view {data, size}; }

StringRef substring(int start_pos, int new_len) const {
StringRef substring(int64_t start_pos, int64_t new_len) const {
return {data + start_pos, (new_len < 0) ? (size - start_pos) : new_len};
}

StringRef substring(int start_pos) const { return substring(start_pos, size - start_pos); }
StringRef substring(int64_t start_pos) const { return substring(start_pos, size - start_pos); }

const char* begin() const { return data; }
const char* end() const { return data + size; }
Expand Down
4 changes: 3 additions & 1 deletion be/src/vec/common/string_searcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "vec/common/string_utils/string_utils.h"

namespace doris {
#include "common/compile_check_begin.h"

// namespace ErrorCodes
// {
Expand All @@ -47,7 +48,7 @@ class StringSearcherBase {
#if defined(__SSE2__) || defined(__aarch64__)
protected:
static constexpr auto n = sizeof(__m128i);
const int page_size = sysconf(_SC_PAGESIZE); //::getPageSize();
const long page_size = sysconf(_SC_PAGESIZE); //::getPageSize();

bool page_safe(const void* const ptr) const {
return ((page_size - 1) & reinterpret_cast<std::uintptr_t>(ptr)) <= page_size - n;
Expand Down Expand Up @@ -416,4 +417,5 @@ struct LibCASCIICaseInsensitiveStringSearcher : public StringSearcherBase {
return search(haystack, haystack + haystack_size);
}
};
#include "common/compile_check_end.h"
} // namespace doris
6 changes: 4 additions & 2 deletions be/src/vec/functions/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "vec/utils/util.hpp"

namespace doris::vectorized {
#include "common/compile_check_begin.h"

ColumnPtr wrap_in_nullable(const ColumnPtr& src, const Block& block, const ColumnNumbers& args,
uint32_t result, size_t input_rows_count) {
Expand Down Expand Up @@ -143,7 +144,7 @@ Status PreparedFunctionImpl::default_implementation_for_constant_arguments(
// now all columns are const.
Block temporary_block;

size_t arguments_size = args.size();
uint32_t arguments_size = cast_set<uint32_t>(args.size());
for (size_t arg_num = 0; arg_num < arguments_size; ++arg_num) {
const ColumnWithTypeAndName& column = block.get_by_position(args[arg_num]);
// Columns in const_list --> column_const, others --> nested_column
Expand All @@ -162,7 +163,7 @@ Status PreparedFunctionImpl::default_implementation_for_constant_arguments(
temporary_block.insert(block.get_by_position(result));

ColumnNumbers temporary_argument_numbers(arguments_size);
for (size_t i = 0; i < arguments_size; ++i) {
for (uint32_t i = 0; i < arguments_size; ++i) {
temporary_argument_numbers[i] = i;
}

Expand Down Expand Up @@ -364,4 +365,5 @@ bool FunctionBuilderImpl::is_array_nested_type_date_or_datetime_or_decimal(
}
return false;
}
#include "common/compile_check_end.h"
} // namespace doris::vectorized
4 changes: 3 additions & 1 deletion be/src/vec/functions/function_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "vec/functions/function.h"

namespace doris::vectorized {
#include "common/compile_check_begin.h"

std::tuple<Block, ColumnNumbers> create_block_with_nested_columns(const Block& block,
const ColumnNumbers& args,
Expand All @@ -51,7 +52,7 @@ std::tuple<Block, ColumnNumbers> create_block_with_nested_columns(const Block& b
// just keep one
for (size_t i = 0; i < args.size(); ++i) {
bool is_in_res = false;
size_t pre_loc = 0;
uint32_t pre_loc = 0;

if (need_check_same) {
for (int j = 0; j < i; ++j) {
Expand Down Expand Up @@ -144,4 +145,5 @@ const ColumnConst* check_and_get_column_const_string_or_fixedstring(const IColum
return {};
}

#include "common/compile_check_end.h"
} // namespace doris::vectorized
5 changes: 4 additions & 1 deletion be/src/vec/functions/function_time_value_to_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "vec/runtime/time_value.h"
#include "vec/utils/template_helpers.hpp"
namespace doris::vectorized {
#include "common/compile_check_begin.h"

template <typename ToDataType, typename Transform>
class FunctionTimeValueToField : public IFunction {
Expand Down Expand Up @@ -62,7 +63,8 @@ class FunctionTimeValueToField : public IFunction {
auto& col_res_data = col_res->get_data();

for (size_t i = 0; i < input_rows_count; i++) {
col_res_data[i] = Transform::execute(column_time->get_element(i));
col_res_data[i] = static_cast<ToDataType::FieldType>(
Transform::execute(column_time->get_element(i)));
}

block.replace_by_position(result, std::move(col_res));
Expand Down Expand Up @@ -91,4 +93,5 @@ void register_function_time_value_field(SimpleFunctionFactory& factory) {
factory.register_function<FunctionTimeValueToField<DataTypeInt8, SecondImpl>>();
}

#include "common/compile_check_end.h"
} // namespace doris::vectorized
5 changes: 4 additions & 1 deletion be/src/vec/functions/function_tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
#include "olap/rowset/segment_v2/inverted_index/analyzer/analyzer.h"
#include "olap/rowset/segment_v2/inverted_index_reader.h"
#include "vec/columns/column.h"
#include "vec/columns/column_string.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_nullable.h"
#include "vec/data_types/data_type_number.h"

namespace doris::vectorized {
#include "common/compile_check_begin.h"

Status parse(const std::string& str, std::map<std::string, std::string>& result) {
boost::regex pattern(
Expand Down Expand Up @@ -82,7 +84,7 @@ void FunctionTokenize::_do_tokenize(const ColumnString& src_column_string,
}
auto reader = doris::segment_v2::inverted_index::InvertedIndexAnalyzer::create_reader(
inverted_index_ctx.char_filter_map);
reader->init(tokenize_str.data, tokenize_str.size, true);
reader->init(tokenize_str.data, (ColumnString::Offset)tokenize_str.size, true);

std::vector<std::string> query_tokens =
doris::segment_v2::inverted_index::InvertedIndexAnalyzer::get_analyse_result(
Expand Down Expand Up @@ -174,4 +176,5 @@ Status FunctionTokenize::execute_impl(FunctionContext* /*context*/, Block& block
}
return Status::RuntimeError("unimplemented function {}", get_name());
}
#include "common/compile_check_end.h"
} // namespace doris::vectorized
15 changes: 9 additions & 6 deletions be/src/vec/functions/like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "vec/functions/simple_function_factory.h"

namespace doris::vectorized {
#include "common/compile_check_begin.h"
// A regex to match any regex pattern is equivalent to a substring search.
static const RE2 SUBSTRING_RE(R"((?:\.\*)*([^\.\^\{\[\(\|\)\]\}\+\*\?\$\\]*)(?:\.\*)*)");

Expand Down Expand Up @@ -384,7 +385,8 @@ Status FunctionLikeBase::vector_substring_fn(const ColumnString& vals,
Status FunctionLikeBase::constant_regex_fn_scalar(LikeSearchState* state, const StringRef& val,
const StringRef& pattern, unsigned char* result) {
if (state->hs_database) { // use hyperscan
auto ret = hs_scan(state->hs_database.get(), val.data, val.size, 0, state->hs_scratch.get(),
auto ret = hs_scan(state->hs_database.get(), val.data, (uint32_t)val.size, 0,
state->hs_scratch.get(),
doris::vectorized::LikeSearchState::hs_match_handler, (void*)result);
if (ret != HS_SUCCESS && ret != HS_SCAN_TERMINATED) {
return Status::RuntimeError(fmt::format("hyperscan error: {}", ret));
Expand Down Expand Up @@ -418,7 +420,7 @@ Status FunctionLikeBase::constant_regex_fn(LikeSearchState* state, const ColumnS
if (state->hs_database) { // use hyperscan
for (size_t i = 0; i < sz; i++) {
const auto& str_ref = val.get_data_at(i);
auto ret = hs_scan(state->hs_database.get(), str_ref.data, str_ref.size, 0,
auto ret = hs_scan(state->hs_database.get(), str_ref.data, (uint32_t)str_ref.size, 0,
state->hs_scratch.get(),
doris::vectorized::LikeSearchState::hs_match_handler,
(void*)(result.data() + i));
Expand Down Expand Up @@ -447,7 +449,7 @@ Status FunctionLikeBase::regexp_fn(LikeSearchState* state, const ColumnString& v
auto sz = val.size();
for (size_t i = 0; i < sz; i++) {
const auto& str_ref = val.get_data_at(i);
auto ret = hs_scan(database, str_ref.data, str_ref.size, 0, scratch,
auto ret = hs_scan(database, str_ref.data, (uint32_t)str_ref.size, 0, scratch,
doris::vectorized::LikeSearchState::hs_match_handler,
(void*)(result.data() + i));
if (ret != HS_SUCCESS && ret != HS_SCAN_TERMINATED) {
Expand Down Expand Up @@ -766,8 +768,8 @@ void FunctionLike::convert_like_pattern(LikeSearchState* state, const std::strin
void FunctionLike::remove_escape_character(std::string* search_string) {
std::string tmp_search_string;
tmp_search_string.swap(*search_string);
int len = tmp_search_string.length();
for (int i = 0; i < len;) {
int64_t len = tmp_search_string.length();
for (int64_t i = 0; i < len;) {
if (tmp_search_string[i] == '\\' && i + 1 < len &&
(tmp_search_string[i + 1] == '%' || tmp_search_string[i + 1] == '_' ||
tmp_search_string[i + 1] == '\\')) {
Expand Down Expand Up @@ -796,7 +798,7 @@ bool re2_full_match(const std::string& str, const RE2& re, std::vector<std::stri
arguments_ptrs[i] = &arguments[i];
}

return RE2::FullMatchN(str, re, arguments_ptrs.data(), args_count);
return RE2::FullMatchN(str, re, arguments_ptrs.data(), (int)args_count);
}

void verbose_log_match(const std::string& str, const std::string& pattern_name, const RE2& re) {
Expand Down Expand Up @@ -1002,4 +1004,5 @@ void register_function_regexp(SimpleFunctionFactory& factory) {
factory.register_alias(FunctionRegexpLike::name, FunctionRegexpLike::alias);
}

#include "common/compile_check_end.h"
} // namespace doris::vectorized
Loading
Loading