@ Override public NodeCentricOptimizationResults < UnionNode > apply ( FlattenUnionProposal proposal , IntermediateQuery query , QueryTreeComponent treeComponent ) throws InvalidQueryOptimizationProposalException , EmptyQueryException { UnionNode focusNode = proposal . getFocusNode ( ) ; IntermediateQuery snapShot = query . createSnapshot ( ) ; query . getChildren ( focusNode ) . stream ( ) . forEach ( n -> treeComponent . removeSubTree ( n ) ) ; ImmutableSet < QueryNode > subqueryRoots = proposal . getSubqueryRoots ( ) ; subqueryRoots . forEach ( n -> treeComponent . addChild ( focusNode , n , Optional . empty ( ) , false ) ) ; subqueryRoots . forEach ( n -> treeComponent . addSubTree ( snapShot , n , n ) ) ; return new NodeCentricOptimizationResultsImpl <> ( query , focusNode ) ; }
Replace the child subtrees of the focus node