Skip to content

Plug into DataFusion Python natively through a custom FFI query planner  #2618

Closed

Description

@milenkovicm

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

The Ballista Python client wraps DataFusion Python: it subclasses SessionContext and DataFrame. Every method that executes a plan is intercepted, the logical plan is serialized, and the plan is resubmitted through a separate Ballista-backed session. As a result:

  • methods the wrapper doesn't know about run locally instead of on the cluster;
  • every execution creates a new Ballista session;
  • the wrapper has to be kept in line with DataFusion Python's API, which is an ongoing maintenance cost;
  • users get a DistributedDataFrame instead of a regular datafusion.DataFrame.

Describe the solution you'd like

DataFusion Python 55 can install a custom query planner and extension codecs through FFI. Ballista can use this to plug into a standard datafusion.SessionContext with no wrapper: DataFusion plans each query as usual, and the Ballista planner sends the plan to the scheduler. Any operation that executes a plan (collect, show, to_pandas, write_parquet, EXPLAIN ANALYZE, ...) then runs on the cluster.

Tasks:

Describe alternatives you've considered

Keep the wrapper-based client. That leaves the problems above in place, and every DataFusion Python release needs matching wrapper changes.

Additional context

This is a breaking change for the Python client:

  • DistributedDataFrame is removed;
  • BallistaSessionContext becomes a factory function, not a class;
  • explain_visual and collect_with_progress move to ballista.jupyter.

The upgrade guide covers these in detail.

Known limitations, to be tracked separately:

  • In-memory table providers (from_pydict, register_record_batches, ...) can't be serialized.
  • information_schema scans can't cross the FFI planner boundary.
  • Executors don't apply file_compression_type when reading compressed CSV.
  • The CSV writer quotes every field when writing a header.
  • COPY ... OPTIONS are dropped by datafusion-proto (upstream).
  • datafusion-ffi 55.2.0 doesn't support file formats in ForeignLogicalExtensionCodec. The client works around this for DataFrame.write_*, and the workaround should be removed once it's fixed upstream.

Activity

  1. changed the title [-]Python client: plug into DataFusion Python natively through a custom FFI query planner[/-] [+]python(client): plug into DataFusion Python natively through a custom FFI query planner[/+] on Oct 18, 2026
  2. changed the title [-]python(client): plug into DataFusion Python natively through a custom FFI query planner[/-] [+]feat(python): Plug into DataFusion Python natively through a custom FFI query planner [/+] on Oct 18, 2026
  3. changed the title [-]feat(python): Plug into DataFusion Python natively through a custom FFI query planner [/-] [+]Plug into DataFusion Python natively through a custom FFI query planner [/+] on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions