From 57391671424c4cf3ad9866ae1c7079eaef78f055 Mon Sep 17 00:00:00 2001 From: Jerry Hu Date: Thu, 30 Nov 2023 09:56:43 +0800 Subject: [PATCH] [feature](window_function) support to secondary argument to ignore null values in first_value/last_value (#27623) --- .../aggregate_function_window.cpp | 27 ++- .../aggregate_function_window.h | 37 +++- .../org/apache/doris/catalog/FunctionSet.java | 20 +- .../rules/analysis/WindowFunctionChecker.java | 2 +- .../functions/window/FirstOrLastValue.java | 23 ++- .../functions/window/FirstValue.java | 14 +- .../functions/window/LastValue.java | 12 +- ...ullable_window_function_legacy_planner.out | 97 ++++++++++ .../test_first_value_window.out | 21 +++ ...test_first_value_window_legacy_planner.out | 43 +++++ .../correctness_p0/test_last_value_window.out | 15 ++ .../test_last_value_window_legacy_planner.out | 30 +++ ...est_always_nullable_window_function.groovy | 2 + ...able_window_function_legacy_planner.groovy | 174 ++++++++++++++++++ .../test_first_value_window.groovy | 80 +++++++- ...t_first_value_window_legacy_planner.groovy | 161 ++++++++++++++++ .../test_last_value_window.groovy | 42 ++++- ...st_last_value_window_legacy_planner.groovy | 117 ++++++++++++ 18 files changed, 891 insertions(+), 26 deletions(-) create mode 100644 regression-test/data/correctness_p0/test_always_nullable_window_function_legacy_planner.out create mode 100644 regression-test/data/correctness_p0/test_first_value_window_legacy_planner.out create mode 100644 regression-test/data/correctness_p0/test_last_value_window_legacy_planner.out create mode 100644 regression-test/suites/correctness_p0/test_always_nullable_window_function_legacy_planner.groovy create mode 100644 regression-test/suites/correctness_p0/test_first_value_window_legacy_planner.groovy create mode 100644 regression-test/suites/correctness_p0/test_last_value_window_legacy_planner.groovy diff --git a/be/src/vec/aggregate_functions/aggregate_function_window.cpp b/be/src/vec/aggregate_functions/aggregate_function_window.cpp index fdc8a0bf86..2b260e6bae 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_window.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_window.cpp @@ -32,17 +32,32 @@ namespace doris::vectorized { template