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

H-3326: Use properties path to sort/filter by property metadata #5160

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

The propertyMetadata query path had the issue that it looked into implementation details. Instead, we want to use the properties path.

🔍 What does this change?

  • Remove propertyMetadata as possible query token
  • Change the possible tokens for properties to only BaseUrls (properties), numbers (indices), "convert", and "dataTypeId". The former two is to look into the property object itself, the last two will convert the path to a property-metadata path. The convert tag will use the canonical value stored in the database (for now), the dataTypeId tag will return the stored data type.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • Previously, it was possible to look into opaque objects and arrays. This PR removes this feature. If we ever need this, we can think about adding another tag (such as "value") which loads the value instead.

🐾 Next steps

  • Allow conversion of parameter

🛡 What tests cover this?

Mainly the doc-tests and http tests.

@TimDiekmann TimDiekmann added this pull request to the merge queue Sep 16, 2024
Merged via the queue into main with commit d131383 Sep 16, 2024
81 of 82 checks passed
@TimDiekmann TimDiekmann deleted the t/h-3326-support-datatypeid-in-query-paths branch September 16, 2024 18:07
Copy link
Contributor

Benchmark results

@rust/graph-benches – Integrations

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 10 entities $$31.6 \mathrm{ms} \pm 243 \mathrm{μs}\left({\color{lightgreen}-41.021 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$268 \mathrm{ms} \pm 2.05 \mathrm{ms}\left({\color{gray}-2.192 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$20.3 \mathrm{ms} \pm 199 \mathrm{μs}\left({\color{gray}-0.546 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$72.4 \mathrm{ms} \pm 362 \mathrm{μs}\left({\color{gray}-2.597 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$25.0 \mathrm{ms} \pm 119 \mathrm{μs}\left({\color{gray}-0.968 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 10 entities $$2.09 \mathrm{ms} \pm 12.5 \mathrm{μs}\left({\color{gray}-0.308 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$4.02 \mathrm{ms} \pm 28.4 \mathrm{μs}\left({\color{gray}2.12 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.89 \mathrm{ms} \pm 8.68 \mathrm{μs}\left({\color{gray}-0.858 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$2.74 \mathrm{ms} \pm 94.2 \mathrm{μs}\left({\color{lightgreen}-7.490 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.90 \mathrm{ms} \pm 9.63 \mathrm{μs}\left({\color{gray}-0.780 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 10 entities $$1.87 \mathrm{ms} \pm 7.36 \mathrm{μs}\left({\color{gray}-0.150 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.04 \mathrm{ms} \pm 10.8 \mathrm{μs}\left({\color{gray}0.579 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$2.80 \mathrm{ms} \pm 14.4 \mathrm{μs}\left({\color{gray}0.287 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.86 \mathrm{ms} \pm 7.51 \mathrm{μs}\left({\color{gray}-1.014 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$13.3 \mathrm{ms} \pm 135 \mathrm{μs}\left({\color{gray}0.555 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579 $$1.42 \mathrm{ms} \pm 8.49 \mathrm{μs}\left({\color{gray}1.09 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$16.9 \mathrm{ms} \pm 220 \mathrm{μs}\left({\color{red}5.87 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.1 \mathrm{ms} \pm 189 \mathrm{μs}\left({\color{gray}-3.576 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$16.6 \mathrm{ms} \pm 186 \mathrm{μs}\left({\color{gray}1.63 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$17.6 \mathrm{ms} \pm 203 \mathrm{μs}\left({\color{gray}3.88 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$15.7 \mathrm{ms} \pm 209 \mathrm{μs}\left({\color{gray}-2.527 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$15.8 \mathrm{ms} \pm 171 \mathrm{μs}\left({\color{lightgreen}-6.398 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$17.0 \mathrm{ms} \pm 251 \mathrm{μs}\left({\color{gray}1.21 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$17.4 \mathrm{ms} \pm 222 \mathrm{μs}\left({\color{lightgreen}-30.122 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$15.7 \mathrm{ms} \pm 173 \mathrm{μs}\left({\color{gray}-0.577 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$102 \mathrm{ms} \pm 669 \mathrm{μs}\left({\color{gray}1.11 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$80.8 \mathrm{ms} \pm 489 \mathrm{μs}\left({\color{gray}0.817 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$43.0 \mathrm{ms} \pm 266 \mathrm{μs}\left({\color{gray}0.459 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$91.1 \mathrm{ms} \pm 518 \mathrm{μs}\left({\color{gray}-0.716 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$96.3 \mathrm{ms} \pm 625 \mathrm{μs}\left({\color{gray}-0.063 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$109 \mathrm{ms} \pm 685 \mathrm{μs}\left({\color{gray}1.81 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$58.4 \mathrm{ms} \pm 302 \mathrm{μs}\left({\color{gray}-2.084 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$45.1 \mathrm{ms} \pm 323 \mathrm{μs}\left({\color{gray}3.35 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$40.4 \mathrm{ms} \pm 322 \mathrm{μs}\left({\color{gray}1.95 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$51.1 \mathrm{ms} \pm 321 \mathrm{μs}\left({\color{gray}2.44 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$54.7 \mathrm{ms} \pm 350 \mathrm{μs}\left({\color{gray}0.099 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$67.3 \mathrm{ms} \pm 375 \mathrm{μs}\left({\color{gray}-0.558 \mathrm{\%}}\right) $$ Flame Graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-graph area/apps area/tests New or updated tests type/eng > backend Owned by the @backend team
Development

Successfully merging this pull request may close these issues.

2 participants