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

package span

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

Index

Package Files

span_builder.go

type Builder Uses

type Builder struct {

    // KeyPrefix is the prefix of keys generated by the builder.
    KeyPrefix []byte
    // contains filtered or unexported fields
}

Builder is a single struct for generating key spans from Constraints, Datums and encDatums.

func MakeBuilder Uses

func MakeBuilder(
    codec keys.SQLCodec, table *sqlbase.ImmutableTableDescriptor, index *descpb.IndexDescriptor,
) *Builder

MakeBuilder creates a Builder for a table and index.

func (*Builder) CanSplitSpanIntoSeparateFamilies Uses

func (s *Builder) CanSplitSpanIntoSeparateFamilies(
    numNeededFamilies, prefixLen int, containsNull bool,
) bool

CanSplitSpanIntoSeparateFamilies returns whether a span encoded with prefixLen keys and numNeededFamilies needed families can be safely split into multiple family specific spans.

func (*Builder) MaybeSplitSpanIntoSeparateFamilies Uses

func (s *Builder) MaybeSplitSpanIntoSeparateFamilies(
    appendTo roachpb.Spans, span roachpb.Span, prefixLen int, containsNull bool,
) roachpb.Spans

MaybeSplitSpanIntoSeparateFamilies uses the needed columns configured by SetNeededColumns to conditionally split the input span into multiple family specific spans. prefixLen is the number of index columns encoded in the span.

The function accepts a slice of spans to append to.

func (*Builder) SetNeededColumns Uses

func (s *Builder) SetNeededColumns(neededCols util.FastIntSet)

SetNeededColumns sets the needed columns on the Builder. This information is used by MaybeSplitSpanIntoSeparateFamilies.

func (*Builder) SetNeededFamilies Uses

func (s *Builder) SetNeededFamilies(neededFamilies []descpb.FamilyID)

SetNeededFamilies sets the needed families of the span builder directly. This information is used by MaybeSplitSpanIntoSeparateFamilies.

func (*Builder) SpanFromDatumRow Uses

func (s *Builder) SpanFromDatumRow(
    values tree.Datums, prefixLen int, colMap map[descpb.ColumnID]int,
) (_ roachpb.Span, containsNull bool, _ error)

SpanFromDatumRow generates an index span with prefixLen constraint columns from the index. SpanFromDatumRow assumes that values is a valid table row for the Builder's table. It also returns whether or not the input values contain a null value or not, which can be used as input for CanSplitSpanIntoSeparateFamilies.

func (*Builder) SpanFromEncDatums Uses

func (s *Builder) SpanFromEncDatums(
    values sqlbase.EncDatumRow, prefixLen int,
) (_ roachpb.Span, containsNull bool, _ error)

SpanFromEncDatums encodes a span with prefixLen constraint columns from the index. SpanFromEncDatums assumes that the EncDatums in values are in the order of the index columns. It also returns whether or not the input values contain a null value or not, which can be used as input for CanSplitSpanIntoSeparateFamilies.

func (*Builder) SpanToPointSpan Uses

func (s *Builder) SpanToPointSpan(span roachpb.Span, family descpb.FamilyID) roachpb.Span

SpanToPointSpan converts a span into a span that represents a point lookup on a specific family. It is up to the caller to ensure that this is a safe operation, by calling CanSplitSpanIntoSeparateFamilies before using it.

func (*Builder) SpansFromConstraint Uses

func (s *Builder) SpansFromConstraint(
    c *constraint.Constraint, needed exec.TableColumnOrdinalSet, forDelete bool,
) (roachpb.Spans, error)

SpansFromConstraint generates spans from an optimizer constraint. TODO (rohany): In future work, there should be a single API to generate spans

from constraints, datums and encdatums.

func (*Builder) UnconstrainedSpans Uses

func (s *Builder) UnconstrainedSpans() (roachpb.Spans, error)

UnconstrainedSpans returns the full span corresponding to the Builder's table and index.

func (*Builder) UnsetNeededColumns Uses

func (s *Builder) UnsetNeededColumns()

UnsetNeededColumns resets the needed columns for column family specific optimizations that the Builder performs.

func (*Builder) UnsetNeededFamilies Uses

func (s *Builder) UnsetNeededFamilies()

UnsetNeededFamilies resets the needed families for column family specific optimizations that the Builder performs.

Package span imports 11 packages (graph) and is imported by 6 packages. Updated 2020-08-12. Refresh now. Tools for package owners.