This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 1132d664909 branch-3.0: [fix](function) The parameters after the first
of the mask function need to be restricted to constants #45348 (#45497)
1132d664909 is described below
commit 1132d664909408acf09f3d43d4b855286a591086
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 17 14:25:31 2024 +0800
branch-3.0: [fix](function) The parameters after the first of the mask
function need to be restricted to constants #45348 (#45497)
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 5b79521cb7d..1b803407b60 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -702,6 +702,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 b7717ab183c..c1116e633d2 100644
--- a/regression-test/suites/correctness_p0/test_mask_function.groovy
+++ b/regression-test/suites/correctness_p0/test_mask_function.groovy
@@ -76,6 +76,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]