Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-36865][cdc] Provide UNIX_TIMESTAMP series functions in YAML pipeline #3819

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

aiwenmo
Copy link
Contributor

@aiwenmo aiwenmo commented Dec 26, 2024

It is reasonable to expect some functions like FROM_UNIXTIME(numeric[, string]), UNIX_TIMESTAMP() and UNIX_TIMESTAMP(string1[, string2]) series functions to help manipulating timestamps without having to write any UDFs.

Function Janino Code Description
FROM_UNIXTIME(numeric[, string]) fromUnixtime(NUMERIC[, STRING]) Returns a representation of the numeric argument as a value in string format (default is ‘yyyy-MM-dd HH:mm:ss’). numeric is an internal timestamp value representing seconds since ‘1970-01-01 00:00:00’ UTC, such as produced by the UNIX_TIMESTAMP() function. The return value is expressed in the session time zone (specified in TableConfig). E.g., FROM_UNIXTIME(44) returns ‘1970-01-01 00:00:44’ if in UTC time zone, but returns ‘1970-01-01 09:00:44’ if in ‘Asia/Tokyo’ time zone.
UNIX_TIMESTAMP() unixTimestamp() Gets current Unix timestamp in seconds. This function is not deterministic which means the value would be recalculated for each record.
UNIX_TIMESTAMP(string1[, string2]) unixTimestamp(STRING1[, STRING2]) Converts a date time string string1 with format string2 (by default: yyyy-MM-dd HH:mm:ss if not specified) to Unix timestamp (in seconds), using the specified timezone in table config.
If a time zone is specified in the date time string and parsed by UTC+X format such as “yyyy-MM-dd HH:mm:ss.SSS X”, this function will use the specified timezone in the date time string instead of the timezone in table config. If the date time string can not be parsed, the default value Long.MIN_VALUE(-9223372036854775808) will be returned.

@github-actions github-actions bot added docs Improvements or additions to documentation common runtime labels Dec 26, 2024
@aiwenmo
Copy link
Contributor Author

aiwenmo commented Dec 26, 2024

PTAL @lvyanquan @leonardBang @yuxiqian

docs/content.zh/docs/core-concept/transform.md Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding cases in TransformE2eITCase#testTemporalFunctions

@aiwenmo
Copy link
Contributor Author

aiwenmo commented Jan 8, 2025

PTAL @yuxiqian

Copy link
Contributor

@yuxiqian yuxiqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for @aiwenmo's nice work, UT case seems comprehensive! Just left some trivial comments on typo.

Would @leonardBang like to take a further look?

Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leonardBang leonardBang merged commit 2fd03e6 into apache:master Jan 13, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved common docs Improvements or additions to documentation reviewed runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants