andygrove opened a new pull request, #105: URL: https://github.com/apache/datafusion-spark/pull/105
Part of #55 ## Rationale #58 added `#[user_doc]` support and documented `sha2` and `substring` as examples. This PR applies the same approach to the rest of the general-purpose string functions, so they appear in generated function references. ## Changes - Document `ascii`, `char`, `concat`, `concat_ws`, `elt`, `format_string` (alias `printf`), `length` (aliases `char_length`, `character_length`, `len`), `quote`, `space`, `soundex`, `like` and `ilike` with `#[user_doc]`, and implement `documentation()` by returning `self.doc()`. - Each description covers how the function differs from the DataFusion built-in of the same name, or says there isn't one, plus its Spark edge cases: NULL handling, out-of-range values, ANSI mode for `elt`, and accepted input types. - Cut the structs' rustdoc down to a one-line summary and the Spark docs link. The behavior notes that were there for `ascii`, `concat` and `concat_ws` moved into the `#[user_doc]` text, so nothing is written twice. - `space` only accepts INT, and integer literals are BIGINT in DataFusion, so its docs say to cast and its examples use `::INT`. - The rest of the string module will come in separate PRs. The binary, encoding and UTF-8 functions (`to_binary`, `try_to_binary`, `encode`, `base64`, `unbase64`, `make_valid_utf8`, `is_valid_utf8`, `luhn_check`) go in their own PR. `substring` was done in #58, and `regexp_extract` is documented in its own PR (#73). ## 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. - The documented behavior is covered by the existing `.slt` and unit tests for these functions, or is visible in the code (for example, `like` and `ilike` take exactly two arguments, so Spark's `escape` argument isn't supported). ## User-facing changes `documentation()` now returns docs for these 12 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]
