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

POC for deleteOne and deleteMany for tables #1324

Merged
merged 15 commits into from
Aug 13, 2024
Merged

POC for deleteOne and deleteMany for tables #1324

merged 15 commits into from
Aug 13, 2024

Conversation

amorton
Copy link
Contributor

@amorton amorton commented Aug 1, 2024

What this PR does:

Adds a new DeleteTableOperation and re-uses the filter resolving, and resolver framework for tables.

Note: we cannot know the number of records deleted, and we cannot limit the number - unless we validate that the entire PK was supplied. Will check those things when we get to Beta,

Which issue(s) this PR fixes:
Fixes #

Checklist

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

amorton and others added 14 commits July 26, 2024 07:44
Encapsulates behavior for clauses that can be validated and
better supports schema object types.
This PR refactors how we process filters by moving the base class
FilterableResolver that was used by command resolvers to be
standalone class FilterResolver that has CollectionFilterResolver and
TableFilterResolver subclasses. The changes to the resolvers are mostly
to handle this change, other than findOne.

The next part is findOne updated to process the filter for a table. Using
the TableFilterResolver to make filters, which then use the
NativeTypeTableFilter and JSONCodec to map from the types used for JSOn
into what CQL expects.

This is POC work, we then need to expand this to handle all the situations
we expect.
POC to show pushing the projection down how we build the select
and how we build the document from the row.

see OperationProjection
Tis commit changes the InsertTableOperation to use the
same JSONCodec created to process data for a filter to transform the
data from the incoming document into what the driver wants to write
to the CQL column
Expands the JSONCode to support mapping toJSON from the
objects the driver sent, to be used in the projection
refactoring out so we can re-use things in the update command
Continues to refactor how we build a CQL statement using the Java
driver, see the CQLClause and it's subclasses for the structure.

UpdateOneCommandResolver works with tables, creates a
TableUpdateOperation and re-uses the where clause from select.

Only supports the $set and $unset operations for now.
Adds a new DeleteTableOperation and re-uses the filter resolving, and resolver framework for tables.

Note: we cannot know the number of records deleted, and we cannot limit the number - unless we validate that the entire PK was supplied. Will check those things when we get to Beta,
@amorton amorton requested a review from a team as a code owner August 1, 2024 01:39

var statement = delete.build(positionalValues.toArray());

LOGGER.warn("DELETE CQL: {}", delete.asCql());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change to Info or just delete the the log if these are just added for debug purpuse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

def will do once we get out of alpha, there are they to make it easy to see the CQL we are generating

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, left one suggestion

@jeffreyscarpenter
Copy link
Contributor

@amorton what is the status of this?

@amorton amorton merged commit 8664579 into main Aug 13, 2024
3 checks passed
@amorton amorton deleted the ajm/delete-poc branch August 13, 2024 17:45
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.

5 participants