You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
145934: sql: refactor plan node control flow r=DrewKimball a=DrewKimball
#### sql: change SetZoneConfig to return type Ack
This commit changes the return type for `tree.SetZoneConfig` to `Ack`
from `RowsAffected`. This mirrors similar statements, and the row count
has been broken (always zero) ever since this statement was implemented
in the declarative schema changer, anyway. Removing the need to track
row count allows a few related functions to be simplified.
Epic: None
Release note: None
#### sql: remove unnecessary nodes and interfaces related to mutation planNodes
This commit adds two new helper structs for use in mutation nodes and
other planNodes that need to output the number of affected rows:
`mutationOutputHelper` and `rowsAffectedOutputHelper`. The former is
now embedded into the mutation planNodes apart from `deleteRangeNode`,
which embeds `rowsAffectedOutputHelper` instead.
This commit also removes `spoolNode`, `serializeNode`, and `rowCount`
node, with `mutationOutputHelper` replacing the work they used to do.
This also allowed the removal of the `batchedPlanNode` interface and
its methods.
These changes simplify some factory logic, and should simplify the
process of moving from `planNode` implementations to processors in
the future.
This change also fixes#139378, where the `spoolNode` added for a mutation
with a RETURNING clause would break some of the EXPLAIN ANALYZE stats.
Fixes#139378
Release note (bug fix): Previously, CockroachDB would omit execution
statistics in EXPLAIN ANALYZE output for mutation nodes when a RETURNING
clause was used. The bug has been present since before v21.1 and is now fixed.
#### sql: remove planNodeFastPath interface for ops that return rows affected
Previously, there were two ways that `planNode` implementations would
propagate the number of rows affected (if using that output mode):
1. Implementing the `planNodeFastPath`, which provided a method to
directly pull the cached row count.
2. A special loop in `planNodeToRowSource`, which simply called `Next()`
repeatedly and counted the number of iterations.
This commit takes advantage of work done in the previous commit for
operators that need to return the number of rows affected. Now, the
helper structs from the previous commit are used to track this count
internally, and then return the final count through the usual `Next()`
and `Values()` calls. This allows for the removal of special logic
in `planNodeToRowSource`, as well as the `planNodeFastPath` interface.
As with the previous commit, this one seeks to remove departures from
the usual `Start()`, `Next()`, and `Values()` control flow, to make
future refactors easier.
Epic: None
Release note: None
Co-authored-by: Drew Kimball <[email protected]>
0 commit comments