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

Change ElementProps acquisition to getInstance #6549

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

6ar8nas
Copy link
Contributor

@6ar8nas 6ar8nas commented Mar 25, 2024

This changes how we fetch ElementProps from the nativeDB. It allows bypassing the creation of a DgnElement on the native side and various json mapping adapters, which should result in both more accurate DB data representation and in some cases better Elements API performance (as explained in iTwin/imodel-native#782) by using InstanceReader for converting the data straight to an already parsed object.

To support this, a mapping function has been drafted that would allow all consuming applications to use the getInstance without the need to match the JSON representation to the accurate ElementProps extending interface.

Closes iTwin/itwinjs-backlog#1153

@6ar8nas 6ar8nas marked this pull request as ready for review March 25, 2024 09:39
@6ar8nas 6ar8nas requested a review from a team as a code owner March 25, 2024 09:39
@6ar8nas 6ar8nas requested review from rschili and khanaffan March 25, 2024 09:39
@pmconne
Copy link
Member

pmconne commented Mar 25, 2024

iModel-native PR: iTwin/imodel-native#688

Instructions for correctly linking your PRs. Don't include "PR", and I'm not sure if it's case-sensitive.

@6ar8nas
Copy link
Contributor Author

6ar8nas commented Mar 25, 2024

/azp run iTwin.js

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@6ar8nas 6ar8nas marked this pull request as draft March 27, 2024 10:41
@6ar8nas
Copy link
Contributor Author

6ar8nas commented Jul 8, 2024

Currently blocked by iTwin/itwinjs-backlog#1162

@6ar8nas 6ar8nas changed the title Change ElementProps acquisition to a prepared statement query Change ElementProps acquisition to getInstance Jul 10, 2024
@6ar8nas
Copy link
Contributor Author

6ar8nas commented Jul 25, 2024

more accurate DB data representation

Can you be more specific?

We would be returning data as stored in our database without layers of further mapping on imodel-native side. This would move the business/itwinjs-core logic from imodel-native to itwinjs-core itself and get the data straight from the DB without all of those adaptors.

This would only be the first part of similar efforts, with insert/update to follow thereafter, ultimately aiming to use the imodel-native data objects as the DTOs without the need to always map all of the data stored in the database to an itwinjs-core interface on imodel-native side already.

considerably better Elements API performance

Have you measured this?

iTwin/imodel-native#782 has measured it with the improvement in big actually used datasets varying between -8% and +91%.

@pmconne
Copy link
Member

pmconne commented Jul 26, 2024

It allows bypassing the creation of a DgnElement on the native side and various json mapping adapters, which should result in both more accurate DB data representation

Have you verified the "more accurate representation" claim? Are you taking into account data fix-up/normalization that occurs during element loading such as iTwin/imodel-native#820 or this?

@6ar8nas
Copy link
Contributor Author

6ar8nas commented Aug 9, 2024

It allows bypassing the creation of a DgnElement on the native side and various json mapping adapters, which should result in both more accurate DB data representation

Have you verified the "more accurate representation" claim? Are you taking into account data fix-up/normalization that occurs during element loading such as iTwin/imodel-native#820 or this?

We are taking that into account. This just changes the mapping place from C++ backend, to an itwinjs-core/common function, as per the second link, that's needed in a restricted format only in frontend.

@MichaelSwigerAtBentley MichaelSwigerAtBentley marked this pull request as ready for review January 30, 2025 18:14
@MichaelSwigerAtBentley
Copy link
Contributor

@ColinKerr @khanaffan The new tryGetElementJson() logic does not seem to be returning null valued iModel Element Addresses. Is this expected behavior or a regression? There is a test failing that expects a null valued address to be returned.

@MichaelSwigerAtBentley
Copy link
Contributor

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.

6 participants