Skip to content

fix: mergeAlignedInterval pkts error#34473

Merged
guanshengliang merged 1 commit into3.3.8from
mergeinterval
Feb 3, 2026
Merged

fix: mergeAlignedInterval pkts error#34473
guanshengliang merged 1 commit into3.3.8from
mergeinterval

Conversation

@Tony2h
Copy link
Copy Markdown
Member

@Tony2h Tony2h commented Feb 2, 2026

Description

Issue(s)

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 February 2, 2026 06:32
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Tony2h, 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 error in the query planner related to mergeAlignedInterval operations, specifically concerning the handling of timestamp placeholders (_twstart and _wstart) as merge keys for INTERVAL windows. The changes refactor the merge key generation logic to ensure correct aggregation and alignment of data. Accompanying test updates validate the fix by adjusting database configurations and expected outcomes, while also temporarily disabling some unstable tests.

Highlights

  • Fix mergeAlignedInterval pkts error: Addressed an issue in the query planner where pkts (packets/timestamps) were not being correctly handled during mergeAlignedInterval operations, particularly for INTERVAL windows.
  • Refactored Merge Key Generation: The stbSplCreatePartWindowNode function now explicitly handles the creation of merge keys, ensuring that both _twstart and _wstart timestamp placeholders are correctly considered for INTERVAL window merging logic.
  • Enhanced Test Coverage and Correction: Increased the number of vgroups in several subquery tests from 1 to 2 to validate the fix in a multi-vgroup environment and updated expected count(cint) values in stream processing tests to reflect accurate results after the fix.
  • Skipped Unstable Tests: Temporarily commented out certain stream processing tests that were producing non-deterministic or 'random expect results' to prevent test flakiness.

🧠 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 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
Copy Markdown
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 effectively addresses a bug in query plan splitting for aligned interval windows, particularly in multi-vgroup scenarios. The core change in planSpliter.c correctly identifies and uses both _wstart and stream-related (_twstart) timestamp placeholders to generate merge keys, ensuring proper data merging. This is a significant improvement over the previous logic. The accompanying test changes, which increase the number of vgroups and update expected results, are well-suited to verify this fix.


def createStreams(self):
self.streams = []
self.streams: list[StreamItem] = []

This comment was marked as resolved.

Copy link
Copy Markdown
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 updates the interval window splitting logic to correctly handle “pkts” placeholders when merging aligned interval windows, and aligns the stream subquery tests with the new behavior by adjusting database layout and expectations.

Changes:

  • In planSpliter.c, stbSplCreatePartWindowNode is extended to create and propagate appropriate placeholder functions (_twstart / _tprev_ts and _wstart) as both output columns and merge keys, and stbSplSplitIntervalForBatch is updated to use these merge keys instead of primary-key-based merge keys.
  • All SubQuery stream test suites (state, sliding, session, event, count_1, count_2) now create qdb with 2 vgroups, and their “information_schema.ins_databases” sanity-check streams are updated to expect the increased vgroup count.
  • A small number of flaky tests with inherently random result expectations are consistently disabled (their self.streams.append(stream) calls are commented) to improve test stability, and test_subquery_sliding clarifies the type of self.streams.

Reviewed changes

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

Show a summary per file
File Description
source/libs/planner/src/planSpliter.c Refactors interval/external window splitting to add a shared helper for building merge keys from expressions, extends stbSplCreatePartWindowNode to emit both stream placeholders and _wstart and feed these into merge keys and pTspk, and updates stbSplSplitIntervalForBatch to use the new merge-keys-from-placeholders flow.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_state.py Uses 2 vgroups for qdb and adjusts stream 47’s expected _wstart result to reflect the higher total vgroup count; disables a few tests with random expectations to avoid flakiness.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_sliding.py Same qdb vgroup increase and stream 47 expectation update as the state tests; annotates self.streams as list[StreamItem] and disables the same random-result tests.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_session.py Mirrors the state/sliding changes for session-triggered streams: qdb vgroups bumped to 2, stream 47 expectation updated to 4, and several random-result tests skipped.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_event.py Applies the same qdb vgroup and stream 47 expectation updates for event-triggered streams, and skips the random-result tests for ids 108 and 119.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_count_1.py For count_window(1, ...) streams, increases qdb vgroups to 2, updates stream 47 expected vgroup sum from 3 to 4, and skips random-result tests at the end of the stream list.
test/cases/18-StreamProcessing/07-SubQuery/test_subquery_count_2.py For count_window(2, ...) streams, mirrors the qdb vgroup change, stream 47 expectation from 3 to 4, and random-result test skips as in the count_1 suite.

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

@guanshengliang guanshengliang merged commit 49368b9 into 3.3.8 Feb 3, 2026
15 of 17 checks passed
@guanshengliang guanshengliang deleted the mergeinterval branch February 3, 2026 01:44
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