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-26943][table] Add the built-in function DATE_ADD #24988

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dylanhz
Copy link
Contributor

@dylanhz dylanhz commented Jun 27, 2024

What is the purpose of the change

Add DATE_ADD supported in SQL & Table API.
Examples:

> SELECT date_add('2016-07-30', 1); 
2016-07-31  

Brief change log

FLINK-26943

Verifying this change

This change added tests and can be verified as follows: TimeFunctionsITCase#dateAddTestCases

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): yes
  • 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? yes
  • If yes, how is the feature documented? docs

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 27, 2024

CI report:

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

@dylanhz dylanhz marked this pull request as draft July 11, 2024 08:24
@dylanhz dylanhz marked this pull request as ready for review July 12, 2024 09:38
@dylanhz dylanhz changed the title [FLINK-26943][Table SQL / API] Add DATE_ADD supported in SQL & Table API [FLINK-26943][table] Add the built-in function DATE_ADD Aug 23, 2024
Copy link
Contributor

@superdiaodiao superdiaodiao left a comment

Choose a reason for hiding this comment

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

Nit


`startDate <DATE | TIMESTAMP_WITHOUT_TIME_ZONE | TIMESTAMP_WITH_LOCAL_TIME_ZONE | CHAR | VARCHAR>, numDays <TINYINT | SMALLINT | INTEGER | BIGINT>`

Returns a `DATE`, `NULL` if any of the arguments are `NULL` or result overflows or date string invalid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Returns a `DATE`, `NULL` if any of the arguments are `NULL` or result overflows or date string invalid.
Returns a `DATE`, `NULL` if any of the arguments is `NULL` or result overflows or date string is invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems both of them are acceptable.

Adds num_days days to start_date.
If num_days is negative, -num_days are subtracted from start_date.

null if any of the arguments are null or result overflows or date string invalid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
null if any of the arguments are null or result overflows or date string invalid.
null if any of the arguments is null or result overflows or date string is invalid.

/**
* Adds {@code numDays} days to {@code startDate}.<br>
* If {@code numDays} is negative, {@code -numDays} are subtracted from {@code startDate}.<br>
* null if any of the arguments are null or result overflows or date string invalid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* null if any of the arguments are null or result overflows or date string invalid.
* null if any of the arguments is null or result overflows or date string is invalid.

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

Successfully merging this pull request may close these issues.

3 participants