Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary of ChangesHello @facetosea, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the accuracy and robustness of time calculation and truncation utilities. It resolves issues related to incorrect month/year arithmetic and refines the application of intervals and offsets, particularly for calendar-based units. These changes ensure more precise time series data processing and prevent unexpected date shifts. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several fixes related to time calculations, particularly for taosTimeTruncate and taosTimeAdd. The changes correctly handle negative month offsets and the application of intervals and offsets for calendar units. A new test case for taosTimeTruncate has been added, which is a good step towards ensuring correctness. I've identified a potential data truncation and overflow issue in taosTimeAdd and provided a suggestion to address it.
There was a problem hiding this comment.
Pull request overview
This PR updates time-window calculations to handle month/year arithmetic and offset behavior more correctly, and adds a regression test around taosTimeTruncate().
Changes:
- Fix month/year addition in
taosTimeAdd()to correctly normalize negative month values. - Adjust
taosTimeTruncate()window-end computation and enhancetaosTimeGetIntervalEnd()to better handle month/year “date shifting” with offsets. - Add a new unit test for
taosTimeTruncate().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
source/common/src/ttime.c |
Fixes calendar month/year arithmetic, adjusts truncate/end calculations for offset + calendar units. |
source/common/test/commonTests.cpp |
Adds a regression test covering taosTimeTruncate() behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.