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

Method append_value

arrow-flight/src/sql/metadata/sql_info.rs:226–273  ·  view source on GitHub ↗

Append the specified value to this builder

(&mut self, v: &SqlInfoValue)

Source from the content-addressed store, hash-verified

224
225 /// Append the specified value to this builder
226 pub fn append_value(&mut self, v: &SqlInfoValue) -> Result<()> {
227 // typeid is which child and len is the child array's length
228 // *after* adding the value
229 let (type_id, len) = match v {
230 SqlInfoValue::String(v) => {
231 self.string_values.append_value(v);
232 (0, self.string_values.len())
233 }
234 SqlInfoValue::Bool(v) => {
235 self.bool_values.append_value(*v);
236 (1, self.bool_values.len())
237 }
238 SqlInfoValue::BigInt(v) => {
239 self.bigint_values.append_value(*v);
240 (2, self.bigint_values.len())
241 }
242 SqlInfoValue::Bitmask(v) => {
243 self.int32_bitmask_values.append_value(*v);
244 (3, self.int32_bitmask_values.len())
245 }
246 SqlInfoValue::StringList(values) => {
247 // build list
248 for v in values {
249 self.string_list_values.values().append_value(v);
250 }
251 // complete the list
252 self.string_list_values.append(true);
253 (4, self.string_list_values.len())
254 }
255 SqlInfoValue::ListMap(values) => {
256 // build map
257 for (k, v) in values.clone() {
258 self.int32_to_int32_list_map_values.keys().append_value(k);
259 self.int32_to_int32_list_map_values
260 .values()
261 .append_value(v.into_iter().map(Some));
262 }
263 // complete the list
264 self.int32_to_int32_list_map_values.append(true)?;
265 (5, self.int32_to_int32_list_map_values.len())
266 }
267 };
268
269 self.type_ids.append_value(type_id);
270 let len = i32::try_from(len).expect("offset fit in i32");
271 self.offsets.append_value(len - 1);
272 Ok(())
273 }
274
275 /// Complete the construction and build the [`UnionArray`]
276 pub fn finish(self) -> UnionArray {

Callers 15

criterion_benchmarkFunction · 0.45
build_utf8_date_arrayFunction · 0.45
build_decimal128_arrayFunction · 0.45
build_decimal256_arrayFunction · 0.45
build_string_arrayFunction · 0.45
build_string_float_arrayFunction · 0.45
create_random_indexFunction · 0.45

Calls 6

lenMethod · 0.45
valuesMethod · 0.45
appendMethod · 0.45
cloneMethod · 0.45
keysMethod · 0.45
into_iterMethod · 0.45