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

Direct relations list fix #946

Merged
merged 38 commits into from
Jul 10, 2024
Merged

Conversation

Jacob-Eliat-Eliat
Copy link
Contributor

@Jacob-Eliat-Eliat Jacob-Eliat-Eliat commented Jun 28, 2024

Changes:

  • Cosmetic: creating a method "getListPropAsSeq" to handle parsing of a row into a list The method is generic and can parse into any type, but I decided to use it to replace the code that was there in place, so I parse into whatever it was first parsed into before. This was done because this piece of code was repeated for each possible list property.

  • Cosmetic: dealing with number parsing in a generic way. There were hundreds of lines of code dedicated to parsing numbers and the way they all worked was to parse like this: => any => string => bigint => specific type. I decided to constrain my change to just code deduplication for now, so I created a second order function that takes the final transformation bigint => specific type and does everything.

  • Cosmetic: I deleted the if p.isList in all cases of the list handling, and the opposite in the non-list handling because we already test this before entering the method.

  • Cosmetic/Functional: I moved the parsing of DirectRelations from happening before the flow separation into lists to happening inside it. So now non-list direct relations are handled in the "toInstancePropertyValueOfNonList" whereas before they were a separate case

  • Functional: I added handling of DirectRelations in toInstancePropertyValueOfList For that I reworked extractDirectRelationReferenceFromStruct and I added the method tryAsDirectNodeRelationList

In the end that's not a lot of functional changes, but it was a bit messy to figure out how it works and how the tests should actually work!

Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 67.02128% with 31 lines in your changes missing coverage. Please review.

Project coverage is 81.12%. Comparing base (3928266) to head (6a46af4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #946      +/-   ##
==========================================
+ Coverage   80.85%   81.12%   +0.26%     
==========================================
  Files          46       46              
  Lines        3087     3046      -41     
  Branches      120      117       -3     
==========================================
- Hits         2496     2471      -25     
+ Misses        591      575      -16     
Files Coverage Δ
...nite/spark/v1/FlexibleDataModelRelationUtils.scala 72.05% <67.02%> (+1.11%) ⬆️

@dmivankov
Copy link
Contributor

Haven't read the bulk of dms change part, but so far changes are dms-only, old tests pass and one new is added so looks good so far 🙂 but will try to read through the main part too

@dmivankov dmivankov requested a review from a team July 9, 2024 13:07
@Jacob-Eliat-Eliat
Copy link
Contributor Author

Haven't read the bulk of dms change part, but so far changes are dms-only, old tests pass and one new is added so looks good so far 🙂 but will try to read through the main part too

most of it is just cleanup/code deduplication, the actual changes needed for this were pretty small, but I had some trouble understanding the existing code correctly!

@dmivankov
Copy link
Contributor

the actual changes needed for this were pretty small

could you point to a summary or place in diff? Looking at commits in the PR there is some separation of changes but a bit too many to easily split into cosmetic&refactor vs the fix

@Jacob-Eliat-Eliat
Copy link
Contributor Author

the actual changes needed for this were pretty small

could you point to a summary or place in diff? Looking at commits in the PR there is some separation of changes but a bit too many to easily split into cosmetic&refactor vs the fix

Will do in the PR header. Yeah sorry about the number of commits, lots of them are just scalafmt and stuff like that as well ^^

Copy link
Contributor

@dmivankov dmivankov left a comment

Choose a reason for hiding this comment

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

some small notes for the non-fix part

….scala

Co-authored-by: Dmitry Ivankov <dmitry.ivankov@cognite.com>
….scala

Co-authored-by: Dmitry Ivankov <dmitry.ivankov@cognite.com>
….scala

Co-authored-by: Dmitry Ivankov <dmitry.ivankov@cognite.com>
@Jacob-Eliat-Eliat Jacob-Eliat-Eliat merged commit bfeba18 into master Jul 10, 2024
3 checks passed
@Jacob-Eliat-Eliat Jacob-Eliat-Eliat deleted the fix-datasource-transformation branch July 10, 2024 09:29
This pull request was closed.
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.

2 participants