This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 41723c3aa3e [Chore](function) remove some unused code about functions
and add some case (#53068)
41723c3aa3e is described below
commit 41723c3aa3e1a1d45710b08d0706d47bb5ac444b
Author: Pxl <[email protected]>
AuthorDate: Fri Jul 11 06:20:10 2025 +0800
[Chore](function) remove some unused code about functions and add some case
(#53068)
---
be/src/vec/functions/function.cpp | 15 +-------------
be/src/vec/functions/function.h | 23 ----------------------
be/src/vec/functions/function_cast.h | 2 --
be/src/vec/functions/function_java_udf.h | 1 -
be/src/vec/functions/function_size.cpp | 19 +++---------------
be/test/vec/function/function_ip_dict_test.cpp | 14 +++++++++++++
.../suites/query_p0/system/test_query_sys.groovy | 4 ++++
7 files changed, 22 insertions(+), 56 deletions(-)
diff --git a/be/src/vec/functions/function.cpp
b/be/src/vec/functions/function.cpp
index 2b8dd3ce91c..1d321b34ae9 100644
--- a/be/src/vec/functions/function.cpp
+++ b/be/src/vec/functions/function.cpp
@@ -262,8 +262,7 @@ void FunctionBuilderImpl::check_number_of_arguments(size_t
number_of_arguments)
get_name(), number_of_arguments, expected_number_of_arguments);
}
-DataTypePtr FunctionBuilderImpl::get_return_type_without_low_cardinality(
- const ColumnsWithTypeAndName& arguments) const {
+DataTypePtr FunctionBuilderImpl::get_return_type(const ColumnsWithTypeAndName&
arguments) const {
check_number_of_arguments(arguments.size());
if (!arguments.empty() && use_default_implementation_for_nulls()) {
@@ -281,18 +280,6 @@ DataTypePtr
FunctionBuilderImpl::get_return_type_without_low_cardinality(
return get_return_type_impl(arguments);
}
-DataTypePtr FunctionBuilderImpl::get_return_type(const ColumnsWithTypeAndName&
arguments) const {
- if (use_default_implementation_for_low_cardinality_columns()) {
- ColumnsWithTypeAndName args_without_low_cardinality(arguments);
- auto type_without_low_cardinality =
-
get_return_type_without_low_cardinality(args_without_low_cardinality);
-
- return type_without_low_cardinality;
- }
-
- return get_return_type_without_low_cardinality(arguments);
-}
-
bool FunctionBuilderImpl::is_date_or_datetime_or_decimal(
const DataTypePtr& return_type, const DataTypePtr& func_return_type)
const {
return (is_date_or_datetime(return_type->get_primitive_type()) &&
diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h
index d4a03374a74..d8385b484e9 100644
--- a/be/src/vec/functions/function.h
+++ b/be/src/vec/functions/function.h
@@ -141,12 +141,6 @@ protected:
virtual bool skip_return_type_check() const { return false; }
- /** If function arguments has single low cardinality column and all other
arguments are constants, call function on nested column.
- * Otherwise, convert all low cardinality columns to ordinary columns.
- * Returns ColumnLowCardinality if at least one argument is
ColumnLowCardinality.
- */
- virtual bool use_default_implementation_for_low_cardinality_columns()
const { return true; }
-
/** Some arguments could remain constant during this implementation.
* Every argument required const must write here and no checks elsewhere.
*/
@@ -352,12 +346,6 @@ protected:
virtual bool need_replace_null_data_to_default() const { return false; }
- /** If use_default_implementation_for_nulls() is true, than change
arguments for get_return_type() and build_impl().
- * If function arguments has low cardinality types, convert them to
ordinary types.
- * get_return_type returns ColumnLowCardinality if at least one argument
type is ColumnLowCardinality.
- */
- virtual bool use_default_implementation_for_low_cardinality_columns()
const { return true; }
-
/// return a real function object to execute. called in build(...).
virtual FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
const DataTypePtr& return_type) const =
0;
@@ -365,9 +353,6 @@ protected:
virtual DataTypes get_variadic_argument_types_impl() const { return {}; }
private:
- DataTypePtr get_return_type_without_low_cardinality(
- const ColumnsWithTypeAndName& arguments) const;
-
bool is_date_or_datetime_or_decimal(const DataTypePtr& return_type,
const DataTypePtr& func_return_type)
const;
bool is_array_nested_type_date_or_datetime_or_decimal(
@@ -393,8 +378,6 @@ public:
bool need_replace_null_data_to_default() const override { return false; }
- bool use_default_implementation_for_low_cardinality_columns() const
override { return true; }
-
/// all constancy check should use this function to do automatically
ColumnNumbers get_arguments_that_are_always_constant() const override {
return {}; }
@@ -484,9 +467,6 @@ protected:
bool use_default_implementation_for_constants() const final {
return function->use_default_implementation_for_constants();
}
- bool use_default_implementation_for_low_cardinality_columns() const final {
- return
function->use_default_implementation_for_low_cardinality_columns();
- }
ColumnNumbers get_arguments_that_are_always_constant() const final {
return function->get_arguments_that_are_always_constant();
}
@@ -582,9 +562,6 @@ protected:
bool need_replace_null_data_to_default() const override {
return function->need_replace_null_data_to_default();
}
- bool use_default_implementation_for_low_cardinality_columns() const
override {
- return
function->use_default_implementation_for_low_cardinality_columns();
- }
FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
const DataTypePtr& return_type) const override {
diff --git a/be/src/vec/functions/function_cast.h
b/be/src/vec/functions/function_cast.h
index d215f317a57..0e1e4cefd10 100644
--- a/be/src/vec/functions/function_cast.h
+++ b/be/src/vec/functions/function_cast.h
@@ -1227,7 +1227,6 @@ protected:
}
bool use_default_implementation_for_nulls() const override { return false;
}
- bool use_default_implementation_for_low_cardinality_columns() const
override { return false; }
ColumnNumbers get_arguments_that_are_always_constant() const override {
return {1}; }
private:
@@ -2312,6 +2311,5 @@ protected:
}
bool use_default_implementation_for_nulls() const override { return false;
}
- bool use_default_implementation_for_low_cardinality_columns() const
override { return false; }
};
} // namespace doris::vectorized
diff --git a/be/src/vec/functions/function_java_udf.h
b/be/src/vec/functions/function_java_udf.h
index 8b4d932d5fc..4ef4f0172de 100644
--- a/be/src/vec/functions/function_java_udf.h
+++ b/be/src/vec/functions/function_java_udf.h
@@ -59,7 +59,6 @@ protected:
}
bool use_default_implementation_for_nulls() const override { return false;
}
- bool use_default_implementation_for_low_cardinality_columns() const
override { return false; }
private:
execute_call_back callback_function;
diff --git a/be/src/vec/functions/function_size.cpp
b/be/src/vec/functions/function_size.cpp
index 1610dfabc79..64ada99bfcf 100644
--- a/be/src/vec/functions/function_size.cpp
+++ b/be/src/vec/functions/function_size.cpp
@@ -34,12 +34,10 @@ public:
String get_name() const override { return name; }
bool is_variadic() const override { return true; }
size_t get_number_of_arguments() const override { return 0; }
+ bool use_default_implementation_for_constants() const override { return
false; }
DataTypePtr get_return_type_impl(const DataTypes& arguments) const
override {
DataTypePtr datatype = arguments[0];
- if (datatype->is_nullable()) {
- datatype = assert_cast<const
DataTypeNullable*>(datatype.get())->get_nested_type();
- }
DCHECK(datatype->get_primitive_type() == TYPE_MAP ||
datatype->get_primitive_type() == TYPE_ARRAY)
<< "first argument for function: " << name
@@ -55,20 +53,9 @@ public:
const ColumnArray* array_column = nullptr;
const ColumnMap* map_column = nullptr;
if (type->get_primitive_type() == TYPE_ARRAY) {
- if (left_column->is_nullable()) {
- auto nullable_column = reinterpret_cast<const
ColumnNullable*>(left_column.get());
- array_column =
-
check_and_get_column<ColumnArray>(nullable_column->get_nested_column());
- } else {
- array_column =
check_and_get_column<ColumnArray>(*left_column.get());
- }
+ array_column =
check_and_get_column<ColumnArray>(*left_column.get());
} else if (type->get_primitive_type() == TYPE_MAP) {
- if (left_column->is_nullable()) {
- auto nullable_column = reinterpret_cast<const
ColumnNullable*>(left_column.get());
- map_column =
check_and_get_column<ColumnMap>(nullable_column->get_nested_column());
- } else {
- map_column =
check_and_get_column<ColumnMap>(*left_column.get());
- }
+ map_column = check_and_get_column<ColumnMap>(*left_column.get());
}
auto dst_column = ColumnInt64::create(input_rows_count);
diff --git a/be/test/vec/function/function_ip_dict_test.cpp
b/be/test/vec/function/function_ip_dict_test.cpp
index ae5a4a71f8b..12cbdeb3419 100644
--- a/be/test/vec/function/function_ip_dict_test.cpp
+++ b/be/test/vec/function/function_ip_dict_test.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include "function_test_util.h"
+#include "runtime/primitive_type.h"
#include "vec/columns/column_string.h"
#include "vec/core/types.h"
#include "vec/data_types/data_type_ipv4.h"
@@ -126,6 +127,19 @@ TEST(IpDictTest, String64) {
auto result = ip_dict->get_column(attribute_name, attribute_type,
key_column, key_type);
std::cout << result->size() << std::endl;
+
+ try {
+ auto int_column = ColumnInt64::create();
+ auto int_key_data = std::make_shared<DataTypeInt64>();
+ auto ip_dict = create_ip_trie_dict_from_column(
+ "ip dict", ColumnWithTypeAndName {int_column->clone(),
int_key_data, ""},
+ ColumnsWithTypeAndName {
+ ColumnWithTypeAndName {int_column->clone(),
int_key_data, "row"},
+ });
+ ASSERT_TRUE(false);
+ } catch (const Exception& e) {
+ ASSERT_EQ(e.code(), ErrorCode::INVALID_ARGUMENT);
+ }
}
} // namespace doris::vectorized
diff --git a/regression-test/suites/query_p0/system/test_query_sys.groovy
b/regression-test/suites/query_p0/system/test_query_sys.groovy
index b192a87ca30..302780a2e25 100644
--- a/regression-test/suites/query_p0/system/test_query_sys.groovy
+++ b/regression-test/suites/query_p0/system/test_query_sys.groovy
@@ -43,6 +43,7 @@ suite("test_query_sys", "query,p0") {
sql "select pi();"
sql "select e();"
sql "select sleep(2);"
+ sql "select sleep(null);"
sql "select last_query_id();"
sql "select LAST_QUERY_ID();"
@@ -62,4 +63,7 @@ suite("test_query_sys", "query,p0") {
sql """set parallel_pipeline_task_num=1"""
def rows2 = sql """ select count(*) from
information_schema.workload_group_resource_usage; """
assertEquals(rows1, rows2)
+
+ sql "set debug_skip_fold_constant=true;"
+ sql "select version();"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]