Skip to content

Commit 98eaf81

Browse files
authored
refactor: remove Array::Null and related variants (supabase#358)
1 parent 0725895 commit 98eaf81

File tree

3 files changed

+0
-18
lines changed

3 files changed

+0
-18
lines changed

etl-destinations/src/bigquery/encoding.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ pub fn array_cell_encode_prost(
250250
buf: &mut impl bytes::BufMut,
251251
) {
252252
match array_cell {
253-
ArrayCellNonOptional::Null => {}
254253
ArrayCellNonOptional::Bool(vec) => {
255254
prost::encoding::bool::encode_packed(tag, &vec, buf);
256255
}
@@ -332,7 +331,6 @@ pub fn array_cell_non_optional_encoded_len_prost(
332331
tag: u32,
333332
) -> usize {
334333
match array_cell {
335-
ArrayCellNonOptional::Null => 0,
336334
ArrayCellNonOptional::Bool(vec) => prost::encoding::bool::encoded_len_packed(tag, &vec),
337335
ArrayCellNonOptional::String(vec) => {
338336
prost::encoding::string::encoded_len_repeated(tag, &vec)

etl-destinations/src/bigquery/validation.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ pub fn validate_cell_for_bigquery(cell: &CellNonOptional) -> EtlResult<()> {
290290
/// Returns an error if any array element is outside BigQuery's supported range for its type.
291291
pub fn validate_array_cell_for_bigquery(array_cell: &ArrayCellNonOptional) -> EtlResult<()> {
292292
match array_cell {
293-
ArrayCellNonOptional::Null => Ok(()),
294293
ArrayCellNonOptional::Bool(_) => Ok(()),
295294
ArrayCellNonOptional::String(_) => Ok(()),
296295
ArrayCellNonOptional::I16(_) => Ok(()),

etl/src/types/cell.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ impl Cell {
110110
/// [`ArrayCellNonOptional`] for destinations that don't support nullable array elements.
111111
#[derive(Debug, Clone, PartialEq)]
112112
pub enum ArrayCell {
113-
/// NULL array value
114-
Null,
115113
/// Array of nullable boolean values
116114
Bool(Vec<Option<bool>>),
117115
/// Array of nullable string values
@@ -150,7 +148,6 @@ impl ArrayCell {
150148
/// Clears all elements from the array while preserving the variant type.
151149
fn clear(&mut self) {
152150
match self {
153-
ArrayCell::Null => {}
154151
ArrayCell::Bool(vec) => vec.clear(),
155152
ArrayCell::String(vec) => vec.clear(),
156153
ArrayCell::I16(vec) => vec.clear(),
@@ -252,7 +249,6 @@ impl CellNonOptional {
252249

253250
#[derive(Debug, Clone, PartialEq)]
254251
pub enum ArrayCellNonOptional {
255-
Null,
256252
Bool(Vec<bool>),
257253
String(Vec<String>),
258254
I16(Vec<i16>),
@@ -276,7 +272,6 @@ impl TryFrom<ArrayCell> for ArrayCellNonOptional {
276272

277273
fn try_from(array_cell: ArrayCell) -> Result<Self, Self::Error> {
278274
match array_cell {
279-
ArrayCell::Null => Ok(ArrayCellNonOptional::Null),
280275
ArrayCell::Bool(vec) => convert_array_variant!(Bool, vec),
281276
ArrayCell::String(vec) => convert_array_variant!(String, vec),
282277
ArrayCell::I16(vec) => convert_array_variant!(I16, vec),
@@ -300,7 +295,6 @@ impl TryFrom<ArrayCell> for ArrayCellNonOptional {
300295
impl ArrayCellNonOptional {
301296
fn clear(&mut self) {
302297
match self {
303-
ArrayCellNonOptional::Null => {}
304298
ArrayCellNonOptional::Bool(vec) => vec.clear(),
305299
ArrayCellNonOptional::String(vec) => vec.clear(),
306300
ArrayCellNonOptional::I16(vec) => vec.clear(),
@@ -385,14 +379,6 @@ mod tests {
385379
}
386380
}
387381

388-
#[test]
389-
fn array_cell_try_from_null_variant() {
390-
let array_cell = ArrayCell::Null;
391-
392-
let result = ArrayCellNonOptional::try_from(array_cell).unwrap();
393-
assert_eq!(result, ArrayCellNonOptional::Null);
394-
}
395-
396382
#[test]
397383
fn cell_types_equality() {
398384
// Test that equal cells are actually equal
@@ -430,7 +416,6 @@ mod tests {
430416
ArrayCell::Bool(vec![Some(true), Some(false)]),
431417
ArrayCell::String(vec![Some("hello".to_string()), Some("world".to_string())]),
432418
ArrayCell::I32(vec![Some(1), Some(2), Some(3)]),
433-
ArrayCell::Null,
434419
];
435420

436421
for array_cell in mixed_types {

0 commit comments

Comments
 (0)