I think the problem is the "order of evaluation" suggested by the Topological Sort.
In the given example, we have the following following expressions:
(2). sum(deptno + deptno)
(3). deptno + deptno
Note that (1) and (2) correspond LogicalWindow and (3) corresponds to a LogicalProject.
Apparently, (3) needs to be evaluated before (2). And, there is no dependency between (1) and (2). The "current" topological sort will give this order: (1), (3), (2).
Although it is a correct topological order in the mathematical sense, this order actually suggests inserting a Project between Two Windows and splits the two LogicalWindow apart. However, if the order (3), (1), (2) is chosen, then, given the same window frame, CalcRelSplitter would not split the LogicalWindow.
On the other hand, though the WindowMergeRule (and PushProjectOverWindowRule) would probably help resolve this issue, the LogicalWindow should not be split apart by CalcRelSplitter at the first place. In this issue, the root cause seems in CalcRelSplitter itself