Skip to content

[FLINK-41743][docs] Add pages for the date and time functions - #30203

Draft
raminqaf wants to merge 1 commit into
apache:masterfrom
raminqaf:FLINK-41743
Draft

raminqaf wants to merge 1 commit into
apache:masterfrom
raminqaf:FLINK-41743

Conversation

@raminqaf

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Step 6 of FLINK-23804 and its last category: every date and time function gets a page of its own, generated from YAML. Each page was rechecked against the implementation, and every example result comes from running its SQL in batch and streaming mode. The recheck changed what the docs say, for example:

Function Old docs Master
HOUR "Returns the hour of a day (an integer between 0 and 23)" Before 1970, a time of day comes out negative: HOUR(TIMESTAMP '1969-12-31 23:00:00') is -1
CEIL "Returns a value that rounds timepoint up to the time unit timeintervalunit." On the first day of a unit it rounds down: CEIL(TIMESTAMP '2024-01-01 10:00:00' TO MONTH) is 2024-01-01 00:00:00
TIMESTAMPDIFF "Returns the (signed) number of timepointunit between timepoint1 and timepoint2." MILLISECOND counts whole seconds: 1.5 seconds apart is 1000
CONVERT_TZ "The format of time zone should be either an abbreviation such as "PST", a full name ... or a custom ID" An unknown zone, such as '+08:00' or a typo, is read as UTC without an error
TO_DATE "Converts a date string string1 with format string2 (by default 'yyyy-MM-dd') to a date." With a format, a string that can't be parsed returns 5471-09-27 instead of NULL

Brief change log

  • Add 35 pages for the 46 rows of the Date & Time table, and point every row at its page.
  • The DATE, TIME, TIMESTAMP and INTERVAL literals get pages of their own. The nine Table API rows that build an interval, such as NUMERIC.days, point at the INTERVAL literal page. FLOOR and CEIL with a time unit get pages in this category, next to the numeric pages of [FLINK-41716][docs] Add pages for the mathematical functions #30185. UNIX_TIMESTAMP and TO_TIMESTAMP_LTZ get one page each for their two rows, and NOW keeps a page next to CURRENT_TIMESTAMP.
  • Arguments are named after their role: temporal, unit, amount, str, format, ts, tz, unix_time, epoch and epoch_precision, rowtime, and start1, end1, start2, end2 for OVERLAPS.
  • The category page: the opening paragraph now says that UNIX_TIMESTAMP() runs for each row in batch mode too, and the unit table drops a duplicate EPOCH row and adds DAYOFYEAR, DAYOFWEEK and NANOSECOND.
  • Chinese pages show the English sections. Where a row had a Chinese description, its first sentence becomes the summary, except for nine summaries that contradicted their page. This drops 1059 of the 1548 Chinese characters of the table. FLINK-41744 translates these pages, as FLINK-41738 does for the string functions.

Verifying this change

This change is documentation only.

The recheck found bugs in the code, which this PR doesn't fix. The pages describe the current behavior, also where it's a bug that users would plausibly hit, such as the results above, FLOOR and CEIL of a TIMESTAMP_LTZ being an hour off in a daylight saving zone, or TO_TIMESTAMP_LTZ dropping an offset that its format reads. The pages name no tickets. I'll file the bugs separately.

The TO_TIMESTAMP and TO_TIMESTAMP_LTZ pages describe master. #27793 changes both and edits their rows in sql_functions.yml, which this PR replaces with pages, so whichever PR lands second moves its text into the two pages.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code 2.1.332 (Claude Opus 5.5)

- Add one EN/ZH page per date and time function, 35 pages for the 46 rows of the category, with SQL-verified examples and the Java and Python Table API calls.
- The DATE, TIME, TIMESTAMP and INTERVAL literals get pages of their own, and the nine Table API rows that build an interval point at the INTERVAL literal page. FLOOR and CEIL with a time unit get pages in this category.
- Point the 46 rows of the category at the pages.
- Correct the opening paragraph and the unit table of the category page.

Generated-by: Claude Code 2.1.332 (Claude Opus 5.5)
@flinkbot

flinkbot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants