Return a [`RecordBatch`] containing only the requested `u32`, if any from [`CommandGetSqlInfo`]
(&self, info: impl IntoIterator<Item = u32>)
| 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`] |