()
| 655 | |
| 656 | #[tokio::test] |
| 657 | async fn test_statistics_cache_default() -> Result<(), DataFusionError> { |
| 658 | let ctx = SessionContext::new(); |
| 659 | |
| 660 | ctx.register_udtf( |
| 661 | "statistics_cache", |
| 662 | Arc::new(StatisticsCacheFunc::new( |
| 663 | ctx.task_ctx().runtime_env().cache_manager.clone(), |
| 664 | )), |
| 665 | ); |
| 666 | |
| 667 | for filename in [ |
| 668 | "alltypes_plain", |
| 669 | "alltypes_tiny_pages", |
| 670 | "lz4_raw_compressed_larger", |
| 671 | ] { |
| 672 | ctx.sql( |
| 673 | format!( |
| 674 | "create external table {filename} |
| 675 | stored as parquet |
| 676 | location '../parquet-testing/data/{filename}.parquet'", |
| 677 | ) |
| 678 | .as_str(), |
| 679 | ) |
| 680 | .await? |
| 681 | .collect() |
| 682 | .await?; |
| 683 | } |
| 684 | |
| 685 | let sql = "SELECT split_part(path, '/', -1) as filename, table, file_size_bytes, num_rows, num_columns, table_size_bytes from statistics_cache() order by filename"; |
| 686 | let df = ctx.sql(sql).await?; |
| 687 | let rbs = df.collect().await?; |
| 688 | assert_snapshot!(batches_to_string(&rbs),@r" |
| 689 | +-----------------------------------+---------------------------+-----------------+--------------+-------------+------------------+ |
| 690 | | filename | table | file_size_bytes | num_rows | num_columns | table_size_bytes | |
| 691 | +-----------------------------------+---------------------------+-----------------+--------------+-------------+------------------+ |
| 692 | | alltypes_plain.parquet | alltypes_plain | 1851 | Exact(8) | 11 | Absent | |
| 693 | | alltypes_tiny_pages.parquet | alltypes_tiny_pages | 454233 | Exact(7300) | 13 | Absent | |
| 694 | | lz4_raw_compressed_larger.parquet | lz4_raw_compressed_larger | 380836 | Exact(10000) | 1 | Absent | |
| 695 | +-----------------------------------+---------------------------+-----------------+--------------+-------------+------------------+ |
| 696 | "); |
| 697 | |
| 698 | Ok(()) |
| 699 | } |
| 700 | |
| 701 | #[tokio::test] |
| 702 | async fn test_list_files_cache() -> Result<(), DataFusionError> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…