Skip to content

Conversation

@guanshengliang
Copy link
Contributor

Description

Please briefly describe the code changes in this pull request.

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @guanshengliang, 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 robustness and diagnostic capabilities of the system by introducing a new error code for missing metrics, improving error logging with more contextual information, and refining the error handling within the metric collection framework. Additionally, the query optimizer's logic for handling aggregate functions has been made more precise, and associated test cases have been updated to reflect these changes.

Highlights

  • New Error Code Introduction: A new error code, TSDB_CODE_UTIL_NO_METRIC_EXIST (0x80006001), has been added to include/util/taoserror.h and its corresponding error message defined in source/util/src/terror.c.
  • Enhanced Error Logging: Error messages in source/client/src/clientMonitor.c and source/libs/monitor/src/monFramework.c have been improved to include the specific error string using tstrerror(terrno), providing more detailed diagnostic information.
  • Improved Metric Collection Error Handling: The taos_collector_registry_bridge_new function in source/libs/monitorfw/src/taos_collector_registry.c now explicitly captures and propagates terrno for various JSON manipulation failures and sets TSDB_CODE_UTIL_NO_METRIC_EXIST if no metrics are found after loading.
  • Query Optimizer Refinement: The isNeedSplitCacheLastFunc function in source/libs/planner/src/planOptimizer.c has been refactored for clarity and correctness, including a new check for FUNCTION_TYPE_GROUP_CONST_VALUE to improve query planning logic for aggregate functions.
  • Test Case Updates: Existing test cases test/cases/22-Functions/resource/ans/last_tag.csv and test/cases/22-Functions/resource/in/last_tag.in have been updated to include new queries and their explain plans for last() and first() functions. Additionally, test/cases/uncatalog/army/whole/test_check_error_code.py now includes the newly added error code for validation.
  • Test Result File Removal: The test result file test/temp_test_vtable_select_test_function.result has been removed, indicating a cleanup or refactoring of test output.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several improvements. It adds a new error code for when no monitoring metrics exist and enhances error logging in the monitoring components to provide more context, which is great for debugging. A complex conditional in the query planner has been refactored, significantly improving code readability. The changes also include new test cases and some code cleanup. My only concern is that the documentation check for the new error code is being bypassed in a test file, which should be addressed to ensure documentation stays up-to-date.

'0x80007004', '0x80007005', '0x80007006', '0x80007007', '0x80007008', '0x80007009', '0x8000700A', '0x8000700B', '0x8000700C', '0x8000700D',
'0x8000700E', '0x8000700F', '0x80007010', '0x80007011', '0x80007012', '0x80007013', '0x80007014', '0x80002694', '0x80002695', '0x80007015',
'0x800004B4', '0x800004B5', '0x800004B6']
'0x800004B4', '0x800004B5', '0x800004B6', '0x80006001']
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The new error code 0x80006001 (TSDB_CODE_UTIL_NO_METRIC_EXIST) has been added to the ignoreCodes list. This bypasses the check that ensures all error codes are properly documented. While this might be a temporary measure, it's best practice to document the new error code in docs/en/14-reference/09-error-code.md and docs/zh/14-reference/09-error-code.md and remove it from this ignore list to maintain documentation consistency.

@guanshengliang guanshengliang merged commit e9d53dd into main Oct 15, 2025
11 of 16 checks passed
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.

4 participants