Extend SessionContext.with_extensions to cover additional extension points (functions, catalogs, object stores)
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 52/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Domínio
- backend-api-design, data-engineering
Direção de pesquisa
Comece com SessionExtensionComponents, SessionExtensionExportable e a transação with_extensions em crates/core/src/context.rs; compare-os com o exemplo MyPlannerExtension em examples/datafusion-ffi-query-planner-example. Comece pelo escopo sugerido para udfs e catalog_providers e, em seguida, resolva o tratamento de colisões e a ordem de registro. Está concluído quando os bundles puderem instalar esses componentes atomicamente por meio de with_extensions sem quebrar os bundles existentes.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Is your feature request related to a problem or challenge?
#1672 adds SessionContext.with_extensions(*extensions), which installs extension bundles atomically: each bundle implements __datafusion_session_extension__(ctx) and returns a SessionExtensionComponents containing logical extension codecs, physical extension codecs, and optionally a query planner. Those components carry weak task-context providers, so the atomic protocol exists to guarantee they bind to the exact context returned to the user.
Extension libraries typically provide more than codecs and a planner. A distributed engine or data-source library may also ship scalar/aggregate/window/table functions, catalog providers, table providers, object stores, and physical optimizer rules. Today the user must install those with separate register_* calls after with_extensions, which defeats the goal of a one-line installation of everything a library provides.
Describe the solution you'd like
Extend SessionExtensionComponents with additional optional fields so a single bundle can declare every extension point its library offers:
udfs,udafs,udwfs,udtfs(or a singlefunctionstuple with type dispatch) — accepting both FFI-capsule and Python-native definitions, flowing through the existingregister_*pathstable_providers: tuple[tuple[str, provider], ...]— named table registrationscatalog_providers: tuple[tuple[str, provider], ...]object_stores: tuple[tuple[str, store], ...]— keyed by schemephysical_optimizer_rules
SessionExtensionComponents is a frozen dataclass with defaulted fields and the Rust _install_extensions helper is private, so this is backward compatible and can be added incrementally. A distributed engine bundle could then install codecs, planner, its UDFs, and a scheduler-backed catalog in one call:
ctx = SessionContext(config).with_extensions(MyEngineExtension(address))
Declarative components are preferred over having factories call ctx.register_udf(...) on the context view directly: the host can validate every component before mutating anything, the configuration-only contract for factories stays honest, and installation order becomes explicit (codecs, then planner, then registrations, with fallible steps first).
Design decisions to settle during implementation:
- Catalog list sharing. The derived context shares its catalog provider list with the source context, so catalog registrations are visible in the source and are not rolled back if a later step fails. Registering catalogs last, after all fallible steps, closes most of the hole. Cloning the catalog provider list at derivation would give true isolation but diverges from the semantics of every other
with_*method. - Name collisions. Two bundles registering the same UDF name or catalog name should probably be an error (matching the one-planner rule) rather than last-wins, since registrations have no fall-through semantics like codec chains do.
Suggested starting scope: udfs and catalog_providers, with collision handling as an error.
Describe alternatives you've considered
Factories can already register functions and catalogs imperatively on the context view passed to __datafusion_session_extension__, since the view shares the destination context. This works but hides side effects inside the factory, cannot be validated up front, and leaves partial registrations behind on failure.
Keeping registrations as separate user-facing register_* calls after with_extensions remains possible, but each library then documents its own multi-step setup recipe, which is the situation with_extensions was introduced to remove.
Additional context
Follow-up to #1672. Relevant pieces there: SessionExtensionComponents, SessionExtensionExportable, the with_extensions transaction in crates/core/src/context.rs, and the MyPlannerExtension example bundle in examples/datafusion-ffi-query-planner-example.
- Linguagem predominante
- Python
- Estrelas
- 605
- Forks
- 176
- Merge médio
- 1d 23h
- PRs com merge (30d)
- 8
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/datafusion-python
-
documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/datafusion-python#1726 ·
-
Dificuldade 2/5 Meio dia Facilidade para iniciantes 88/100
apache/datafusion-python#1691 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/datafusion-python#1644 ·
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
apache/datafusion-python#1737 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 76/100
apache/datafusion-python#1735 · 1 comentário ·
Todas as issues de apache/datafusion-python
Issues semelhantes
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Abertaarea: ci bug perceived difficulty: 3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
ClickHouse/clickhouse-connect#1057 ·