return a TableProvider with data for the test
(&self)
| 945 | |
| 946 | /// return a TableProvider with data for the test |
| 947 | fn table(&self) -> Arc<dyn TableProvider> { |
| 948 | match self { |
| 949 | Self::AccessLog => { |
| 950 | let batches = access_log_batches(); |
| 951 | let table = |
| 952 | MemTable::try_new(batches[0].schema(), vec![batches]).unwrap(); |
| 953 | Arc::new(table) |
| 954 | } |
| 955 | Self::AccessLogStreaming => { |
| 956 | let batches = access_log_batches(); |
| 957 | |
| 958 | // Create a new streaming table with the generated schema and batches |
| 959 | let table = StreamingTable::try_new( |
| 960 | batches[0].schema(), |
| 961 | vec![Arc::new(DummyStreamPartition { |
| 962 | schema: batches[0].schema(), |
| 963 | batches: batches.clone(), |
| 964 | })], |
| 965 | ) |
| 966 | .unwrap() |
| 967 | .with_infinite_table(true); |
| 968 | Arc::new(table) |
| 969 | } |
| 970 | Self::DictionaryStrings { |
| 971 | partitions, |
| 972 | single_row_batches, |
| 973 | } => { |
| 974 | use datafusion::physical_expr::expressions::col; |
| 975 | let batches: Vec<Vec<_>> = std::iter::repeat_n( |
| 976 | maybe_split_batches(dict_batches(), *single_row_batches), |
| 977 | *partitions, |
| 978 | ) |
| 979 | .collect(); |
| 980 | |
| 981 | let schema = batches[0][0].schema(); |
| 982 | let options = SortOptions { |
| 983 | descending: false, |
| 984 | nulls_first: false, |
| 985 | }; |
| 986 | let sort_information = vec![ |
| 987 | [ |
| 988 | PhysicalSortExpr::new(col("a", &schema).unwrap(), options), |
| 989 | PhysicalSortExpr::new(col("b", &schema).unwrap(), options), |
| 990 | ] |
| 991 | .into(), |
| 992 | ]; |
| 993 | |
| 994 | let table = SortedTableProvider::new(batches, sort_information); |
| 995 | Arc::new(table) |
| 996 | } |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | /// return specific physical optimizer rules to use |
| 1001 | fn rules(&self) -> Option<Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>> { |
no test coverage detected