-
Notifications
You must be signed in to change notification settings - Fork 2
Use a sql recursive query for node tree invalidation and dto tree building #791
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
Use a sql recursive query for node tree invalidation and dto tree building #791
Conversation
…into use_sql_recursive_for_node_tree_invalidation
…into use_sql_recursive_for_node_tree_invalidation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small remarks
Test: OK
"FROM NodeHierarchy nh " + | ||
"ORDER BY nh.depth DESC") | ||
List<String> findAllDescendants(UUID nodeUuid); | ||
"SELECT cast(nh.id_node AS VARCHAR) " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is "cast()" needed here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes otherwise the result is of type string and not uuid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it work without casting neither in postgres nor H2? or not working only in H2?
return nodesRepository.findAllChildrenUuids(parentUuid); | ||
} | ||
|
||
// TODO Remove this method and use getAllChildrenUuids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we've already changed some "getChildren" to "getChildrenUuids" here, why don't we make this change right now by renaming all occurences ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used in many places and you have to test a lot of things
A TS was created
@@ -598,7 +598,7 @@ void testNodeModificationInfos() throws Exception { | |||
|
|||
List<AbstractNode> children = root.getChildren(); | |||
assertEquals(2, children.size()); | |||
NetworkModificationNode n1 = (NetworkModificationNode) children.get(0); | |||
NetworkModificationNode n1 = (NetworkModificationNode) (children.get(0).getName().equals("n1") ? children.get(0) : children.get(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could replace by .stream().findFirst by name instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
*/ | ||
assertChildrenEquals(Set.of(node1, node2), root.getChildren()); | ||
|
||
node2.setName("niark"); | ||
node1.setName("condriak"); | ||
node1.setModificationGroupUuid(UUID.randomUUID()); | ||
createNode(root.getStudyId(), children.get(1), node2, userId); | ||
createNode(root.getStudyId(), children.get(1), node1, userId); | ||
AbstractNode child = children.get(0).getName().equals("loadflow") ? children.get(0) : children.get(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
" FROM NODE n " + | ||
" INNER JOIN NodeHierarchy nh ON n.parent_node = nh.id_node " + | ||
") " + | ||
"SELECT nh.id_node::text " + | ||
"FROM NodeHierarchy nh " + | ||
"ORDER BY nh.depth DESC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that ordering by depth was not necessary anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
a545215
to
d62860d
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code OK
No description provided.