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

Cherry-picked from 58005870ceab0249c91c33b19e0ddaaf9329586a