This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 8faf010c640 branch-2.1: [fix](function) The parameters after the first
of the mask function need to be restricted to constants #45348 (#45498)
8faf010c640 is described below
commit 8faf010c6407442fc786a491bba7f317e09f61e4
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 17 14:25:05 2024 +0800
branch-2.1: [fix](function) The parameters after the first of the mask
function need to be restricted to constants #45348 (#45498)
Cherry-picked from #45348
Co-authored-by: Jerry Hu <[email protected]>
---
be/src/vec/functions/function_string.h | 2 ++
.../suites/correctness_p0/test_mask_function.groovy | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/be/src/vec/functions/function_string.h
b/be/src/vec/functions/function_string.h
index 777f461cfa1..41af863bda4 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -920,6 +920,8 @@ public:
size_t get_number_of_arguments() const override { return 0; }
+ ColumnNumbers get_arguments_that_are_always_constant() const override {
return {1, 2, 3}; }
+
bool is_variadic() const override { return true; }
Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
diff --git a/regression-test/suites/correctness_p0/test_mask_function.groovy
b/regression-test/suites/correctness_p0/test_mask_function.groovy
index be6f9be1b9a..09a0c61610d 100644
--- a/regression-test/suites/correctness_p0/test_mask_function.groovy
+++ b/regression-test/suites/correctness_p0/test_mask_function.groovy
@@ -77,6 +77,27 @@ suite("test_mask_function") {
select digital_masking(13812345678);
"""
+ test {
+ sql """
+ select mask('abcd', name) from table_mask_test order by id;
+ """
+ exception "Argument at index 1 for function mask must be constant"
+ }
+
+ test {
+ sql """
+ select mask('abcd', '>', name) from table_mask_test order by id;
+ """
+ exception "Argument at index 2 for function mask must be constant"
+ }
+
+ test {
+ sql """
+ select mask('abcd', '>', '<', `name`) from table_mask_test order
by id;
+ """
+ exception "Argument at index 3 for function mask must be constant"
+ }
+
test {
sql """ select mask_last_n("12345", -100); """
exception "function mask_last_n only accept non-negative input for 2nd
argument but got -100"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]