MCPcopy Create free account
hub / github.com/apache/datafusion / table

Method table

datafusion/core/tests/memory_limit/mod.rs:947–998  ·  view source on GitHub ↗

return a TableProvider with data for the test

(&self)

Source from the content-addressed store, hash-verified

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>>> {

Callers 15

describeFunction · 0.45
select_with_periodsFunction · 0.45
drop_with_quotesFunction · 0.45
drop_with_periodsFunction · 0.45
registryFunction · 0.45
register_tableFunction · 0.45
with_column_renamed_joinFunction · 0.45

Calls 7

access_log_batchesFunction · 0.85
newFunction · 0.85
maybe_split_batchesFunction · 0.85
dict_batchesFunction · 0.85
with_infinite_tableMethod · 0.80
collectMethod · 0.80
schemaMethod · 0.45

Tested by

no test coverage detected