```
SELECT
    number,
    leadInFrame(number) OVER w AS W
FROM numbers(10)
WINDOW w AS (ORDER BY number ASC Rows BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
LIMIT 3;

┌─number─┬─W─┐
│      0 │ 1 │
│      1 │ 2 │
│      2 │ 0 │ <-- W should be 3!
└────────┴───┘
```

In contrast:  https://www.db-fiddle.com/f/hNNECnp7YC3E2zBKBaxN6T/1
const auto * transforming = dynamic_cast<const ITransformingStep *>(child.get());
    
    if (!transforming)
        return 0;
    
    if (tryUpdateLimitForSortingSteps(child_node, limit->getLimitForSorting()))
        return 0;
    
    if (typeid_cast<const TotalsHavingStep *>(child.get()))
        return 0;
    
    const auto & transform_traits = transforming->getTransformTraits();
    const auto & data_stream_traits = transforming->getDataStreamTraits();
    
    if (!transform_traits.preserves_number_of_rows)
        return 0;
    
    if (!child->getOutputStream().sort_description.empty() && !data_stream_traits.preserves_sorting)
        return 0;
    
    
    if (!limit->getOutputStream().hasEqualPropertiesWith(transforming->getOutputStream()))
        return 0;
    
    limit->updateInputStream(transforming->getInputStreams().front());
    parent.swap(child);
    return 2;
}
}