ting-hong-shieh opened a new pull request, #1692:
URL: https://github.com/apache/datafusion-python/pull/1692
# Which issue does this PR close?
Closes #1691.
# Rationale for this change
`AGENTS.md` requires every public Python function to carry a usage example,
and
no public function in `python/datafusion/unparser.py` had one. The omission
is
most costly in this module: the reason `Dialect` exists is that dialects
render
the same plan differently, and nothing in the documentation showed that.
# What changes are included in this PR?
* Docstring examples for `Dialect.default`, `Dialect.mysql`,
`Dialect.postgres`,
`Dialect.sqlite`, `Dialect.duckdb`, `Unparser.plan_to_sql` and
`Unparser.with_pretty`. All build the same input table so the examples
differ
only in the behaviour being demonstrated, and each shows the actual
quoting a
dialect produces:
```
>>> Unparser(Dialect.default()).plan_to_sql(plan)
'SELECT t.a FROM t'
>>> Unparser(Dialect.mysql()).plan_to_sql(plan)
'SELECT `t`.`a` FROM `t`'
>>> Unparser(Dialect.postgres()).plan_to_sql(plan)
'SELECT "t"."a" FROM "t"'
```
* Corrected the `Dialect` class summary, which read `"DataFusion data
catalog."`
* Described what `with_pretty` does — it drops redundant parentheses and
returns
the same unparser so the call can be chained — instead of restating its
name.
No behaviour is changed; the diff is docstrings only.
# Are there any user-facing changes?
Documentation only. The new examples run as doctests under the existing
`--doctest-modules` setting, so they are checked in CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]