Skip to content

Commit

Permalink
Reduce cpu usage by avoiding throwing an exception during query execu…
Browse files Browse the repository at this point in the history
…tion (#11715)

* Avoid throwing exception

* Address review comment

Co-authored-by: Xiaotian (Jackie) Jiang <17555551+Jackie-Jiang@users.noreply.github.com>

---------

Co-authored-by: Xiaotian (Jackie) Jiang <17555551+Jackie-Jiang@users.noreply.github.com>
  • Loading branch information
vvivekiyer and Jackie-Jiang authored Oct 3, 2023
1 parent e0a1f62 commit 1d0303c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ default void explainPlan(ExplainPlanRows explainPlanRows, int[] globalId, int pa
* Returns the index segment associated with the operator.
*/
default IndexSegment getIndexSegment() {
throw new UnsupportedOperationException();
return null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ public static void setExecutionStatistics(BaseResultsBlock resultsBlock, List<Op
if (executionStatistics.getNumDocsScanned() > 0) {
numSegmentsMatched++;
}
// TODO: Check all operators and properly implement the getIndexSegment and remove this exception handling
try {
if (operator.getIndexSegment() instanceof MutableSegment) {
numConsumingSegmentsProcessed += 1;
if (executionStatistics.getNumDocsScanned() > 0) {
numConsumingSegmentsMatched++;
}

// TODO: Check all operators and properly implement the getIndexSegment.
if (operator.getIndexSegment() instanceof MutableSegment) {
numConsumingSegmentsProcessed += 1;
if (executionStatistics.getNumDocsScanned() > 0) {
numConsumingSegmentsMatched++;
}
} catch (UnsupportedOperationException ignored) {
}

numDocsScanned += executionStatistics.getNumDocsScanned();
Expand Down

0 comments on commit 1d0303c

Please sign in to comment.