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

feat(query): add date_diff function #16560

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

chagelo
Copy link
Contributor

@chagelo chagelo commented Oct 2, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

related to #16534

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Oct 2, 2024
@chagelo chagelo marked this pull request as draft October 2, 2024 05:58
@chagelo chagelo force-pushed the feat-add-date-diff branch from 6e56eb2 to 3053fc0 Compare October 3, 2024 17:45
@chagelo chagelo marked this pull request as ready for review October 3, 2024 17:57
@sundy-li sundy-li requested a review from TCeason October 8, 2024 04:04
@chagelo
Copy link
Contributor Author

chagelo commented Oct 8, 2024

Sorry, I got you. But, what's the result of select date_diff(year, to_date('2023-12-31'), to_date('2024-01-01'))?

@TCeason
Copy link
Collaborator

TCeason commented Oct 8, 2024

Sorry, I got you. But, what's the result of select date_diff(year, to_date('2023-12-31'), to_date('2024-01-01'))?

Oh, I just mean add a logic test case:

query T
SELECT DATE_DIFF(YEAR, to_date('2023-12-31'), to_date('2024-01-01'))
----
1

@chagelo
Copy link
Contributor Author

chagelo commented Oct 8, 2024

So what should I do is to fix it to be compatible with Snowflake and add more tests?

@TCeason
Copy link
Collaborator

TCeason commented Oct 8, 2024

So what should I do is to fix it to be compatible with Snowflake and add more tests?

Date diff about year just need to evaluate year sub. E.g.

2023-12-31 2024-01-01 just need to calc year sub.

@chagelo
Copy link
Contributor Author

chagelo commented Oct 8, 2024 via email

@chagelo chagelo force-pushed the feat-add-date-diff branch from 06be419 to df2d0fd Compare October 8, 2024 15:48
@chagelo chagelo marked this pull request as draft October 8, 2024 15:56
@chagelo chagelo force-pushed the feat-add-date-diff branch 4 times, most recently from 29a36d8 to bb1d61c Compare October 9, 2024 12:46
@chagelo chagelo marked this pull request as ready for review October 9, 2024 13:39
@chagelo chagelo requested a review from TCeason October 9, 2024 13:39
@chagelo chagelo force-pushed the feat-add-date-diff branch from dd1e9f1 to 663ae9f Compare October 10, 2024 09:22
@chagelo chagelo force-pushed the feat-add-date-diff branch 2 times, most recently from 8946d89 to bfaff2f Compare October 10, 2024 15:28
@BohuTANG BohuTANG requested a review from TCeason October 11, 2024 11:29
Copy link
Collaborator

@TCeason TCeason left a comment

Choose a reason for hiding this comment

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

LGTM

* support date and timestamp
@chagelo chagelo force-pushed the feat-add-date-diff branch from 476b8d1 to 5308b77 Compare October 12, 2024 03:11
@TCeason
Copy link
Collaborator

TCeason commented Oct 12, 2024

Hi @chagelo after approving this pr, I see you force-push a commit. What's diff in this commit? just rebase lastest main?

image

@chagelo
Copy link
Contributor Author

chagelo commented Oct 12, 2024

Yes

@TCeason TCeason added this pull request to the merge queue Oct 12, 2024
@BohuTANG BohuTANG removed this pull request from the merge queue due to a manual request Oct 12, 2024
@BohuTANG BohuTANG merged commit 6ad9da2 into databendlabs:main Oct 12, 2024
71 checks passed
@BohuTANG
Copy link
Member

@soyeric128 Documentation need update. Thanks.

@BohuTANG
Copy link
Member

@chagelo Thanks to your contribution!

@chagelo chagelo deleted the feat-add-date-diff branch October 12, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants