-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmod.rs
More file actions
61 lines (48 loc) · 1.99 KB
/
mod.rs
File metadata and controls
61 lines (48 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#![allow(dead_code)]
pub mod age_index;
pub mod composite_pk_age_index;
pub mod composite_pk_department_index;
pub mod composite_pk_fetcher;
pub mod composite_pk_provider;
pub mod department_index;
pub mod employee_provider;
pub mod record_fetcher;
use composite_pk_provider::MultiTenantEmployeeProvider;
use datafusion::execution::context::SessionContext;
use datafusion_index_provider::types::UnionMode;
use employee_provider::EmployeeTableProvider;
use std::sync::Arc;
/// Helper function to setup test environment with parallel union mode (default).
pub async fn setup_test_env() -> SessionContext {
setup_test_env_with_mode(UnionMode::Parallel).await
}
/// Helper function to setup test environment with sequential union mode.
pub async fn setup_test_env_sequential() -> SessionContext {
setup_test_env_with_mode(UnionMode::Sequential).await
}
/// Helper function to setup test environment with a specific union mode.
async fn setup_test_env_with_mode(mode: UnionMode) -> SessionContext {
let _ = env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.is_test(true)
.try_init();
let ctx = SessionContext::new();
let provider = EmployeeTableProvider::new().with_union_mode(mode);
ctx.register_table("employees", Arc::new(provider)).unwrap();
ctx
}
/// Helper function to setup composite PK test environment with parallel union mode (default).
pub async fn setup_composite_pk_test_env() -> SessionContext {
setup_composite_pk_test_env_with_mode(UnionMode::Parallel).await
}
/// Helper function to setup composite PK test environment with a specific union mode.
async fn setup_composite_pk_test_env_with_mode(mode: UnionMode) -> SessionContext {
let _ = env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.is_test(true)
.try_init();
let ctx = SessionContext::new();
let provider = MultiTenantEmployeeProvider::new().with_union_mode(mode);
ctx.register_table("employees", Arc::new(provider)).unwrap();
ctx
}