Debian Codegraph @

lib/grn_window_function.h

raw symbols SCIP
1 /*
2 Copyright(C) 2016-2017 Brazil
3 Copyright(C) 2019-2021 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "grn_db.h"
21
22 #pragma once
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef struct {
29 grn_obj *table;
30 bool is_context_table;
31 grn_obj *window_function_call;
32 grn_proc *window_function;
33 grn_obj arguments;
34 grn_obj *output_column;
35 grn_obj key_columns;
36 grn_obj ids;
37 ssize_t current_index;
38 } grn_window_shard;
39
40 struct _grn_window {
41 grn_window_shard *shards;
42 size_t n_shards;
43 ssize_t current_shard;
44 grn_id current_id;
45 grn_window_direction direction;
46 bool is_sorted;
47 struct {
48 size_t n;
49 grn_obj *buffer1;
50 grn_obj *buffer2;
51 grn_obj *previous;
52 grn_obj *current;
53 } values;
54 bool is_value_changed_computed;
55 bool is_value_changed;
56 };
57
58 grn_rc grn_window_init(grn_ctx *ctx,
59 grn_window *window);
60 grn_rc grn_window_fin(grn_ctx *ctx, grn_window *window);
61 grn_rc grn_window_reset(grn_ctx *ctx, grn_window *window);
62 grn_rc grn_window_add_record(grn_ctx *ctx,
63 grn_window *window,
64 grn_obj *table,
65 bool is_context_table,
66 grn_id record_id,
67 grn_obj *window_function_call,
68 grn_obj *output_column,
69 grn_obj *key_columns);
70 bool grn_window_is_empty(grn_ctx *ctx, grn_window *window);
71 grn_rc grn_window_set_is_sorted(grn_ctx *ctx,
72 grn_window *window,
73 bool is_sorted);
74 grn_rc grn_window_execute(grn_ctx *ctx, grn_window *window);
75
76 #ifdef __cplusplus
77 }
78 #endif