docs: missing documentation for TO_INTERVAL and TRY_TO_INTERVAL functions

Open Beginner friendly
#3,268 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
sql
Domain
documentation

Research direction

Start with /docs/en/sql-reference/20-sql-functions/05-datetime-functions/try-to-datetime.md and try-to-timestamp.md for the expected format, then check the implementation in /workspace/databend/src/query/functions/src/scalars/timestamp/src/interval.rs. Add the suggested to-interval.md page covering both functions, syntax, arguments, return behavior, and common interval-string examples; done means the SQL reference documents both functions clearly.

Written by the indexing model from the issue text.

Description

automated issue documentation

Summary

The TO_INTERVAL and TRY_TO_INTERVAL functions are implemented and registered in the Databend source but have no documentation page in the SQL reference.

Source

  • File: /workspace/databend/src/query/functions/src/scalars/timestamp/src/interval.rs
  • Registration: register_string_to_interval() registers both to_interval (via scalar_builder) and try_to_interval (via register_combine_nullable_1_arg)

What They Do

  • TO_INTERVAL(string) — Parses a string into an INTERVAL value. Accepts standard interval literals such as '1 year 2 months', '3 days 4 hours', '5 minutes', etc. Throws an error if the string cannot be parsed.
  • TRY_TO_INTERVAL(string) — Same as TO_INTERVAL but returns NULL instead of throwing an error on invalid input.

These are the primary way to construct INTERVAL values from string literals in Databend, analogous to TO_DATE / TRY_TO_DATE for dates.

What's Missing

No documentation page exists for either function. The interval data type page at /docs/en/sql-reference/00-sql-reference/10-data-types/interval.md mentions intervals but does not document these conversion functions.

The existing try-to-datetime.md and try-to-timestamp.md pages in the datetime functions section show the expected doc format.

Suggested Doc Location

/docs/en/sql-reference/20-sql-functions/05-datetime-functions/to-interval.md

The page should cover both TO_INTERVAL and TRY_TO_INTERVAL, include syntax, argument description, return type (INTERVAL or NULL), and examples showing common interval string formats.

Dominant language
TypeScript
Stars
17
Forks
44
Avg merge
2d 7m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend-docs

All issues in databendlabs/databend-docs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.