You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/05 09:14:40 UTC

[GitHub] [incubator-doris] BiteTheDDDDt commented on a diff in pull request #9376: [BUG][Vectorized] fix `replace_if_not_null` in vectorized compaction

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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org