diff --git a/be/src/http/action/compaction_score_action.cpp b/be/src/http/action/compaction_score_action.cpp index eeb0d0a642cb25..1e9bce8e84d002 100644 --- a/be/src/http/action/compaction_score_action.cpp +++ b/be/src/http/action/compaction_score_action.cpp @@ -62,8 +62,8 @@ constexpr std::string_view TABLET_ID = "tablet_id"; template concept CompactionScoreAccessble = requires(T t) { - { t.get_real_compaction_score() } -> std::same_as; -}; + { t.get_real_compaction_score() } -> std::same_as; + }; template std::vector calculate_compaction_scores( diff --git a/be/src/vec/columns/column_array.cpp b/be/src/vec/columns/column_array.cpp index 96658dbbd36a19..0df0ddcb0f30d5 100644 --- a/be/src/vec/columns/column_array.cpp +++ b/be/src/vec/columns/column_array.cpp @@ -79,7 +79,6 @@ ColumnArray::ColumnArray(MutableColumnPtr&& nested_column) : data(std::move(nest offsets = ColumnOffsets::create(); } - void ColumnArray::shrink_padding_chars() { data->shrink_padding_chars(); } @@ -372,8 +371,7 @@ void ColumnArray::pop_back(size_t n) { void ColumnArray::reserve(size_t n) { get_offsets().reserve(n); get_data().reserve( - get_offsets() - .back()); /// The average size of arrays is not taken into account here. Or it is considered to be no more than 1. + n); /// The average size of arrays is not taken into account here. Or it is considered to be no more than 1. } //please check you real need size in data column, because it's maybe need greater size when data is string column @@ -475,63 +473,30 @@ void ColumnArray::insert_range_from_ignore_overflow(const IColumn& src, size_t s } ColumnPtr ColumnArray::filter(const Filter& filt, ssize_t result_size_hint) const { - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_number(filt, result_size_hint); - } - if (typeid_cast(data.get())) { - return filter_string(filt, result_size_hint); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return filter_string(filt, result_size_hint); + //if (typeid_cast(data.get())) return filterTuple(filt, result_size_hint); + if (typeid_cast(data.get())) return filter_nullable(filt, result_size_hint); - } return filter_generic(filt, result_size_hint); } @@ -570,13 +535,12 @@ ColumnPtr ColumnArray::filter_number(const Filter& filt, ssize_t result_size_hin if (get_offsets().empty()) return ColumnArray::create(data); auto res = ColumnArray::create(data->clone_empty()); - using ColVecType = ColumnVectorOrDecimal; - auto& res_elems = assert_cast(res->get_data()).get_data(); + auto& res_elems = assert_cast&>(res->get_data()).get_data(); auto& res_offsets = res->get_offsets(); filter_arrays_impl( - assert_cast(*data).get_data(), + assert_cast&, TypeCheckOnRelease::DISABLE>(*data).get_data(), get_offsets(), res_elems, res_offsets, filt, result_size_hint); return res; } @@ -835,71 +799,27 @@ void ColumnArray::insert_many_from(const IColumn& src, size_t position, size_t l } ColumnPtr ColumnArray::replicate(const IColumn::Offsets& replicate_offsets) const { - if (replicate_offsets.empty()) { - return clone_empty(); - } + if (replicate_offsets.empty()) return clone_empty(); // keep ColumnUInt8 for ColumnNullable::null_map - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_number(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_string(replicate_offsets); - } - if (typeid_cast(data.get())) { - return replicate_const(replicate_offsets); - } - if (typeid_cast(data.get())) { + if (typeid_cast(data.get())) return replicate_string(replicate_offsets); + if (typeid_cast(data.get())) return replicate_const(replicate_offsets); + if (typeid_cast(data.get())) return replicate_nullable(replicate_offsets); - } return replicate_generic(replicate_offsets); } @@ -909,7 +829,6 @@ ColumnPtr ColumnArray::replicate_number(const IColumn::Offsets& replicate_offset column_match_offsets_size(col_size, replicate_offsets.size()); MutableColumnPtr res = clone_empty(); - using ColVecType = ColumnVectorOrDecimal; if (!col_size) { return res; @@ -917,12 +836,12 @@ ColumnPtr ColumnArray::replicate_number(const IColumn::Offsets& replicate_offset auto& res_arr = assert_cast(*res); - const typename ColVecType::Container& src_data = - assert_cast(*data).get_data(); + const typename ColumnVector::Container& src_data = + assert_cast&>(*data).get_data(); const auto& src_offsets = get_offsets(); - typename ColVecType::Container& res_data = - assert_cast(res_arr.get_data()).get_data(); + typename ColumnVector::Container& res_data = + assert_cast&>(res_arr.get_data()).get_data(); auto& res_offsets = res_arr.get_offsets(); res_data.reserve(data->size() / col_size * replicate_offsets.back()); @@ -1137,10 +1056,10 @@ ColumnPtr ColumnArray::permute(const Permutation& perm, size_t limit) const { nested_perm.push_back(offset_at(perm[i]) + j); } } - if (!nested_perm.empty()) { + if (nested_perm.size() != 0) { res->data = data->permute(nested_perm, nested_perm.size()); } return res; } -} // namespace doris::vectorized +} // namespace doris::vectorized \ No newline at end of file diff --git a/be/src/vec/columns/column_vector.cpp b/be/src/vec/columns/column_vector.cpp index ae9c8cbf1c9447..816b28ba25e10b 100644 --- a/be/src/vec/columns/column_vector.cpp +++ b/be/src/vec/columns/column_vector.cpp @@ -265,15 +265,6 @@ void ColumnVector::get_permutation(bool reverse, size_t limit, int nan_direct } } -template -const char* ColumnVector::get_family_name() const { - // however we have a conflict type of number and other can store in number type such as ipv4 and uint32 - if (std::is_same_v) { - return "IPv4"; - } - return TypeName::get(); -} - template MutableColumnPtr ColumnVector::clone_resized(size_t size) const { auto res = this->create(); diff --git a/be/src/vec/columns/column_vector.h b/be/src/vec/columns/column_vector.h index 970997a91864cc..734ae4ef42386b 100644 --- a/be/src/vec/columns/column_vector.h +++ b/be/src/vec/columns/column_vector.h @@ -337,7 +337,13 @@ class ColumnVector final : public COWHelper> { void resize(size_t n) override { data.resize(n); } - std::string get_name() const override { return TypeName::get(); } + std::string get_name() const override { + // however we have a conflict type of number and other can store in number type such as ipv4 and uint32 + if (std::is_same_v) { + return "IPv4"; + } + return TypeName::get(); + } MutableColumnPtr clone_resized(size_t size) const override; diff --git a/be/src/vec/columns/columns_common.cpp b/be/src/vec/columns/columns_common.cpp index ee2156aefe3c54..6297be2ce28e58 100644 --- a/be/src/vec/columns/columns_common.cpp +++ b/be/src/vec/columns/columns_common.cpp @@ -363,6 +363,8 @@ INSTANTIATE(UInt32, IColumn::Offset) INSTANTIATE(UInt32, ColumnArray::Offset64) INSTANTIATE(UInt64, IColumn::Offset) INSTANTIATE(UInt64, ColumnArray::Offset64) +INSTANTIATE(UInt128, IColumn::Offset) +INSTANTIATE(UInt128, ColumnArray::Offset64) INSTANTIATE(Int8, IColumn::Offset) INSTANTIATE(Int8, ColumnArray::Offset64) INSTANTIATE(Int16, IColumn::Offset) @@ -373,8 +375,6 @@ INSTANTIATE(Int64, IColumn::Offset) INSTANTIATE(Int64, ColumnArray::Offset64) INSTANTIATE(Int128, IColumn::Offset) INSTANTIATE(Int128, ColumnArray::Offset64) -INSTANTIATE(UInt128, IColumn::Offset) -INSTANTIATE(UInt128, ColumnArray::Offset64) INSTANTIATE(Float32, IColumn::Offset) INSTANTIATE(Float32, ColumnArray::Offset64) INSTANTIATE(Float64, IColumn::Offset) diff --git a/be/src/vec/columns/predicate_column.h b/be/src/vec/columns/predicate_column.h index 4de4559faae80a..7e15656fe1d204 100644 --- a/be/src/vec/columns/predicate_column.h +++ b/be/src/vec/columns/predicate_column.h @@ -157,8 +157,6 @@ class PredicateColumnType final : public COWHelperget_data(); static constexpr UInt8 max_cidr_mask = IPV6_BINARY_LENGTH * 8; + unsigned char ipv6_address_data[IPV6_BINARY_LENGTH]; if (is_addr_const) { + StringRef str_ref = from_column.get_data_at(0); + const char* value = str_ref.data; + size_t value_size = str_ref.size; + if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0) { + throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'", + std::string(value, value_size)); + } + memcpy(ipv6_address_data, value, value_size); + memset(ipv6_address_data + value_size, 0, IPV6_BINARY_LENGTH - value_size); for (size_t i = 0; i < input_rows_count; ++i) { auto cidr = cidr_column.get_int(i); if (cidr < 0 || cidr > max_cidr_mask) { @@ -939,9 +949,13 @@ class FunctionIPv6CIDRToRange : public IFunction { if constexpr (std::is_same_v) { // 16 bytes ipv6 string is stored in big-endian byte order // so transfer to little-endian firstly - auto* src_data = const_cast(from_column.get_data_at(0).data); - std::reverse(src_data, src_data + IPV6_BINARY_LENGTH); - apply_cidr_mask(src_data, reinterpret_cast(&vec_res_lower_range[i]), + if (!IPv6Value::is_valid_string(value, value_size)) { + throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'", + std::string(value, value_size)); + } + std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH); + apply_cidr_mask(reinterpret_cast(&ipv6_address_data), + reinterpret_cast(&vec_res_lower_range[i]), reinterpret_cast(&vec_res_upper_range[i]), cast_set(cidr)); } else { @@ -961,9 +975,19 @@ class FunctionIPv6CIDRToRange : public IFunction { if constexpr (std::is_same_v) { // 16 bytes ipv6 string is stored in big-endian byte order // so transfer to little-endian firstly - auto* src_data = const_cast(from_column.get_data_at(i).data); - std::reverse(src_data, src_data + IPV6_BINARY_LENGTH); - apply_cidr_mask(src_data, reinterpret_cast(&vec_res_lower_range[i]), + StringRef str_ref = from_column.get_data_at(i); + const char* value = str_ref.data; + size_t value_size = str_ref.size; + if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0 + || !IPv6Value::is_valid_string(value, value_size)) { + throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'", + std::string(value, value_size)); + } + memcpy(ipv6_address_data, value, value_size); + memset(ipv6_address_data + value_size, 0, IPV6_BINARY_LENGTH - value_size); + std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH); + apply_cidr_mask(reinterpret_cast(&ipv6_address_data), + reinterpret_cast(&vec_res_lower_range[i]), reinterpret_cast(&vec_res_upper_range[i]), cast_set(cidr)); } else { @@ -983,9 +1007,19 @@ class FunctionIPv6CIDRToRange : public IFunction { if constexpr (std::is_same_v) { // 16 bytes ipv6 string is stored in big-endian byte order // so transfer to little-endian firstly - auto* src_data = const_cast(from_column.get_data_at(i).data); - std::reverse(src_data, src_data + IPV6_BINARY_LENGTH); - apply_cidr_mask(src_data, reinterpret_cast(&vec_res_lower_range[i]), + StringRef str_ref = from_column.get_data_at(i); + const char* value = str_ref.data; + size_t value_size = str_ref.size; + if (value_size > IPV6_BINARY_LENGTH || value == nullptr || value_size == 0 + || !IPv6Value::is_valid_string(value, value_size)) { + throw Exception(ErrorCode::INVALID_ARGUMENT, "Illegal ipv6 address '{}'", + std::string(value, value_size)); + } + memcpy(ipv6_address_data, value, value_size); + memset(ipv6_address_data + value_size, 0, IPV6_BINARY_LENGTH - value_size); + std::reverse(ipv6_address_data, ipv6_address_data + IPV6_BINARY_LENGTH); + apply_cidr_mask(reinterpret_cast(&ipv6_address_data), + reinterpret_cast(&vec_res_lower_range[i]), reinterpret_cast(&vec_res_upper_range[i]), cast_set(cidr)); } else { diff --git a/be/test/vec/columns/column_array_test.cpp b/be/test/vec/columns/column_array_test.cpp deleted file mode 100644 index 66f26b4beda5d6..00000000000000 --- a/be/test/vec/columns/column_array_test.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// 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 "vec/columns/column_array.h" - -#include -#include -#include - -#include "vec/columns/column.h" -#include "vec/columns/columns_number.h" -#include "vec/columns/common_column_test.h" -#include "vec/core/field.h" -#include "vec/core/types.h" -#include "vec/data_types/data_type.h" - -// this test is gonna to be a column test template for all column which should make ut test to coverage the function defined in column -// for example column_array should test this function: -// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized, -// get_shrinked_column, filter, filter_by_selector, serialize_vec, deserialize_vec, get_max_row_byte_size -// -namespace doris::vectorized { -class ColumnArrayTest : public CommonColumnTest { -protected: - void dump_size(ColumnArray::MutablePtr& arr) { - std::cout << "size: " << arr->size() << std::endl; - std::cout << "offset size: " << arr->get_offsets().size() << std::endl; - std::cout << "data size: " << arr->get_data_ptr()->size() << std::endl; - std::cout << "allocated_bytes: " << arr->allocated_bytes() << std::endl; - std::cout << "byte_size: " << arr->byte_size() << std::endl; - } - - // in array we should always check size with data and offset column - void check_size(IColumn& arr, size_t expect_size) { - auto& a = assert_cast(arr); - EXPECT_EQ(a.size(), expect_size); - EXPECT_EQ(a.get_offsets().size(), expect_size); - EXPECT_EQ(a.get_offsets().back(), a.get_data_ptr()->size()); - } - - void SetUp() override { - col_int_arr = - ColumnArray::create(ColumnInt64::create(), ColumnArray::ColumnOffsets::create()); - Array array1 = {1, 2, 3}; - Array array2 = {4}; - col_int_arr->insert(array1); - col_int_arr->insert(Array()); - col_int_arr->insert(array2); - col_int_arr->insert(Null()); - - col_string_arr = - ColumnArray::create(ColumnString::create(), ColumnArray::ColumnOffsets::create()); - Array array3 = {"1\\0", "2", "3"}; - Array array4 = {"4"}; - col_string_arr->insert(array3); - col_string_arr->insert(Array()); - col_string_arr->insert(array4); - } - - ColumnArray::MutablePtr col_int_arr; - ColumnArray::MutablePtr col_string_arr; -}; - -TEST_F(ColumnArrayTest, SizeTest) { - // now column_array size() use offsets_column size as the size of itself, - // but we should make sure the length of data_column is the same as the size of itself - check_size(*col_int_arr, 4); -} - -TEST_F(ColumnArrayTest, ReserveTest) { - // reserve now in ColumnArray make offsets column and data column reserve the same size - // reserve bigger ? - col_int_arr->reserve(10); - EXPECT_GE(col_int_arr->size(), 4); - col_int_arr->reserve(0); - EXPECT_GE(col_int_arr->size(), 0); - // reserve to -1 will fatal with Check failed: false Amount of memory requested to allocate is more than allowed, num_elements 18446744073709551615, ELEMENT_SIZE 8 - // col_int_arr->reserve(-1); - // dump_size(col_int_arr); -} - -TEST_F(ColumnArrayTest, ResizeTest) { - // resize now in ColumnArray make offsets column - // and data column resize to offsets.back() - // resize bigger ? - col_int_arr->resize(10); - check_size(*col_int_arr, 10); - col_int_arr->resize(0); - check_size(*col_int_arr, 0); - // resize to -1 will fatal with - // Check failed: false Amount of memory requested to allocate is more than allowed, num_elements 18446744073709551615, ELEMENT_SIZE 8 - // EXPECT_ANY_THROW(col_int_arr->resize(-1)); -} - -TEST_F(ColumnArrayTest, ReplicateTest) { - // replicate now in ColumnArray make offsets column and data column replicate the same size - // replicate bigger ? - auto rep = col_int_arr->replicate(IColumn::Offsets(4, 10)); - check_size(*col_int_arr, 4); - check_size(rep->assume_mutable_ref(), 10); - rep = col_int_arr->replicate(IColumn::Offsets(4, 0)); - check_size(*col_int_arr, 4); - check_size(rep->assume_mutable_ref(), 0); - // replicate to -1 will hang this interface, so we should not set the size to -1 - // col_int_arr->replicate(IColumn::Offsets(4, -1)); -} - -TEST_F(ColumnArrayTest, ByteSizeTest) { - // column_array byte_size means the byte size of - // the data column + offsets_size * size_of(offsets_type) - size_t expect_size = 5 * sizeof(int64_t) + 4 * sizeof(int64_t); - byteSizeAssert(col_int_arr->get_ptr(), expect_size); -} - -TEST_F(ColumnArrayTest, AllocatedBytesTest) { - // column_array allocated_bytes means the allocated bytes of the data column + allocated bytes of the offsets column - // which should satisfied the real size of the column - EXPECT_EQ(col_int_arr->get_data_ptr()->allocated_bytes(), 4096); - EXPECT_EQ(col_int_arr->get_offsets().allocated_bytes(), 4096); - allocatedBytesAssert(col_int_arr->get_ptr(), 8192); // contains data pod and offsets pod -} - -TEST_F(ColumnArrayTest, CloneResizedTest) { - // clone_resized will clone the column_array and resize the new column_array to the size of the original column_array - auto new_col_int_arr = col_int_arr->clone_resized(10); - check_size(*new_col_int_arr, 10); - new_col_int_arr = col_int_arr->clone_resized(0); - check_size(*new_col_int_arr, 0); - // resize to -1 will fatal with - // Check failed: false Amount of memory requested to allocate is more than allowed, num_elements 18446744073709551615, ELEMENT_SIZE 8 - // new_col_int_arr = col_int_arr->clone_resized(-1); -} - -TEST_F(ColumnArrayTest, GetShrinkedColumnTest) { - // get_shrinked_column should only happened in char-type column or nested char-type column - EXPECT_ANY_THROW(col_int_arr->get_shrinked_column()); - MutableColumnPtr shrinked_col = col_string_arr->get_shrinked_column(); - check_size(*shrinked_col, 3); -} - -TEST_F(ColumnArrayTest, FilterTest) { - std::vector filter = {1, 0, 1, 0}; - filterAssert(col_int_arr->get_ptr(), filter, 2); -} - -// array should not make a PredicateColumnType -TEST_F(ColumnArrayTest, FilterBySelectorTest) {} - -// array do not implement permutation -TEST_F(ColumnArrayTest, PermuteTest) { - IColumn::Permutation permutation = {3, 2, 1, 0}; - EXPECT_ANY_THROW(assertColumnPermutation(*col_int_arr, true, 0, 0, permutation, permutation)); -} - -TEST_F(ColumnArrayTest, SortColumnTest) { - IColumn::Permutation permutation = {3, 2, 1, 0}; - assertSortColumn(*col_int_arr, permutation, 0); -} - -} // namespace doris::vectorized \ No newline at end of file diff --git a/build.sh b/build.sh index c90f6b14144600..7b2522ee1e3e32 100755 --- a/build.sh +++ b/build.sh @@ -691,11 +691,11 @@ function build_ui() { } # FE UI must be built before building FE -if [[ "${BUILD_FE}" -eq 1 ]]; then - if [[ "${BUILD_UI}" -eq 1 ]]; then - build_ui - fi -fi +#if [[ "${BUILD_FE}" -eq 1 ]]; then +# if [[ "${BUILD_UI}" -eq 1 ]]; then +# build_ui +# fi +#fi # Clean and build Frontend if [[ "${FE_MODULES}" != '' ]]; then diff --git a/regression-test/suites/nereids_function_p0/scalar_function/IP.groovy b/regression-test/suites/nereids_function_p0/scalar_function/IP.groovy index 9cbdccbe78840b..92a1517e0746ae 100644 --- a/regression-test/suites/nereids_function_p0/scalar_function/IP.groovy +++ b/regression-test/suites/nereids_function_p0/scalar_function/IP.groovy @@ -29,7 +29,11 @@ suite("nereids_scalar_fn_IP") { qt_sql_cidr_ipv4 "select id, struct_element(ipv4_cidr_to_range(ip4, $cidr_v4), 'min') as min_range, struct_element(ipv4_cidr_to_range(ip4, $cidr_v4), 'max') as max_range from fn_test_ip_nullable order by id" qt_sql_cidr_ipv6_all """ select id, ipv6_cidr_to_range(ip6, 16) from fn_test_ip_nullable order by id; """ qt_sql_cidr_ipv4_all """ select id, ipv4_cidr_to_range(ip4, 16) from fn_test_ip_nullable order by id; """ - + // column_nullable + test { + sql "select id, ipv6_cidr_to_range(nullable(''), 32) from fn_test_ip_nullable order by id" + exception "Illegal ipv6 address" + } // test IPV4_STRING_TO_NUM/IPV6_STRING_TO_NUM (we have null value in ip4 and ip6 column in fn_test_ip_nullable table) test { @@ -153,6 +157,11 @@ suite("nereids_scalar_fn_IP") { qt_sql_not_null_cidr_ipv6_all """ select id, ipv6_cidr_to_range(ip6, 16) from fn_test_ip_not_nullable order by id; """ qt_sql_not_null_cidr_ipv4_all """ select id, ipv4_cidr_to_range(ip4, 16) from fn_test_ip_not_nullable order by id; """ + // column_nullable param + test { + sql "select id, ipv6_cidr_to_range(nullable(''), 32) from fn_test_ip_not_nullable order by id" + exception "Illegal ipv6 address" + } // test IPV4_STRING_TO_NUM/IPV6_STRING_TO_NUM qt_sql_not_null_ipv6_string_to_num 'select id, hex(ipv6_string_to_num(ip6)) from fn_test_ip_not_nullable order by id'