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 findOne/find wrt _id column (actually all filterables) #1359

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

tatu-at-datastax
Copy link
Contributor

What this PR does:

Fixes handling of _id column wrt Find operations: there is something specific about this compared to all other ids (quoted or not)

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

Checklist

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

@tatu-at-datastax tatu-at-datastax self-assigned this Aug 23, 2024
@tatu-at-datastax
Copy link
Contributor Author

Ok, this turns out to be rather difficult to solve: basically FilterClauseDeserializer has quite specific handling for _id (DOC_ID), in:

which creates value type not matched by filter resolved for Tables.

Conceptually it'd be good for deserializer to skip this special handling for Tables, but piping through that information proves difficult given that deserialization is invoked by Quarkus, via type on endpoint.

@tatu-at-datastax tatu-at-datastax marked this pull request as ready for review August 26, 2024 17:52
@tatu-at-datastax tatu-at-datastax requested a review from a team as a code owner August 26, 2024 17:52
(BigDecimal) filterOperation.operand().value()));
(BigDecimal) rhsValue));
} else if (captureExpression.marker() == DYNAMIC_DOCID_GROUP) {
Object actualValue = ((DocumentId) rhsValue).value();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should probably be refactored to avoid duplicating code to create Text/NumberTableFilter.

@tatu-at-datastax tatu-at-datastax changed the title (WIP) Fix findOne/find wrt _id column Fix findOne/find wrt _id column (actually all filterables) Aug 26, 2024
}
} else {
throw new UnsupportedOperationException(
"Unsupported dynamic filter type: " + filterOperation);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is just following the pattern. We can change these to Data API exception later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sorry I missed this one before merging.

Copy link
Contributor

@Yuqi-Du Yuqi-Du left a comment

Choose a reason for hiding this comment

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

LGTM!

@tatu-at-datastax tatu-at-datastax merged commit efc2119 into main Aug 27, 2024
3 checks passed
@tatu-at-datastax tatu-at-datastax deleted the tatu/1357-filter-by-_id branch August 27, 2024 15:19
vkarpov15 added a commit to stargate/stargate-mongoose-sample-apps that referenced this pull request Aug 27, 2024
@vkarpov15
Copy link
Collaborator

I confirmed yesterday that this works in stargate/stargate-mongoose-sample-apps#397

@tatu-at-datastax
Copy link
Contributor Author

Thank you for verifying @vkarpov15 !

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.

Not able to filter by _id with tables
3 participants