risingwave_common/array/
vector_array.rs

1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::fmt::Debug;
16
17use risingwave_common_estimate_size::EstimateSize;
18use risingwave_pb::data::PbArray;
19
20use super::{Array, ArrayBuilder};
21use crate::bitmap::Bitmap;
22use crate::types::{DataType, Scalar, ScalarRef, ToText};
23
24#[derive(Debug, Clone, EstimateSize)]
25pub struct VectorArrayBuilder {}
26
27impl ArrayBuilder for VectorArrayBuilder {
28    type ArrayType = VectorArray;
29
30    #[cfg(not(test))]
31    fn new(_capacity: usize) -> Self {
32        panic!("please use `VectorArrayBuilder::with_type` instead");
33    }
34
35    #[cfg(test)]
36    fn new(_capacity: usize) -> Self {
37        todo!("VECTOR_PLACEHOLDER")
38    }
39
40    fn with_type(_capacity: usize, _ty: DataType) -> Self {
41        todo!("VECTOR_PLACEHOLDER")
42    }
43
44    fn append_n(&mut self, _n: usize, _value: Option<VectorRef<'_>>) {
45        todo!("VECTOR_PLACEHOLDER")
46    }
47
48    fn append_array(&mut self, _other: &VectorArray) {
49        todo!("VECTOR_PLACEHOLDER")
50    }
51
52    fn pop(&mut self) -> Option<()> {
53        todo!("VECTOR_PLACEHOLDER")
54    }
55
56    fn len(&self) -> usize {
57        todo!("VECTOR_PLACEHOLDER")
58    }
59
60    fn finish(self) -> VectorArray {
61        todo!("VECTOR_PLACEHOLDER")
62    }
63}
64
65#[derive(Debug, Clone)]
66pub struct VectorArray {}
67
68impl EstimateSize for VectorArray {
69    fn estimated_heap_size(&self) -> usize {
70        todo!("VECTOR_PLACEHOLDER")
71    }
72}
73
74impl Array for VectorArray {
75    type Builder = VectorArrayBuilder;
76    type OwnedItem = VectorVal;
77    type RefItem<'a> = VectorRef<'a>;
78
79    unsafe fn raw_value_at_unchecked(&self, _idx: usize) -> Self::RefItem<'_> {
80        todo!("VECTOR_PLACEHOLDER")
81    }
82
83    fn len(&self) -> usize {
84        todo!("VECTOR_PLACEHOLDER")
85    }
86
87    fn to_protobuf(&self) -> PbArray {
88        todo!("VECTOR_PLACEHOLDER")
89    }
90
91    fn null_bitmap(&self) -> &Bitmap {
92        todo!("VECTOR_PLACEHOLDER")
93    }
94
95    fn into_null_bitmap(self) -> Bitmap {
96        todo!("VECTOR_PLACEHOLDER")
97    }
98
99    fn set_bitmap(&mut self, _bitmap: Bitmap) {
100        todo!("VECTOR_PLACEHOLDER")
101    }
102
103    fn data_type(&self) -> DataType {
104        todo!("VECTOR_PLACEHOLDER")
105    }
106}
107
108#[derive(Clone, EstimateSize)]
109pub struct VectorVal {}
110
111impl Debug for VectorVal {
112    fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
113        todo!("VECTOR_PLACEHOLDER")
114    }
115}
116
117impl PartialEq for VectorVal {
118    fn eq(&self, _other: &Self) -> bool {
119        todo!("VECTOR_PLACEHOLDER")
120    }
121}
122impl Eq for VectorVal {}
123impl PartialOrd for VectorVal {
124    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
125        Some(self.cmp(other))
126    }
127}
128impl Ord for VectorVal {
129    fn cmp(&self, _other: &Self) -> std::cmp::Ordering {
130        todo!("VECTOR_PLACEHOLDER")
131    }
132}
133
134impl Scalar for VectorVal {
135    type ScalarRefType<'a> = VectorRef<'a>;
136
137    fn as_scalar_ref(&self) -> VectorRef<'_> {
138        todo!("VECTOR_PLACEHOLDER")
139    }
140}
141
142#[derive(Clone, Copy)]
143pub struct VectorRef<'a> {
144    _marker: std::marker::PhantomData<&'a ()>,
145}
146
147impl Debug for VectorRef<'_> {
148    fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
149        todo!("VECTOR_PLACEHOLDER")
150    }
151}
152
153impl PartialEq for VectorRef<'_> {
154    fn eq(&self, _other: &Self) -> bool {
155        todo!("VECTOR_PLACEHOLDER")
156    }
157}
158impl Eq for VectorRef<'_> {}
159impl PartialOrd for VectorRef<'_> {
160    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
161        Some(self.cmp(other))
162    }
163}
164impl Ord for VectorRef<'_> {
165    fn cmp(&self, _other: &Self) -> std::cmp::Ordering {
166        todo!("VECTOR_PLACEHOLDER")
167    }
168}
169
170impl ToText for VectorRef<'_> {
171    fn write<W: std::fmt::Write>(&self, _f: &mut W) -> std::fmt::Result {
172        todo!("VECTOR_PLACEHOLDER")
173    }
174
175    fn write_with_type<W: std::fmt::Write>(&self, _ty: &DataType, _f: &mut W) -> std::fmt::Result {
176        todo!("VECTOR_PLACEHOLDER")
177    }
178}
179
180impl<'a> ScalarRef<'a> for VectorRef<'a> {
181    type ScalarType = VectorVal;
182
183    fn to_owned_scalar(&self) -> VectorVal {
184        todo!("VECTOR_PLACEHOLDER")
185    }
186
187    fn hash_scalar<H: std::hash::Hasher>(&self, _state: &mut H) {
188        todo!("VECTOR_PLACEHOLDER")
189    }
190}