Skip to content

[fix](cache) fix same sql return wrong result when switch database with use db and enable sql cache - #44782

Merged
morningman merged 2 commits into
apache:masterfrom
htyoung:nereids-sql-cache
Nov 30, 2024
Merged

[fix](cache) fix same sql return wrong result when switch database with use db and enable sql cache#44782
morningman merged 2 commits into
apache:masterfrom
htyoung:nereids-sql-cache

Conversation

@htyoung

@htyounghtyoung commented Nov 29, 2024

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

It will return wrong result when running same sql in different db with enable_sql_cache=true

for example, the db1 and db2 has the same table tbl but the data are not equals,
if execute the below sql in db1 and cache the result, then execute it in db2, it will return the wrong result

selectcount(*) from tbl

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@doris-robot

Copy link
Copy Markdown

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@htyoung

Copy link
Copy Markdown
ContributorAuthor

run build all

@924060929

Copy link
Copy Markdown
Contributor

run buildall

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actionsgithub-actionsBot added approved Indicates a PR has been approved by one committer. reviewed labels Nov 29, 2024
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@morningmanmorningman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@morningman
morningman merged commit ea2a21d into apache:masterNov 30, 2024
924060929 pushed a commit that referenced this pull request Dec 2, 2024
…th use db and enable sql cache (#44782) (#44852)
It will return wrong result when running same sql in different db with `enable_sql_cache=true`
for example, the `db1` and `db2` has the same table `tbl` but the data are not equals, if execute the below sql in `db1` and cache the result, then execute it in `db2`, it will return the wrong result
```sql
select count(*) from tbl
```
@yiguoleiyiguolei mentioned this pull request Jan 19, 2025
@gavinchougavinchou mentioned this pull request Feb 18, 2025
HappenLee pushed a commit to HappenLee/incubator-doris that referenced this pull request Apr 24, 2026
…th `use db` and enable sql cache (apache#44782)
### What problem does this PR solve?
It will return wrong result when running same sql in different db with
`enable_sql_cache=true`
for example, the `db1` and `db2` has the same table `tbl` but the data
are not equals,
if execute the below sql in `db1` and cache the result, then execute it
in `db2`, it will return the wrong result
```sql
select count(*) from tbl
```
Co-authored-by: tongyang.han <tongyang.han@jiduauto.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/2.1.8-mergeddev/3.0.4-mergedreviewedusercaseImportant user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@htyoung@doris-robot@924060929@morningman