Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: vtable slot key not found#34644

Open
Simon9997 wants to merge 1 commit intomainfrom
fix/main/6843756344
Open

fix: vtable slot key not found#34644
Simon9997 wants to merge 1 commit intomainfrom
fix/main/6843756344

Conversation

@Simon9997
Copy link
Contributor

…ad path.

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

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?

Copilot AI review requested due to automatic review settings March 2, 2026 09:19
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 addresses a critical issue where virtual table slot keys were not being correctly identified, leading to potential errors in query planning. The changes ensure that the system accurately constructs slot keys for virtual tables by utilizing their reference names, and also refines the handling of primary timestamp column dependencies in virtual tables, improving the overall robustness of the query planner.

Highlights

  • Virtual Table Slot Key Generation: Corrected the generation of slot keys for virtual tables by distinguishing between virtual and non-virtual table types, ensuring the use of appropriate reference names.
  • Virtual Table Column Dependency Handling: Introduced logic to properly set dependency and reference flags for primary timestamp columns within virtual tables when no reference tables are mapped.

🧠 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.

Changelog
  • source/libs/planner/src/planLogicCreater.c
    • Added a conditional block to handle cases where pRefTablesMap is empty, iterating through virtual table scan columns to correctly set hasDep and hasRef for primary timestamp columns.
  • source/libs/planner/src/planPhysiCreater.c
    • Modified the getSlotKey function to conditionally use refDbName, refTableName, and refColName for TSDB_VIRTUAL_CHILD_TABLE and TSDB_VIRTUAL_NORMAL_TABLE types, while retaining the original dbName, tableAlias, and colName for other table types.
Activity
  • No specific activity (comments, reviews, progress updates) has been recorded for this pull request yet.
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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a planner failure (“slot key not found”) that occurs when building slot-key mappings for virtual table (vtable) scans, particularly around dependent/reference column handling.

Changes:

  • Update getSlotKey() to build slot keys for hasDep columns in virtual tables using the referenced (ref*) names rather than the virtual table’s own names.
  • Add logic in virtual normal/child table planning to convert a referenced primary timestamp column into a dependent column when no referenced-table scan nodes are created.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/libs/planner/src/planPhysiCreater.c Adjusts slot-key construction for dependent columns on virtual tables to use refDbName/refTableName/refColName.
source/libs/planner/src/planLogicCreater.c Adds an edge-case handling block when pRefTablesMap is empty to flip primary-ts ref columns into dependent columns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Simon9997 Simon9997 force-pushed the fix/main/6843756344 branch from b0daa43 to af8caf7 Compare March 3, 2026 00:21
@Simon9997 Simon9997 requested a review from a team as a code owner March 3, 2026 00:21
Copilot AI review requested due to automatic review settings March 3, 2026 00:28
@Simon9997 Simon9997 force-pushed the fix/main/6843756344 branch from af8caf7 to d9e5dee Compare March 3, 2026 00:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Simon9997 Simon9997 force-pushed the fix/main/6843756344 branch from ab215a1 to a1984d9 Compare March 3, 2026 02:10
Copilot AI review requested due to automatic review settings March 3, 2026 02:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

source/libs/parser/src/parTranslater.c:5940

  • This new setColRef(&pMeta->colRef[0], ...) assumes that both the virtual table and the reference table have the timestamp column at schema[0] and that colRef[0] corresponds to that timestamp column. It would be safer to assert/check pTsSchema->colId (and pRefTsSchema->colId) is PRIMARYKEY_TIMESTAMP_COL_ID (and that pMeta->numOfColRefs covers index 0) before mutating colRef[0], otherwise this could accidentally set a ref for the wrong column if schema ordering differs.
      // if there is only one reference table, we can set ts column's reference to it, which will be used when virtual
      // table scan node is eliminated.
      const SSchema* pTsSchema = &pMeta->schema[0];
      const SSchema* pRefTsSchema = &pRTNode->pMeta->schema[0];
      PAR_ERR_JRET(setColRef(&pMeta->colRef[0], pTsSchema->colId, (char*)pRefTsSchema->name, pRTNode->table.tableName,
                             pRTNode->table.dbName));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Simon9997 Simon9997 force-pushed the fix/main/6843756344 branch from a1984d9 to 2c2f441 Compare March 3, 2026 02:18
@Simon9997 Simon9997 force-pushed the fix/main/6843756344 branch from 2c2f441 to 6edf7c8 Compare March 3, 2026 02:23
Copilot AI review requested due to automatic review settings March 3, 2026 02:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants