| 565 | } |
| 566 | |
| 567 | fn dictionary(&self) -> Result<Option<ImportedArrowArray<'_>>> { |
| 568 | match (self.array.dictionary(), &self.data_type) { |
| 569 | (Some(array), DataType::Dictionary(_, value_type)) => Ok(Some(ImportedArrowArray { |
| 570 | array, |
| 571 | data_type: value_type.as_ref().clone(), |
| 572 | owner: self.owner, |
| 573 | })), |
| 574 | (Some(_), _) => Err(ArrowError::CDataInterface( |
| 575 | "Got dictionary in FFI_ArrowArray for non-dictionary data type".to_string(), |
| 576 | )), |
| 577 | (None, DataType::Dictionary(_, _)) => Err(ArrowError::CDataInterface( |
| 578 | "Missing dictionary in FFI_ArrowArray for dictionary data type".to_string(), |
| 579 | )), |
| 580 | (_, _) => Ok(None), |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | #[cfg(test)] |