This commit is contained in:
Aliaksandr Valialkin 2024-04-29 03:47:25 +02:00
parent cc1a3e09b9
commit 801a4d79d6
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
4 changed files with 143 additions and 143 deletions

View file

@ -104,8 +104,8 @@ func (bs *blockSearch) search(bsw *blockSearchWork) {
bs.csh.initFromBlockHeader(bsw.p, &bsw.bh) bs.csh.initFromBlockHeader(bsw.p, &bsw.bh)
// search rows matching the given filter // search rows matching the given filter
bm := getFilterBitmap(int(bsw.bh.rowsCount)) bm := getBitmap(int(bsw.bh.rowsCount))
defer putFilterBitmap(bm) defer putBitmap(bm)
bm.setBits() bm.setBits()
bs.bsw.so.filter.apply(bs, bm) bs.bsw.so.filter.apply(bs, bm)
@ -317,7 +317,7 @@ func (br *blockResult) reset() {
br.columnNames = nil br.columnNames = nil
} }
func (br *blockResult) fetchAllColumns(bs *blockSearch, bm *filterBitmap) { func (br *blockResult) fetchAllColumns(bs *blockSearch, bm *bitmap) {
// Add _stream column // Add _stream column
br.columnNamesBuf = append(br.columnNamesBuf, "_stream") br.columnNamesBuf = append(br.columnNamesBuf, "_stream")
if !br.addStreamColumn(bs) { if !br.addStreamColumn(bs) {
@ -360,7 +360,7 @@ func (br *blockResult) fetchAllColumns(bs *blockSearch, bm *filterBitmap) {
br.columnNames = br.columnNamesBuf br.columnNames = br.columnNamesBuf
} }
func (br *blockResult) fetchRequestedColumns(bs *blockSearch, bm *filterBitmap) { func (br *blockResult) fetchRequestedColumns(bs *blockSearch, bm *bitmap) {
for _, columnName := range bs.bsw.so.resultColumnNames { for _, columnName := range bs.bsw.so.resultColumnNames {
switch columnName { switch columnName {
case "_stream": case "_stream":
@ -392,7 +392,7 @@ func (br *blockResult) RowsCount() int {
return len(br.timestamps) return len(br.timestamps)
} }
func (br *blockResult) mustInit(bs *blockSearch, bm *filterBitmap) { func (br *blockResult) mustInit(bs *blockSearch, bm *bitmap) {
br.reset() br.reset()
br.streamID = bs.bsw.bh.streamID br.streamID = bs.bsw.bh.streamID
@ -417,7 +417,7 @@ func (br *blockResult) mustInit(bs *blockSearch, bm *filterBitmap) {
br.timestamps = dstTimestamps br.timestamps = dstTimestamps
} }
func (br *blockResult) addColumn(bs *blockSearch, ch *columnHeader, bm *filterBitmap) { func (br *blockResult) addColumn(bs *blockSearch, ch *columnHeader, bm *bitmap) {
buf := br.buf buf := br.buf
valuesBuf := br.valuesBuf valuesBuf := br.valuesBuf
valuesBufLen := len(valuesBuf) valuesBufLen := len(valuesBuf)

View file

@ -16,43 +16,43 @@ import (
"github.com/VictoriaMetrics/VictoriaMetrics/lib/stringsutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/stringsutil"
) )
func getFilterBitmap(bitsLen int) *filterBitmap { func getBitmap(bitsLen int) *bitmap {
v := filterBitmapPool.Get() v := bitmapPool.Get()
if v == nil { if v == nil {
v = &filterBitmap{} v = &bitmap{}
} }
bm := v.(*filterBitmap) bm := v.(*bitmap)
bm.init(bitsLen) bm.init(bitsLen)
return bm return bm
} }
func putFilterBitmap(bm *filterBitmap) { func putBitmap(bm *bitmap) {
bm.reset() bm.reset()
filterBitmapPool.Put(bm) bitmapPool.Put(bm)
} }
var filterBitmapPool sync.Pool var bitmapPool sync.Pool
type filterBitmap struct { type bitmap struct {
a []uint64 a []uint64
bitsLen int bitsLen int
} }
func (bm *filterBitmap) reset() { func (bm *bitmap) reset() {
bm.resetBits() bm.resetBits()
bm.a = bm.a[:0] bm.a = bm.a[:0]
bm.bitsLen = 0 bm.bitsLen = 0
} }
func (bm *filterBitmap) copyFrom(src *filterBitmap) { func (bm *bitmap) copyFrom(src *bitmap) {
bm.reset() bm.reset()
bm.a = append(bm.a[:0], src.a...) bm.a = append(bm.a[:0], src.a...)
bm.bitsLen = src.bitsLen bm.bitsLen = src.bitsLen
} }
func (bm *filterBitmap) init(bitsLen int) { func (bm *bitmap) init(bitsLen int) {
a := bm.a a := bm.a
wordsLen := (bitsLen + 63) / 64 wordsLen := (bitsLen + 63) / 64
if n := wordsLen - cap(a); n > 0 { if n := wordsLen - cap(a); n > 0 {
@ -63,14 +63,14 @@ func (bm *filterBitmap) init(bitsLen int) {
bm.bitsLen = bitsLen bm.bitsLen = bitsLen
} }
func (bm *filterBitmap) resetBits() { func (bm *bitmap) resetBits() {
a := bm.a a := bm.a
for i := range a { for i := range a {
a[i] = 0 a[i] = 0
} }
} }
func (bm *filterBitmap) setBits() { func (bm *bitmap) setBits() {
a := bm.a a := bm.a
for i := range a { for i := range a {
a[i] = ^uint64(0) a[i] = ^uint64(0)
@ -82,7 +82,7 @@ func (bm *filterBitmap) setBits() {
} }
} }
func (bm *filterBitmap) isZero() bool { func (bm *bitmap) isZero() bool {
for _, word := range bm.a { for _, word := range bm.a {
if word != 0 { if word != 0 {
return false return false
@ -91,7 +91,7 @@ func (bm *filterBitmap) isZero() bool {
return true return true
} }
func (bm *filterBitmap) areAllBitsSet() bool { func (bm *bitmap) areAllBitsSet() bool {
a := bm.a a := bm.a
for i, word := range a { for i, word := range a {
if word != (1<<64)-1 { if word != (1<<64)-1 {
@ -107,7 +107,7 @@ func (bm *filterBitmap) areAllBitsSet() bool {
return true return true
} }
func (bm *filterBitmap) andNot(x *filterBitmap) { func (bm *bitmap) andNot(x *bitmap) {
if bm.bitsLen != x.bitsLen { if bm.bitsLen != x.bitsLen {
logger.Panicf("BUG: cannot merge bitmaps with distinct lengths; %d vs %d", bm.bitsLen, x.bitsLen) logger.Panicf("BUG: cannot merge bitmaps with distinct lengths; %d vs %d", bm.bitsLen, x.bitsLen)
} }
@ -118,7 +118,7 @@ func (bm *filterBitmap) andNot(x *filterBitmap) {
} }
} }
func (bm *filterBitmap) or(x *filterBitmap) { func (bm *bitmap) or(x *bitmap) {
if bm.bitsLen != x.bitsLen { if bm.bitsLen != x.bitsLen {
logger.Panicf("BUG: cannot merge bitmaps with distinct lengths; %d vs %d", bm.bitsLen, x.bitsLen) logger.Panicf("BUG: cannot merge bitmaps with distinct lengths; %d vs %d", bm.bitsLen, x.bitsLen)
} }
@ -130,7 +130,7 @@ func (bm *filterBitmap) or(x *filterBitmap) {
} }
// forEachSetBit calls f for each set bit and clears that bit if f returns false // forEachSetBit calls f for each set bit and clears that bit if f returns false
func (bm *filterBitmap) forEachSetBit(f func(idx int) bool) { func (bm *bitmap) forEachSetBit(f func(idx int) bool) {
a := bm.a a := bm.a
bitsLen := bm.bitsLen bitsLen := bm.bitsLen
for i, word := range a { for i, word := range a {
@ -158,7 +158,7 @@ type filter interface {
String() string String() string
// apply must update bm according to the filter applied to the given bs block // apply must update bm according to the filter applied to the given bs block
apply(bs *blockSearch, bm *filterBitmap) apply(bs *blockSearch, bm *bitmap)
} }
// noopFilter does nothing // noopFilter does nothing
@ -169,7 +169,7 @@ func (nf *noopFilter) String() string {
return "" return ""
} }
func (nf *noopFilter) apply(_ *blockSearch, _ *filterBitmap) { func (nf *noopFilter) apply(_ *blockSearch, _ *bitmap) {
// nothing to do // nothing to do
} }
@ -190,9 +190,9 @@ func (of *orFilter) String() string {
return strings.Join(a, " or ") return strings.Join(a, " or ")
} }
func (of *orFilter) apply(bs *blockSearch, bm *filterBitmap) { func (of *orFilter) apply(bs *blockSearch, bm *bitmap) {
bmResult := getFilterBitmap(bm.bitsLen) bmResult := getBitmap(bm.bitsLen)
bmTmp := getFilterBitmap(bm.bitsLen) bmTmp := getBitmap(bm.bitsLen)
for _, f := range of.filters { for _, f := range of.filters {
// Minimize the number of rows to check by the filter by checking only // Minimize the number of rows to check by the filter by checking only
// the rows, which may change the output bm: // the rows, which may change the output bm:
@ -208,9 +208,9 @@ func (of *orFilter) apply(bs *blockSearch, bm *filterBitmap) {
f.apply(bs, bmTmp) f.apply(bs, bmTmp)
bmResult.or(bmTmp) bmResult.or(bmTmp)
} }
putFilterBitmap(bmTmp) putBitmap(bmTmp)
bm.copyFrom(bmResult) bm.copyFrom(bmResult)
putFilterBitmap(bmResult) putBitmap(bmResult)
} }
// andFilter contains filters joined by AND opertor. // andFilter contains filters joined by AND opertor.
@ -237,7 +237,7 @@ func (af *andFilter) String() string {
return strings.Join(a, " ") return strings.Join(a, " ")
} }
func (af *andFilter) apply(bs *blockSearch, bm *filterBitmap) { func (af *andFilter) apply(bs *blockSearch, bm *bitmap) {
if tokens := af.getMsgTokens(); len(tokens) > 0 { if tokens := af.getMsgTokens(); len(tokens) > 0 {
// Verify whether af tokens for the _msg field match bloom filter. // Verify whether af tokens for the _msg field match bloom filter.
ch := bs.csh.getColumnHeader("_msg") ch := bs.csh.getColumnHeader("_msg")
@ -314,14 +314,14 @@ func (nf *notFilter) String() string {
return "!" + s return "!" + s
} }
func (nf *notFilter) apply(bs *blockSearch, bm *filterBitmap) { func (nf *notFilter) apply(bs *blockSearch, bm *bitmap) {
// Minimize the number of rows to check by the filter by applying it // Minimize the number of rows to check by the filter by applying it
// only to the rows, which match the bm, e.g. they may change the bm result. // only to the rows, which match the bm, e.g. they may change the bm result.
bmTmp := getFilterBitmap(bm.bitsLen) bmTmp := getBitmap(bm.bitsLen)
bmTmp.copyFrom(bm) bmTmp.copyFrom(bm)
nf.f.apply(bs, bmTmp) nf.f.apply(bs, bmTmp)
bm.andNot(bmTmp) bm.andNot(bmTmp)
putFilterBitmap(bmTmp) putBitmap(bmTmp)
} }
// streamFilter is the filter for `_stream:{...}` // streamFilter is the filter for `_stream:{...}`
@ -361,7 +361,7 @@ func (sf *streamFilter) initStreamIDs() {
sf.streamIDs = m sf.streamIDs = m
} }
func (sf *streamFilter) apply(bs *blockSearch, bm *filterBitmap) { func (sf *streamFilter) apply(bs *blockSearch, bm *bitmap) {
if sf.f.isEmpty() { if sf.f.isEmpty() {
return return
} }
@ -386,7 +386,7 @@ func (tf *timeFilter) String() string {
return "_time:" + tf.stringRepr return "_time:" + tf.stringRepr
} }
func (tf *timeFilter) apply(bs *blockSearch, bm *filterBitmap) { func (tf *timeFilter) apply(bs *blockSearch, bm *bitmap) {
minTimestamp := tf.minTimestamp minTimestamp := tf.minTimestamp
maxTimestamp := tf.maxTimestamp maxTimestamp := tf.maxTimestamp
@ -461,7 +461,7 @@ func (sf *sequenceFilter) initNonEmptyPhrases() {
sf.nonEmptyPhrases = result sf.nonEmptyPhrases = result
} }
func (sf *sequenceFilter) apply(bs *blockSearch, bm *filterBitmap) { func (sf *sequenceFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := sf.fieldName fieldName := sf.fieldName
phrases := sf.getNonEmptyPhrases() phrases := sf.getNonEmptyPhrases()
@ -538,7 +538,7 @@ func (ef *exactPrefixFilter) initTokens() {
ef.tokens = getTokensSkipLast(ef.prefix) ef.tokens = getTokensSkipLast(ef.prefix)
} }
func (ef *exactPrefixFilter) apply(bs *blockSearch, bm *filterBitmap) { func (ef *exactPrefixFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := ef.fieldName fieldName := ef.fieldName
prefix := ef.prefix prefix := ef.prefix
@ -610,7 +610,7 @@ func (ef *exactFilter) initTokens() {
ef.tokens = tokenizeStrings(nil, []string{ef.value}) ef.tokens = tokenizeStrings(nil, []string{ef.value})
} }
func (ef *exactFilter) apply(bs *blockSearch, bm *filterBitmap) { func (ef *exactFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := ef.fieldName fieldName := ef.fieldName
value := ef.value value := ef.value
@ -897,7 +897,7 @@ func (af *inFilter) initTimestampISO8601Values() {
af.timestampISO8601Values = m af.timestampISO8601Values = m
} }
func (af *inFilter) apply(bs *blockSearch, bm *filterBitmap) { func (af *inFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := af.fieldName fieldName := af.fieldName
if len(af.values) == 0 { if len(af.values) == 0 {
@ -976,7 +976,7 @@ func (rf *ipv4RangeFilter) String() string {
return fmt.Sprintf("%sipv4_range(%s, %s)", quoteFieldNameIfNeeded(rf.fieldName), toIPv4String(nil, minValue), toIPv4String(nil, maxValue)) return fmt.Sprintf("%sipv4_range(%s, %s)", quoteFieldNameIfNeeded(rf.fieldName), toIPv4String(nil, minValue), toIPv4String(nil, maxValue))
} }
func (rf *ipv4RangeFilter) apply(bs *blockSearch, bm *filterBitmap) { func (rf *ipv4RangeFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := rf.fieldName fieldName := rf.fieldName
minValue := rf.minValue minValue := rf.minValue
maxValue := rf.maxValue maxValue := rf.maxValue
@ -1042,7 +1042,7 @@ func (rf *stringRangeFilter) String() string {
return fmt.Sprintf("%sstring_range(%s, %s)", quoteFieldNameIfNeeded(rf.fieldName), quoteTokenIfNeeded(rf.minValue), quoteTokenIfNeeded(rf.maxValue)) return fmt.Sprintf("%sstring_range(%s, %s)", quoteFieldNameIfNeeded(rf.fieldName), quoteTokenIfNeeded(rf.minValue), quoteTokenIfNeeded(rf.maxValue))
} }
func (rf *stringRangeFilter) apply(bs *blockSearch, bm *filterBitmap) { func (rf *stringRangeFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := rf.fieldName fieldName := rf.fieldName
minValue := rf.minValue minValue := rf.minValue
maxValue := rf.maxValue maxValue := rf.maxValue
@ -1108,7 +1108,7 @@ func (rf *lenRangeFilter) String() string {
return quoteFieldNameIfNeeded(rf.fieldName) + "len_range" + rf.stringRepr return quoteFieldNameIfNeeded(rf.fieldName) + "len_range" + rf.stringRepr
} }
func (rf *lenRangeFilter) apply(bs *blockSearch, bm *filterBitmap) { func (rf *lenRangeFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := rf.fieldName fieldName := rf.fieldName
minLen := rf.minLen minLen := rf.minLen
maxLen := rf.maxLen maxLen := rf.maxLen
@ -1175,7 +1175,7 @@ func (rf *rangeFilter) String() string {
return quoteFieldNameIfNeeded(rf.fieldName) + "range" + rf.stringRepr return quoteFieldNameIfNeeded(rf.fieldName) + "range" + rf.stringRepr
} }
func (rf *rangeFilter) apply(bs *blockSearch, bm *filterBitmap) { func (rf *rangeFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := rf.fieldName fieldName := rf.fieldName
minValue := rf.minValue minValue := rf.minValue
maxValue := rf.maxValue maxValue := rf.maxValue
@ -1237,7 +1237,7 @@ func (rf *regexpFilter) String() string {
return fmt.Sprintf("%sre(%q)", quoteFieldNameIfNeeded(rf.fieldName), rf.re.String()) return fmt.Sprintf("%sre(%q)", quoteFieldNameIfNeeded(rf.fieldName), rf.re.String())
} }
func (rf *regexpFilter) apply(bs *blockSearch, bm *filterBitmap) { func (rf *regexpFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := rf.fieldName fieldName := rf.fieldName
re := rf.re re := rf.re
@ -1325,7 +1325,7 @@ func (pf *anyCasePrefixFilter) initPrefixLowercase() {
pf.prefixLowercase = strings.ToLower(pf.prefix) pf.prefixLowercase = strings.ToLower(pf.prefix)
} }
func (pf *anyCasePrefixFilter) apply(bs *blockSearch, bm *filterBitmap) { func (pf *anyCasePrefixFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := pf.fieldName fieldName := pf.fieldName
prefixLowercase := pf.getPrefixLowercase() prefixLowercase := pf.getPrefixLowercase()
@ -1402,7 +1402,7 @@ func (pf *prefixFilter) initTokens() {
pf.tokens = getTokensSkipLast(pf.prefix) pf.tokens = getTokensSkipLast(pf.prefix)
} }
func (pf *prefixFilter) apply(bs *blockSearch, bm *filterBitmap) { func (pf *prefixFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := pf.fieldName fieldName := pf.fieldName
prefix := pf.prefix prefix := pf.prefix
@ -1485,7 +1485,7 @@ func (pf *anyCasePhraseFilter) initPhraseLowercase() {
pf.phraseLowercase = strings.ToLower(pf.phrase) pf.phraseLowercase = strings.ToLower(pf.phrase)
} }
func (pf *anyCasePhraseFilter) apply(bs *blockSearch, bm *filterBitmap) { func (pf *anyCasePhraseFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := pf.fieldName fieldName := pf.fieldName
phraseLowercase := pf.getPhraseLowercase() phraseLowercase := pf.getPhraseLowercase()
@ -1567,7 +1567,7 @@ func (pf *phraseFilter) initTokens() {
pf.tokens = tokenizeStrings(nil, []string{pf.phrase}) pf.tokens = tokenizeStrings(nil, []string{pf.phrase})
} }
func (pf *phraseFilter) apply(bs *blockSearch, bm *filterBitmap) { func (pf *phraseFilter) apply(bs *blockSearch, bm *bitmap) {
fieldName := pf.fieldName fieldName := pf.fieldName
phrase := pf.phrase phrase := pf.phrase
@ -1617,14 +1617,14 @@ func (pf *phraseFilter) apply(bs *blockSearch, bm *filterBitmap) {
} }
} }
func matchTimestampISO8601ByLenRange(bm *filterBitmap, minLen, maxLen uint64) { func matchTimestampISO8601ByLenRange(bm *bitmap, minLen, maxLen uint64) {
if minLen > uint64(len(iso8601Timestamp)) || maxLen < uint64(len(iso8601Timestamp)) { if minLen > uint64(len(iso8601Timestamp)) || maxLen < uint64(len(iso8601Timestamp)) {
bm.resetBits() bm.resetBits()
return return
} }
} }
func matchTimestampISO8601ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchTimestampISO8601ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -1638,7 +1638,7 @@ func matchTimestampISO8601ByStringRange(bs *blockSearch, ch *columnHeader, bm *f
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchTimestampISO8601ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toTimestampISO8601StringExt(bs, bb, v) s := toTimestampISO8601StringExt(bs, bb, v)
@ -1647,7 +1647,7 @@ func matchTimestampISO8601ByRegexp(bs *blockSearch, ch *columnHeader, bm *filter
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchTimestampISO8601ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
// Fast path - all the timestamp values match an empty prefix aka `*` // Fast path - all the timestamp values match an empty prefix aka `*`
return return
@ -1668,7 +1668,7 @@ func matchTimestampISO8601ByPrefix(bs *blockSearch, ch *columnHeader, bm *filter
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchTimestampISO8601BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) == 1 { if len(phrases) == 1 {
matchTimestampISO8601ByPhrase(bs, ch, bm, phrases[0], tokens) matchTimestampISO8601ByPhrase(bs, ch, bm, phrases[0], tokens)
return return
@ -1687,7 +1687,7 @@ func matchTimestampISO8601BySequence(bs *blockSearch, ch *columnHeader, bm *filt
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchTimestampISO8601ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
return return
} }
@ -1704,7 +1704,7 @@ func matchTimestampISO8601ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *f
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, value string, tokens []string) { func matchTimestampISO8601ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, value string, tokens []string) {
n, ok := tryParseTimestampISO8601(value) n, ok := tryParseTimestampISO8601(value)
if !ok || n < ch.minValue || n > ch.maxValue { if !ok || n < ch.minValue || n > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -1716,7 +1716,7 @@ func matchTimestampISO8601ByExactValue(bs *blockSearch, ch *columnHeader, bm *fi
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchTimestampISO8601ByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchTimestampISO8601ByPhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
_, ok := tryParseTimestampISO8601(phrase) _, ok := tryParseTimestampISO8601(phrase)
if ok { if ok {
// Fast path - the phrase contains complete timestamp, so we can use exact search // Fast path - the phrase contains complete timestamp, so we can use exact search
@ -1738,7 +1738,7 @@ func matchTimestampISO8601ByPhrase(bs *blockSearch, ch *columnHeader, bm *filter
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchIPv4ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -1752,7 +1752,7 @@ func matchIPv4ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchIPv4ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if minLen > uint64(len("255.255.255.255")) || maxLen < uint64(len("0.0.0.0")) { if minLen > uint64(len("255.255.255.255")) || maxLen < uint64(len("0.0.0.0")) {
bm.resetBits() bm.resetBits()
return return
@ -1766,7 +1766,7 @@ func matchIPv4ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, mi
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue uint32) { func matchIPv4ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue uint32) {
if ch.minValue > uint64(maxValue) || ch.maxValue < uint64(minValue) { if ch.minValue > uint64(maxValue) || ch.maxValue < uint64(minValue) {
bm.resetBits() bm.resetBits()
return return
@ -1782,7 +1782,7 @@ func matchIPv4ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minVa
}) })
} }
func matchIPv4ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchIPv4ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toIPv4StringExt(bs, bb, v) s := toIPv4StringExt(bs, bb, v)
@ -1791,7 +1791,7 @@ func matchIPv4ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchIPv4ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
// Fast path - all the ipv4 values match an empty prefix aka `*` // Fast path - all the ipv4 values match an empty prefix aka `*`
return return
@ -1812,7 +1812,7 @@ func matchIPv4ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pref
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchIPv4BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) == 1 { if len(phrases) == 1 {
matchIPv4ByPhrase(bs, ch, bm, phrases[0], tokens) matchIPv4ByPhrase(bs, ch, bm, phrases[0], tokens)
return return
@ -1833,7 +1833,7 @@ func matchIPv4BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, ph
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchIPv4ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
return return
} }
@ -1850,7 +1850,7 @@ func matchIPv4ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, value string, tokens []string) { func matchIPv4ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, value string, tokens []string) {
n, ok := tryParseIPv4(value) n, ok := tryParseIPv4(value)
if !ok || uint64(n) < ch.minValue || uint64(n) > ch.maxValue { if !ok || uint64(n) < ch.minValue || uint64(n) > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -1862,7 +1862,7 @@ func matchIPv4ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchIPv4ByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchIPv4ByPhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
_, ok := tryParseIPv4(phrase) _, ok := tryParseIPv4(phrase)
if ok { if ok {
// Fast path - phrase contains the full IP address, so we can use exact matching // Fast path - phrase contains the full IP address, so we can use exact matching
@ -1886,7 +1886,7 @@ func matchIPv4ByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phra
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchFloat64ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "+" { if minValue > "9" || maxValue < "+" {
bm.resetBits() bm.resetBits()
return return
@ -1900,7 +1900,7 @@ func matchFloat64ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitm
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchFloat64ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if minLen > 24 || maxLen == 0 { if minLen > 24 || maxLen == 0 {
bm.resetBits() bm.resetBits()
return return
@ -1914,7 +1914,7 @@ func matchFloat64ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchFloat64ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
if minValue > math.Float64frombits(ch.maxValue) || maxValue < math.Float64frombits(ch.minValue) { if minValue > math.Float64frombits(ch.maxValue) || maxValue < math.Float64frombits(ch.minValue) {
bm.resetBits() bm.resetBits()
return return
@ -1931,7 +1931,7 @@ func matchFloat64ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, mi
}) })
} }
func matchFloat64ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchFloat64ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toFloat64StringExt(bs, bb, v) s := toFloat64StringExt(bs, bb, v)
@ -1940,7 +1940,7 @@ func matchFloat64ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, r
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchFloat64ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
// Fast path - all the float64 values match an empty prefix aka `*` // Fast path - all the float64 values match an empty prefix aka `*`
return return
@ -1968,7 +1968,7 @@ func matchFloat64ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, p
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchFloat64BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -1986,7 +1986,7 @@ func matchFloat64BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchFloat64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if prefix == "" { if prefix == "" {
// An empty prefix matches all the values // An empty prefix matches all the values
return return
@ -2004,7 +2004,7 @@ func matchFloat64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitm
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, value string, tokens []string) { func matchFloat64ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, value string, tokens []string) {
f, ok := tryParseFloat64(value) f, ok := tryParseFloat64(value)
if !ok || f < math.Float64frombits(ch.minValue) || f > math.Float64frombits(ch.maxValue) { if !ok || f < math.Float64frombits(ch.minValue) || f > math.Float64frombits(ch.maxValue) {
bm.resetBits() bm.resetBits()
@ -2017,7 +2017,7 @@ func matchFloat64ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchFloat64ByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchFloat64ByPhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
// The phrase may contain a part of the floating-point number. // The phrase may contain a part of the floating-point number.
// For example, `foo:"123"` must match `123`, `123.456` and `-0.123`. // For example, `foo:"123"` must match `123`, `123.456` and `-0.123`.
// This means we cannot search in binary representation of floating-point numbers. // This means we cannot search in binary representation of floating-point numbers.
@ -2046,7 +2046,7 @@ func matchFloat64ByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, p
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByIPv4Range(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue uint32) { func matchValuesDictByIPv4Range(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue uint32) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchIPv4Range(v, minValue, maxValue) { if matchIPv4Range(v, minValue, maxValue) {
@ -2057,7 +2057,7 @@ func matchValuesDictByIPv4Range(bs *blockSearch, ch *columnHeader, bm *filterBit
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchValuesDictByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchStringRange(v, minValue, maxValue) { if matchStringRange(v, minValue, maxValue) {
@ -2068,7 +2068,7 @@ func matchValuesDictByStringRange(bs *blockSearch, ch *columnHeader, bm *filterB
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchValuesDictByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchLenRange(v, minLen, maxLen) { if matchLenRange(v, minLen, maxLen) {
@ -2079,7 +2079,7 @@ func matchValuesDictByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitm
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchValuesDictByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchRange(v, minValue, maxValue) { if matchRange(v, minValue, maxValue) {
@ -2090,7 +2090,7 @@ func matchValuesDictByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchValuesDictByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if re.MatchString(v) { if re.MatchString(v) {
@ -2101,7 +2101,7 @@ func matchValuesDictByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByAnyCasePrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefixLowercase string) { func matchValuesDictByAnyCasePrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefixLowercase string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchAnyCasePrefix(v, prefixLowercase) { if matchAnyCasePrefix(v, prefixLowercase) {
@ -2112,7 +2112,7 @@ func matchValuesDictByAnyCasePrefix(bs *blockSearch, ch *columnHeader, bm *filte
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByAnyCasePhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phraseLowercase string) { func matchValuesDictByAnyCasePhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phraseLowercase string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchAnyCasePhrase(v, phraseLowercase) { if matchAnyCasePhrase(v, phraseLowercase) {
@ -2123,7 +2123,7 @@ func matchValuesDictByAnyCasePhrase(bs *blockSearch, ch *columnHeader, bm *filte
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchValuesDictByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchPrefix(v, prefix) { if matchPrefix(v, prefix) {
@ -2134,7 +2134,7 @@ func matchValuesDictByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictBySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases []string) { func matchValuesDictBySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases []string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchSequence(v, phrases) { if matchSequence(v, phrases) {
@ -2145,7 +2145,7 @@ func matchValuesDictBySequence(bs *blockSearch, ch *columnHeader, bm *filterBitm
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchValuesDictByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchExactPrefix(v, prefix) { if matchExactPrefix(v, prefix) {
@ -2156,7 +2156,7 @@ func matchValuesDictByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterB
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, value string) { func matchValuesDictByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, value string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if v == value { if v == value {
@ -2167,7 +2167,7 @@ func matchValuesDictByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBi
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByAnyValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, values map[string]struct{}) { func matchValuesDictByAnyValue(bs *blockSearch, ch *columnHeader, bm *bitmap, values map[string]struct{}) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if _, ok := values[v]; ok { if _, ok := values[v]; ok {
@ -2178,7 +2178,7 @@ func matchValuesDictByAnyValue(bs *blockSearch, ch *columnHeader, bm *filterBitm
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchValuesDictByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string) { func matchValuesDictByPhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string) {
bb := bbPool.Get() bb := bbPool.Get()
for i, v := range ch.valuesDict.values { for i, v := range ch.valuesDict.values {
if matchPhrase(v, phrase) { if matchPhrase(v, phrase) {
@ -2189,7 +2189,7 @@ func matchValuesDictByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchEncodedValuesDict(bs *blockSearch, ch *columnHeader, bm *filterBitmap, encodedValues []byte) { func matchEncodedValuesDict(bs *blockSearch, ch *columnHeader, bm *bitmap, encodedValues []byte) {
if len(encodedValues) == 0 { if len(encodedValues) == 0 {
// Fast path - the phrase is missing in the valuesDict // Fast path - the phrase is missing in the valuesDict
bm.resetBits() bm.resetBits()
@ -2205,49 +2205,49 @@ func matchEncodedValuesDict(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
}) })
} }
func matchStringByIPv4Range(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue uint32) { func matchStringByIPv4Range(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue uint32) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchIPv4Range(v, minValue, maxValue) return matchIPv4Range(v, minValue, maxValue)
}) })
} }
func matchStringByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchStringByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchStringRange(v, minValue, maxValue) return matchStringRange(v, minValue, maxValue)
}) })
} }
func matchStringByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchStringByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchLenRange(v, minLen, maxLen) return matchLenRange(v, minLen, maxLen)
}) })
} }
func matchStringByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchStringByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchRange(v, minValue, maxValue) return matchRange(v, minValue, maxValue)
}) })
} }
func matchStringByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchStringByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return re.MatchString(v) return re.MatchString(v)
}) })
} }
func matchStringByAnyCasePrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefixLowercase string) { func matchStringByAnyCasePrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefixLowercase string) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchAnyCasePrefix(v, prefixLowercase) return matchAnyCasePrefix(v, prefixLowercase)
}) })
} }
func matchStringByAnyCasePhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phraseLowercase string) { func matchStringByAnyCasePhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phraseLowercase string) {
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
return matchAnyCasePhrase(v, phraseLowercase) return matchAnyCasePhrase(v, phraseLowercase)
}) })
} }
func matchStringByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchStringByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2257,7 +2257,7 @@ func matchStringByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pr
}) })
} }
func matchStringBySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases []string, tokens []string) { func matchStringBySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases []string, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2267,7 +2267,7 @@ func matchStringBySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
}) })
} }
func matchStringByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchStringByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2277,7 +2277,7 @@ func matchStringByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitma
}) })
} }
func matchStringByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, value string, tokens []string) { func matchStringByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, value string, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2287,7 +2287,7 @@ func matchStringByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap
}) })
} }
func matchStringByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchStringByPhrase(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2297,7 +2297,7 @@ func matchStringByPhrase(bs *blockSearch, ch *columnHeader, bm *filterBitmap, ph
}) })
} }
func matchUint8ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchUint8ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -2310,7 +2310,7 @@ func matchUint8ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchUint16ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -2323,7 +2323,7 @@ func matchUint16ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchUint32ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -2336,7 +2336,7 @@ func matchUint32ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByStringRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue string) { func matchUint64ByStringRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue string) {
if minValue > "9" || maxValue < "0" { if minValue > "9" || maxValue < "0" {
bm.resetBits() bm.resetBits()
return return
@ -2363,7 +2363,7 @@ func matchMinMaxValueLen(ch *columnHeader, minLen, maxLen uint64) bool {
return minLen <= uint64(len(s)) return minLen <= uint64(len(s))
} }
func matchUint8ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchUint8ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if !matchMinMaxValueLen(ch, minLen, maxLen) { if !matchMinMaxValueLen(ch, minLen, maxLen) {
bm.resetBits() bm.resetBits()
return return
@ -2377,7 +2377,7 @@ func matchUint8ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, m
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchUint16ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if !matchMinMaxValueLen(ch, minLen, maxLen) { if !matchMinMaxValueLen(ch, minLen, maxLen) {
bm.resetBits() bm.resetBits()
return return
@ -2391,7 +2391,7 @@ func matchUint16ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchUint32ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if !matchMinMaxValueLen(ch, minLen, maxLen) { if !matchMinMaxValueLen(ch, minLen, maxLen) {
bm.resetBits() bm.resetBits()
return return
@ -2405,7 +2405,7 @@ func matchUint32ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minLen, maxLen uint64) { func matchUint64ByLenRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minLen, maxLen uint64) {
if !matchMinMaxValueLen(ch, minLen, maxLen) { if !matchMinMaxValueLen(ch, minLen, maxLen) {
bm.resetBits() bm.resetBits()
return return
@ -2419,7 +2419,7 @@ func matchUint64ByLenRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint8ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchUint8ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
minValueUint, maxValueUint := toUint64Range(minValue, maxValue) minValueUint, maxValueUint := toUint64Range(minValue, maxValue)
if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue { if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue {
bm.resetBits() bm.resetBits()
@ -2436,7 +2436,7 @@ func matchUint8ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minV
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchUint16ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
minValueUint, maxValueUint := toUint64Range(minValue, maxValue) minValueUint, maxValueUint := toUint64Range(minValue, maxValue)
if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue { if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue {
bm.resetBits() bm.resetBits()
@ -2454,7 +2454,7 @@ func matchUint16ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, min
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchUint32ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
minValueUint, maxValueUint := toUint64Range(minValue, maxValue) minValueUint, maxValueUint := toUint64Range(minValue, maxValue)
if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue { if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue {
bm.resetBits() bm.resetBits()
@ -2472,7 +2472,7 @@ func matchUint32ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, min
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, minValue, maxValue float64) { func matchUint64ByRange(bs *blockSearch, ch *columnHeader, bm *bitmap, minValue, maxValue float64) {
minValueUint, maxValueUint := toUint64Range(minValue, maxValue) minValueUint, maxValueUint := toUint64Range(minValue, maxValue)
if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue { if maxValue < 0 || minValueUint > ch.maxValue || maxValueUint < ch.minValue {
bm.resetBits() bm.resetBits()
@ -2490,7 +2490,7 @@ func matchUint64ByRange(bs *blockSearch, ch *columnHeader, bm *filterBitmap, min
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint8ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchUint8ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toUint8String(bs, bb, v) s := toUint8String(bs, bb, v)
@ -2499,7 +2499,7 @@ func matchUint8ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchUint16ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toUint16String(bs, bb, v) s := toUint16String(bs, bb, v)
@ -2508,7 +2508,7 @@ func matchUint16ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchUint32ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toUint32String(bs, bb, v) s := toUint32String(bs, bb, v)
@ -2517,7 +2517,7 @@ func matchUint32ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re *regexp.Regexp) { func matchUint64ByRegexp(bs *blockSearch, ch *columnHeader, bm *bitmap, re *regexp.Regexp) {
bb := bbPool.Get() bb := bbPool.Get()
visitValues(bs, ch, bm, func(v string) bool { visitValues(bs, ch, bm, func(v string) bool {
s := toUint64String(bs, bb, v) s := toUint64String(bs, bb, v)
@ -2526,7 +2526,7 @@ func matchUint64ByRegexp(bs *blockSearch, ch *columnHeader, bm *filterBitmap, re
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint8ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchUint8ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
if prefix == "" { if prefix == "" {
// Fast path - all the uint8 values match an empty prefix aka `*` // Fast path - all the uint8 values match an empty prefix aka `*`
return return
@ -2549,7 +2549,7 @@ func matchUint8ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pre
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchUint16ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
if prefix == "" { if prefix == "" {
// Fast path - all the uint16 values match an empty prefix aka `*` // Fast path - all the uint16 values match an empty prefix aka `*`
return return
@ -2572,7 +2572,7 @@ func matchUint16ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pr
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchUint32ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
if prefix == "" { if prefix == "" {
// Fast path - all the uint32 values match an empty prefix aka `*` // Fast path - all the uint32 values match an empty prefix aka `*`
return return
@ -2595,7 +2595,7 @@ func matchUint32ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pr
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string) { func matchUint64ByPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string) {
if prefix == "" { if prefix == "" {
// Fast path - all the uint64 values match an empty prefix aka `*` // Fast path - all the uint64 values match an empty prefix aka `*`
return return
@ -2618,7 +2618,7 @@ func matchUint64ByPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, pr
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint8BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchUint8BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) > 1 { if len(phrases) > 1 {
bm.resetBits() bm.resetBits()
return return
@ -2626,7 +2626,7 @@ func matchUint8BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, p
matchUint8ByExactValue(bs, ch, bm, phrases[0], tokens) matchUint8ByExactValue(bs, ch, bm, phrases[0], tokens)
} }
func matchUint16BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchUint16BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) > 1 { if len(phrases) > 1 {
bm.resetBits() bm.resetBits()
return return
@ -2634,7 +2634,7 @@ func matchUint16BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
matchUint16ByExactValue(bs, ch, bm, phrases[0], tokens) matchUint16ByExactValue(bs, ch, bm, phrases[0], tokens)
} }
func matchUint32BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchUint32BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) > 1 { if len(phrases) > 1 {
bm.resetBits() bm.resetBits()
return return
@ -2642,7 +2642,7 @@ func matchUint32BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
matchUint32ByExactValue(bs, ch, bm, phrases[0], tokens) matchUint32ByExactValue(bs, ch, bm, phrases[0], tokens)
} }
func matchUint64BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrases, tokens []string) { func matchUint64BySequence(bs *blockSearch, ch *columnHeader, bm *bitmap, phrases, tokens []string) {
if len(phrases) > 1 { if len(phrases) > 1 {
bm.resetBits() bm.resetBits()
return return
@ -2650,7 +2650,7 @@ func matchUint64BySequence(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
matchUint64ByExactValue(bs, ch, bm, phrases[0], tokens) matchUint64ByExactValue(bs, ch, bm, phrases[0], tokens)
} }
func matchUint8ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchUint8ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) { if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) {
return return
} }
@ -2663,7 +2663,7 @@ func matchUint8ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchUint16ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) { if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) {
return return
} }
@ -2676,7 +2676,7 @@ func matchUint16ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchUint32ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) { if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) {
return return
} }
@ -2689,7 +2689,7 @@ func matchUint32ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) { func matchUint64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *bitmap, prefix string, tokens []string) {
if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) { if !matchMinMaxExactPrefix(ch, bm, prefix, tokens) {
return return
} }
@ -2702,7 +2702,7 @@ func matchUint64ByExactPrefix(bs *blockSearch, ch *columnHeader, bm *filterBitma
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchMinMaxExactPrefix(ch *columnHeader, bm *filterBitmap, prefix string, tokens []string) bool { func matchMinMaxExactPrefix(ch *columnHeader, bm *bitmap, prefix string, tokens []string) bool {
if prefix == "" { if prefix == "" {
// An empty prefix matches all the values // An empty prefix matches all the values
return false return false
@ -2721,7 +2721,7 @@ func matchMinMaxExactPrefix(ch *columnHeader, bm *filterBitmap, prefix string, t
return true return true
} }
func matchUint8ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchUint8ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
n, ok := tryParseUint64(phrase) n, ok := tryParseUint64(phrase)
if !ok || n < ch.minValue || n > ch.maxValue { if !ok || n < ch.minValue || n > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -2733,7 +2733,7 @@ func matchUint8ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap,
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint16ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchUint16ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
n, ok := tryParseUint64(phrase) n, ok := tryParseUint64(phrase)
if !ok || n < ch.minValue || n > ch.maxValue { if !ok || n < ch.minValue || n > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -2745,7 +2745,7 @@ func matchUint16ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint32ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchUint32ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
n, ok := tryParseUint64(phrase) n, ok := tryParseUint64(phrase)
if !ok || n < ch.minValue || n > ch.maxValue { if !ok || n < ch.minValue || n > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -2757,7 +2757,7 @@ func matchUint32ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchUint64ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, phrase string, tokens []string) { func matchUint64ByExactValue(bs *blockSearch, ch *columnHeader, bm *bitmap, phrase string, tokens []string) {
n, ok := tryParseUint64(phrase) n, ok := tryParseUint64(phrase)
if !ok || n < ch.minValue || n > ch.maxValue { if !ok || n < ch.minValue || n > ch.maxValue {
bm.resetBits() bm.resetBits()
@ -2769,7 +2769,7 @@ func matchUint64ByExactValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap
bbPool.Put(bb) bbPool.Put(bb)
} }
func matchBinaryValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, binValue []byte, tokens []string) { func matchBinaryValue(bs *blockSearch, ch *columnHeader, bm *bitmap, binValue []byte, tokens []string) {
if !matchBloomFilterAllTokens(bs, ch, tokens) { if !matchBloomFilterAllTokens(bs, ch, tokens) {
bm.resetBits() bm.resetBits()
return return
@ -2779,7 +2779,7 @@ func matchBinaryValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, binVa
}) })
} }
func matchAnyValue(bs *blockSearch, ch *columnHeader, bm *filterBitmap, values map[string]struct{}, tokenSets [][]string) { func matchAnyValue(bs *blockSearch, ch *columnHeader, bm *bitmap, values map[string]struct{}, tokenSets [][]string) {
if !matchBloomFilterAnyTokenSet(bs, ch, tokenSets) { if !matchBloomFilterAnyTokenSet(bs, ch, tokenSets) {
bm.resetBits() bm.resetBits()
return return
@ -2816,7 +2816,7 @@ func matchBloomFilterAllTokens(bs *blockSearch, ch *columnHeader, tokens []strin
return bf.containsAll(tokens) return bf.containsAll(tokens)
} }
func visitValues(bs *blockSearch, ch *columnHeader, bm *filterBitmap, f func(value string) bool) { func visitValues(bs *blockSearch, ch *columnHeader, bm *bitmap, f func(value string) bool) {
if bm.isZero() { if bm.isZero() {
// Fast path - nothing to visit // Fast path - nothing to visit
return return

View file

@ -245,9 +245,9 @@ func TestMatchIPv4Range(t *testing.T) {
f("127.0.0.1", 0x7f000000, 0x7f000001, true) f("127.0.0.1", 0x7f000000, 0x7f000001, true)
} }
func TestFilterBitmap(t *testing.T) { func TestBitmap(t *testing.T) {
for i := 0; i < 100; i++ { for i := 0; i < 100; i++ {
bm := getFilterBitmap(i) bm := getBitmap(i)
if bm.bitsLen != i { if bm.bitsLen != i {
t.Fatalf("unexpected bits length: %d; want %d", bm.bitsLen, i) t.Fatalf("unexpected bits length: %d; want %d", bm.bitsLen, i)
} }
@ -332,7 +332,7 @@ func TestFilterBitmap(t *testing.T) {
t.Fatalf("unexpected non-zero number of set bits remained: %d", bitsCount) t.Fatalf("unexpected non-zero number of set bits remained: %d", bitsCount)
} }
putFilterBitmap(bm) putBitmap(bm)
} }
} }

View file

@ -44,8 +44,8 @@ func (scp *statsCountProcessor) updateStatsForAllRows(timestamps []int64, column
} }
// Slow path - count rows containing at least a single non-empty value for the fields enumerated inside count(). // Slow path - count rows containing at least a single non-empty value for the fields enumerated inside count().
bm := getFilterBitmap(len(timestamps)) bm := getBitmap(len(timestamps))
defer putFilterBitmap(bm) defer putBitmap(bm)
bm.setBits() bm.setBits()
for _, f := range fields { for _, f := range fields {