Skip to content

fix: show results in the nine silent top-level examples - #1730

Open
ump45nose wants to merge 1 commit into
apache:mainfrom
ump45nose:fix/examples-terminal-output
Open

fix: show results in the nine silent top-level examples#1730
ump45nose wants to merge 1 commit into
apache:mainfrom
ump45nose:fix/examples-terminal-output

Conversation

@ump45nose

Copy link
Copy Markdown

Which issue does this PR close?

Part of #1728.

Rationale for this change

Issue #1728 documents two example-side problems. The self-contained csv-read-options.py fix is already covered by #1729; this PR addresses the other half: nine top-level examples (export.py, import.py, python-udaf.py, python-udf.py, query-pyarrow-data.py, sql-to-pandas.py, sql-using-python-udaf.py, sql-using-python-udf.py, substrait.py) end in bare asserts and print nothing, so running them gives a reader no output and a silent script is indistinguishable from a broken one.

What changes are included in this PR?

Are there any user-facing changes?

No API changes. The examples are documentation; after this change they visibly print their results when run.

Testing: ran all nine scripts with the released datafusion 54.0.0 wheel on Python 3.12 (macOS ARM). sql-to-pandas.py was additionally verified end-to-end with the NYC taxi parquet documented in examples/README.md (generated chart.png removed afterwards). ruff check / ruff format (v0.15.1 as pinned in .pre-commit-config.yaml) and codespell pass on the changed files.

Prepared with AI assistance (agent contribution).

Nine examples (`export.py`, `import.py`, `python-udaf.py`,
`python-udf.py`, `query-pyarrow-data.py`, `sql-to-pandas.py`,
`sql-using-python-udaf.py`, `sql-using-python-udf.py`, `substrait.py`)
ended in bare asserts and printed nothing, so a reader running them
sees no output and cannot tell a working script from a silent one
(apache#1728). Each now shows its final result with `df.show()` or a
terminal `print`, keeping the asserts.
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.

1 participant