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

Add 'returnDocumentResponses' for "insertMany" #1161

Merged
merged 32 commits into from
Jun 18, 2024

Conversation

tatu-at-datastax
Copy link
Contributor

What this PR does:

Adds support for requesting returning of doc ids of successful and failed inserts with "insertMany" command

Which issue(s) this PR fixes:
N/A

Checklist

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

@tatu-at-datastax tatu-at-datastax marked this pull request as ready for review June 12, 2024 23:29
@tatu-at-datastax tatu-at-datastax requested a review from a team as a code owner June 12, 2024 23:29
@tatu-at-datastax tatu-at-datastax changed the title (WIP) Add 'returnDocumentPositions' for "insertMany" Add 'returnDocumentPositions' for "insertMany" Jun 12, 2024
@tatu-at-datastax tatu-at-datastax changed the title Add 'returnDocumentPositions' for "insertMany" Add 'returnDocumentResponses' for "insertMany" Jun 17, 2024
@tatu-at-datastax tatu-at-datastax marked this pull request as draft June 17, 2024 16:36
@@ -46,7 +46,7 @@ public record CommandResult(
nullable = true)
})
Map<CommandStatus, Object> status,
@Schema(nullable = true) List<Error> errors) {
@JsonInclude(JsonInclude.Include.NON_EMPTY) @Schema(nullable = true) List<Error> errors) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding this so that both null and [ ] values are skipped (not just nulls)

@tatu-at-datastax tatu-at-datastax marked this pull request as ready for review June 18, 2024 15:34
}

private static CommandResult.Error getError(DocumentId documentId, Throwable throwable) {
String message =
"Failed to insert document with _id %s: %s".formatted(documentId, throwable.getMessage());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code was not being used, not sure why it was there (ThrowableToErrorMapper handles this logic)

@@ -18,12 +16,10 @@
public class InsertManyCommandResolver implements CommandResolver<InsertManyCommand> {

private final Shredder shredder;
private final ObjectMapper objectMapper;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was not being used, removed.

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 69e93fa into main Jun 18, 2024
4 checks passed
@tatu-at-datastax tatu-at-datastax deleted the tatu/c2-3382-return-doc-positions branch June 18, 2024 17:15
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.

3 participants