Skip to content

v2.2.0-alpha.20181217

tagged this 10 Dec 18:05
32774: opt: Add Update support to CBO r=andy-kimball a=andy-kimball

Add a new Update operator to the CBO which is used to optimize the
UPDATE SQL statement. As part of compiling the UPDATE statement, the
optbuilder constructs an expression that outputs the existing values
for all rows from the target table that match the WHERE clause.
Additional column(s) that provide updated values are projected for
each of the SET expressions, as well as for any computed columns. For
example:
```
  CREATE TABLE abc (a INT PRIMARY KEY, b INT, c INT)
  UPDATE abc SET b=1 WHERE a=2
```
This would create an input expression similar to this SQL:
```
  SELECT a AS oa, b AS ob, c AS oc, 1 AS nb FROM abc WHERE a=2
```
The execution engine evaluates this relational expression and uses
the resulting values to form the KV keys and values.

Co-authored-by: Andrew Kimball <[email protected]>
Assets 2
Loading