Documentation
¶
Index ¶
- type BufferedRecord
- type RowBuffer
- func (rb *RowBuffer) ConsumerClosed()
- func (rb *RowBuffer) ConsumerDone()
- func (rb *RowBuffer) GetRowsNoMeta(t *testing.T) sqlbase.EncDatumRows
- func (rb *RowBuffer) Next() (sqlbase.EncDatumRow, *execinfrapb.ProducerMetadata)
- func (rb *RowBuffer) NextNoMeta(tb testing.TB) sqlbase.EncDatumRow
- func (rb *RowBuffer) OutputTypes() []*types.T
- func (rb *RowBuffer) ProducerClosed() bool
- func (rb *RowBuffer) ProducerDone()
- func (rb *RowBuffer) Push(row sqlbase.EncDatumRow, meta *execinfrapb.ProducerMetadata) execinfra.ConsumerStatus
- func (rb *RowBuffer) Start(ctx context.Context) context.Context
- func (rb *RowBuffer) Types() []*types.T
- type RowBufferArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedRecord ¶
type BufferedRecord struct {
Meta *execinfrapb.ProducerMetadata
// contains filtered or unexported fields
}
BufferedRecord represents a row or metadata record that has been buffered inside a RowBuffer.
type RowBuffer ¶
type RowBuffer struct {
Mu struct {
syncutil.Mutex
// records represent the data that has been buffered. Push appends a row
// to the back, Next removes a row from the front.
Records []BufferedRecord
// contains filtered or unexported fields
}
// Done is used when the RowBuffer is used as a RowSource; it is set to true
// when the receiver read all the rows.
Done bool
ConsumerStatus execinfra.ConsumerStatus
// contains filtered or unexported fields
}
RowBuffer is an implementation of RowReceiver that buffers (accumulates) results in memory, as well as an implementation of RowSource that returns records from a record buffer. Just for tests.
func NewRowBuffer ¶
func NewRowBuffer(types []*types.T, rows sqlbase.EncDatumRows, hooks RowBufferArgs) *RowBuffer
NewRowBuffer creates a RowBuffer with the given schema and initial rows.
func (*RowBuffer) ConsumerClosed ¶
func (rb *RowBuffer) ConsumerClosed()
ConsumerClosed is part of the RowSource interface.
func (*RowBuffer) ConsumerDone ¶
func (rb *RowBuffer) ConsumerDone()
ConsumerDone is part of the RowSource interface.
func (*RowBuffer) GetRowsNoMeta ¶
func (rb *RowBuffer) GetRowsNoMeta(t *testing.T) sqlbase.EncDatumRows
GetRowsNoMeta returns the rows in the buffer; it fails the test if it encounters any metadata.
func (*RowBuffer) Next ¶
func (rb *RowBuffer) Next() (sqlbase.EncDatumRow, *execinfrapb.ProducerMetadata)
Next is part of the RowSource interface.
There's no synchronization here with Push(). The assumption is that these two methods are not called concurrently.
func (*RowBuffer) NextNoMeta ¶
func (rb *RowBuffer) NextNoMeta(tb testing.TB) sqlbase.EncDatumRow
NextNoMeta is a version of Next which fails the test if it encounters any metadata.
func (*RowBuffer) OutputTypes ¶
OutputTypes is part of the RowSource interface.
func (*RowBuffer) ProducerClosed ¶
ProducerClosed is a utility function used by tests to check whether the RowBuffer has had ProducerDone() called on it.
func (*RowBuffer) ProducerDone ¶
func (rb *RowBuffer) ProducerDone()
ProducerDone is part of the RowSource interface.
func (*RowBuffer) Push ¶
func (rb *RowBuffer) Push( row sqlbase.EncDatumRow, meta *execinfrapb.ProducerMetadata, ) execinfra.ConsumerStatus
Push is part of the RowReceiver interface.
type RowBufferArgs ¶
type RowBufferArgs struct {
// If not set, then the RowBuffer will behave like a RowChannel and not
// accumulate rows after it's been put in draining mode. If set, rows will still
// be accumulated. Useful for tests that want to observe what rows have been
// pushed after draining.
AccumulateRowsWhileDraining bool
// OnConsumerDone, if specified, is called as the first thing in the
// ConsumerDone() method.
OnConsumerDone func(*RowBuffer)
// OnConsumerClose, if specified, is called as the first thing in the
// ConsumerClosed() method.
OnConsumerClosed func(*RowBuffer)
// OnNext, if specified, is called as the first thing in the Next() method.
// If it returns an empty row and metadata, then RowBuffer.Next() is allowed
// to run normally. Otherwise, the values are returned from RowBuffer.Next().
OnNext func(*RowBuffer) (sqlbase.EncDatumRow, *execinfrapb.ProducerMetadata)
// OnPush, if specified, is called as the first thing in the Push() method.
OnPush func(sqlbase.EncDatumRow, *execinfrapb.ProducerMetadata)
}
RowBufferArgs contains testing-oriented parameters for a RowBuffer.