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
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.
The text was updated successfully, but these errors were encountered:
<...>
// EncDatumRows returned by Next() are only valid until the next call to
// Next(), although the EncDatums inside them stay valid forever.
//
<...>
Next() (sqlbase.EncDatumRow, *execinfrapb.ProducerMetadata)
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
inRowSource
orRow
inRowIterator
. Callers that want to buffer rows callCopyRow
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 theEncDatum
object, rather than any of its fields. However, #43145 ran into problems when trying to reuse theencoded
field since the slice is not copied inCopyRow
. This is dangerous because this could result in a row changing under the caller even after aCopyRow
. To satisfy the interface contract, we need to implement deep copies forEncDatumRow
s.To provide deep copies of
EncDatum
, we need to also add aCopy
method to theDatum
interface with implementations for each type.The text was updated successfully, but these errors were encountered: