Documentation ¶
Index ¶
- Constants
- func Compare(row Row, colIdx int, ad *types.Datum) int
- type Chunk
- func (c *Chunk) Append(other *Chunk, begin, end int)
- func (c *Chunk) AppendBytes(colIdx int, b []byte)
- func (c *Chunk) AppendDatum(colIdx int, d *types.Datum)
- func (c *Chunk) AppendDuration(colIdx int, dur types.Duration)
- func (c *Chunk) AppendEnum(colIdx int, enum types.Enum)
- func (c *Chunk) AppendFloat32(colIdx int, f float32)
- func (c *Chunk) AppendFloat64(colIdx int, f float64)
- func (c *Chunk) AppendInt64(colIdx int, i int64)
- func (c *Chunk) AppendJSON(colIdx int, j json.BinaryJSON)
- func (c *Chunk) AppendMyDecimal(colIdx int, dec *types.MyDecimal)
- func (c *Chunk) AppendNull(colIdx int)
- func (c *Chunk) AppendPartialRow(colIdx int, row Row)
- func (c *Chunk) AppendRow(row Row)
- func (c *Chunk) AppendSet(colIdx int, set types.Set)
- func (c *Chunk) AppendString(colIdx int, str string)
- func (c *Chunk) AppendTime(colIdx int, t types.Time)
- func (c *Chunk) AppendUint64(colIdx int, u uint64)
- func (c *Chunk) GetRow(idx int) Row
- func (c *Chunk) LowerBound(colIdx int, d *types.Datum) (index int, match bool)
- func (c *Chunk) MakeRef(srcColIdx, dstColIdx int)
- func (c *Chunk) MemoryUsage() (sum int64)
- func (c *Chunk) NumCols() int
- func (c *Chunk) NumRows() int
- func (c *Chunk) Reset()
- func (c *Chunk) SetNumVirtualRows(numVirtualRows int)
- func (c *Chunk) SwapColumn(colIdx int, other *Chunk, otherIdx int)
- func (c *Chunk) SwapColumns(other *Chunk)
- func (c *Chunk) TruncateTo(numRows int)
- func (c *Chunk) UpperBound(colIdx int, d *types.Datum) int
- type CompareFunc
- type Iterator
- type Iterator4Chunk
- type List
- func (l *List) Add(chk *Chunk)
- func (l *List) AppendRow(row Row) RowPtr
- func (l *List) GetChunk(chkIdx int) *Chunk
- func (l *List) GetMemTracker() *memory.Tracker
- func (l *List) GetRow(ptr RowPtr) Row
- func (l *List) Len() int
- func (l *List) NumChunks() int
- func (l *List) Reset()
- func (l *List) Walk(walkFunc ListWalkFunc) error
- type ListWalkFunc
- type MutRow
- type Row
- func (r Row) GetBytes(colIdx int) []byte
- func (r Row) GetDatum(colIdx int, tp *types.FieldType) types.Datum
- func (r Row) GetDatumRow(fields []*types.FieldType) types.DatumRow
- func (r Row) GetDuration(colIdx int) types.Duration
- func (r Row) GetEnum(colIdx int) types.Enum
- func (r Row) GetFloat32(colIdx int) float32
- func (r Row) GetFloat64(colIdx int) float64
- func (r Row) GetInt64(colIdx int) int64
- func (r Row) GetJSON(colIdx int) json.BinaryJSON
- func (r Row) GetMyDecimal(colIdx int) *types.MyDecimal
- func (r Row) GetSet(colIdx int) types.Set
- func (r Row) GetString(colIdx int) string
- func (r Row) GetTime(colIdx int) types.Time
- func (r Row) GetUint64(colIdx int) uint64
- func (r Row) Idx() int
- func (r Row) IsNull(colIdx int) bool
- func (r Row) Len() int
- type RowPtr
Constants ¶
const (
InitialCapacity = 32
)
Capacity constants.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk stores multiple rows of data in Apache Arrow format. See https://arrow.apache.org/docs/memory_layout.html Values are appended in compact format and can be directly accessed without decoding. When the chunk is done processing, we can reuse the allocated memory by resetting it.
func NewChunkWithCapacity ¶
NewChunkWithCapacity creates a new chunk with field types and capacity.
func (*Chunk) AppendBytes ¶
AppendBytes appends a bytes value to the chunk.
func (*Chunk) AppendDatum ¶
AppendDatum appends a datum into the chunk.
func (*Chunk) AppendDuration ¶
AppendDuration appends a Duration value to the chunk.
func (*Chunk) AppendEnum ¶
AppendEnum appends an Enum value to the chunk.
func (*Chunk) AppendFloat32 ¶
AppendFloat32 appends a float32 value to the chunk.
func (*Chunk) AppendFloat64 ¶
AppendFloat64 appends a float64 value to the chunk.
func (*Chunk) AppendInt64 ¶
AppendInt64 appends a int64 value to the chunk.
func (*Chunk) AppendJSON ¶
func (c *Chunk) AppendJSON(colIdx int, j json.BinaryJSON)
AppendJSON appends a JSON value to the chunk.
func (*Chunk) AppendMyDecimal ¶
AppendMyDecimal appends a MyDecimal value to the chunk.
func (*Chunk) AppendNull ¶
AppendNull appends a null value to the chunk.
func (*Chunk) AppendPartialRow ¶
AppendPartialRow appends a row to the chunk.
func (*Chunk) AppendString ¶
AppendString appends a string value to the chunk.
func (*Chunk) AppendTime ¶
AppendTime appends a Time value to the chunk. TODO: change the time structure so it can be directly written to memory.
func (*Chunk) AppendUint64 ¶
AppendUint64 appends a uint64 value to the chunk.
func (*Chunk) LowerBound ¶
LowerBound searches on the non-decreasing column colIdx, returns the smallest index i such that the value at row i is not less than `d`.
func (*Chunk) MemoryUsage ¶
MemoryUsage returns the total memory usage of a Chunk in B. We ignore the size of column.length and column.nullCount since they have little effect of the total memory usage.
func (*Chunk) Reset ¶
func (c *Chunk) Reset()
Reset resets the chunk, so the memory it allocated can be reused. Make sure all the data in the chunk is not used anymore before you reuse this chunk.
func (*Chunk) SetNumVirtualRows ¶
SetNumVirtualRows sets the virtual row number for a Chunk. It should only be used when there exists no column in the Chunk.
func (*Chunk) SwapColumn ¶
SwapColumn swaps column "c.columns[colIdx]" with column "other.columns[otherIdx]". If there exists columns refer to the column to be swapped, we need to re-build the reference.
func (*Chunk) SwapColumns ¶
SwapColumns swaps columns with another Chunk.
func (*Chunk) TruncateTo ¶
TruncateTo truncates rows from tail to head in a Chunk to "numRows" rows.
type CompareFunc ¶
CompareFunc is a function to compare the two values in Row, the two columns must have the same type.
func GetCompareFunc ¶
func GetCompareFunc(tp *types.FieldType) CompareFunc
GetCompareFunc gets a compare function for the field type.
type Iterator ¶
type Iterator interface { // Begin resets the cursor of the iterator and returns the first Row. Begin() Row // Next returns the next Row. Next() Row // End returns the invalid end Row. End() Row // Len returns the length. Len() int // Current returns the current Row. Current() Row // ReachEnd reaches the end of iterator. ReachEnd() }
Iterator is used to iterate a number of rows.
for row := it.Begin(); row != it.End(); row = it.Next() { ... }
func NewIterator4List ¶
NewIterator4List returns a Iterator for List.
func NewIterator4RowPtr ¶
NewIterator4RowPtr returns a Iterator for RowPtrs.
func NewIterator4Slice ¶
NewIterator4Slice returns a Iterator for Row slice.
type Iterator4Chunk ¶
type Iterator4Chunk struct {
// contains filtered or unexported fields
}
Iterator4Chunk is used to iterate rows inside a chunk.
func NewIterator4Chunk ¶
func NewIterator4Chunk(chk *Chunk) *Iterator4Chunk
NewIterator4Chunk returns a iterator for Chunk.
func (*Iterator4Chunk) Begin ¶
func (it *Iterator4Chunk) Begin() Row
Begin implements the Iterator interface.
func (*Iterator4Chunk) Current ¶
func (it *Iterator4Chunk) Current() Row
Current implements the Iterator interface.
func (*Iterator4Chunk) End ¶
func (it *Iterator4Chunk) End() Row
End implements the Iterator interface.
func (*Iterator4Chunk) Len ¶
func (it *Iterator4Chunk) Len() int
Len implements the Iterator interface
func (*Iterator4Chunk) Next ¶
func (it *Iterator4Chunk) Next() Row
Next implements the Iterator interface.
func (*Iterator4Chunk) ReachEnd ¶
func (it *Iterator4Chunk) ReachEnd()
ReachEnd implements the Iterator interface.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List holds a slice of chunks, use to append rows with max chunk size properly handled.
func (*List) Add ¶
Add adds a chunk to the List, the chunk may be modified later by the list. Caller must make sure the input chk is not empty and not used any more and has the same field types.
func (*List) GetMemTracker ¶
GetMemTracker returns the memory tracker of this List.
func (*List) Walk ¶
func (l *List) Walk(walkFunc ListWalkFunc) error
Walk iterate the list and call walkFunc for each row.
type ListWalkFunc ¶
ListWalkFunc is used to walk the list. If error is returned, it will stop walking.
type MutRow ¶
type MutRow Row
MutRow represents a mutable Row. The underlying columns only contains one row and not exposed to the user.
func MutRowFromDatums ¶
MutRowFromDatums creates a MutRow from a datum slice.
func MutRowFromTypes ¶
MutRowFromTypes creates a MutRow from a FieldType slice, each column is initialized to zero value.
func MutRowFromValues ¶
func MutRowFromValues(vals ...interface{}) MutRow
MutRowFromValues creates a MutRow from a interface slice.
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row represents a row of data, can be used to assess values.
func (Row) GetDatumRow ¶
GetDatumRow converts chunk.Row to types.DatumRow. Keep in mind that GetDatumRow has a reference to r.c, which is a chunk, this function works only if the underlying chunk is valid or unchanged.
func (Row) GetDuration ¶
GetDuration returns the Duration value with the colIdx.
func (Row) GetFloat32 ¶
GetFloat32 returns the float32 value with the colIdx.
func (Row) GetFloat64 ¶
GetFloat64 returns the float64 value with the colIdx.
func (Row) GetJSON ¶
func (r Row) GetJSON(colIdx int) json.BinaryJSON
GetJSON returns the JSON value with the colIdx.
func (Row) GetMyDecimal ¶
GetMyDecimal returns the MyDecimal value with the colIdx.
func (Row) GetTime ¶
GetTime returns the Time value with the colIdx. TODO: use Time structure directly.