greptimedb
greptimedb copied to clipboard
feat: support `WITHIN` filter
trafficstars
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
Part of #3755.
This PR supports within syntax like:
select * from monitors where ts within '2024';
select * from monitors where ts within '2024-04-19';
select * from monitors where ts within '2024-04-19 23:50';
They are converted to
select * from monitors where ts >= '2024-01-01 00:00:00' and ts < '2025-01-01 00:00:00';
select * from monitors where ts >= '2024-04-19 00:00:00' and ts < '2024-04-20 00:00:00';
select * from monitors where ts >= '2024-04-19 23:50:00' and ts < '2024-04-19 23:51:00';
What's changed and what's your intention?
PR Checklist
Please convert it to a draft if some of the following conditions are not met.
- [ ] I have written the necessary rustdoc comments.
- [ ] I have added the necessary unit tests and integration tests.
- [ ] This PR requires documentation updates.
- [ ] API changes are backward compatible.
- [ ] Schema or data changes are backward compatible.
Summary by CodeRabbit
-
New Features
• Enhanced query filtering now accepts year-only date inputs, automatically converting them into valid date ranges.
• Expanded SQL functionality adds new aggregation and data selection options for analyzing system metrics. -
Chores
• Updated an internal dependency for improved stability. -
Tests
• Added new SQL queries and data insertion tests to validate the improved filtering and aggregation behaviors.