andygrove opened a new pull request, #102: URL: https://github.com/apache/datafusion-spark/pull/102
Part of #55 ## Rationale `CONTRIBUTING.md` asks for every function to be documented with `#[user_doc]`, as #58 did for `sha2` and `substring`. This PR does that for the date truncation, time zone and interval functions. ## Changes - Document `trunc`, `date_trunc`, `time_trunc`, `from_utc_timestamp`, `to_utc_timestamp`, `make_interval` and `make_dt_interval` with `#[user_doc]`, and implement `documentation()` for each by returning `self.doc()`. - Each description says how the function differs from DataFusion's built-in, or that there isn't one, and covers its edge cases: NULL handling, unit aliases, errors, accepted time zone spellings, overflow and non-finite seconds. Known differences from Spark are listed too, for example `trunc` and `date_trunc` raising an error for an unsupported unit where Spark returns NULL, and `secs` being a DOUBLE rather than a DECIMAL(18, 6) in `make_interval` and `make_dt_interval`. - Cut the structs' rustdoc down to a one-line summary and a link to the Spark docs. The compatibility notes in `from_utc_timestamp`'s rustdoc move into the user docs; the note that points Rust callers to `SparkFromUtcTimestampExpr` stays in the rustdoc. The other datetime functions are documented in a separate PR, and `monthname` is left alone because #75 changes it. ## 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. I also checked there that `to_utc_timestamp` rejects `PST` and `GMT+1`, as the docs say. - Everything else in the docs is covered by the existing SLT or unit tests, or is visible in the code. ## User-facing changes `documentation()` now returns docs for these seven 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]
