-
Notifications
You must be signed in to change notification settings - Fork 4.1k
rowexec: implement deep copies for EncDatumRow #43182
Description
Throughout the row execution engine, there are interfaces that specify that a row may only be reused until the next call to a specific interface method. For example Next in RowSource or Row in RowIterator. Callers that want to buffer rows call CopyRow with the returned row for reuse.
CopyRow only performs a shallow copy. This is fine most of the time because processors tend to only reuse the EncDatum object, rather than any of its fields. However, #43145 ran into problems when trying to reuse the encoded field since the slice is not copied in CopyRow. This is dangerous because this could result in a row changing under the caller even after a CopyRow. To satisfy the interface contract, we need to implement deep copies for EncDatumRows.
To provide deep copies of EncDatum, we need to also add a Copy method to the Datum interface with implementations for each type.