MCPcopy Create free account
hub / github.com/apache/arrow-rs / create_dictionary_array

Function create_dictionary_array

arrow/tests/array_transform.rs:297–309  ·  view source on GitHub ↗
(values: &[&str], keys: &[Option<&str>])

Source from the content-addressed store, hash-verified

295}
296
297fn create_dictionary_array(values: &[&str], keys: &[Option<&str>]) -> ArrayData {
298 let values = StringArray::from(values.to_vec());
299 let mut builder =
300 StringDictionaryBuilder::<Int16Type>::new_with_dictionary(keys.len(), &values).unwrap();
301 for key in keys {
302 if let Some(v) = key {
303 builder.append(v).unwrap();
304 } else {
305 builder.append_null()
306 }
307 }
308 builder.finish().into_data()
309}
310
311#[test]
312fn test_dictionary() {

Callers 1

test_dictionaryFunction · 0.70

Calls 5

lenMethod · 0.45
appendMethod · 0.45
append_nullMethod · 0.45
into_dataMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected