Skip to content

Conversation

@suddendust
Copy link
Contributor

PR: Implement Delete Operations for Flat PostgreSQL Collections

Methods Implemented

  • delete(Key key) - Delete single document by primary key
  • delete(Set keys) - Bulk delete by multiple keys
  • delete(Filter filter) - Delete using legacy Filter (delegates to new API)
  • delete(query.Filter filter) - Delete using new query Filter API
  • deleteAll() - Delete all documents from collection

Why Deprecate delete(Filter filter)?

The legacy Filter class uses hardcoded JSONB document access patterns that don't work with flat collections where fields are direct PostgreSQL columns. The parsing logic assumes nested document structure.

Why New delete(query.Filter filter)?

The new query.Filter wraps FilterTypeExpression which:

  • Works with the v1 PostgresQueryParser that supports pluggable field transformers
  • Uses FlatPostgresFieldTransformer to correctly resolve field names to PostgreSQL columns
  • Properly handles nested JSONB paths via JsonIdentifierExpression
  • Maintains consistency with other query operations that already use this API

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 86.20690% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.50%. Comparing base (faeac22) to head (3dad7d2).

Files with missing lines Patch % Lines
...documentstore/postgres/FlatPostgresCollection.java 87.71% 5 Missing and 2 partials ⚠️
.../org/hypertrace/core/documentstore/Collection.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #270      +/-   ##
============================================
+ Coverage     80.44%   80.50%   +0.05%     
  Complexity     1396     1396              
============================================
  Files           239      239              
  Lines          6598     6652      +54     
  Branches        605      607       +2     
============================================
+ Hits           5308     5355      +47     
- Misses          888      893       +5     
- Partials        402      404       +2     
Flag Coverage Δ
integration 80.50% <86.20%> (+0.05%) ⬆️
unit 55.02% <0.00%> (-0.46%) ⬇️

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.

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.

1 participant