Skip to content
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

fix(core): incorrect result when execute sql with between | > or < in or not in #1332 #1393

Conversation

hustjieke
Copy link
Collaborator

@hustjieke hustjieke commented Mar 15, 2023

Summary about this PR

In tianmu, pack_int uses uint64_t to store level 2 encode, ranges from [0, uint64_max], so when filter data, the conditions(in code named "pv1, pv2") should be also changed to level 2 encode. e.g.: stored value = actually value - min
uint64 upv1 = pv1 - local_min;
uint64 upv2 = local_max - local_min;
the fixes mainly in funciont "EvaluatePack_BetweenInt".

For not int (value): when value < local_min, it should be a special case. Only used when rough check = RS_ALL(no numeric data matchs), but table has null, rough check will be reset RS_SOME.

Issue Number: close #1332

Tests Check List

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Changelog

  • New Feature
  • Bug Fix
  • Performance Improvement
  • Build/Testing/CI/CD
  • Documentation
  • Not for changelog (changelog entry is not required)

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features

…in or not in stoneatom#1332

[summary]
In tianmu, pack_int uses uint64_t to store level 2 encode, ranges from [0, uint64_max], so
when filter data, the conditions(in code named "pv1, pv2") should be also changed to level 2 encode.
e.g.: stored value = actually value - min
uint64 upv1 = pv1 - local_min;
uint64 upv2 = local_max - local_min;
the fixes mainly in funciont "EvaluatePack_BetweenInt".

For not int (value): when value < local_min, it should be a special case.
Only used when rough check = RS_ALL(no numeric data matchs), but table has null, rough check will be reset RS_SOME.
@mergify
Copy link
Contributor

mergify bot commented Mar 15, 2023

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the PR-bug bug for pull request label Mar 15, 2023
@wisehead wisehead self-requested a review March 16, 2023 08:04
Copy link
Collaborator

@wisehead wisehead left a comment

Choose a reason for hiding this comment

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

reviewed the code hustjieke via tencent meeting, looks good to me.

mysql-test/suite/tianmu/t/select_from.test Outdated Show resolved Hide resolved
mysql-test/suite/tianmu/t/select_from.test Outdated Show resolved Hide resolved
storage/tianmu/core/tianmu_attr_exqp.cpp Show resolved Hide resolved
storage/tianmu/core/tianmu_attr_exqp.cpp Outdated Show resolved Hide resolved
storage/tianmu/core/tianmu_attr_exqp.cpp Show resolved Hide resolved
storage/tianmu/core/tianmu_attr_exqp.cpp Outdated Show resolved Hide resolved
storage/tianmu/core/tianmu_attr_exqp.cpp Outdated Show resolved Hide resolved
@mergify mergify bot merged commit 3ddea31 into stoneatom:stonedb-5.7-dev Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-bug bug for pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: insert bigint data close to the boundary range, the result set is wrong
3 participants