raminqaf opened a new pull request, #30203:
URL: https://github.com/apache/flink/pull/30203
## 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 #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.
- Every SQL example ran in batch and streaming mode on master with a local
runner, which isn't part of this PR. The results on the pages are pasted from
those runs. Examples that depend on the session time zone set
`table.local-time-zone` in their SQL, and the `CURRENT_WATERMARK` examples run
in streaming mode only.
- A second review checked each statement against the type strategies, the
code generation, the runtime classes and the tests. A third pass removed what
the reviews of #29864 and #30033 asked to leave out.
- Hugo 0.126.3 builds both languages without warnings. A link check finds no
new broken internal links.
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?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code 2.1.332 (Claude Opus 5.5)
--
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]