Dependent Dimensions (declaration and enforcement) #430
Replies: 2 comments 2 replies
-
Updated Approach 2To enable faster reads, we store the entire graph for each dimension using an adjacency list to represent relations. Additionally, we maintain an immediate parent map to facilitate efficient updates. Graph Representation (Dimension A Example)
Adding a New Dependency (G → E)
Cycle Detection Resolving Dependencies
After adding G as a dependency of E, the updated graph becomes:
Propagating Updates to Immediate Parents Immediate Parent of E: [C]
Handling Multiple Immediate Parents This approach ensures fast reads and prevents cycles. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1st approach
Add the column in Dimensions table ( dependent_dimensions -> Array )
Store the immediate dependents in the array
Say
Store in this way
Dimensions Dependent Dimension ([Text])
A [B]
B [C, D]
C [D]
Retrieval -> O(N), N being the number of nodes in the dependency tree
Update -> O(N) overall
O(N) for cycle detection
O(1) for updating a dependent
2nd approach
Add the column in Dimensions table ( dependent_dimensions -> JSON )
Store the whole dependency tree for all the dimensions
Dimensions Dependent Dimension (JSON)
A store
For B store
Retrieval -> O(1), As we are storing the whole dependency tree for all the dimensions
Update -> O(N) overall
O(N) for cycle detection
O(N) for updating a dependent, As we'll have to update the dependency tree for all the parent dimensions
3rd Approach
Make a new table for storing all the relations
Retrieval -> O(N), As we'll need to go through the all the entries
Update -> O(N) overall
O(1) for cycle detection, As we can directly find the relation between them exists or not
O(N) for updating a dependent, As we'll have to update with new entries showing all the transitive dependency
between the new dimension and all the parent dimensions
4th Approach
Mix of the 2nd approach and 3rd approach
Keep the new table for the relations and store the dependency tree to make the reads faster, but the updation still suffers a bit
Retrieval -> O(1), As we'll find the whole dependency tree in the dimensions table.
Update -> O(N) overall
O(1) for cycle detection, As we can directly find the relation between them exists or not
O(N) for updating a dependent, As we'll have to update with new entries showing all the transitive dependency
between the new dimension and all the parent dimensions
Api changes (written as per the 2nd approach)
List the dd graph
-> Evaluate the flatten json
Creation a dimension
-> No validation for DAG
-> Add Mandatory dimension as DD
Updating MD
-> Dependent Dimension should exist.
-> validate the dependencies
-> It should be a DAG (No cycles)
-> Update the dependencies
-> update it with MD in workspace.
Updating a dimension
-> Dependent Dimension should exist.
-> Validation
-> It should be a DAG (No cycles)
-> Update the dependencies
Update List Dimensions API
Beta Was this translation helpful? Give feedback.
All reactions