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 #572: add ITs to verify empty JSON Object is valid for sort of find/findOne, fix as necessary #576

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

tatu-at-datastax
Copy link
Contributor

What this PR does:

Adds 2 ITs for find()/findOne()

Which issue(s) this PR fixes:
Fixes #572

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@tatu-at-datastax tatu-at-datastax self-assigned this Oct 20, 2023
@tatu-at-datastax tatu-at-datastax requested a review from a team as a code owner October 20, 2023 21:06
@tatu-at-datastax tatu-at-datastax force-pushed the tatu/572-allow-empty-object-for-sort branch from 61a28c7 to 1f8d473 Compare October 23, 2023 16:18
@tatu-at-datastax tatu-at-datastax changed the title Fix #572: add Integration Tests to verify empty JSON Object is valid for sort of find/findOne Fix #572: add ITs to verify empty JSON Object is valid for sort of find/findOne, fix as necessary Oct 23, 2023
@@ -25,18 +25,15 @@ public record SortClause(@Valid List<SortExpression> sortExpressions) {

public boolean hasVsearchClause() {
return sortExpressions != null
&& sortExpressions.stream()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Problem was that not only is null check needed, but also isEmpty() for specific case of explicitly empty sort.
But we also don't need to create stream() etc as it's a List can just get the first (and only, for vector/vectorize case as no combinations allowed).

@tatu-at-datastax tatu-at-datastax merged commit 69c6037 into main Oct 23, 2023
3 checks passed
@tatu-at-datastax tatu-at-datastax deleted the tatu/572-allow-empty-object-for-sort branch October 23, 2023 17:14
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing of empty JSON Object ({ }) for sort for find and findOne Commands
3 participants