Documentation
¶
Overview ¶
Package dataset contains utilities for working with datasets. Datasets hold columnar data across multiple pages.
Index ¶
- func CompareValues(a, b *Value) int
- func WalkPredicate(p Predicate, fn func(p Predicate) bool)
- func WithStats(ctx context.Context, stats *ReaderStats) context.Context
- type AndPredicate
- type BinaryValueSet
- type BuilderOptions
- type Column
- type ColumnBuilder
- type ColumnDesc
- type ColumnType
- type CompressionOptions
- type Dataset
- type DownloadStats
- type EqualPredicate
- type FalsePredicate
- type FuncPredicate
- type GreaterThanPredicate
- type InPredicate
- type Int64Set
- type InvalidTypeError
- type LessThanPredicate
- type MemColumn
- type MemPage
- type NotPredicate
- type OrPredicate
- type Page
- type PageData
- type PageDesc
- type Pages
- type Predicate
- type Reader
- type ReaderOptions
- type ReaderStats
- func (s *ReaderStats) AddBatchDownloadRequests(count uint64)
- func (s *ReaderStats) AddMaxRows(count uint64)
- func (s *ReaderStats) AddPageDownloadTime(duration time.Duration)
- func (s *ReaderStats) AddPagesFoundInCache(count uint64)
- func (s *ReaderStats) AddPagesScanned(count uint64)
- func (s *ReaderStats) AddPrimaryColumnBytesDownloaded(bytes uint64)
- func (s *ReaderStats) AddPrimaryColumnPages(count uint64)
- func (s *ReaderStats) AddPrimaryColumnPagesDownloaded(count uint64)
- func (s *ReaderStats) AddPrimaryColumnUncompressedBytes(count uint64)
- func (s *ReaderStats) AddPrimaryColumns(count uint64)
- func (s *ReaderStats) AddPrimaryRowBytes(count uint64)
- func (s *ReaderStats) AddPrimaryRowsRead(count uint64)
- func (s *ReaderStats) AddReadCalls(count int)
- func (s *ReaderStats) AddRowsToReadAfterPruning(count uint64)
- func (s *ReaderStats) AddSecondaryColumnBytesDownloaded(bytes uint64)
- func (s *ReaderStats) AddSecondaryColumnPages(count uint64)
- func (s *ReaderStats) AddSecondaryColumnPagesDownloaded(count uint64)
- func (s *ReaderStats) AddSecondaryColumnUncompressedBytes(count uint64)
- func (s *ReaderStats) AddSecondaryColumns(count uint64)
- func (s *ReaderStats) AddSecondaryRowBytes(count uint64)
- func (s *ReaderStats) AddSecondaryRowsRead(count uint64)
- func (s *ReaderStats) AddTotalRowsAvailable(count int64)
- func (s *ReaderStats) LinkGlobalStats(stats *stats.Context)
- func (s *ReaderStats) LogSummary(logger log.Logger, execDuration time.Duration)
- func (s *ReaderStats) Reset()
- type Row
- type StatisticsOptions
- type TruePredicate
- type Uint64ValueSet
- type UnsupportedTypeError
- type Value
- func (v *Value) Binary() []byte
- func (v *Value) Buffer() []byte
- func (v *Value) Int64() int64
- func (v *Value) IsNil() bool
- func (v *Value) IsZero() bool
- func (v Value) MarshalBinary() (data []byte, err error)
- func (v Value) Size() int
- func (v *Value) Type() datasetmd.PhysicalType
- func (v *Value) Uint64() uint64
- func (v *Value) UnmarshalBinary(data []byte) error
- func (v *Value) Zero()
- type ValueSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareValues ¶
CompareValues returns -1 if a<b, 0 if a==b, or 1 if a>b. CompareValues panics if a and b are not the same type.
As a special case, either a or b may be nil. Two nil values are equal, and a nil value is always less than a non-nil value.
func WalkPredicate ¶ added in v3.5.0
WalkPredicate traverses a predicate in depth-first order: it starts by calling fn(p). If fn(p) returns true, WalkPredicate is invoked recursively with fn for each of the non-nil children of p, followed by a call of fn(nil).
Types ¶
type AndPredicate ¶ added in v3.5.0
type AndPredicate struct{ Left, Right Predicate }
An AndPredicate is a Predicate which asserts that a row may only be included if both the Left and Right Predicate are true.
type BinaryValueSet ¶ added in v3.6.0
type BinaryValueSet struct {
// contains filtered or unexported fields
}
func NewBinaryValueSet ¶ added in v3.6.0
func NewBinaryValueSet(values []Value) BinaryValueSet
func (BinaryValueSet) Contains ¶ added in v3.6.0
func (s BinaryValueSet) Contains(value Value) bool
func (BinaryValueSet) Size ¶ added in v3.6.0
func (s BinaryValueSet) Size() int
type BuilderOptions ¶
type BuilderOptions struct {
// PageSizeHint is the soft limit for the size of the page. Builders try to
// fill pages as close to this size as possible, but the actual size may be
// slightly larger or smaller.
PageSizeHint int
// PageMaxRowCount is the limit for the number of rows of the page.
// When 0 or a negative number, then builders use the [BuilderOptions.PageSizeHint]
// option to determine when a page needs to be flushed.
PageMaxRowCount int
// Type is the type of data in the column. Type.Physical is used for
// encoding; Type.Logical is used as a hint to readers.
Type ColumnType
// Encoding is the encoding algorithm to use for values.
Encoding datasetmd.EncodingType
// Compression is the compression algorithm to use for values.
Compression datasetmd.CompressionType
// CompressionOptions holds optional configuration for compression.
CompressionOptions CompressionOptions
// StatisticsOptions holds optional configuration for statistics.
Statistics StatisticsOptions
}
BuilderOptions configures common settings for building pages.
type Column ¶
type Column interface {
// ColumnDesc returns the metadata for the Column.
ColumnDesc() *ColumnDesc
// ListPages returns the set of ordered pages in the column.
ListPages(ctx context.Context) result.Seq[Page]
}
A Column represents a sequence of values within a dataset. Columns are split up across one or more [Page]s to limit the amount of memory needed to read a portion of the column at a time.
type ColumnBuilder ¶
type ColumnBuilder struct {
// contains filtered or unexported fields
}
A ColumnBuilder builds a sequence of Value entries of a common type into a column. Values are accumulated into a buffer and then flushed into [MemPage]s once the size of data exceeds a configurable limit.
func NewColumnBuilder ¶
func NewColumnBuilder(tag string, opts BuilderOptions) (*ColumnBuilder, error)
NewColumnBuilder creates a new ColumnBuilder from the optional tag and provided options. NewColumnBuilder returns an error if the options are invalid.
func (*ColumnBuilder) Append ¶
func (cb *ColumnBuilder) Append(row int, value Value) error
Append adds a new value into cb with the given zero-indexed row number. If the row number is higher than the current number of rows in cb, null values are added up to the new row.
Append returns an error if the row number is out-of-order.
func (*ColumnBuilder) Backfill ¶
func (cb *ColumnBuilder) Backfill(row int)
Backfill adds NULLs into cb up to (but not including) the provided row number. If values exist up to the provided row number, Backfill does nothing.
func (*ColumnBuilder) EstimatedSize ¶
func (cb *ColumnBuilder) EstimatedSize() int
EstimatedSize returns the estimated size of all data in cb. EstimatedSize includes the compressed size of all cut pages in cb, followed by the size estimate of the in-progress page.
Because compression isn't considered for the in-progress page, EstimatedSize tends to overestimate the actual size after flushing.
func (*ColumnBuilder) Flush ¶
func (cb *ColumnBuilder) Flush() (*MemColumn, error)
Flush converts data in cb into a MemColumn. Afterwards, cb is reset to a fresh state and can be reused.
func (*ColumnBuilder) Reset ¶
func (cb *ColumnBuilder) Reset()
Reset clears all data in cb and resets it to a fresh state.
type ColumnDesc ¶ added in v3.6.0
type ColumnDesc struct {
Type ColumnType // Type of values in the column.
Tag string // Optional string to distinguish columns with the same type.
Compression datasetmd.CompressionType // Compression used for the column.
PagesCount int // Total number of pages in the column.
RowsCount int // Total number of rows in the column.
ValuesCount int // Total number of non-NULL values in the column.
CompressedSize int // Total size of all pages in the column after compression.
UncompressedSize int // Total size of all pages in the column before compression.
Statistics *datasetmd.Statistics // Optional statistics for the column.
}
ColumnDesc describes a column.
type ColumnType ¶ added in v3.6.0
type ColumnType struct {
// Physical is the type of values physically stored within the column.
Physical datasetmd.PhysicalType
// Logical is a custom string indicating how dataset-derived sections
// should interpret the physical type.
Logical string
}
ColumnType represents the type of data stored in a column. Column types are represented as a tuple of a physical and logical type.
type CompressionOptions ¶
type CompressionOptions struct {
// Zstd holds encoding options for Zstd compression. Only used for
// [datasetmd.COMPRESSION_TYPE_ZSTD].
Zstd []zstd.EOption
}
CompressionOptions customizes the compressor used when building pages.
type Dataset ¶
type Dataset interface {
// ListColumns returns the set of [Column]s in the Dataset. The order of
// Columns in the returned sequence must be consistent across calls.
ListColumns(ctx context.Context) result.Seq[Column]
// ListPages retrieves a set of [Pages] given a list of [Column]s.
// Implementations of Dataset may use ListPages to optimize for batch reads.
// The order of [Pages] in the returned sequence must match the order of the
// columns argument.
ListPages(ctx context.Context, columns []Column) result.Seq[Pages]
// ReadPages returns the set of [PageData] for the specified slice of pages.
// Implementations of Dataset may use ReadPages to optimize for batch reads.
// The order of [PageData] in the returned sequence must match the order of
// the pages argument.
ReadPages(ctx context.Context, pages []Page) result.Seq[PageData]
}
A Dataset holds a collection of [Columns], each of which is split into a set of Pages and further split into a sequence of [Values].
Dataset is read-only; callers must not modify any of the values returned by methods in Dataset.
func FromMemory ¶
FromMemory returns an in-memory Dataset from the given list of [MemColumn]s.
type DownloadStats ¶ added in v3.6.0
type DownloadStats struct {
// Use the following three stats together.
// 1. PagesScanned is the total number of ReadPage calls made to the downloader.
// 2. PagesFoundInCache is the number of pages that were found in cache and
// did not require a download.
// 3. BatchDownloadRequests is the number of batch download requests made by
// the downloader when a page is not found in cache.
PagesScanned uint64
PagesFoundInCache uint64
BatchDownloadRequests uint64
PageDownloadTime time.Duration // Total time taken for downloading paga data or metadata.
PrimaryColumnPages uint64 // Number of pages downloaded for primary columns
SecondaryColumnPages uint64 // Number of pages downloaded for secondary columns
PrimaryColumnBytes uint64 // Total bytes downloaded for primary columns
SecondaryColumnBytes uint64 // Total bytes downloaded for secondary columns
PrimaryColumnUncompressedBytes uint64 // Total uncompressed bytes for primary columns
SecondaryColumnUncompressedBytes uint64 // Total uncompressed bytes for secondary columns
}
DownloadStats holds statistics about the download operations performed by the dataset reader.
func (*DownloadStats) Reset ¶ added in v3.6.0
func (ds *DownloadStats) Reset()
type EqualPredicate ¶ added in v3.5.0
type EqualPredicate struct {
Column Column // Column to check.
Value Value // Value to check equality for.
}
An EqualPredicate is a Predicate which asserts that a row may only be included if the Value of the Column is equal to the Value.
type FalsePredicate ¶ added in v3.5.0
type FalsePredicate struct{}
FalsePredicate is a Predicate which always returns false.
type FuncPredicate ¶ added in v3.5.0
type FuncPredicate struct {
Column Column // Column to check.
// Keep is invoked with the column and value pair to check. Keep is given
// the Column instance to allow for reusing the same function across
// multiple columns, if necessary.
//
// If Keep returns true, the row is kept.
Keep func(column Column, value Value) bool
}
FuncPredicate is a Predicate which asserts that a row may only be included if the Value of the Column passes the Keep function.
Instances of FuncPredicate are ineligible for page filtering and should only be used when there isn't a more explicit Predicate implementation.
type GreaterThanPredicate ¶ added in v3.5.0
type GreaterThanPredicate struct {
Column Column // Column to check.
Value Value // Value for which rows in Column must be greater than.
}
A GreaterThanPredicate is a Predicate which asserts that a row may only be included if the Value of the Column is greater than the provided Value.
type InPredicate ¶ added in v3.6.0
type InPredicate struct {
Column Column // Column to check.
Values ValueSet // Set of values to check.
}
An InPredicate is a Predicate which asserts that a row may only be included if the Value of the Column is present in the provided Values.
type Int64Set ¶ added in v3.6.0
type Int64Set struct {
// contains filtered or unexported fields
}
func NewInt64ValueSet ¶ added in v3.6.0
type InvalidTypeError ¶ added in v3.6.0
type InvalidTypeError struct {
Expected datasetmd.PhysicalType
Actual datasetmd.PhysicalType
}
InvalidTypeError is used as a panic value when using Value methods with the incorrect type.
func (*InvalidTypeError) Error ¶ added in v3.6.0
func (e *InvalidTypeError) Error() string
Error returns a string representation denoting the expected and actual types.
type LessThanPredicate ¶ added in v3.5.0
type LessThanPredicate struct {
Column Column // Column to check.
Value Value // Value for which rows in Column must be less than.
}
A LessThanPredicate is a Predicate which asserts that a row may only be included if the Value of the Column is less than the provided Value.
type MemColumn ¶
type MemColumn struct {
Desc ColumnDesc // Description of the column.
Pages []*MemPage // The set of pages in the column.
}
MemColumn holds a set of pages of a common type.
func (*MemColumn) ColumnDesc ¶ added in v3.6.0
func (c *MemColumn) ColumnDesc() *ColumnDesc
ColumnDesc implements Column and returns c.Desc.
type MemPage ¶
type MemPage struct {
Desc PageDesc // Description of the page.
Data PageData // Data for the page.
}
MemPage holds an encoded (and optionally compressed) sequence of Value entries of a common type. Use ColumnBuilder to construct sets of pages.
type NotPredicate ¶ added in v3.5.0
type NotPredicate struct{ Inner Predicate }
A NotePredicate is a Predicate which asserts that a row may only be included if the inner Predicate is false.
type OrPredicate ¶ added in v3.5.0
type OrPredicate struct{ Left, Right Predicate }
An OrPredicate is a Predicate which asserts that a row may only be included if either the Left or Right Predicate are true.
type Page ¶
type Page interface {
// PageDesc returns the metadata for the Page.
PageDesc() *PageDesc
// ReadPage returns the [PageData] for the Page.
ReadPage(ctx context.Context) (PageData, error)
}
A Page holds an encoded and optionally compressed sequence of [Value]s within a Column.
type PageData ¶
type PageData []byte
PageData holds the raw data for a page. Data is formatted as:
<uvarint(presence-bitmap-size)> <presence-bitmap> <values-data>
The presence-bitmap is a bitmap-encoded sequence of booleans, where values describe which rows are present (1) or nil (0). The presence bitmap is always stored uncompressed.
values-data is then the encoded and optionally compressed sequence of non-NULL values.
type PageDesc ¶ added in v3.6.0
type PageDesc struct {
UncompressedSize int // UncompressedSize is the size of a page before compression.
CompressedSize int // CompressedSize is the size of a page after compression.
CRC32 uint32 // CRC32 checksum of the page after encoding and compression.
RowCount int // RowCount is the number of rows in the page, including NULLs.
ValuesCount int // ValuesCount is the number of non-NULL values in the page.
Encoding datasetmd.EncodingType // Encoding used for values in the page.
Stats *datasetmd.Statistics // Optional statistics for the page.
}
PageDesc describes a page.
type Predicate ¶ added in v3.5.0
type Predicate interface {
// contains filtered or unexported methods
}
Predicate is an expression used to filter rows in a Reader.
type Reader ¶ added in v3.5.0
type Reader struct {
// contains filtered or unexported fields
}
A Reader reads [Row]s from a Dataset.
func NewReader ¶ added in v3.5.0
func NewReader(opts ReaderOptions) *Reader
NewReader creates a new Reader from the provided options.
func (*Reader) Close ¶ added in v3.5.0
Close closes the Reader. Closed Readers can be reused by calling Reader.Reset.
func (*Reader) Read ¶ added in v3.5.0
Read reads up to the next len(s) rows from r and stores them into s. It returns the number of rows read and any error encountered. At the end of the Dataset, Read returns 0, io.EOF.
func (*Reader) Reset ¶ added in v3.5.0
func (r *Reader) Reset(opts ReaderOptions)
Reset discards any state and resets the Reader with a new set of options. This permits reusing a Reader rather than allocating a new one.
type ReaderOptions ¶ added in v3.5.0
type ReaderOptions struct {
Dataset Dataset // Dataset to read from.
// Columns to read from the Dataset. It is invalid to provide a Column that
// is not in Dataset.
//
// The set of Columns can include columns not used in Predicate; such columns
// are considered non-predicate columns.
Columns []Column
// Predicates filter the data returned by a Reader. Predicates are optional; if
// nil, all rows from Columns are returned.
//
// Expressions in Predicate may only reference columns in Columns.
// Holds a list of predicates that can be sequentially applied to the dataset.
Predicates []Predicate
// Prefetch enables bulk retrieving pages from the dataset when reading
// starts. To reduce read latency, this option should only be disabled when
// the entire Dataset is already held in memory.
Prefetch bool
}
ReaderOptions configures how a Reader will read [Row]s.
type ReaderStats ¶ added in v3.6.0
type ReaderStats struct {
// Column statistics
PrimaryColumns uint64 // Number of primary columns to read from the dataset
SecondaryColumns uint64 // Number of secondary columns to read from the dataset
// Page statistics
PrimaryColumnPages uint64 // Total pages in primary columns
SecondaryColumnPages uint64 // Total pages in secondary columns
DownloadStats DownloadStats // Download statistics for primary and secondary columns
ReadCalls int64 // Total number of read calls made to the reader
// Row statistics
MaxRows uint64 // Maximum number of rows across all columns
RowsToReadAfterPruning uint64 // Total number of primary rows to read after page pruning
PrimaryRowsRead uint64 // Actual number of primary rows read.
SecondaryRowsRead uint64 // Actual number of secondary rows read.
PrimaryRowBytes uint64 // Total bytes read for primary rows
SecondaryRowBytes uint64 // Total bytes read for secondary rows
// contains filtered or unexported fields
}
ReaderStats tracks statistics about dataset read operations.
func StatsFromContext ¶ added in v3.6.0
func StatsFromContext(ctx context.Context) *ReaderStats
StatsFromContext returns the reader stats from context.
func (*ReaderStats) AddBatchDownloadRequests ¶ added in v3.6.0
func (s *ReaderStats) AddBatchDownloadRequests(count uint64)
func (*ReaderStats) AddMaxRows ¶ added in v3.6.0
func (s *ReaderStats) AddMaxRows(count uint64)
func (*ReaderStats) AddPageDownloadTime ¶ added in v3.6.0
func (s *ReaderStats) AddPageDownloadTime(duration time.Duration)
AddPageDownloadTime adds the given duration into the total download time for page metadata and data.
func (*ReaderStats) AddPagesFoundInCache ¶ added in v3.6.0
func (s *ReaderStats) AddPagesFoundInCache(count uint64)
func (*ReaderStats) AddPagesScanned ¶ added in v3.6.0
func (s *ReaderStats) AddPagesScanned(count uint64)
func (*ReaderStats) AddPrimaryColumnBytesDownloaded ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryColumnBytesDownloaded(bytes uint64)
func (*ReaderStats) AddPrimaryColumnPages ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryColumnPages(count uint64)
func (*ReaderStats) AddPrimaryColumnPagesDownloaded ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryColumnPagesDownloaded(count uint64)
func (*ReaderStats) AddPrimaryColumnUncompressedBytes ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryColumnUncompressedBytes(count uint64)
func (*ReaderStats) AddPrimaryColumns ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryColumns(count uint64)
func (*ReaderStats) AddPrimaryRowBytes ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryRowBytes(count uint64)
func (*ReaderStats) AddPrimaryRowsRead ¶ added in v3.6.0
func (s *ReaderStats) AddPrimaryRowsRead(count uint64)
func (*ReaderStats) AddReadCalls ¶ added in v3.6.0
func (s *ReaderStats) AddReadCalls(count int)
func (*ReaderStats) AddRowsToReadAfterPruning ¶ added in v3.6.0
func (s *ReaderStats) AddRowsToReadAfterPruning(count uint64)
func (*ReaderStats) AddSecondaryColumnBytesDownloaded ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryColumnBytesDownloaded(bytes uint64)
func (*ReaderStats) AddSecondaryColumnPages ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryColumnPages(count uint64)
func (*ReaderStats) AddSecondaryColumnPagesDownloaded ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryColumnPagesDownloaded(count uint64)
func (*ReaderStats) AddSecondaryColumnUncompressedBytes ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryColumnUncompressedBytes(count uint64)
func (*ReaderStats) AddSecondaryColumns ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryColumns(count uint64)
func (*ReaderStats) AddSecondaryRowBytes ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryRowBytes(count uint64)
func (*ReaderStats) AddSecondaryRowsRead ¶ added in v3.6.0
func (s *ReaderStats) AddSecondaryRowsRead(count uint64)
func (*ReaderStats) AddTotalRowsAvailable ¶ added in v3.6.0
func (s *ReaderStats) AddTotalRowsAvailable(count int64)
func (*ReaderStats) LinkGlobalStats ¶ added in v3.6.0
func (s *ReaderStats) LinkGlobalStats(stats *stats.Context)
func (*ReaderStats) LogSummary ¶ added in v3.6.0
func (s *ReaderStats) LogSummary(logger log.Logger, execDuration time.Duration)
LogSummary logs a summary of the read statistics to the provided logger.
func (*ReaderStats) Reset ¶ added in v3.6.0
func (s *ReaderStats) Reset()
type Row ¶
type Row struct {
Index int // Index of the row in the dataset.
Values []Value // Values for the row, one per [Column].
}
A Row in a Dataset is a set of values across multiple columns with the same row number.
func (Row) SizeOfColumns ¶ added in v3.6.0
SizeOfColumns returns the size of values in the row for the given column indices.
type StatisticsOptions ¶ added in v3.5.0
type StatisticsOptions struct {
// StoreRangeStats indicates whether to store value range statistics for the
// column and pages.
StoreRangeStats bool
// StoreCardinalityStats indicates whether to store cardinality estimations,
// facilitated by hyperloglog
StoreCardinalityStats bool
}
StatisticsOptions customizes the collection of statistics for a column.
type TruePredicate ¶ added in v3.6.0
type TruePredicate struct{}
TruePredicate is a Predicate which always returns true.
type Uint64ValueSet ¶ added in v3.6.0
type Uint64ValueSet struct {
// contains filtered or unexported fields
}
func NewUint64ValueSet ¶ added in v3.6.0
func NewUint64ValueSet(values []Value) Uint64ValueSet
func (Uint64ValueSet) Contains ¶ added in v3.6.0
func (s Uint64ValueSet) Contains(value Value) bool
func (Uint64ValueSet) Size ¶ added in v3.6.0
func (s Uint64ValueSet) Size() int
type UnsupportedTypeError ¶ added in v3.6.0
type UnsupportedTypeError struct {
Got datasetmd.PhysicalType
}
UnsupportedTypeError is used as a panic value when using Value methods with an unsupported type.
func (*UnsupportedTypeError) Error ¶ added in v3.6.0
func (e *UnsupportedTypeError) Error() string
Error returns a string representation denoting the unsupported type.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
A Value represents a single value within a dataset. Unlike [any], Values can be constructed without allocations. The zero Value corresponds to nil.
func BinaryValue ¶ added in v3.6.0
BinaryValue returns a Value for a byte slice representing a string.
func (*Value) Binary ¶ added in v3.6.0
ByteSlice returns v's value as binary data. If v is not a string, ByteSlice returns a byte slice of the form "PHYSICAL_TYPE_T", where T is the underlying type of v.
func (*Value) Buffer ¶ added in v3.6.0
Buffer returns any memory that was allocated for v, even if v is currently null.
If Value does not hold underlying memory, Buffer returns nil.
func (*Value) Int64 ¶
Int64 returns v's value as an int64. It panics if v is not a datasetmd.PHYSICAL_TYPE_INT64.
func (Value) MarshalBinary ¶ added in v3.5.0
MarshalBinary encodes v into a binary representation. Non-NULL values encode first with the type (encoded as uvarint), followed by an encoded value, where:
- datasetmd.PHYSICAL_TYPE_INT64 encodes as a varint.
- datasetmd.PHYSICAL_TYPE_UINT64 encodes as a uvarint.
- datasetmd.PHYSICAL_TYPE_BINARY encodes the string as a sequence of bytes.
NULL values encode as nil.
func (*Value) Type ¶
func (v *Value) Type() datasetmd.PhysicalType
Type returns the datasetmd.PhysicalType of v. If v is nil, Type returns datasetmd.PHYSICAL_TYPE_UNSPECIFIED.
func (*Value) Uint64 ¶
Uint64 returns v's value as a uint64. It panics if v is not a datasetmd.PHYSICAL_TYPE_UINT64.
func (*Value) UnmarshalBinary ¶ added in v3.5.0
UnmarshalBinary decodes a Value from a binary representation. See Value.MarshalBinary for the encoding format.
func (*Value) Zero ¶ added in v3.6.0
func (v *Value) Zero()
Zero sets Value to its zero state while retaining any underlying memory if Value was a datasetmd.PHYSICAL_TYPE_BINARY. After calling Zero, Value.IsNil and Value.IsZero will both report true.
However, Value.Binary will continue to return the underlying memory.
Source Files
¶
- column.go
- column_builder.go
- column_reader.go
- column_stats.go
- dataset.go
- page.go
- page_builder.go
- page_compress_writer.go
- page_reader.go
- predicate.go
- read_stats.go
- reader.go
- reader_basic.go
- reader_downloader.go
- row_range.go
- row_ranges.go
- value.go
- value_encoding.go
- value_encoding_bitmap.go
- value_encoding_delta.go
- value_encoding_plain.go