Reduce memory over limitation exception for OrderByOperator
The input pages have much larger retained size than size and should be
compacted.
@@ -184,6 +184,11 @@ public class OrderByOperator
requireNonNull(page, "page is null");
pageIndex.addPage(page);
+
+ if (!operatorContext.trySetMemoryReservation(pageIndex.getEstimatedSize().toBytes())) {
+ pageIndex.compact();
+ }
+
operatorContext.setMemoryReservation(pageIndex.getEstimatedSize().toBytes());
}
