Sitelet https://github.com/apache/datafusion-python/pull/1790
Skip to content

examples: give the two FFI example crates a runnable entry point - #1790

Open
Awesome06 wants to merge 3 commits into
apache:mainfrom
Awesome06:examples/1727-ffi-runnable-entry-points
Open

Awesome06 wants to merge 3 commits into
apache:mainfrom
Awesome06:examples/1727-ffi-runnable-entry-points

Conversation

@Awesome06

Copy link
Copy Markdown

Which issue does this PR close?

Closes #1727.

Rationale for this change

Neither datafusion-ffi-example nor datafusion-ffi-query-planner-example had a standalone script that users could run; they only delivered pytest assertions. Meanwhile, the documentation explicitly promises "a complete example" and a "user example." This PR provides standalone runnable scripts for both crates, ensuring they behave like real examples. It follows the examples/tpch precedent: the script is the primary artifact, and a subprocess pytest driver keeps it honest.

What changes are included in this PR?

  • examples/datafusion-ffi-example/run_demo.py: Adds a standalone script that walks the conformance matrix in numbered sections (table provider, functions, catalog provider, config extension, and codec round-trip). Includes a strict import guard that instructs users to run maturin develop if the extension is not built.
  • examples/datafusion-ffi-query-planner-example/run_demo.py: Adds a standalone script that demonstrates and prints the logical plan, physical plan, the effect of SET ffi_query_planner.max_rows, and planner nesting. Includes the same import guard.
  • python/tests/_test_run_demo.py (in both crates): Adds driver tests that execute the demo scripts natively via subprocess.run([sys.executable, script]) and assert on their output anchor lines to guarantee they continue running standalone.
  • README.md (in both crates): Adds a concise three-line header explaining what the directory is, linking to the protocol guide, and showing exactly how to run the demo.

Are there any user-facing changes?

Yes, this adds fully standalone, runnable Python examples that users can execute directly to learn the FFI bindings without dealing with the internal test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give the two FFI example crates a runnable entry point

1 participant