[SERVER-60222] Consider changing all variadic expressions to short-circuit in SBE Created: 24/Sep/21  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Query Execution
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Kyle Suarez Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-59785 [SBE] Change $concatArrays to not sho... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

As part of SERVER-59785, we have decided to err on the side of consistency and make $concatArrays not short-circuit in SBE, to match the behavior of the rest of the variadic expressions. However, for expressions that take an arbitrary number of arguments, there is a practical performance benefit to short-circuiting early when it is known that the result should be e.g. null.

This ticket is to consider implementing a uniform policy in SBE, wherein fixed, low-arity expressions always evaluate all arguments, but variadic expressions will attempt to short-circuit when possible for the sake of efficiency.

The list of variadic expressions currently implemented in SBE are

  • $concat
  • $add
  • $multiply

Generated at Thu Feb 08 05:49:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.