Builds a [`SessionState`] with the current configuration. Note that there is an explicit option for enabling catalog and schema defaults in [SessionConfig::create_default_catalog_and_schema] which if enabled will be built here.
(self)
| 1536 | /// in [SessionConfig::create_default_catalog_and_schema] which if enabled |
| 1537 | /// will be built here. |
| 1538 | pub fn build(self) -> SessionState { |
| 1539 | let Self { |
| 1540 | session_id, |
| 1541 | analyzer, |
| 1542 | expr_planners, |
| 1543 | #[cfg(feature = "sql")] |
| 1544 | relation_planners, |
| 1545 | #[cfg(feature = "sql")] |
| 1546 | type_planner, |
| 1547 | optimizer, |
| 1548 | physical_optimizers, |
| 1549 | query_planner, |
| 1550 | catalog_list, |
| 1551 | table_functions, |
| 1552 | scalar_functions, |
| 1553 | higher_order_functions, |
| 1554 | aggregate_functions, |
| 1555 | window_functions, |
| 1556 | extension_types, |
| 1557 | serializer_registry, |
| 1558 | file_formats, |
| 1559 | table_options, |
| 1560 | config, |
| 1561 | execution_props, |
| 1562 | table_factories, |
| 1563 | runtime_env, |
| 1564 | function_factory, |
| 1565 | cache_factory, |
| 1566 | statistics_registry, |
| 1567 | analyzer_rules, |
| 1568 | optimizer_rules, |
| 1569 | physical_optimizer_rules, |
| 1570 | } = self; |
| 1571 | |
| 1572 | let config = config.unwrap_or_default(); |
| 1573 | let runtime_env = runtime_env.unwrap_or_else(|| Arc::new(RuntimeEnv::default())); |
| 1574 | |
| 1575 | let mut state = SessionState { |
| 1576 | session_id: session_id.unwrap_or_else(|| Uuid::new_v4().to_string()), |
| 1577 | analyzer: analyzer.unwrap_or_default(), |
| 1578 | expr_planners: expr_planners.unwrap_or_default(), |
| 1579 | #[cfg(feature = "sql")] |
| 1580 | relation_planners: relation_planners.unwrap_or_default(), |
| 1581 | #[cfg(feature = "sql")] |
| 1582 | type_planner, |
| 1583 | optimizer: optimizer.unwrap_or_default(), |
| 1584 | physical_optimizers: physical_optimizers.unwrap_or_default(), |
| 1585 | query_planner: query_planner |
| 1586 | .unwrap_or_else(|| Arc::new(DefaultQueryPlanner {})), |
| 1587 | catalog_list: catalog_list.unwrap_or_else(|| { |
| 1588 | Arc::new(MemoryCatalogProviderList::new()) as Arc<dyn CatalogProviderList> |
| 1589 | }), |
| 1590 | table_functions: table_functions.unwrap_or_default(), |
| 1591 | scalar_functions: HashMap::new(), |
| 1592 | higher_order_functions: HashMap::new(), |
| 1593 | aggregate_functions: HashMap::new(), |
| 1594 | window_functions: HashMap::new(), |
| 1595 | extension_types: Arc::new(MemoryExtensionTypeRegistry::default()), |