[SP-1337] - Backport of MONDRIAN-2107 - Incorrect segment rollup with overlapping segments (5.0)

cherry-pick of e9d83e9b14a4827f4a3d7d20d8299ff5b3919d37
Merge pull request #385 from aliakseihaidukou/SP-1337

[SP-1337] - Backport of MONDRIAN-2107 - Incorrect segment rollup with ov...