diff --git a/presto-main/src/main/java/com/facebook/presto/operator/TableScanOperator.java b/presto-main/src/main/java/com/facebook/presto/operator/TableScanOperator.java index ba8775dc6994..6ecebfd2fcf1 100644 --- a/presto-main/src/main/java/com/facebook/presto/operator/TableScanOperator.java +++ b/presto-main/src/main/java/com/facebook/presto/operator/TableScanOperator.java @@ -254,14 +254,8 @@ public Page getOutput() page = page.getLoadedPage(); // update operator stats - long endCompletedBytes = source.getCompletedBytes(); - long endCompletedPositions = source.getCompletedPositions(); - long endReadTimeNanos = source.getReadTimeNanos(); - operatorContext.recordRawInputWithTiming(endCompletedBytes - completedBytes, endCompletedPositions - completedPositions, endReadTimeNanos - readTimeNanos); operatorContext.recordProcessedInput(page.getSizeInBytes(), page.getPositionCount()); - completedBytes = endCompletedBytes; - completedPositions = endCompletedPositions; - readTimeNanos = endReadTimeNanos; + recordSourceRawInputStats(); } // updating system memory usage should happen after page is loaded. @@ -269,4 +263,17 @@ public Page getOutput() return page; } + + private void recordSourceRawInputStats() + { + checkState(source != null, "source must not be null"); + // update operator stats + long endCompletedBytes = source.getCompletedBytes(); + long endCompletedPositions = source.getCompletedPositions(); + long endReadTimeNanos = source.getReadTimeNanos(); + operatorContext.recordRawInputWithTiming(endCompletedBytes - completedBytes, endCompletedPositions - completedPositions, endReadTimeNanos - readTimeNanos); + completedBytes = endCompletedBytes; + completedPositions = endCompletedPositions; + readTimeNanos = endReadTimeNanos; + } }