marcuslin123 opened a new pull request, #59411:
URL: https://github.com/apache/spark/pull/59411

   ### What changes were proposed in this pull request?
   
   This pull request adds the original Python callable, `func`, to the
   `AbstractTranspiler._transpile_from_ast` hook and passes it through from 
`_transpile_func`.
   
   The built-in `CatalystTranspiler` signature and its direct test invocation 
are updated to match.
   A regression test registers an out-of-tree-style transpiler and verifies 
that it receives the exact
   callable object being transpiled.
   
   ### Why are the changes needed?
   
   Out-of-tree transpilers may need the callable for capture extraction, 
canonical source generation,
   or fingerprinting. Today they must recover it by walking Python stack frames 
and reading the `func`
   local from `_transpile_func`. Passing the callable through the hook makes 
that contract explicit and
   removes the dependency on Spark's internal stack layout.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This changes an experimental internal transpiler extension hook.
   
   ### How was this patch tested?
   
   Added `test_udf_transpiler_receives_original_callable` to
   `pyspark.sql.tests.test_udf_transpile_unit`.
   
   ```
   build/sbt -Phive package
   python/run-tests --testnames pyspark.sql.tests.test_udf_transpile_unit
   dev/lint-python --ruff
   dev/lint-python --compile
   mypy --python-executable .venv/bin/python --namespace-packages 
--follow-imports=skip \
     --config-file python/mypy.ini python/pyspark/sql/transpile.py
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (used for code assistance).
   


-- 
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]

Reply via email to