This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit bf58cc6fe13afbc4c21e3aaa3991d0531a7de288 Author: Gabriel <[email protected]> AuthorDate: Sat Feb 4 18:43:23 2023 +0800 [Bug](date) Fix BE crash caused by function `datediff` (#16397) * [Bug](date) Fix BE crash caused by function `datediff` * update --- be/src/vec/functions/function_date_or_datetime_computation.h | 4 +++- .../query_p0/sql_functions/datetime_functions/test_date_function.out | 3 +++ .../sql_functions/datetime_functions/test_date_function.groovy | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/be/src/vec/functions/function_date_or_datetime_computation.h b/be/src/vec/functions/function_date_or_datetime_computation.h index ee33e82cf7..b45333b89d 100644 --- a/be/src/vec/functions/function_date_or_datetime_computation.h +++ b/be/src/vec/functions/function_date_or_datetime_computation.h @@ -548,10 +548,12 @@ struct DateTimeAddIntervalImpl { if (const auto* delta_vec_column = check_and_get_column<ColumnVector<FromType2>>( *remove_nullable(block.get_by_position(arguments[1]).column))) { Op::constant_vector(sources_const->template get_value<FromType1>(), - col_to->get_data(), delta_vec_column->get_data()); + col_to->get_data(), null_map->get_data(), + delta_vec_column->get_data()); } else { Op::constant_vector( sources_const->template get_value<FromType2>(), col_to->get_data(), + null_map->get_data(), *remove_nullable(block.get_by_position(arguments[1]).column)); } if (const auto* nullable_col = check_and_get_column<ColumnNullable>( diff --git a/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out b/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out index 578da53634..57136bcf02 100644 --- a/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out +++ b/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out @@ -147,6 +147,9 @@ -- !sql -- 16 +-- !sql -- +\N + -- !sql -- 31 diff --git a/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy b/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy index e588c68569..f1220233c0 100644 --- a/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy @@ -238,6 +238,7 @@ suite("test_date_function") { qt_sql """ select datediff(CAST('2007-12-31 23:59:59' AS DATETIME), CAST('2007-12-30' AS DATETIME)) """ qt_sql """ select datediff(CAST('2010-11-30 23:59:59' AS DATETIME), CAST('2010-12-31' AS DATETIME)) """ qt_sql """ select datediff('2010-10-31', '2010-10-15') """ + qt_sql """ select datediff('10000-10-31', '2010-10-15') from ${tableName}; """ // DAY qt_sql """ select day('1987-01-31') """ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
