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

Function main_inner

datafusion-cli/src/main.rs:173–307  ·  view source on GitHub ↗

Main CLI entrypoint

()

Source from the content-addressed store, hash-verified

171
172/// Main CLI entrypoint
173async fn main_inner() -> Result<()> {
174 env_logger::init();
175 let args = Args::parse();
176
177 if !args.quiet {
178 println!("DataFusion CLI v{DATAFUSION_CLI_VERSION}");
179 }
180
181 if let Some(ref path) = args.data_path {
182 let p = Path::new(path);
183 env::set_current_dir(p).unwrap();
184 };
185
186 let session_config = get_session_config(&args)?;
187
188 let mut rt_builder = RuntimeEnvBuilder::new();
189 // set memory pool size
190 if let Some(memory_limit) = args.memory_limit {
191 // set memory pool type
192 let pool: Arc<dyn MemoryPool> = match args.mem_pool_type {
193 PoolType::Fair if args.top_memory_consumers == 0 => {
194 Arc::new(FairSpillPool::new(memory_limit))
195 }
196 PoolType::Fair => Arc::new(TrackConsumersPool::new(
197 FairSpillPool::new(memory_limit),
198 NonZeroUsize::new(args.top_memory_consumers).unwrap(),
199 )),
200 PoolType::Greedy if args.top_memory_consumers == 0 => {
201 Arc::new(GreedyMemoryPool::new(memory_limit))
202 }
203 PoolType::Greedy => Arc::new(TrackConsumersPool::new(
204 GreedyMemoryPool::new(memory_limit),
205 NonZeroUsize::new(args.top_memory_consumers).unwrap(),
206 )),
207 };
208
209 rt_builder = rt_builder.with_memory_pool(pool)
210 }
211
212 // set disk limit
213 if let Some(disk_limit) = args.disk_limit {
214 let builder = DiskManagerBuilder::default()
215 .with_mode(DiskManagerMode::OsTmpDirectory)
216 .with_max_temp_directory_size(disk_limit.try_into().unwrap());
217 rt_builder = rt_builder.with_disk_manager_builder(builder);
218 }
219
220 let instrumented_registry = Arc::new(
221 InstrumentedObjectStoreRegistry::new()
222 .with_profile_mode(args.object_store_profiling),
223 );
224 rt_builder = rt_builder.with_object_store_registry(instrumented_registry.clone());
225
226 let runtime_env = rt_builder.build_arc()?;
227
228 // enable dynamic file query
229 let ctx = SessionContext::new_with_config_rt(session_config, runtime_env)
230 .enable_url_table();

Callers 1

mainFunction · 0.85

Calls 15

newFunction · 0.85
get_session_configFunction · 0.85
exec_from_filesFunction · 0.85
exec_from_replFunction · 0.85
exec_from_commandsFunction · 0.85
with_profile_modeMethod · 0.80
build_arcMethod · 0.80
enable_url_tableMethod · 0.80
refresh_catalogsMethod · 0.80
catalog_listMethod · 0.80
state_weak_refMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…