()
| 643 | |
| 644 | #[tokio::test] |
| 645 | async fn test_csv_serializer() -> Result<()> { |
| 646 | let ctx = SessionContext::new(); |
| 647 | let df = ctx |
| 648 | .read_csv( |
| 649 | &format!("{}/csv/aggregate_test_100.csv", arrow_test_data()), |
| 650 | CsvReadOptions::default().has_header(true), |
| 651 | ) |
| 652 | .await?; |
| 653 | let batches = df |
| 654 | .select_columns(&["c2", "c3"])? |
| 655 | .limit(0, Some(10))? |
| 656 | .collect() |
| 657 | .await?; |
| 658 | let batch = concat_batches(&batches[0].schema(), &batches)?; |
| 659 | let serializer = CsvSerializer::new(); |
| 660 | let bytes = serializer.serialize(batch, true)?; |
| 661 | assert_eq!( |
| 662 | "c2,c3\n2,1\n5,-40\n1,29\n1,-85\n5,-82\n4,-111\n3,104\n3,13\n1,38\n4,-38\n", |
| 663 | String::from_utf8(bytes.into()).unwrap() |
| 664 | ); |
| 665 | Ok(()) |
| 666 | } |
| 667 | |
| 668 | #[tokio::test] |
| 669 | async fn test_csv_serializer_no_header() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…