andygrove opened a new pull request, #108: URL: https://github.com/apache/datafusion-spark/pull/108
Part of #55 ## Rationale #58 added `#[user_doc]` and documented `sha2` and `substring` as examples. This PR applies the same approach to the array, collection, JSON, generator and aggregate functions, so they appear in generated function references. ## Changes Each function gets `#[user_doc]` on its struct and a `documentation()` that returns `self.doc()`. The struct rustdoc is cut to a one-line summary and a link to the Spark docs, and behavior notes from the old rustdoc or code comments moved into the docs. - **Array:** `slice`, `array`, `shuffle`, `array_repeat` - **Collection:** `size`. The docs say it returns -1 for NULL whatever the ANSI mode setting, which differs from Spark 4's default (#90). - **JSON:** `json_tuple` - **Generator:** `stack` - **Aggregate:** `try_sum`, `avg`, `collect_list`, `collect_set`. The docs say `avg` casts DECIMAL input to DOUBLE and returns a DOUBLE, unlike DataFusion's `avg` and Spark's. I left out functions in these packages that open PRs change: - `array_contains` (#63) - `map_from_arrays`, `map_from_entries` and `str_to_map` (#98) ## 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, and they all match. - A throwaway test checked that `documentation()` returns docs with the expected section, syntax and argument names for all 11 functions. - The documented behavior is covered by the existing SLT tests, or is visible in the code. ## User-facing changes `documentation()` now returns docs for these 11 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]
