diff --git a/lib/logstorage/filter.go b/lib/logstorage/filter.go index 5a525897f..20e62a32d 100644 --- a/lib/logstorage/filter.go +++ b/lib/logstorage/filter.go @@ -2,9 +2,6 @@ package logstorage import ( "sync" - - "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" ) type filter interface { @@ -62,27 +59,3 @@ func (fs *streamFilter) apply(bs *blockSearch, bm *bitmap) { return } } - -func toFloat64StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { - if len(v) != 8 { - logger.Panicf("FATAL: %s: unexpected length for binary representation of floating-point number: got %d; want 8", bs.partPath(), len(v)) - } - bb.B = toFloat64String(bb.B[:0], v) - return bytesutil.ToUnsafeString(bb.B) -} - -func toIPv4StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { - if len(v) != 4 { - logger.Panicf("FATAL: %s: unexpected length for binary representation of IPv4: got %d; want 4", bs.partPath(), len(v)) - } - bb.B = toIPv4String(bb.B[:0], v) - return bytesutil.ToUnsafeString(bb.B) -} - -func toTimestampISO8601StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { - if len(v) != 8 { - logger.Panicf("FATAL: %s: unexpected length for binary representation of ISO8601 timestamp: got %d; want 8", bs.partPath(), len(v)) - } - bb.B = toTimestampISO8601String(bb.B[:0], v) - return bytesutil.ToUnsafeString(bb.B) -} diff --git a/lib/logstorage/filter_phrase.go b/lib/logstorage/filter_phrase.go index e34822f2e..fc396668e 100644 --- a/lib/logstorage/filter_phrase.go +++ b/lib/logstorage/filter_phrase.go @@ -6,6 +6,7 @@ import ( "sync" "unicode/utf8" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" ) @@ -292,3 +293,27 @@ func quoteFieldNameIfNeeded(s string) string { func isMsgFieldName(fieldName string) bool { return fieldName == "" || fieldName == "_msg" } + +func toFloat64StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { + if len(v) != 8 { + logger.Panicf("FATAL: %s: unexpected length for binary representation of floating-point number: got %d; want 8", bs.partPath(), len(v)) + } + bb.B = toFloat64String(bb.B[:0], v) + return bytesutil.ToUnsafeString(bb.B) +} + +func toIPv4StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { + if len(v) != 4 { + logger.Panicf("FATAL: %s: unexpected length for binary representation of IPv4: got %d; want 4", bs.partPath(), len(v)) + } + bb.B = toIPv4String(bb.B[:0], v) + return bytesutil.ToUnsafeString(bb.B) +} + +func toTimestampISO8601StringExt(bs *blockSearch, bb *bytesutil.ByteBuffer, v string) string { + if len(v) != 8 { + logger.Panicf("FATAL: %s: unexpected length for binary representation of ISO8601 timestamp: got %d; want 8", bs.partPath(), len(v)) + } + bb.B = toTimestampISO8601String(bb.B[:0], v) + return bytesutil.ToUnsafeString(bb.B) +}