pub async fn build_factory(
base: &Arc<ViewFactory>,
rows: &[ViewDefinitionRow],
runtime: Arc<RuntimeEnv>,
lake: Arc<DataLakeConnection>,
session_configurator: Arc<dyn SessionConfigurator>,
purpose: BuildPurpose,
) -> Result<(Arc<ViewFactory>, Vec<BuildFailure>), Error>Expand description
Builds a factory from an explicit row set instead of store.list(), so a caller already
holding rows inside an open transaction (the DDL executor’s dependent-protection check) can
validate against them without a second, pool-backed read that would not see its own
uncommitted write. reload() calls this too, after its own store.list(). async because
building each row’s SqlBatchView is itself async and needs runtime/lake/
session_configurator to plan the extract query.
Builds incrementally, in the order rows is given ((update_group, view_set_name)): let mut factory = (**base).clone(); then, per row, build and validate its SqlBatchView against
Arc::new(factory.clone()) – the built-ins plus every already-folded-in row – and only then
factory.add_global_view(...). A row that fails to parse, build, or validate is skipped, not
fatal: collected into the returned failed-set with its reason, so one broken definition
cannot take out every other view set. Whether that skip is also logged and metered is
purpose’s call.