distsqlutils

package
v0.0.0-...-b8ff010 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

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

func (rb *RowBuffer) OutputTypes() []*types.T

OutputTypes is part of the RowSource interface.

func (*RowBuffer) ProducerClosed

func (rb *RowBuffer) ProducerClosed() bool

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

Push is part of the RowReceiver interface.

func (*RowBuffer) Start

func (rb *RowBuffer) Start(ctx context.Context) context.Context

Start is part of the RowSource interface.

func (*RowBuffer) Types

func (rb *RowBuffer) Types() []*types.T

Types 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL