()
| 1127 | |
| 1128 | #[test] |
| 1129 | fn test_dictionary() -> Result<()> { |
| 1130 | // create an array natively |
| 1131 | let values = vec!["a", "aaa", "aaa"]; |
| 1132 | let dict_array: DictionaryArray<Int8Type> = values.into_iter().collect(); |
| 1133 | |
| 1134 | // export it |
| 1135 | let (array, schema) = to_ffi(&dict_array.to_data())?; |
| 1136 | |
| 1137 | // (simulate consumer) import it |
| 1138 | let data = unsafe { from_ffi(array, &schema) }?; |
| 1139 | let array = make_array(data); |
| 1140 | let actual = array |
| 1141 | .as_any() |
| 1142 | .downcast_ref::<DictionaryArray<Int8Type>>() |
| 1143 | .unwrap(); |
| 1144 | |
| 1145 | // verify |
| 1146 | let new_values = vec!["a", "aaa", "aaa"]; |
| 1147 | let expected: DictionaryArray<Int8Type> = new_values.into_iter().collect(); |
| 1148 | assert_eq!(actual, &expected); |
| 1149 | |
| 1150 | // (drop/release) |
| 1151 | Ok(()) |
| 1152 | } |
| 1153 | |
| 1154 | #[test] |
| 1155 | #[allow(deprecated)] |
nothing calls this directly
no test coverage detected