()
| 2750 | // Test issue: https://github.com/apache/datafusion/issues/13873 |
| 2751 | #[tokio::test] |
| 2752 | async fn write_parquet_with_order() -> Result<()> { |
| 2753 | let tmp_dir = TempDir::new()?; |
| 2754 | let schema = Arc::new(Schema::new(vec![ |
| 2755 | Field::new("a", DataType::Int32, true), |
| 2756 | Field::new("b", DataType::Int32, true), |
| 2757 | ])); |
| 2758 | |
| 2759 | let ctx = SessionContext::new(); |
| 2760 | let write_df = ctx.read_batch(RecordBatch::try_new( |
| 2761 | schema.clone(), |
| 2762 | vec![ |
| 2763 | Arc::new(Int32Array::from(vec![1, 5, 7, 3, 2])), |
| 2764 | Arc::new(Int32Array::from(vec![2, 3, 4, 5, 6])), |
| 2765 | ], |
| 2766 | )?)?; |
| 2767 | |
| 2768 | let test_path = tmp_dir.path().join("test.parquet"); |
| 2769 | |
| 2770 | write_df |
| 2771 | .clone() |
| 2772 | .write_parquet( |
| 2773 | test_path.to_str().unwrap(), |
| 2774 | DataFrameWriteOptions::new().with_sort_by(vec![col("a").sort(true, true)]), |
| 2775 | None, |
| 2776 | ) |
| 2777 | .await?; |
| 2778 | |
| 2779 | let ctx = SessionContext::new(); |
| 2780 | ctx.register_parquet( |
| 2781 | "data", |
| 2782 | test_path.to_str().unwrap(), |
| 2783 | ParquetReadOptions::default(), |
| 2784 | ) |
| 2785 | .await?; |
| 2786 | |
| 2787 | let df = ctx.sql("SELECT * FROM data").await?; |
| 2788 | let results = df.collect().await?; |
| 2789 | |
| 2790 | assert_snapshot!( |
| 2791 | batches_to_string(&results), |
| 2792 | @r" |
| 2793 | +---+---+ |
| 2794 | | a | b | |
| 2795 | +---+---+ |
| 2796 | | 1 | 2 | |
| 2797 | | 2 | 6 | |
| 2798 | | 3 | 5 | |
| 2799 | | 5 | 3 | |
| 2800 | | 7 | 4 | |
| 2801 | +---+---+ |
| 2802 | " |
| 2803 | ); |
| 2804 | |
| 2805 | Ok(()) |
| 2806 | } |
| 2807 | |
| 2808 | // Test issue: https://github.com/apache/datafusion/issues/13873 |
| 2809 | #[tokio::test] |
nothing calls this directly
no test coverage detected
searching dependent graphs…