Skip to content

[fix] let runtime filter use prefix match if necessary - #15233

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
aunjgr:runtime_filter
Mar 29, 2024
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
aunjgr:runtime_filter

Conversation

@aunjgr

@aunjgr aunjgr commented Mar 29, 2024 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #15196

What this PR does / why we need it:

if joined columns are the prefix of primary key, we should set MatchPrefix
flag on RuntimeFilterSpec

@mergify mergify Bot added the kind/bug Something isn't working label Mar 29, 2024
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Mar 29, 2024
@matrix-meow

Copy link
Copy Markdown
Contributor

@aunjgr Thanks for your contributions!

Pull Request Review:

Title:

The title of the pull request is clear and concise, indicating that the purpose of the changes is to fix an issue related to the runtime filter using prefix match when necessary.

Body:

The body of the pull request provides essential information about the type of PR (BUG), the specific issue being addressed (issue #15196), and the reason for the changes, which is to set the MatchPrefix flag on RuntimeFilterSpec when joined columns are the prefix of the primary key.

Changes:

  1. In explain_node.go:

    • Added a condition to check if MatchPrefix is true and append "Match Prefix" to the buffer if so. This change seems appropriate for displaying additional information in the output.
  2. In runtime_filter.go:

    • Added MatchPrefix field to RuntimeFilterSpec struct with a condition to set it based on whether the count of columns is less than the length of primary key columns.
    • Similar changes made in another block of code within the same file.

Feedback and Suggestions for Improvement:

  1. Consistency in Naming Convention:

    • Ensure consistent naming conventions are followed throughout the codebase. For example, in runtime_filter.go, the field MatchPrefix is camel case, while in explain_node.go, "Match Prefix" is used with a space. It's better to maintain consistency, either by using camel case or underscore for naming.
  2. Code Optimization:

    • Consider refactoring the code to avoid duplication. Since the same logic for setting MatchPrefix is used in multiple places in runtime_filter.go, it might be beneficial to extract this logic into a separate function to improve code readability and maintainability.
  3. Security Concerns:

    • Ensure that the addition of the MatchPrefix flag does not introduce any security vulnerabilities, especially if it affects filtering or querying sensitive data. Perform thorough testing to validate the behavior and security implications of this change.
  4. Documentation:

    • It would be helpful to update relevant documentation or comments to explain the purpose of the MatchPrefix flag and how it impacts the runtime filter behavior. This will assist other developers in understanding the code and its intended functionality.
  5. Testing:

    • Verify that the changes made in the pull request are covered by appropriate unit tests to ensure that the new functionality works as expected and does not introduce regressions.

By addressing the points mentioned above, the codebase can be improved in terms of consistency, maintainability, and security. Additionally, thorough testing and documentation will help in ensuring the reliability and clarity of the implemented changes.

@mergify
mergify Bot merged commit 908a7ea into matrixorigin:main Mar 29, 2024
@aunjgr
aunjgr deleted the runtime_filter branch April 3, 2024 09:21
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
…15233)

if joined columns are the prefix of primary key, we should set MatchPrefix
flag on RuntimeFilterSpec

Approved by: @ouyuanning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants