SubDocUpdate Parsers for FlatPostgresCollection#279
SubDocUpdate Parsers for FlatPostgresCollection#279suddendust wants to merge 14 commits intohypertrace:mainfrom
Conversation
…rite_subDocOperatorRemainingParsers
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #279 +/- ##
============================================
+ Coverage 81.01% 81.19% +0.18%
- Complexity 1446 1459 +13
============================================
Files 241 238 -3
Lines 6979 6977 -2
Branches 648 653 +5
============================================
+ Hits 5654 5665 +11
+ Misses 907 895 -12
+ Partials 418 417 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ResultSet rs = ps.executeQuery()) { | ||
| assertTrue(rs.next()); | ||
| assertEquals(999, rs.getInt("price")); | ||
| assertEquals(15, rs.getInt("price")); |
There was a problem hiding this comment.
Are these changes intentional?
There was a problem hiding this comment.
Yes, if you look at the diff, the earlier code had List.of(SubDocumentUpdate.of("price", 999));, so I was asserting on 999. Now, it has this:
List.of(
SubDocumentUpdate.builder()
.subDocument("price")
.operator(UpdateOperator.ADD)
.subDocumentValue(
org.hypertrace.core.documentstore.model.subdoc.SubDocumentValue.of(5))
.build());
So, I am asserting on 5.
| } | ||
|
|
||
| /** Returns the PostgreSQL type cast for the column type. */ | ||
| private String getPostgresTypeCast(PostgresDataType columnType) { |
There was a problem hiding this comment.
Would it be helpful to have it in a common class and use it for any numeric operators?
There was a problem hiding this comment.
I think so, we might be doing these casts at multiple places. Will refactor if this is the case.
There was a problem hiding this comment.
@suresh-prakash Refactored this. This touched 2 files in the query layer but I think it's okay.
Description
This PR implements sub-doc update parsers for flat collections.
Testing
[x] Added integration tests to validate the behaviour on PG.
[x] Added Mongo/PG compatibility test.
Checklist: