-
Notifications
You must be signed in to change notification settings - Fork 293
event filter: fix panic when evaluate expressions for table with virtual columns #12211
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @lidezhu, 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 resolves a critical crash that occurred when evaluating event filter expressions for tables containing virtual columns. The core issue stemmed from the expression evaluation engine not correctly receiving the computed values for these derived columns. The changes introduce robust mechanisms to precisely identify, store offsets for, and dynamically compute virtual column values, ensuring that expressions are evaluated against a complete and accurate representation of the row data. This prevents crashes and enables reliable filtering for tables with virtual columns.
Highlights
- Enhanced Virtual Column Handling: The
TableInfo
structure has been refactored to store explicit offsets of virtual columns (VirtualColumnsOffset
) instead of just a count. This provides more precise metadata for handling these columns throughout the system. - Row Data Reconstruction: New methods (
getDatumsWithVirtualCols
,GetRowDatumsWithVirtualCols
,GetPreRowDatumsWithVirtualCols
) have been introduced inRowChangedDatums
to dynamically reconstruct row data. This process inserts placeholders for virtual columns at their correct positions, preparing the data for expression evaluation. - Dynamic Virtual Column Computation: Logic within the expression filter (
buildRowWithVirtualColumns
) now computes and fills the values of virtual columns into the row data before expression evaluation. This ensures that filter expressions can correctly reference and use these derived values, preventing crashes and ensuring accurate filtering. - Improved Data Casting: The
AdjustBinaryProtocolForDatum
utility has been updated to correctly align incoming data (which typically lacks virtual columns) with the full table schema. It achieves this by skipping non-CDC visible columns during the casting process, ensuring data integrity. - Comprehensive Test Coverage: A dedicated test case has been added for tables with virtual columns in
expr_filter_test.go
. This new test validates the correct behavior of event filtering with expressions that involve virtual columns, confirming the fix.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request addresses a critical issue related to virtual columns. The changes are well-structured and include a new test case. I've provided suggestions to improve thread safety and logging.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #12211 +/- ##
===========================================
Coverage 55.0649% 55.0649%
===========================================
Files 1030 1030
Lines 143487 143556 +69
===========================================
+ Hits 79011 79049 +38
- Misses 58669 58691 +22
- Partials 5807 5816 +9 🚀 New features to boost your workflow:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: asddongmen, hongyunyan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
…ual columns (#12211) (#12217) (#12258) close #12206 Co-authored-by: Ti Chi Robot <[email protected]>
What problem does this PR solve?
Issue Number: close #12206
What is changed and how it works?
Evaluate and fill the value of virtual columns before evaluate the expression on the row.
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note