MCPcopy Create free account
hub / github.com/apache/datafusion / validate_unique_primitive_keys

Function validate_unique_primitive_keys

datafusion/functions-nested/src/map.rs:109–126  ·  view source on GitHub ↗
(array: &dyn Array)

Source from the content-addressed store, hash-verified

107}
108
109fn validate_unique_primitive_keys<T: ArrowPrimitiveType>(array: &dyn Array) -> Result<()>
110where
111 T::Native: Copy + Eq + Hash + std::fmt::Display,
112{
113 let primitive_array = array.as_primitive::<T>();
114 if primitive_array.null_count() > 0 {
115 return exec_err!("map key cannot be null");
116 }
117
118 if let Some(value) = find_duplicate_value(
119 primitive_array.len(),
120 primitive_array.values().iter().copied(),
121 ) {
122 return exec_err!("map key must be unique, duplicate key found: {}", value);
123 }
124
125 Ok(())
126}
127
128fn validate_unique_str_keys<'a>(
129 null_count: usize,

Callers

nothing calls this directly

Calls 5

find_duplicate_valueFunction · 0.85
null_countMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…