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: reject invalid timestamp ranges in copy statement #3623

Merged

Conversation

v0y4g3r
Copy link
Contributor

@v0y4g3r v0y4g3r commented Apr 1, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

This PR adds timestamp validity check to reject invalid timestamps in copy statement.

mysql> copy monitor from '/tmp/export/monitor.parquet' with (format='parquet', START_TIME='2023-12-13 03:05:41', END_TIME='2023-12-13 02:05:51');

ERROR 1815 (HY000): Invalid timestamp range, start: `2023-12-13 03:05:41+0000`, end: `2023-12-13 02:05:51+0000`

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Apr 1, 2024
Copy link

codecov bot commented Apr 1, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 85.02%. Comparing base (bfd3257) to head (e3d1987).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3623      +/-   ##
==========================================
- Coverage   85.35%   85.02%   -0.33%     
==========================================
  Files         932      932              
  Lines      155611   155620       +9     
==========================================
- Hits       132818   132313     -505     
- Misses      22793    23307     +514     

Copy link
Contributor

@tisonkun tisonkun 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 this prompt fix.

  1. This patch should be "fix" or "feat" rather than "chore".
  2. Perhaps we can lower the Option -> Result into GenericRange::new method? All other refs seems in the test scope.

@v0y4g3r v0y4g3r changed the title chore: reject invalid timestamp ranges in copy statement feat: reject invalid timestamp ranges in copy statement Apr 1, 2024
@v0y4g3r
Copy link
Contributor Author

v0y4g3r commented Apr 1, 2024

1. This patch should be "fix" or "feat" rather than "chore".

Fixed.

2. Perhaps we can lower the Option -> Result into GenericRange::new method? All other refs seems in the test scope.

GenericRange::new does not have other error variants and it does not know how to interpret T in it's error message.

@v0y4g3r v0y4g3r requested a review from tisonkun April 1, 2024 07:53
Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

Rest LGTM

Copy link
Contributor

@tisonkun tisonkun 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 your updates and explanation! LGTM.

@v0y4g3r v0y4g3r added this pull request to the merge queue Apr 1, 2024
Merged via the queue into GreptimeTeam:main with commit 5e24448 Apr 1, 2024
24 checks passed
@v0y4g3r v0y4g3r deleted the chore/reject-invalid-timestamp-in-copy branch April 1, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants