andygrove opened a new pull request, #104: URL: https://github.com/apache/datafusion-spark/pull/104
Part of #55 ## Rationale #58 added `#[user_doc]` support and documented `sha2` and `substring` as examples. This PR applies the same approach to the math functions, so they show up in generated function references with their Spark-specific behavior. ## Changes - Document these functions with `#[user_doc]` and implement `documentation()` by returning `self.doc()`: `abs`, `atan2`, `bin`, `ceil` (with `ceiling` as alternative syntax), `csc`, `expm1`, `factorial`, `floor`, `hex`, `hypot`, `negative`, `rint`, `round`, `sec`, `unhex` and `width_bucket`. - Each description says how the function differs from the DataFusion built-in of the same name, or that there is none. It also covers the edge cases the tests check: return types, NULL and NaN handling, overflow with and without ANSI mode, and out-of-range inputs. - Cut each struct's rustdoc to a one-line summary and a link to the Spark docs, and move the behavior notes that were there into the `#[user_doc]` text, so nothing is written twice. - Skipped `pow` (it already implements `documentation()`, and #67 changes it) and `mod`/`pmod` (#66 changes `modulus.rs`), to avoid conflicts. They can follow once those PRs land. ## Testing - `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo test -p datafusion-spark` and `cargo test -p datafusion-spark-sqllogictest` pass. - I ran every SQL example in the docs through the sqllogictest runner (a temporary `.slt` file, not committed), and they all match. - The documented behavior is covered by the existing SLT and unit tests for each function, or is visible in the code. ## User-facing changes `documentation()` now returns docs for these 16 functions. Behavior does not change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
