BiteTheDDDDt commented on code in PR #9376:
URL: https://github.com/apache/incubator-doris/pull/9376#discussion_r865707004


##########
be/src/vec/aggregate_functions/aggregate_function_window.h:
##########
@@ -348,6 +353,44 @@ struct WindowFunctionFirstData : Data {
     static const char* name() { return "first_value"; }
 };
 
+template <typename Data>
+struct WindowFunctionFirstNonNullData : Data {
+    void add_range_single_place(int64_t partition_start, int64_t 
partition_end, int64_t frame_start,
+                                int64_t frame_end, const IColumn** columns) {
+        if (this->has_set_value()) {
+            return;
+        }
+        if (frame_start < frame_end &&
+            frame_end <= partition_start) { //rewrite last_value when under 
partition
+            this->set_is_null();            //so no need more judge
+            return;
+        }
+        frame_start = std::max<int64_t>(frame_start, partition_start);
+        frame_end = std::min<int64_t>(frame_end, partition_end);
+        for (int i = frame_start; i < frame_end; i++) {
+            if (const auto* nullable_column = 
check_and_get_column<ColumnNullable>(columns[0])) {

Review Comment:
   Why not move check_and_get_column outside the loop to improve performance?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to