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

   ### What changes were proposed in this pull request?
   
   This pull request allows the experimental Python UDF transpiler to handle 
functions and lambdas with explicit positional-only parameters.
   
   The change:
   
   * reads `posonlyargs` together with regular positional arguments when 
building parameter lists, type-category variants, and lambda source checks;
   * records caller-facing positional-only names so an invalid keyword call 
remains on the interpreted Python path and raises Python's normal `TypeError`;
   * continues to reject defaulted positional-only parameters, because omitted 
defaults cannot be represented by the positional placeholder scheme; and
   * adds positive and negative regression coverage for functions, lambdas, 
annotations, mixed positional/keyword calls, and defaults.
   
   ### Why are the changes needed?
   
   Explicit positional-only parameters without defaults are always supplied 
positionally and map directly to the transpiler's `_udf_param_N` placeholders. 
Rejecting every function that uses `/` unnecessarily prevents valid UDFs from 
being transpiled.
   
   At the same time, calls that incorrectly pass a positional-only parameter by 
keyword must not be rewritten into a valid positional call. Leaving those calls 
unresolved preserves the same error behavior as interpreted Python.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. With the experimental Python UDF transpiler enabled, UDFs and lambdas 
with required positional-only parameters can now be transpiled. Invalid keyword 
calls for those parameters continue to raise Python's positional-only argument 
error, and positional-only parameters with defaults continue to fall back to 
interpreted Python.
   
   ### How was this patch tested?
   
   New unit coverage was added to 
`UDFTranspileUnitTests.test_udf_transpile_positional_only_params`.
   
   The following commands passed locally:
   
   ```
   build/sbt -Phive package
   python/run-tests --testnames pyspark.sql.tests.test_udf_transpile_unit
   dev/lint-python --ruff
   dev/lint-python --compile --custom-pyspark-error
   git diff --check
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


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