Use dedicated decoded in cursor
parent
5f20af0023
commit
571fde8d3a
13
tx.go
13
tx.go
|
@ -129,6 +129,9 @@ func (tx *tx) CreateIterators(stmt *influxql.SelectStatement) ([]influxql.Iterat
|
||||||
}
|
}
|
||||||
tagSets := m.tagSets(stmt, dimensions)
|
tagSets := m.tagSets(stmt, dimensions)
|
||||||
|
|
||||||
|
// Get a field decoder.
|
||||||
|
d := NewFieldCodec(m)
|
||||||
|
|
||||||
// Create an iterator for every shard.
|
// Create an iterator for every shard.
|
||||||
var itrs []influxql.Iterator
|
var itrs []influxql.Iterator
|
||||||
for tag, set := range tagSets {
|
for tag, set := range tagSets {
|
||||||
|
@ -139,7 +142,7 @@ func (tx *tx) CreateIterators(stmt *influxql.SelectStatement) ([]influxql.Iterat
|
||||||
// create a series cursor for each unique series id
|
// create a series cursor for each unique series id
|
||||||
cursors := make([]*seriesCursor, 0, len(set))
|
cursors := make([]*seriesCursor, 0, len(set))
|
||||||
for id, cond := range set {
|
for id, cond := range set {
|
||||||
cursors = append(cursors, &seriesCursor{id: id, condition: cond, decoder: m})
|
cursors = append(cursors, &seriesCursor{id: id, condition: cond, decoder: d})
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the shard iterator that will map over all series for the shard
|
// create the shard iterator that will map over all series for the shard
|
||||||
|
@ -258,7 +261,7 @@ type keyValue struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type fieldDecoder interface {
|
type fieldDecoder interface {
|
||||||
DecodeField(b []byte, fieldID uint8) interface{}
|
DecodeByID(fieldID uint8, b []byte) (interface{}, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type seriesCursor struct {
|
type seriesCursor struct {
|
||||||
|
@ -292,7 +295,11 @@ func (c *seriesCursor) Next(fieldName string, fieldID uint8, tmin, tmax int64) (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal key & value.
|
// Marshal key & value.
|
||||||
key, value = int64(btou64(k)), c.decoder.DecodeField(v, fieldID)
|
key := int64(btou64(k))
|
||||||
|
value, err := c.decoder.DecodeByID(fieldID, v)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if key > tmax {
|
if key > tmax {
|
||||||
return 0, nil, nil
|
return 0, nil, nil
|
||||||
|
|
Loading…
Reference in New Issue