Documentation
¶
Index ¶
- Variables
- type Column
- func BytesColumn(idx int) Column[[]byte]
- func DocColumn(idx int) Column[*insaneJSON.Root]
- func Float64ArrayColumn(idx int) Column[[]float64]
- func Float64Column(idx int) Column[float64]
- func Int32Column(idx int) Column[int32]
- func Int64Column(idx int) Column[int64]
- func SeqIDColumn(idx int) Column[seq.ID]
- func StringArrayColumn(idx int) Column[[]string]
- func StringColumn(idx int) Column[string]
- func Uint32Column(idx int) Column[uint32]
- func Uint64Column(idx int) Column[uint64]
- type ColumnDesc
- type DataType
- type Record
- type RecordProducer
- type RecordVals
- func NewBytesVals(data []byte) *RecordVals
- func NewDocVals(payload []byte) *RecordVals
- func NewFloat64ArrayVals(v []float64) *RecordVals
- func NewFloat64Vals(v float64) *RecordVals
- func NewInt32Vals(v int32) *RecordVals
- func NewInt64Vals(v int64) *RecordVals
- func NewRecordVals(dataType DataType, rawData []byte) *RecordVals
- func NewSeqIDVals(id seq.ID) *RecordVals
- func NewStringArrayVals(v []string) *RecordVals
- func NewStringVals(s string) *RecordVals
- func NewUint32Vals(v uint32) *RecordVals
- func NewUint64Vals(v uint64) *RecordVals
- func (rv *RecordVals) AsBytes() []byte
- func (rv *RecordVals) AsDoc() *insaneJSON.Root
- func (rv *RecordVals) AsFloat64() float64
- func (rv *RecordVals) AsFloat64Array() []float64
- func (rv *RecordVals) AsInt32() int32
- func (rv *RecordVals) AsInt64() int64
- func (rv *RecordVals) AsSeqID() seq.ID
- func (rv *RecordVals) AsString() string
- func (rv *RecordVals) AsStringArray() []string
- func (rv *RecordVals) AsUint32() uint32
- func (rv *RecordVals) AsUint64() uint64
- func (rv *RecordVals) RawData() []byte
- func (rv *RecordVals) Release()
- type Schema
- func (s *Schema) Cols() []ColumnDesc
- func (s *Schema) Column[T any](name string) (Column[T], error)
- func (s *Schema) Equal(other *Schema) bool
- func (s *Schema) Extend(cols ...ColumnDesc) *Schema
- func (s *Schema) Index(name string) (int, error)
- func (s *Schema) Len() int
- func (s *Schema) MustColumn[T any](name string) Column[T]
- type Summary
Constants ¶
This section is empty.
Variables ¶
var ( DocsIDCol = "id" DocsDataCol = "data" DocsSchema = MustNewSchema( ColumnDesc{Name: DocsIDCol, Type: DataTypeSeqID}, ColumnDesc{Name: DocsDataCol, Type: DataTypeDocument}, ) AggsSchema = MustNewSchema( ColumnDesc{Name: "token", Type: DataTypeString}, ColumnDesc{Name: "min", Type: DataTypeFloat64}, ColumnDesc{Name: "max", Type: DataTypeFloat64}, ColumnDesc{Name: "sum", Type: DataTypeFloat64}, ColumnDesc{Name: "total", Type: DataTypeUint64}, ColumnDesc{Name: "not_exists", Type: DataTypeUint64}, ColumnDesc{Name: "ts", Type: DataTypeUint64}, ColumnDesc{Name: "samples", Type: DataTypeFloat64Array}, ColumnDesc{Name: "values", Type: DataTypeStringArray}, ) AggResultSchema = MustNewSchema( ColumnDesc{Name: "token", Type: DataTypeString}, ColumnDesc{Name: "value", Type: DataTypeFloat64}, ColumnDesc{Name: "ts", Type: DataTypeUint64}, ColumnDesc{Name: "quantiles", Type: DataTypeFloat64Array}, ) )
We still get hardcoded schemas at the edges of the pipeline.
Functions ¶
This section is empty.
Types ¶
type Column ¶ added in v0.81.0
type Column[T any] struct { // contains filtered or unexported fields }
func BytesColumn ¶ added in v0.81.0
func Float64ArrayColumn ¶ added in v0.81.0
func Float64Column ¶ added in v0.81.0
func Int32Column ¶ added in v0.81.0
func Int64Column ¶ added in v0.81.0
func StringArrayColumn ¶ added in v0.81.0
func StringColumn ¶ added in v0.81.0
func Uint32Column ¶ added in v0.81.0
func Uint64Column ¶ added in v0.81.0
type ColumnDesc ¶ added in v0.81.0
type Record ¶
type Record struct {
Vals []*RecordVals
}
executors make use of val's index, executor's parameters has colIdx field
func NewRecord ¶
func NewRecord(vals []*RecordVals) *Record
type RecordProducer ¶
type RecordProducer interface {
// Next returns the next record, or nil when the stream is exhausted. Errors
// that occur during production are not returned here; they are accumulated
// internally and reported via Finalize.
Next() *Record
// Finalize releases resources held by the producer and returns the final
// summary gathered during the stream. It must be called exactly once after the
// producer is exhausted.
Finalize() *Summary
}
type RecordVals ¶
type RecordVals struct {
Type DataType
// contains filtered or unexported fields
}
func NewBytesVals ¶ added in v0.81.0
func NewBytesVals(data []byte) *RecordVals
func NewDocVals ¶ added in v0.81.0
func NewDocVals(payload []byte) *RecordVals
NewDocVals aliases payload — no copy. The payload must stay unmodified until the val is decoded (decoding is lazy: AsDoc may run in a downstream executor long after this call) — so pooled or reused buffers are unsafe here.
func NewFloat64ArrayVals ¶ added in v0.81.0
func NewFloat64ArrayVals(v []float64) *RecordVals
func NewFloat64Vals ¶ added in v0.81.0
func NewFloat64Vals(v float64) *RecordVals
func NewInt32Vals ¶ added in v0.81.0
func NewInt32Vals(v int32) *RecordVals
func NewInt64Vals ¶ added in v0.81.0
func NewInt64Vals(v int64) *RecordVals
func NewRecordVals ¶
func NewRecordVals(dataType DataType, rawData []byte) *RecordVals
func NewSeqIDVals ¶ added in v0.81.0
func NewSeqIDVals(id seq.ID) *RecordVals
func NewStringArrayVals ¶ added in v0.81.0
func NewStringArrayVals(v []string) *RecordVals
func NewStringVals ¶ added in v0.81.0
func NewStringVals(s string) *RecordVals
NewStringVals aliases s — no copy, so s must outlive the val.
func NewUint32Vals ¶ added in v0.81.0
func NewUint32Vals(v uint32) *RecordVals
func NewUint64Vals ¶ added in v0.81.0
func NewUint64Vals(v uint64) *RecordVals
func (*RecordVals) AsBytes ¶ added in v0.81.0
func (rv *RecordVals) AsBytes() []byte
func (*RecordVals) AsDoc ¶ added in v0.81.0
func (rv *RecordVals) AsDoc() *insaneJSON.Root
func (*RecordVals) AsFloat64 ¶ added in v0.81.0
func (rv *RecordVals) AsFloat64() float64
func (*RecordVals) AsFloat64Array ¶ added in v0.81.0
func (rv *RecordVals) AsFloat64Array() []float64
func (*RecordVals) AsInt32 ¶ added in v0.81.0
func (rv *RecordVals) AsInt32() int32
func (*RecordVals) AsInt64 ¶ added in v0.81.0
func (rv *RecordVals) AsInt64() int64
func (*RecordVals) AsSeqID ¶ added in v0.81.0
func (rv *RecordVals) AsSeqID() seq.ID
func (*RecordVals) AsString ¶ added in v0.81.0
func (rv *RecordVals) AsString() string
func (*RecordVals) AsStringArray ¶ added in v0.81.0
func (rv *RecordVals) AsStringArray() []string
func (*RecordVals) AsUint32 ¶ added in v0.81.0
func (rv *RecordVals) AsUint32() uint32
func (*RecordVals) AsUint64 ¶ added in v0.81.0
func (rv *RecordVals) AsUint64() uint64
func (*RecordVals) RawData ¶
func (rv *RecordVals) RawData() []byte
func (*RecordVals) Release ¶
func (rv *RecordVals) Release()
Release returns the insaneJSON root allocated in AsDoc back to the library's internal pool and invalidates the cache. It is idempotent: after the first call the cache is cleared, so repeated calls are a no-op. Calling it on a non-document val or a not-yet-decoded val is also a no-op. Safe to invoke from every executor that has touched the val — the first caller wins.
type Schema ¶ added in v0.81.0
type Schema struct {
// contains filtered or unexported fields
}
Schema is an immutable ordered list of column descriptors.
func MustNewSchema ¶ added in v0.81.0
func MustNewSchema(cols ...ColumnDesc) *Schema
func NewSchema ¶ added in v0.81.0
func NewSchema(cols ...ColumnDesc) (*Schema, error)
func (*Schema) Cols ¶ added in v0.81.0
func (s *Schema) Cols() []ColumnDesc
Cols returns the column descriptors in schema order.
func (*Schema) Column ¶ added in v0.81.0
Column resolves the column by name. It fails when the column is absent or its declared type is incompatible with T.
func (*Schema) Equal ¶ added in v0.81.0
Equal reports whether both schemas list identical (name, type) pairs in the same order.
func (*Schema) Extend ¶ added in v0.81.0
func (s *Schema) Extend(cols ...ColumnDesc) *Schema
Extend returns a new schema with the given columns appended. The original schema is untouched. Panics on duplicate names.