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

   ### What changes were proposed in this pull request?
   
   This PR makes the `arguments` field of `@ExpressionDescription` a required 
part of built-in function documentation, alongside the already-required 
`usage`, `examples`, `since`, and `group` fields.
   
   - `ExpressionInfoSuite` (the `SPARK-32870` test) now asserts 
`info.getArguments.nonEmpty` for every registered function, except functions 
that take no arguments, which are enumerated in a new `noArgumentsSet` (e.g. 
`pi`, `current_date`, `current_timestamp`, `input_file_name`, `uuid`, 
`spark_partition_id`). The existing format assertions (the value must start 
with `\n    Arguments:\n` and end with `\n  `) continue to apply.
   - Backfills `arguments` documentation for 118 built-in expressions across 45 
files that were previously missing it.
   
   Note on scope: the enforced list is derived from what is actually registered 
in the expression `FunctionRegistry`. Expressions whose `ExpressionInfo` is 
produced through a builder object (e.g. `minute`/`second`/`max_by`/`min_by`, 
whose builders already document `arguments`) or that live only in the table 
function registry are validated via their builder class and were not part of 
the backfill. This change does not affect the generated 
`sql-expression-schema.md` golden file.
   
   ### Why are the changes needed?
   
   Most built-in functions already document their `arguments`, but it was not 
enforced, so newly added expressions could omit it and the generated function 
docs would be inconsistent. Requiring the field keeps the built-in function 
documentation complete and uniform, and turns a missing `Arguments:` section 
into a test failure rather than a silent gap.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The generated documentation for the affected built-in functions now 
includes an `Arguments:` section describing each argument. This is a 
documentation-only change; there are no behavior changes.
   
   ### How was this patch tested?
   
   Existing `ExpressionInfoSuite` covers this, extended to assert that 
`arguments` is present for all registered functions (minus the zero-argument 
exemptions).
   
   ```
   build/sbt 'sql/testOnly org.apache.spark.sql.expressions.ExpressionInfoSuite'
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   
   This pull request and its description were written by Isaac.


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