Concatenates `batches` and returns a single batch sorted ascending by the first (id) column.
(batches: &[RecordBatch])
| 862 | /// Concatenates `batches` and returns a single batch sorted ascending by |
| 863 | /// the first (id) column. |
| 864 | fn concat_and_sort_by_id(batches: &[RecordBatch]) -> Result<RecordBatch> { |
| 865 | let schema = test_schema(); |
| 866 | let combined = compute::concat_batches(&schema, batches)?; |
| 867 | let indices = compute::sort_to_indices(combined.column(0), None, None)?; |
| 868 | let sorted_cols: Vec<_> = combined |
| 869 | .columns() |
| 870 | .iter() |
| 871 | .map(|col| compute::take(col.as_ref(), &indices, None)) |
| 872 | .collect::<std::result::Result<_, _>>()?; |
| 873 | Ok(RecordBatch::try_new(schema, sorted_cols)?) |
| 874 | } |
| 875 | |
| 876 | #[tokio::test] |
| 877 | async fn test_ndjson_partitioned() -> Result<()> { |
searching dependent graphs…