Skip to content

Commit

Permalink
Fixed row count estimate overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMpn committed Oct 31, 2023
1 parent 6de3297 commit 0237775
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MarkMpn.Sql4Cds.Engine/ExecutionPlan/BaseAggregateNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ protected override RowCountEstimate EstimateRowsOutInternal(NodeCompilationConte
if (GroupBy.Count == 0)
return RowCountEstimateDefiniteRange.ExactlyOne;

var rows = Source.EstimateRowsOut(context).Value * 4 / 10;
var sourceRows = Source.EstimateRowsOut(context).Value;
var rows = sourceRows * 4 / 10;

if (rows < 0)
rows = sourceRows / 10 * 4;

return new RowCountEstimate(rows);
}
Expand Down

0 comments on commit 0237775

Please sign in to comment.