Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: experimental support for further nested types #318

Merged
merged 14 commits into from
Jun 8, 2024
1 change: 0 additions & 1 deletion crates/duckdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,6 @@ mod test {
}

mod query_and_then_tests {

use super::*;

#[derive(Debug)]
Expand Down
17 changes: 15 additions & 2 deletions crates/duckdb/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{Error, Result, Statement};
use crate::types::{self, EnumType, FromSql, FromSqlError, ListType, ValueRef};

use arrow::{
array::{self, Array, ArrayRef, DictionaryArray, ListArray, StructArray},
array::{self, Array, ArrayRef, DictionaryArray, FixedSizeListArray, ListArray, MapArray, StructArray},
datatypes::*,
};
use fallible_iterator::FallibleIterator;
Expand Down Expand Up @@ -608,7 +608,20 @@ impl<'stmt> Row<'stmt> {
row,
)
}
_ => unreachable!("invalid value: {} {}", col, column.data_type()),
DataType::Struct(_) => {
let res = column.as_any().downcast_ref::<StructArray>().unwrap();
ValueRef::Struct(res, row)
}
DataType::Map(..) => {
let arr = column.as_any().downcast_ref::<MapArray>().unwrap();
ValueRef::Map(arr, row)
}
DataType::FixedSizeList(..) => {
let arr = column.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
ValueRef::Array(arr, row)
}
DataType::Union(..) => ValueRef::Union(column, row),
_ => unreachable!("invalid value: {}, {}", col, column.data_type()),
}
}

Expand Down
Loading
Loading