Skip to content

[SPARK-56518][PYTHON] Add current_path to PySpark functions#55379

Closed
srielau wants to merge 2 commits into
apache:masterfrom
srielau:SPARK-56518-fucntion-parity-failure
Closed

[SPARK-56518][PYTHON] Add current_path to PySpark functions#55379
srielau wants to merge 2 commits into
apache:masterfrom
srielau:SPARK-56518-fucntion-parity-failure

Conversation

@srielau
Copy link
Copy Markdown
Contributor

@srielau srielau commented Apr 16, 2026

What changes were proposed in this pull request?

Add the current_path() function to PySpark to match the JVM-side current_path() added in SPARK-56489.

The following files were updated:

  • python/pyspark/sql/functions/builtin.py — added the current_path() function definition with docstring.
  • python/pyspark/sql/functions/__init__.py — added current_path to __all__.
  • python/pyspark/sql/connect/functions/builtin.py — added the Spark Connect stub.

Why are the changes needed?

SPARK-56489 added CURRENT_PATH() as a builtin SQL expression and registered it in org.apache.spark.sql.functions, but the corresponding PySpark function was not added. This causes test_function_parity in test_functions.py to fail because the test checks that every function in the JVM functions object has a corresponding PySpark function (or is explicitly excluded).

Does this PR introduce any user-facing change?

Yes. pyspark.sql.functions.current_path() is now available and returns the current SQL path as a comma-separated list of qualified schema names (e.g. system.builtin,system.session,spark_catalog.default). This is a new function on the unreleased master branch only.

How was this patch tested?

The existing test_function_parity test in python/pyspark/sql/tests/test_functions.py covers this change — it will now pass since current_path is no longer missing from PySpark.

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

Generated-by: Cursor (Claude Opus 4.6)

@srielau srielau changed the title [SC-56518] Add current_path support to builtin.py etc [SPARK-56518][PySpark] Add current_path to PySpark functions Apr 16, 2026
@HyukjinKwon HyukjinKwon changed the title [SPARK-56518][PySpark] Add current_path to PySpark functions [SPARK-56518][PYTHON] Add current_path to PySpark functions Apr 16, 2026
"bitmap_count",
"current_catalog",
"current_database",
"current_path",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — added in 711f64a.

Copy link
Copy Markdown
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

LGTM pending ci

Copy link
Copy Markdown
Contributor

@dtenedor dtenedor 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 the fix!

@gaogaotiantian
Copy link
Copy Markdown
Contributor

We need this to recover our CI.

@HyukjinKwon
Copy link
Copy Markdown
Member

Merged to master.

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.

4 participants