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

Method run

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

Run the test, panic'ing on error

(self)

Source from the content-addressed store, hash-verified

825
826 /// Run the test, panic'ing on error
827 async fn run(self) {
828 let Self {
829 query,
830 expected_errors,
831 memory_limit,
832 memory_pool,
833 config,
834 scenario,
835 disk_manager_builder,
836 expected_plan,
837 expected_success,
838 } = self;
839
840 let table = scenario.table();
841
842 let mut builder = RuntimeEnvBuilder::new()
843 // disk manager setting controls the spilling
844 .with_disk_manager_builder(disk_manager_builder)
845 .with_memory_limit(memory_limit, MEMORY_FRACTION);
846
847 if let Some(pool) = memory_pool {
848 builder = builder.with_memory_pool(pool);
849 };
850 let runtime = builder.build_arc().unwrap();
851
852 // Configure execution
853 let builder = SessionStateBuilder::new()
854 .with_config(config)
855 .with_runtime_env(runtime)
856 .with_default_features();
857 let builder = match scenario.rules() {
858 Some(rules) => builder.with_physical_optimizer_rules(rules),
859 None => builder,
860 };
861
862 let ctx = SessionContext::new_with_state(builder.build());
863 ctx.register_table("t", table).expect("registering table");
864
865 let query = query.expect("Test error: query not specified");
866 let df = ctx.sql(&query).await.expect("Planning query");
867
868 if !expected_plan.is_empty() {
869 let expected_plan: Vec<_> =
870 expected_plan.iter().map(|s| s.as_str()).collect();
871 let actual_plan = df
872 .clone()
873 .explain(false, false)
874 .unwrap()
875 .collect()
876 .await
877 .unwrap();
878 assert_batches_eq!(expected_plan, &actual_plan);
879 }
880
881 match df.collect().await {
882 Ok(_batches) => {
883 if !expected_success {
884 panic!(

Callers 15

oom_sortFunction · 0.45
group_by_noneFunction · 0.45
group_by_row_hashFunction · 0.45
group_by_hashFunction · 0.45
join_by_expressionFunction · 0.45
cross_joinFunction · 0.45
sort_merge_join_no_spillFunction · 0.45
sort_merge_join_spillFunction · 0.45
symmetric_hash_joinFunction · 0.45
sort_preserving_mergeFunction · 0.45

Calls 15

newFunction · 0.85
build_arcMethod · 0.80
with_default_featuresMethod · 0.80
rulesMethod · 0.80
sqlMethod · 0.80
collectMethod · 0.80
tableMethod · 0.45
with_memory_limitMethod · 0.45
with_memory_poolMethod · 0.45
with_runtime_envMethod · 0.45

Tested by

no test coverage detected