springql_core/pipeline/field/
field_name.rs

1// This file is part of https://github.com/SpringQL/SpringQL which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details.
2
3use crate::{
4    mem_size::MemSize,
5    pipeline::name::{ColumnName, StreamName},
6};
7
8/// Reference to a column in a row.
9///
10/// Note that this never point to other expressions like `1 + 1 AS a`.
11#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
12pub enum ColumnReference {
13    /// Normal column reference
14    Column {
15        stream_name: StreamName,
16        column_name: ColumnName,
17    },
18    /// Processing time
19    PTime { stream_name: StreamName },
20}
21
22impl MemSize for ColumnReference {
23    fn mem_size(&self) -> usize {
24        match self {
25            Self::Column {
26                stream_name,
27                column_name,
28            } => stream_name.mem_size() + column_name.mem_size(),
29            Self::PTime { stream_name } => stream_name.mem_size(),
30        }
31    }
32}