Merge pull request #6089 from influxdata/js-6055-order-by-desc-fix

Fix ORDER BY desc so it doesn't skip values
pull/6035/head
Jonathan A. Sternberg 2016-03-22 09:55:29 -04:00
commit a82778c75c
2 changed files with 10 additions and 10 deletions

View File

@ -338,7 +338,7 @@ func newFloatDescendingCursor(seek int64, cacheValues Values, tsmKeyCursor *KeyC
}
c.tsm.keyCursor = tsmKeyCursor
c.tsm.buf = make([]FloatValue, 1000)
c.tsm.buf = make([]FloatValue, 10)
c.tsm.values, _ = c.tsm.keyCursor.ReadFloatBlock(c.tsm.buf)
c.tsm.pos = sort.Search(len(c.tsm.values), func(i int) bool {
return c.tsm.values[i].UnixNano() >= seek
@ -418,7 +418,7 @@ func (c *floatDescendingCursor) nextTSM() {
if len(c.tsm.values) == 0 {
return
}
c.tsm.pos = 0
c.tsm.pos = len(c.tsm.values) - 1
}
}
@ -681,7 +681,7 @@ func newIntegerDescendingCursor(seek int64, cacheValues Values, tsmKeyCursor *Ke
}
c.tsm.keyCursor = tsmKeyCursor
c.tsm.buf = make([]IntegerValue, 1000)
c.tsm.buf = make([]IntegerValue, 10)
c.tsm.values, _ = c.tsm.keyCursor.ReadIntegerBlock(c.tsm.buf)
c.tsm.pos = sort.Search(len(c.tsm.values), func(i int) bool {
return c.tsm.values[i].UnixNano() >= seek
@ -761,7 +761,7 @@ func (c *integerDescendingCursor) nextTSM() {
if len(c.tsm.values) == 0 {
return
}
c.tsm.pos = 0
c.tsm.pos = len(c.tsm.values) - 1
}
}
@ -1024,7 +1024,7 @@ func newStringDescendingCursor(seek int64, cacheValues Values, tsmKeyCursor *Key
}
c.tsm.keyCursor = tsmKeyCursor
c.tsm.buf = make([]StringValue, 1000)
c.tsm.buf = make([]StringValue, 10)
c.tsm.values, _ = c.tsm.keyCursor.ReadStringBlock(c.tsm.buf)
c.tsm.pos = sort.Search(len(c.tsm.values), func(i int) bool {
return c.tsm.values[i].UnixNano() >= seek
@ -1104,7 +1104,7 @@ func (c *stringDescendingCursor) nextTSM() {
if len(c.tsm.values) == 0 {
return
}
c.tsm.pos = 0
c.tsm.pos = len(c.tsm.values) - 1
}
}
@ -1367,7 +1367,7 @@ func newBooleanDescendingCursor(seek int64, cacheValues Values, tsmKeyCursor *Ke
}
c.tsm.keyCursor = tsmKeyCursor
c.tsm.buf = make([]BooleanValue, 1000)
c.tsm.buf = make([]BooleanValue, 10)
c.tsm.values, _ = c.tsm.keyCursor.ReadBooleanBlock(c.tsm.buf)
c.tsm.pos = sort.Search(len(c.tsm.values), func(i int) bool {
return c.tsm.values[i].UnixNano() >= seek
@ -1447,7 +1447,7 @@ func (c *booleanDescendingCursor) nextTSM() {
if len(c.tsm.values) == 0 {
return
}
c.tsm.pos = 0
c.tsm.pos = len(c.tsm.values) - 1
}
}

View File

@ -334,7 +334,7 @@ func new{{.Name}}DescendingCursor(seek int64, cacheValues Values, tsmKeyCursor *
}
c.tsm.keyCursor = tsmKeyCursor
c.tsm.buf = make([]{{.Name}}Value, 1000)
c.tsm.buf = make([]{{.Name}}Value, 10)
c.tsm.values, _ = c.tsm.keyCursor.Read{{.Name}}Block(c.tsm.buf)
c.tsm.pos = sort.Search(len(c.tsm.values), func(i int) bool {
return c.tsm.values[i].UnixNano() >= seek
@ -414,7 +414,7 @@ func (c *{{.name}}DescendingCursor) nextTSM() {
if len(c.tsm.values) == 0 {
return
}
c.tsm.pos = 0
c.tsm.pos = len(c.tsm.values) - 1
}
}