Skip to content

[SPARK-51883][DOCS][PYTHON] Python Data Source user guide for filter pushdown #50684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wengh
Copy link
Contributor

@wengh wengh commented Apr 23, 2025

What changes were proposed in this pull request?

Update python_data_source.rst to add filter pushdown docs.

Why are the changes needed?

Feature was added but documentation was still missing.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Verified locally

Was this patch authored or co-authored using generative AI tooling?

Yes. Initial draft was generated using AI then manually edited.

Generated-by: GitHub Copilot with Claude 3.7 Sonnet

@wengh wengh changed the title [SPARK-51883][DOCS][PYTHON] Python Data Source docs for filter pushdown [SPARK-51883][DOCS][PYTHON] Python Data Source user guide for filter pushdown Apr 23, 2025
Copy link
Contributor

@allisonwang-db allisonwang-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the docs!


Other methods such as DataSource.schema() and DataSourceStreamReader.latestOffset() can be stateful. Changes to the object state made in these methods are visible to future invocations.

Refer to the documentation of each method for more details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also link to the documentation here?

from pyspark.sql.datasource import EqualTo, Filter, GreaterThan, LessThan
def pushFilters(self, filters: List[Filter]) -> Iterable[Filter]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a complete example here so that people can copy paste and try it out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to an example source that returns prime numbers sequentially

Comment on lines 544 to 545
Configuration `spark.sql.python.filterPushdown.enabled` must be set to `true`
to implement this method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should put this in the doc. Can we throw an warning in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we already show an error if it's disabled. I guess the user can find out when they try to use the source so it's not necessary to put in the doc.

@wengh wengh force-pushed the pyds-docs-pushdown branch from 264ccfc to 13df8b4 Compare May 1, 2025 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants