Skip to content

[GH-3477] Export only the module's own functions from the DataFrame API modules - #3478

Merged
jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:fix/explicit-dataframe-api-exports
Oct 18, 2026
Merged

jiayuasu merged 1 commit into
apache:masterfrom
jiayuasu:fix/explicit-dataframe-api-exports

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

st_functions, st_constructors, st_predicates and st_aggregates now build __all__ only from functions whose __module__ is the module itself. validate_argument_types uses functools.update_wrapper, so every decorated ST_* function keeps its module and stays listed. The names that drop out are exactly the imported helpers: call_sedona_function and validate_argument_types in all four modules, and lit in st_functions. from sedona.spark import * no longer exports them.

How was this patch tested?

  • New tests in tests/sql/test_st_function_imports.py (no Spark session needed): each module's __all__ lists only functions defined in that module and none of the helpers, and from sedona.spark import * doesn't export the helpers. They fail before the change and pass after it.
  • Compared __all__ before and after: the only removed names are the helpers above; all 195 ST_* functions in st_functions (and every function in the other three modules) stay.
  • Searched the repository's Python files, notebooks and docs for code that uses lit after from sedona.spark import * without importing it: none.
  • pre-commit run on the changed files passes.

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

…rame API modules

st_functions, st_constructors, st_predicates and st_aggregates built __all__
from every function in their namespace, so it also listed imported
helpers: call_sedona_function and validate_argument_types in all four, and
PySpark's lit in st_functions. sedona.spark star-imports all four, so
from sedona.spark import * exported them too. Keep only functions whose
__module__ is the module itself.
@jiayuasu
jiayuasu merged commit 7da6068 into apache:master Oct 18, 2026
34 checks passed
@jiayuasu
jiayuasu deleted the fix/explicit-dataframe-api-exports branch October 18, 2026 08:27
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.

from sedona.spark import * also exports helpers such as lit

1 participant