mirror of
https://github.com/apache/doris.git
synced 2026-11-04 17:16:21 +00:00
…cific files (#62262) https://github.com/apache/doris/pull/62262 https://github.com/apache/doris/pull/56304 `function_string.h` was a 5393-line monolithic header containing ~40 function class implementations with heavy dependencies (`pugixml`, ICU, Boost.Locale, digest libs, etc.). Every translation unit including it pulled in all dependencies, causing slow compilation and unnecessary rebuilds. This PR splits it into 9 domain-specific files. 6 files with no external consumers are converted to standalone `.cpp` with their own registration functions. 3 files with external consumers remain as `.h`. **Converted to .cpp (6 files):** - `function_string_basic.cpp` — Strcmp, Substring, Left, Right, NullOrEmpty - `function_string_mask.cpp` — Mask, MaskPartial - `function_string_search.cpp` — LocatePos, SplitPart, SubstringIndex, SplitByString, CountSubString - `function_string_digest.cpp` — SM3, MD5, SHA1, SHA2 - `function_string_url.cpp` — ExtractURLParameter, ParseUrl, UrlDecode, UrlEncode - `function_string_misc.cpp` — AutoPartitionName, RandomBytes, ConvertTo, IntToChar, NgramSearch, Translate, XPathString, MakeSet, ExportSet, Crc32, UnicodeNormalize **Kept as .h (3 files):** - `function_string_concat.h` — used by `column_string_test.cpp` - `function_string_format.h` — used by `function_money_format_test.cpp` - `function_string_replace.h` — used by `function_reverse.h`, `function_sub_replace_test.cpp` **Other changes:** - `function_string.cpp` — removed original header include, calls 6 sub-registration functions via extern declarations - Removed unnecessary `function_string.h` includes from `partition_transformers.h` and `function_split_by_regexp.cpp` - Updated test files to include specific sub-headers - Fixed missing `block.h` include in `function_array_reverse.h` - Fixed pre-existing missing `vexpr_context.h` include in `viceberg_merge_sink.cpp` The original `function_string.h` is deleted. None - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 --> - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> --------- Co-authored-by: linrrarity <linzhenqi@selectdb.com>
52 lines
2.0 KiB
C++
52 lines
2.0 KiB
C++
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "core/block/block.h"
|
|
#include "core/data_type/data_type_number.h"
|
|
#include "core/data_type/data_type_string.h"
|
|
#include "exprs/function/function_string_replace.h"
|
|
|
|
namespace doris {
|
|
TEST(SubReplaceTest, test) {
|
|
const int rows = 10240;
|
|
auto str = ColumnString::create();
|
|
auto new_str = ColumnString::create();
|
|
auto start = ColumnInt32::create();
|
|
auto length = ColumnInt32::create();
|
|
|
|
for (int i = 0; i < rows; i++) {
|
|
str->insert_default();
|
|
new_str->insert_default();
|
|
start->insert_default();
|
|
length->insert_default();
|
|
}
|
|
|
|
Block block {
|
|
ColumnWithTypeAndName {std::move(str), std::make_shared<DataTypeString>(), "str"},
|
|
ColumnWithTypeAndName {std::move(new_str), std::make_shared<DataTypeString>(),
|
|
"new_str"},
|
|
ColumnWithTypeAndName {std::move(start), std::make_shared<DataTypeInt32>(), "start"},
|
|
ColumnWithTypeAndName {std::move(length), std::make_shared<DataTypeInt32>(), "length"},
|
|
ColumnWithTypeAndName {nullptr, std::make_shared<DataTypeInt32>(), "res"},
|
|
};
|
|
|
|
EXPECT_TRUE(SubReplaceImpl::replace_execute(block, ColumnNumbers {0, 1, 2, 3}, 4, rows));
|
|
}
|
|
} // namespace doris
|