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 multi-value sort for unsigned long #16732

Merged
merged 13 commits into from
Jan 10, 2025

Conversation

bugmakerrrrrr
Copy link
Contributor

Description

Fix #16698

Related Issues

Resolves #16698

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@bugmakerrrrrr
Copy link
Contributor Author

@reta ping :)

Copy link
Contributor

❌ Gradle check result for 82c08dd: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@reta
Copy link
Collaborator

reta commented Nov 27, 2024

@reta ping :)

My apologies @bugmakerrrrrr , I haven't had time to look at the issue yet, I believe your approach is viable but there could be a simpler option to fall back to doubles for unsigned long, I will check it shortly and get back to you. Thanks !

@bugmakerrrrrr
Copy link
Contributor Author

@reta Thank you for your reply. I actually considered the double method, but I think there are two issues with it. One is that the maximum integer value that double can accurately represent is 2^53, if we use double to handle unsigned long, there may be loss of precision and we get wrong result. The other is that doc values in a document is possible unsorted, so we still need to special handling of min/max/median. Please correct me if I misunderstood something.

Copy link
Contributor

❌ Gradle check result for 29c7e46: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 257ee07: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 257ee07: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@bugmakerrrrrr
Copy link
Contributor Author

@reta Sorry for disturbing you during the holidays. Thank you for sharing this update. I like the idea, it's more clean and consistent. I'll review the latest change soon. Hope you have a wonderful holiday.

@reta
Copy link
Collaborator

reta commented Dec 20, 2024

@reta Sorry for disturbing you during the holidays.

Thanks @bugmakerrrrrr , no worries at all, just a bit difficult to find the time, happy holidays to you as well!

@rishabh6788
Copy link
Contributor

@bugmakerrrrrr Do you think it is a good idea to run a quick benchmark as well to check if there is any impact on the query performance as well? If yes, check out https://github.com/opensearch-project/OpenSearch/blob/main/PERFORMANCE_BENCHMARKS.md, id_5 will be good candidate.

reta added 2 commits December 20, 2024 17:02
Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: Andriy Redko <[email protected]>
Copy link
Contributor

❌ Gradle check result for cfbf241: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

…ericUnsignedLongValues (as per review comments)

Signed-off-by: Andriy Redko <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 2, 2025

❌ Gradle check result for bbb1858: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Jan 2, 2025

❌ Gradle check result for bbb1858: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@bugmakerrrrrr
Copy link
Contributor Author

@bugmakerrrrrr Do you think it is a good idea to run a quick benchmark as well to check if there is any impact on the query performance as well?

I don't think so, this is simply a bugfix, not an enhancement :)

@bugmakerrrrrr
Copy link
Contributor Author

@reta I have an additional concern. Users may specify the numeric_type option for the sort field in their request, or scripts may depend on the ordered values obtained from the field data. It may be necessary for us to sort the values before returning the document values.(just like we did in SortingBinaryDocValues)

@reta
Copy link
Collaborator

reta commented Jan 6, 2025

@reta I have an additional concern. Users may specify the numeric_type option for the sort field in their request, or scripts may depend on the ordered values obtained from the field data. It may be necessary for us to sort the values before returning the document values.(just like we did in SortingBinaryDocValues)

Thanks @bugmakerrrrrr , it would make sense very likely, I think we could make it a separate issue / fix, right? (since it seems to be not related to multivalues).

@bugmakerrrrrr
Copy link
Contributor Author

@reta I have an additional concern. Users may specify the numeric_type option for the sort field in their request, or scripts may depend on the ordered values obtained from the field data. It may be necessary for us to sort the values before returning the document values.(just like we did in SortingBinaryDocValues)

Thanks @bugmakerrrrrr , it would make sense very likely, I think we could make it a separate issue / fix, right? (since it seems to be not related to multivalues).

@reta Certainly, I will create a new issue to deal with this.

@reta
Copy link
Collaborator

reta commented Jan 6, 2025

❌ Gradle check result for bbb1858: FAILURE

org.opensearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT.test {yaml=search/260_sort_unsigned_long/test sorting against unsigned_long only fields}

@bugmakerrrrrr these failures should be addressed by #16881 (whatever the fix would be), correct? thank you

@bugmakerrrrrr
Copy link
Contributor Author

❌ Gradle check result for bbb1858: FAILURE

org.opensearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT.test {yaml=search/260_sort_unsigned_long/test sorting against unsigned_long only fields}

@bugmakerrrrrr these failures should be addressed by #16881 (whatever the fix would be), correct? thank you

@reta Yes

Copy link
Contributor

❕ Gradle check result for 9048c7c: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreIT.testCloseIndexWithNoOpSyncAndFlushForSyncTranslog

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@reta reta merged commit f6dc4a6 into opensearch-project:main Jan 10, 2025
37 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 10, 2025
* Fix multi-value sort for unsigned long

Signed-off-by: panguixin <[email protected]>

* Add initial rest-api-spec tests

Signed-off-by: Andriy Redko <[email protected]>

* add more rest tests

Signed-off-by: panguixin <[email protected]>

* fix

Signed-off-by: panguixin <[email protected]>

* fix

Signed-off-by: panguixin <[email protected]>

* Extend MultiValueMode with dedicated support of unsigned_long doc values

Signed-off-by: Andriy Redko <[email protected]>

* Add CHANGELOG.md, minor cleanups

Signed-off-by: Andriy Redko <[email protected]>

* Correct the license headers

Signed-off-by: Andriy Redko <[email protected]>

* Correct the @publicapi version

Signed-off-by: Andriy Redko <[email protected]>

* Replace SingletonSortedNumericUnsignedLongValues with LongToSortedNumericUnsignedLongValues (as per review comments)

Signed-off-by: Andriy Redko <[email protected]>

---------

Signed-off-by: panguixin <[email protected]>
Signed-off-by: Andriy Redko <[email protected]>
Co-authored-by: Andriy Redko <[email protected]>
(cherry picked from commit f6dc4a6)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
reta added a commit that referenced this pull request Jan 10, 2025
* Fix multi-value sort for unsigned long



* Add initial rest-api-spec tests



* add more rest tests



* fix



* fix



* Extend MultiValueMode with dedicated support of unsigned_long doc values



* Add CHANGELOG.md, minor cleanups



* Correct the license headers



* Correct the @publicapi version



* Replace SingletonSortedNumericUnsignedLongValues with LongToSortedNumericUnsignedLongValues (as per review comments)



---------




(cherry picked from commit f6dc4a6)

Signed-off-by: panguixin <[email protected]>
Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andriy Redko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch bug Something isn't working Search Search query, autocomplete ...etc v2.19.0 Issues and PRs related to version 2.19.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort on multi-value unsigned long field is incorrect
3 participants