andygrove opened a new pull request, #103:
URL: https://github.com/apache/datafusion-spark/pull/103
Part of #55
## Rationale
#58 added `#[user_doc]` and documented `sha2` and `substring` as examples.
This PR applies the same approach to the binary, encoding and URL 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()`:
- `to_binary`, `try_to_binary`, `encode`, `base64`, `unbase64` (section
"Binary String Functions", which DataFusion uses for its own `encode`/`decode`)
- `make_valid_utf8`, `is_valid_utf8`, `luhn_check` (section "String
Functions")
- `url_encode`, `url_decode`, `try_url_decode` (section "URL Functions";
DataFusion core has no URL section)
- Cut the structs' rustdoc down to a one-line summary and a link to the
Spark docs. Behavior notes that were in rustdoc (`to_binary`, `try_to_binary`,
`encode`) moved into the user docs. `encode` keeps its Spark 3.5 vs 4.0 note
there and its TODO as a code comment.
- Add three slt cases to back claims the docs make: the characters
`url_encode` leaves unescaped, and invalid UTF-8 in `url_decode` (error) and
`try_url_decode` (NULL).
- `parse_url` and `try_parse_url` are left out, since #89 changes them.
## Testing
- `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 tests for each
function, the new slt cases above, 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]