[Draft] Add MongoPostgresWriteConsistencyTest#280
[Draft] Add MongoPostgresWriteConsistencyTest#280suddendust wants to merge 39 commits intohypertrace:mainfrom
Conversation
| } | ||
| break; | ||
|
|
||
| case "float4": |
There was a problem hiding this comment.
Currently for PG, this returns the value as a string. This is not the behaviour in Mongo, so added a fix here. Validated this in the compatibility test.
|
|
||
| @Override | ||
| public String parseNonJsonbField(final UpdateParserInput input) { | ||
| if (!input.isArray()) { |
There was a problem hiding this comment.
Added this check to make this compatible with Mongo.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #280 +/- ##
============================================
- Coverage 81.12% 81.12% -0.01%
- Complexity 1480 1485 +5
============================================
Files 240 240
Lines 7072 7124 +52
Branches 667 674 +7
============================================
+ Hits 5737 5779 +42
- Misses 911 915 +4
- Partials 424 430 +6
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:
|
…setSubDocOp # Conflicts: # document-store/src/integrationTest/java/org/hypertrace/core/documentstore/MongoPostgresWriteConsistencyTest.java # document-store/src/main/java/org/hypertrace/core/documentstore/postgres/update/parser/PostgresSetValueParser.java
| if (isTopLevel && colMeta.isArray() && paramValue != null) { | ||
| Object[] arrayValues = (Object[]) paramValue; | ||
| Array sqlArray = | ||
| connection.createArrayOf(colMeta.getPostgresType().getSqlType(), arrayValues); |
There was a problem hiding this comment.
JDBC can't bind Object[] directly to array columns like TEXT[]. It requires java.sql.Array. So convert the Java array to JDBC Array.
|
@suddendust This is such a big chunk of change in tests, how are you ensuring that you are not changing tests behaviour? |
|
@puneet-traceable So this PR contains changes in two tests:
So you'll find the I now do an At no place any Mongo write tests have been touched. |
| input.getParamsBuilder().addObjectParam(values); | ||
| } else { | ||
| // For scalar columns, use standard value parser (ignore returned JSONB expression) | ||
| input |
There was a problem hiding this comment.
Bit confused here. If the result/return value is ignored, then, why call this in the first place?
This PR adds exhaustive
MongoPostgresWriteConsistencyTestto ensure functional parity b/w Mongo and Postgres write implementations. In addition to this, it also:PostgresResultIteratorWithBasicTypesin whichfloat4/realvalues were cast to strings. So say we have a fieldratingswith is arealfield - It would appear as"4.3"inDocumentinstead of4.3(Mongo behaves correctly so this fix is added for functional compatibility).SETupdate parsers to parse them as a single value.Collection#upsertfor PG. Till now, it returnstrueif a new doc is created,falseif it's updated. This is not inline with the contract or Mongo's behaviour - So now, it returnstrueif it succeeds.