RFC: Finer-grained engine protocols (interface segregation)¶
Status¶
Draft / not implemented. This document records a possible future direction if a real second backend needs a smaller surface than the full ExecutionEngine protocol in pydantable-protocol.
Context¶
Today, PlanExecutor, SinkWriter, and ExecutionEngine (composition of the two plus plan builders) live in pydantable-protocol. Implementations that only need execution can still satisfy ExecutionEngine by raising UnsupportedEngineOperationError for sinks or unsupported plan ops—see CUSTOM_ENGINE_PACKAGE.
Problem¶
A backend that never writes Parquet/CSV/IPC/NDJSON must nonetheless implement or delegate sink methods if it wants to type-check as ExecutionEngine, or it documents “always raises” and accepts the wide protocol.
Proposal (breaking, cross-package)¶
- Optional runtime protocols — e.g. split
AsyncPlanExecutoronly if async execution is optional and callers useEngineCapabilities+isinstancechecks beforeasync_execute_plan. - Versioned protocol module — e.g.
pydantable_protocol.protocols_v2with slimmer types;pydantablecontinues to re-export v1 until a major release. - Narrow imports for authors — third-party packages import only
PlanExecutor/SinkWriterwhen defining adapters;ExecutionEngineremains the “full” façade forDataFrame.
Preconditions¶
Do not undertake this without:
- At least one concrete non-native engine that benefits (smaller stubs, clearer errors, or static typing wins).
- Coordinated releases of
pydantable-protocol,pydantable-native, andpydantable, plus a migration note in the changelog.