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 918004c016 [Bug](date) Fix BE crash caused by function `datediff`
(#16397)
918004c016 is described below
commit 918004c016e3ce53f386684c0427fa189bfa74b5
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 563040c4ec..a08ba6294f 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 09472c76d7..83f99991a8 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
@@ -235,6 +235,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]