Skip to content

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

Merged
mergify[bot] merged 3 commits intostoneatom:stonedb-5.7-devfrom
hustjieke:fix_incorrect_result_with_between_and_issue1332
Mar 17, 2023
Merged

fix(core): incorrect result when execute sql with between | > or < in or not in #1332#1393
mergify[bot] merged 3 commits intostoneatom:stonedb-5.7-devfrom
hustjieke:fix_incorrect_result_with_between_and_issue1332

Conversation

@hustjieke
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@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