cockroach: github.com/cockroachdb/cockroach/pkg/sql/colexecbase Index | Files | Directories

package colexecbase

import "github.com/cockroachdb/cockroach/pkg/sql/colexecbase"

Index

Package Files

operator.go testutils.go

type BatchBuffer Uses

type BatchBuffer struct {
    ZeroInputNode
    // contains filtered or unexported fields
}

BatchBuffer exposes a buffer of coldata.Batches through an Operator interface. If there are no batches to return, Next will panic.

func NewBatchBuffer Uses

func NewBatchBuffer() *BatchBuffer

NewBatchBuffer creates a new BatchBuffer.

func (*BatchBuffer) Add Uses

func (b *BatchBuffer) Add(batch coldata.Batch, _ []*types.T)

Add adds a batch to the buffer.

func (*BatchBuffer) Init Uses

func (b *BatchBuffer) Init()

Init is part of the Operator interface.

func (*BatchBuffer) Next Uses

func (b *BatchBuffer) Next(context.Context) coldata.Batch

Next is part of the Operator interface.

type BufferingInMemoryOperator Uses

type BufferingInMemoryOperator interface {
    Operator

    // ExportBuffered returns all the batches that have been buffered up from the
    // input and have not yet been processed by the operator. It needs to be
    // called once the memory limit has been reached in order to "dump" the
    // buffered tuples into a disk-backed operator. It will return a zero-length
    // batch once the buffer has been emptied.
    //
    // Calling ExportBuffered may invalidate the contents of the last batch
    // returned by ExportBuffered.
    ExportBuffered(input Operator) coldata.Batch
}

BufferingInMemoryOperator is an Operator that buffers up intermediate tuples in memory and knows how to export them once the memory limit has been reached.

type CallbackOperator Uses

type CallbackOperator struct {
    ZeroInputNode
    NextCb func(ctx context.Context) coldata.Batch
}

CallbackOperator is a testing utility struct that delegates Next calls to a callback provided by the user.

func (*CallbackOperator) Init Uses

func (o *CallbackOperator) Init()

Init is part of the Operator interface.

func (*CallbackOperator) Next Uses

func (o *CallbackOperator) Next(ctx context.Context) coldata.Batch

Next is part of the Operator interface.

type DrainableOperator Uses

type DrainableOperator interface {
    Operator
    execinfrapb.MetadataSource
}

DrainableOperator is an operator that also implements DrainMeta. Next and DrainMeta may not be called concurrently.

type Operator Uses

type Operator interface {
    // Init initializes this operator. Will be called once at operator setup
    // time. If an operator has an input operator, it's responsible for calling
    // Init on that input operator as well.
    // TODO(yuzefovich): we might need to clarify whether it is ok to call
    // Init() multiple times before the first call to Next(). It is possible to
    // hit the memory limit during Init(), and a disk-backed operator needs to
    // make sure that the input has been initialized. We could also in case that
    // Init() doesn't succeed for bufferingInMemoryOperator - which should only
    // happen when 'workmem' setting is too low - just bail, even if we have
    // disk spilling for that operator.
    Init()

    // Next returns the next Batch from this operator. Once the operator is
    // finished, it will return a Batch with length 0. Subsequent calls to
    // Next at that point will always return a Batch with length 0.
    //
    // Calling Next may invalidate the contents of the last Batch returned by
    // Next.
    // Canceling the provided context results in forceful termination of
    // execution.
    Next(context.Context) coldata.Batch

    execinfra.OpNode
}

Operator is a column vector operator that produces a Batch as output.

type RepeatableBatchSource Uses

type RepeatableBatchSource struct {
    ZeroInputNode
    // contains filtered or unexported fields
}

RepeatableBatchSource is an Operator that returns the same batch forever.

func NewRepeatableBatchSource Uses

func NewRepeatableBatchSource(
    allocator *colmem.Allocator, batch coldata.Batch, typs []*types.T,
) *RepeatableBatchSource

NewRepeatableBatchSource returns a new Operator initialized to return its input batch forever. Note that it stores the contents of the input batch and copies them into a separate output batch. The output batch is allowed to be modified whereas the input batch is *not*.

func (*RepeatableBatchSource) Init Uses

func (s *RepeatableBatchSource) Init()

Init is part of the Operator interface.

func (*RepeatableBatchSource) Next Uses

func (s *RepeatableBatchSource) Next(context.Context) coldata.Batch

Next is part of the Operator interface.

func (*RepeatableBatchSource) ResetBatchesToReturn Uses

func (s *RepeatableBatchSource) ResetBatchesToReturn(b int)

ResetBatchesToReturn sets a limit on how many batches the source returns, as well as resetting how many batches the source has returned so far.

type TestingSemaphore Uses

type TestingSemaphore struct {
    // contains filtered or unexported fields
}

TestingSemaphore is a semaphore.Semaphore that never blocks and is always successful. If the requested number of resources exceeds the given limit, an error is returned. If too many resources are released, the semaphore panics.

func NewTestingSemaphore Uses

func NewTestingSemaphore(limit int) *TestingSemaphore

NewTestingSemaphore initializes a new TestingSemaphore with the provided limit. If limit is zero, there will be no limit. Can also use &TestingSemaphore{} directly in this case.

func (*TestingSemaphore) Acquire Uses

func (s *TestingSemaphore) Acquire(_ context.Context, n int) error

Acquire implements the semaphore.Semaphore interface.

func (*TestingSemaphore) GetCount Uses

func (s *TestingSemaphore) GetCount() int

GetCount implements the semaphore.Semaphore interface.

func (*TestingSemaphore) GetLimit Uses

func (s *TestingSemaphore) GetLimit() int

GetLimit implements the semaphore.Semaphore interface.

func (*TestingSemaphore) Release Uses

func (s *TestingSemaphore) Release(n int) int

Release implements the semaphore.Semaphore interface.

func (*TestingSemaphore) SetLimit Uses

func (s *TestingSemaphore) SetLimit(n int)

SetLimit implements the semaphore.Semaphore interface.

func (*TestingSemaphore) TryAcquire Uses

func (s *TestingSemaphore) TryAcquire(n int) bool

TryAcquire implements the semaphore.Semaphore interface.

type ZeroInputNode Uses

type ZeroInputNode struct{}

ZeroInputNode is an execinfra.OpNode with no inputs.

func (ZeroInputNode) Child Uses

func (ZeroInputNode) Child(nth int, verbose bool) execinfra.OpNode

Child implements the execinfra.OpNode interface.

func (ZeroInputNode) ChildCount Uses

func (ZeroInputNode) ChildCount(verbose bool) int

ChildCount implements the execinfra.OpNode interface.

Directories

PathSynopsis
colexecerror

Package colexecbase imports 9 packages (graph) and is imported by 8 packages. Updated 2020-08-12. Refresh now. Tools for package owners.