WindowFunction optimizer