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

Method record_batch

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

Return a [`RecordBatch`] containing only the requested `u32`, if any from [`CommandGetSqlInfo`]

(&self, info: impl IntoIterator<Item = u32>)

Source from the content-addressed store, hash-verified

407 /// Return a [`RecordBatch`] containing only the requested `u32`, if any
408 /// from [`CommandGetSqlInfo`]
409 pub fn record_batch(&self, info: impl IntoIterator<Item = u32>) -> Result<RecordBatch> {
410 let arr = self.batch.column(0);
411 let type_filter = info
412 .into_iter()
413 .map(|tt| {
414 let s = UInt32Array::from(vec![tt]);
415 eq(arr, &Scalar::new(&s))
416 })
417 .collect::<std::result::Result<Vec<_>, _>>()?
418 .into_iter()
419 // We know the arrays are of same length as they are produced from the same root array
420 .reduce(|filter, arr| or(&filter, &arr).unwrap());
421 if let Some(filter) = type_filter {
422 Ok(filter_record_batch(&self.batch, &filter)?)
423 } else {
424 Ok(self.batch.clone())
425 }
426 }
427
428 /// Return the schema of the RecordBatch that will be returned
429 /// from [`CommandGetSqlInfo`]

Callers 12

buildMethod · 0.45
test_sql_infosFunction · 0.45
test_filter_sql_infosFunction · 0.45
test_tensor_arrayFunction · 0.45
test_record_batch_readerFunction · 0.45
iter_batchesFunction · 0.45
test_table_pycapsuleFunction · 0.45
test_table_roundtripFunction · 0.45
test_table_from_batchesFunction · 0.45

Calls 6

eqFunction · 0.85
orFunction · 0.85
filter_record_batchFunction · 0.85
columnMethod · 0.45
into_iterMethod · 0.45
cloneMethod · 0.45

Tested by 11

test_sql_infosFunction · 0.36
test_filter_sql_infosFunction · 0.36
test_tensor_arrayFunction · 0.36
test_record_batch_readerFunction · 0.36
iter_batchesFunction · 0.36
test_table_pycapsuleFunction · 0.36
test_table_roundtripFunction · 0.36
test_table_from_batchesFunction · 0.36