Skip to content

Conversation

@suddendust
Copy link
Contributor

Description

This PR implements Collection#bulkUpsert for FlatPostgresCollection.

Testing

Added integration tests

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

Note that based on the MissingColumnStrategy, we either skip the corresponding docs (and), or just skip those columns, or throw an exception.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 84.84848% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.52%. Comparing base (faeac22) to head (beafd9f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...documentstore/postgres/FlatPostgresCollection.java 84.84% 12 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #269      +/-   ##
============================================
+ Coverage     80.44%   80.52%   +0.07%     
  Complexity     1396     1396              
============================================
  Files           239      239              
  Lines          6598     6695      +97     
  Branches        605      615      +10     
============================================
+ Hits           5308     5391      +83     
- Misses          888      900      +12     
- Partials        402      404       +2     
Flag Coverage Δ
integration 80.52% <84.84%> (+0.07%) ⬆️
unit 54.66% <0.00%> (-0.81%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

LOGGER.error("SQLException in bulkUpsertAndReturnOlderDocuments. query: {}", selectQuery, e);
if (connection != null) {
try {
connection.close();

Choose a reason for hiding this comment

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

what about closing prepared statement here? Also, can we try reducing the complexity of this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Closing a connection would close the PS associated with it too. Yes, refactored this method.

@puneet-traceable
Copy link

LGTM

@suddendust suddendust changed the title Implement bulkUpdate for flat collections Implement bulkUpsert for flat collections Feb 5, 2026
public boolean bulkUpsert(Map<Key, Document> documents) {
throw new UnsupportedOperationException(WRITE_NOT_SUPPORTED);
if (documents == null || documents.isEmpty()) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Good place to log?

@suresh-prakash suresh-prakash merged commit 6a2b05d into hypertrace:main Feb 5, 2026
6 checks passed
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