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

Fix for polymorphic fields in SqlMapping #634

Merged
merged 1 commit into from
Sep 14, 2024
Merged

Conversation

milessabin
Copy link
Member

@milessabin milessabin commented Jun 11, 2024

  • The resolution of polymorphic field mappings now takes the runtime context into account properly.
  • All narrowing operations on cursors yield a value in Result allowing mappings to report internal errors for failed discriminators.
  • In SQL mappings, failed discriminators now fail the entire query with an internal error.
  • The TypeCase extractor has been removed because it can't take the context into account.

@milessabin milessabin added bug Something isn't working query compilation labels Jun 11, 2024
@milessabin milessabin self-assigned this Jun 11, 2024
@milessabin milessabin marked this pull request as draft June 11, 2024 17:06
@tpolecat
Copy link
Member

Can you summarize what this change does? It looks like it's causing all of our discriminator predicates to fail.

Copy link
Member

@tpolecat tpolecat left a comment

Choose a reason for hiding this comment

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

👍 this is working fine for us. The problem was on our end and was related to one of the new static methods on ResultT, for which we had a local syntax method with a different type (everything continued to typecheck after the update but some database operations were no longer being executed)

@milessabin
Copy link
Member Author

@tpolecat thanks for the update!

@milessabin
Copy link
Member Author

Rebased.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 86.13861% with 14 lines in your changes missing coverage. Please review.

Project coverage is 75.59%. Comparing base (3a6b7b8) to head (a1dbc5f).
Report is 89 commits behind head on main.

Files with missing lines Patch % Lines
modules/sql/shared/src/main/scala/SqlMapping.scala 88.00% 6 Missing ⚠️
modules/core/src/main/scala/cursor.scala 0.00% 2 Missing ⚠️
modules/core/src/main/scala/mapping.scala 89.47% 2 Missing ⚠️
modules/circe/src/main/scala/circemapping.scala 80.00% 1 Missing ⚠️
modules/core/src/main/scala/queryinterpreter.scala 93.75% 1 Missing ⚠️
modules/core/src/main/scala/valuemapping.scala 80.00% 1 Missing ⚠️
...les/generic/src/main/scala-2/genericmapping2.scala 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #634      +/-   ##
==========================================
+ Coverage   74.22%   75.59%   +1.36%     
==========================================
  Files          32       32              
  Lines        4609     5064     +455     
  Branches     1025     1099      +74     
==========================================
+ Hits         3421     3828     +407     
- Misses       1188     1236      +48     

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

+ The resolution of polymorphic field mappings now takes the runtime
  context into account properly.
+ All narrowing operations on cursors yield a value in Result allowing
  mappings to report internal errors for failed discriminators.
+ In SQL mappings, failed discriminators now fail the entire query with
  an internal error.
+ The TypeCase extractor has been removed because it can't take the
  context into account.
@milessabin milessabin marked this pull request as ready for review September 14, 2024 15:28
@milessabin milessabin merged commit 5df3486 into main Sep 14, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working query compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants