risingwave_pb/
window_function.rs

1// This file is @generated by prost-build.
2/// State for the row_number window function.
3#[derive(prost_helpers::AnyPB)]
4#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct RowNumberState {
6    #[prost(int64, tag = "1")]
7    pub prev_rank: i64,
8}
9/// State for the rank window function.
10#[derive(prost_helpers::AnyPB)]
11#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
12pub struct RankState {
13    /// The memcmp-encoded order key of the previous output row.
14    /// Absent when no row has been output yet.
15    #[prost(bytes = "vec", optional, tag = "1")]
16    pub prev_order_key: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
17    #[prost(int64, tag = "2")]
18    pub prev_rank: i64,
19    #[prost(int64, tag = "3")]
20    pub prev_pos_in_peer_group: i64,
21}
22/// State for the dense_rank window function.
23#[derive(prost_helpers::AnyPB)]
24#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
25pub struct DenseRankState {
26    /// The memcmp-encoded order key of the previous output row.
27    /// Absent when no row has been output yet.
28    #[prost(bytes = "vec", optional, tag = "1")]
29    pub prev_order_key: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
30    #[prost(int64, tag = "2")]
31    pub prev_rank: i64,
32}
33/// Serialized form of a StateKey stored in a WindowStateSnapshot.
34/// Both fields are opaque binary blobs; the order_key is MemcmpEncoded and
35/// the pk is serialized by OrderedRowSerde in the executor.
36#[derive(prost_helpers::AnyPB)]
37#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
38pub struct StateKey {
39    #[prost(bytes = "vec", tag = "1")]
40    pub order_key: ::prost::alloc::vec::Vec<u8>,
41    #[prost(bytes = "vec", tag = "2")]
42    pub pk: ::prost::alloc::vec::Vec<u8>,
43}
44/// Persisted snapshot of a window function state, stored per partition per
45/// window call in the intermediate_state_table.
46#[derive(prost_helpers::AnyPB)]
47#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
48pub struct WindowStateSnapshot {
49    /// The key of the last row that was output before this snapshot was taken.
50    /// Absent when no row has been output yet.
51    #[prost(message, optional, tag = "1")]
52    pub last_output_key: ::core::option::Option<StateKey>,
53    /// Function-specific state. The variant must match the window function type
54    /// of the corresponding call; a mismatch is treated as a decode error.
55    #[prost(oneof = "window_state_snapshot::FunctionState", tags = "2, 3, 4")]
56    pub function_state: ::core::option::Option<window_state_snapshot::FunctionState>,
57}
58/// Nested message and enum types in `WindowStateSnapshot`.
59pub mod window_state_snapshot {
60    /// Function-specific state. The variant must match the window function type
61    /// of the corresponding call; a mismatch is treated as a decode error.
62    #[derive(prost_helpers::AnyPB)]
63    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
64    pub enum FunctionState {
65        #[prost(message, tag = "2")]
66        RowNumberState(super::RowNumberState),
67        #[prost(message, tag = "3")]
68        RankState(super::RankState),
69        #[prost(message, tag = "4")]
70        DenseRankState(super::DenseRankState),
71    }
72}