This is an automated email from the ASF dual-hosted git repository. xuyang pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new 19e7bf14a8c [branch-1.2](bug) fix mask/mask_first_n/mask_last_n function can't handle const value 19e7bf14a8c is described below commit 19e7bf14a8ca2a14f6dce6d3caf35c6ee0fcff44 Author: xy720 <22125576+xy...@users.noreply.github.com> AuthorDate: Wed Feb 28 14:14:04 2024 +0800 [branch-1.2](bug) fix mask/mask_first_n/mask_last_n function can't handle const value Issue Number: close ##30624 cherry-pick #16308 --- be/src/vec/functions/function_string.h | 4 ++-- regression-test/data/correctness_p0/test_mask_function.out | 3 +++ regression-test/suites/correctness_p0/test_mask_function.groovy | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h index 62846cabae5..9537ea25a67 100644 --- a/be/src/vec/functions/function_string.h +++ b/be/src/vec/functions/function_string.h @@ -327,8 +327,8 @@ public: char upper = DEFAULT_UPPER_MASK, lower = DEFAULT_LOWER_MASK, number = DEFAULT_NUMBER_MASK; auto res = ColumnString::create(); - const auto& source_column = - assert_cast<const ColumnString&>(*block.get_by_position(arguments[0]).column); + auto col = block.get_by_position(arguments[0]).column->convert_to_full_column_if_const(); + const ColumnString& source_column = assert_cast<const ColumnString&>(*col); if (arguments.size() > 1) { auto& col = *block.get_by_position(arguments[1]).column; diff --git a/regression-test/data/correctness_p0/test_mask_function.out b/regression-test/data/correctness_p0/test_mask_function.out index a0b1d15e7f2..be33e137c5d 100644 --- a/regression-test/data/correctness_p0/test_mask_function.out +++ b/regression-test/data/correctness_p0/test_mask_function.out @@ -55,3 +55,6 @@ Meimei Han Xxxxxx Xxx Meimei Xxx Xxxxxx Xxx 19943216789 nnnnnnnnnnn 19943216nnn nnnnnnnnnnn 13556780000 nnnnnnnnnnn 13556780nnn nnnnnnnnnnn +-- !select_mask_first_n_const -- +xxxxnnnn + diff --git a/regression-test/suites/correctness_p0/test_mask_function.groovy b/regression-test/suites/correctness_p0/test_mask_function.groovy index 0a582c2b43b..54d9b6549de 100644 --- a/regression-test/suites/correctness_p0/test_mask_function.groovy +++ b/regression-test/suites/correctness_p0/test_mask_function.groovy @@ -71,4 +71,6 @@ suite("test_mask_function") { qt_select_mask_last_n_nullable """ select phone, mask_last_n(phone), mask_last_n(phone, 3), mask_last_n(phone, 100) from table_mask_test order by id; """ + + qt_select_mask_first_n_const "select mask_first_n('qwer1234', 10);" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org